8 Commits
gh ... ymf

Author SHA1 Message Date
wwz
7b0c291492 Merge branch 'dev' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into test 2024-12-23 09:41:57 +08:00
wwz
f62b1fde5d Merge branch 'test' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into wwz 2024-12-19 14:47:09 +08:00
wwz
b69a95c92c 赠送管理 2024-12-19 14:45:37 +08:00
wwz
b566eaf516 台桌费 2024-12-18 11:22:14 +08:00
gyq
d85c6db3f6 修复添加商品时间 2024-12-18 09:42:53 +08:00
gyq
e959aba44d 修复添加商品时间 2024-12-18 09:41:10 +08:00
wwz
9f72777317 代客下单增加课座费 2024-12-17 10:29:00 +08:00
73a6736075 挂账金额禁止编辑 2024-12-10 18:30:00 +08:00
7 changed files with 206 additions and 245 deletions

View File

@@ -666,8 +666,8 @@ export default {
singlePeopleLimit: 0,
weight: '',
days: couponEnum.cycle.map(item => item.value),
startTime: '',
endTime: ''
startTime: '00:00',
endTime: '23:59'
},
useTime: ['00:00', '23:59'],
imgList: [],

View File

@@ -187,7 +187,6 @@ export default {
isActive() {
const isSel =
this.selIndex === this.index && this.placeNum === this.selPlaceNum;
console.log(isSel);
return isSel ? "active" : "";
},
},

View File

@@ -65,7 +65,6 @@ export default {
this.$set(this.listdata.proGroupVo, index, { ...this.listdata.proGroupVo[index], alertshow: this.listdata.proGroupVo[index].number != this.multipleSelection[index].length ? true : false });
},
confirm() {
console.log(listdata.proGroupVo)
this.$emit("dialogpackageconfirm", this.listdata, this.multipleSelection);
this.show = false;
@@ -84,7 +83,6 @@ export default {
return false;
}
this.disabledshow = true
console.log(this.listdata, this.multipleSelection);
this.show = true;
},
},

View File

@@ -7,7 +7,7 @@
</slot>
</div>
<slot name="tips"></slot>
<div class="number_list_box">
<div class="number_list_box" v-if="!disabled">
<div class="yd-keyboard">
<div class="mini-number-box1">
<div class="mini-number">
@@ -65,6 +65,10 @@ export default {
type: Boolean,
default: false,
},
disabled:{
type:Boolean,
default:false
},
max: {
type: [Number, String],
default: Infinity,

View File

@@ -25,6 +25,7 @@
v-model="number"
isFloat
@clear="clear"
:disabled="true"
:max="payMoney"
:maxTips="'超出未结账金额'"
>
@@ -36,7 +37,7 @@
>
{{ tips }}
</div>
<div slot="input" class="u-p-l-20 u-p-r-20 u-flex w-full">
<div slot="input" class="u-p-l-20 u-p-r-20 u-flex w-full u-relative">
<div class="font-bold u-font-32">¥</div>
<el-input
placeholder="请输入挂账金额"
@@ -48,6 +49,7 @@
:type="focus ? 'number' : 'text'"
>
</el-input>
<div class="zhezhao"></div>
</div>
</key-board>
<div class="confirm_btns">
@@ -267,7 +269,14 @@ export default {
font-size: 20px;
position: relative;
}
.zhezhao{
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: 1;
}
.select_desk .select_desk_dialog .inputs .close {
color: #aaa;
position: absolute;

View File

@@ -1,14 +1,18 @@
<template>
<div class="select_desk">
<el-dialog title="请选择商品" :visible.sync="show">
<div style="padding: 10px 0;display: flex;justify-content: space-between;align-items: center;">
<div style="
padding: 10px 0;
display: flex;
justify-content: space-between;
align-items: center;
">
<el-checkbox v-model="isFull">并桌</el-checkbox>
<el-select v-model="targetTableId" placeholder="请选择目标台桌">
<el-option v-for="item in originTableList" :key="item.tableId" :label="item.name"
:value="item.tableId" @click="changeTable(item, index)">
:value="item.tableId">
</el-option>
</el-select>
</div>
<div v-if="!isFull">
<div v-if="itemdata.list.length > 0">
@@ -53,7 +57,6 @@
{{ (scope.row.salePrice * scope.row.number).toFixed(2) }}
</div>
</template>
</el-table-column>
</el-table>
</div>
@@ -64,7 +67,6 @@
<el-button @click="toggleSelection">取消</el-button>
</div>
</el-dialog>
</div>
</template>
@@ -74,16 +76,22 @@ import { forEach } from "lodash";
export default {
data() {
return {
selectalllist: [],
show: false,
itemdata: {},
itemdata: {
list: [],
old: {
list: [],
}
},
list: [],
masterId: '',
currentTableId: '',
targetTableId: '',
originTableList: [],//桌台列表
masterId: "",
currentTableId: "",
targetTableId: "",
originTableList: [], //桌台列表
multipleSelection: [],
refcartSelection: [],
isFull: false
isFull: false,
};
},
methods: {
@@ -92,79 +100,80 @@ export default {
this.$refs.refcart.clearSelection();
this.$refs.reftransfertoPinpin.forEach((a) => {
a.clearSelection();
})
} catch (error) {
}
});
} catch (error) { }
},
handleSelectionChange(val, index) {
try {
this.itemdata.old.list.forEach((a, i) => {
this.multipleSelection[index] = i === index ? val : this.multipleSelection[index] || []
})
this.multipleSelection[index] =
i === index ? val : this.multipleSelection[index] || [];
});
} catch (error) { }
},
handlerefcart(val) {
this.refcartSelection = val
this.refcartSelection = val;
},
async confirm() {
console.log(this.itemdata, this.multipleSelection)
if (!this.targetTableId) {
this.$message({
message: '请选择目标台桌!',
type: 'warning'
})
message: "请选择目标台桌!",
type: "warning",
});
return false;
}
// 判断全选增加课桌费
// var tzf = []
// try {
// let one = this.itemdata.old.list.every((i, index) => i.info.length == this.multipleSelection[index].length)
// let tow = this.itemdata.list.every((icon) => icon.length == this.refcartSelection.length)
// if (one && tow) {
// tzf = [999]
// }
// } catch (error) { }
// 数据处理 增加cartId方便判断
if (this.refcartSelection.length) {
this.refcartSelection.forEach((i) => {
i.cartId = i.id
})
i.cartId = i.id;
});
}
let cartIds = [...this.multipleSelection, [...this.refcartSelection]]
console.log(cartIds)
let cartIds = [...this.multipleSelection, [...this.refcartSelection]];
await placeswitch({
masterId: this.masterId,
orderId: this.itemdata.orderId,//当前台桌订单id 可选
cartIds: this.isFull ? '' : cartIds.flatMap(subArray => subArray.map(item => item.cartId)),//转单的购物车商品 并桌时可不传 可选
isFull: this.isFull,//并台会将全部购物车商品转入默认为false 可选
orderId: this.itemdata.orderId, //当前台桌订单id 可选
cartIds: this.isFull ? "" : cartIds.flatMap((subArray) => subArray.map((item) => item.cartId)), //转单的购物车商品 并桌时可不传 可选
isFull: this.isFull, //并台会将全部购物车商品转入默认为false 可选
currentTableId: this.currentTableId,
targetTableId: this.targetTableId,
})
});
this.$forceUpdate();
this.$emit("transfertoPinpin");
this.show = false;
},
open(item, masterId, currentTableId, originTableList) {
// 订单信息,取餐码,用餐类型,桌台号id台桌列表
console.log(item, masterId, currentTableId, originTableList)
this.itemdata = item
this.masterId = masterId//取餐码
this.currentTableId = currentTableId//当前桌台id
this.originTableList = originTableList.filter((i) => i.tableId != currentTableId && i.status == 'using')//台桌列表
// console.log(item, masterId, currentTableId, originTableList);
this.itemdata = item;
this.masterId = masterId; //取餐码
this.currentTableId = currentTableId; //当前桌台id
this.originTableList = originTableList.filter(
(i) => i.tableId != currentTableId && i.status == "using"
); //台桌列表
try {
this.$refs.refcart.clearSelection();
this.$refs.reftransfertoPinpin.forEach((a) => {
a.clearSelection();
})
});
} catch (error) { }
this.multipleSelection = []
this.refcartSelection = []
this.targetTableId = ''
this.show = true;
},
returnTableColor(key) {
const item = $status[key];
return item ? item.type : "";
},
changeTable(item, index) {
console.log(item, index)
},
searchInput(e) {
console.log(e);
// this.tableList = $originTableList.filter((v) =>
// $strMatch(v.name, e.trim())
// );
},
},
};
</script>
@@ -179,7 +188,6 @@ export default {
margin: 20px 10px;
.boxspan {}
}
.buttonbox {
@@ -188,4 +196,4 @@ export default {
text-align: right;
}
}
</style>
</style>

View File

@@ -369,7 +369,8 @@
<div class="btn" :class="{ disabled: !isSku }" @click="orderBtnsClick('sku')">
规格
</div>
<div class="btn" :class="{ disabled: order.selIndex < 0 }" @click="orderBtnsClick('gift')">
<div class="btn" :class="{ disabled: order.selIndex < 0 }" @click="orderBtnsClick('gift')"
v-if="returnGiftTextshow">
{{ returnGiftText }}
</div>
<div class="btn" :class="{ disabled: order.selIndex < 0 }" @click="orderBtnsClick('pack')">
@@ -422,7 +423,6 @@
</div>
<div @click="orderBtnsClick('print')" :class="{ disabled: order.selIndex < 0 }" class="btn">
{{ returnPrintText }}
</div>
<div @click="refPopChangePriceShow" :class="{ disabled: order.selIndex < 0 }" class="btn">
单品改价
@@ -435,7 +435,7 @@
{{ returnWaingAllText }}
</div>
<div class="btn no-wrap u-font-12" @click="clicktransfertoPinpin()"
v-if="table.name && useTypes.sel == 'dine-in' && payAfter">
v-if="table.name && useTypes.sel == 'dine-in' && payAfter && cktableList">
转桌/并桌
</div>
<!-- -->
@@ -1015,8 +1015,7 @@
<pop-tuan-quan :cartGoods="createOrder.data.detailList || []" ref="refPopTuanQuan"
@confirm="tuanQuanConfirm"></pop-tuan-quan>
<!-- 美团/抖音团购券核销 -->
<pop-quan-hexiao ref="refQuanHexiao">
</pop-quan-hexiao>
<pop-quan-hexiao ref="refQuanHexiao"> </pop-quan-hexiao>
<!-- 挂账 -->
<popup-choose-guazhang ref="refGuaZhang" :payMoney="yinFuJinE"
@confirm="guazhangPayConfirm"></popup-choose-guazhang>
@@ -1054,8 +1053,6 @@ import popupWeightGoods from "./components/popup-weight-goods.vue";
import dialogpackage from "./components/dialogpackage.vue";
import transfertoPinpin from "./components/transfertoPinpin.vue";
import dayjs from "dayjs";
import { tbShopInfo } from "@/api/user";
import { hasPermission } from "@/utils/limits.js";
@@ -1108,11 +1105,13 @@ import { returnProductCoupAllPrice } from "./quan_util.js";
let $goodsPayPriceMap = {};
import { $status } from "@/utils/table.js";
import PopupChooseGuazhang from "./components/popup-choose-guazhang.vue";
import { forEach } from "jszip";
let $originTableList = [];
export default {
components: {
popupWeightGoods, popQuanHexiao,
popupWeightGoods,
popQuanHexiao,
popupChooseGuazhang,
cartChangePrice,
popTuanQuan,
@@ -1131,7 +1130,7 @@ export default {
chooseDinersNumber,
PopupChooseGuazhang,
dialogpackage,
transfertoPinpin
transfertoPinpin,
},
data() {
return {
@@ -1354,14 +1353,27 @@ export default {
};
},
computed: {
cktableList() {
// 使用 reduce 方法统计指定值出现的次数
// const count = this.tableList.reduce((acc, cur) => {
// if (cur.status == "using") {
// return acc + 1;
// }
// return acc;
// }, 0);
if (this.tableList) {
let res = this.tableList.filter((i) => i.status == 'using')
return res.length >= 2 ? true : false
} else {
return false
}
},
returnPrintText() {
if (this.order.selIndex < 0) {
return "免厨打";
}
const cart = this.order.list[this.order.selIndex]
return (cart.isPrint || cart.isPrint === null)
? "免厨打"
: "打印";
const cart = this.order.list[this.order.selIndex];
return cart.isPrint || cart.isPrint === null ? "免厨打" : "打印";
},
returnWaingText() {
if (this.order.selIndex < 0) {
@@ -1387,11 +1399,14 @@ export default {
},
gaijia() {
if (!this.createOrder.data.amount) {
return 0
return 0;
}
const disCountOriginPrice =
this.createOrder.data.amount - this.productCouponDiscountAmount;
const discountPrice = ((1 - this.createOrder.discount) * disCountOriginPrice).toFixed(2)
const discountPrice = (
(1 - this.createOrder.discount) *
disCountOriginPrice
).toFixed(2);
return discountPrice;
},
pointsCanDicountMoney() {
@@ -1410,15 +1425,19 @@ export default {
return n;
},
productCouponDiscountAmount() {
const n = this.quansSelArr.filter(v => v.type == 2).reduce((prve, cur) => {
return prve + cur.discountAmount * 1;
}, 0);
const n = this.quansSelArr
.filter((v) => v.type == 2)
.reduce((prve, cur) => {
return prve + cur.discountAmount * 1;
}, 0);
return n;
},
fullCouponDiscountAmount() {
const n = this.quansSelArr.filter(v => v.type == 1).reduce((prve, cur) => {
return prve + cur.discountAmount * 1;
}, 0);
const n = this.quansSelArr
.filter((v) => v.type == 1)
.reduce((prve, cur) => {
return prve + cur.discountAmount * 1;
}, 0);
return n;
},
currentPayMoney() {
@@ -1426,13 +1445,16 @@ export default {
const discount = this.createOrder.discount || 1;
// const total=((amount - this.coupdiscount) * this.createOrder.discount - this.points.toMoney)
// const total = amount - this.gaijia - this.coupdiscount;
const total = amount - this.productCouponDiscountAmount - this.gaijia - this.fullCouponDiscountAmount;
const total =
amount -
this.productCouponDiscountAmount -
this.gaijia -
this.fullCouponDiscountAmount;
return total <= 0 ? 0 : total;
},
yinFuJinE() {
const total =
this.currentPayMoney - (this.points.selected ? this.points.toMoney : 0);
console.log(total);
if (this.isCreateOrder) {
return total.toFixed(2);
} else {
@@ -1445,9 +1467,9 @@ export default {
this.order.selIndex >= 0 ||
!this.order.selGoods ||
this.order.old.list.length <= 0 ||
this.order.selGoods.status == "return"
|| this.order.selGoods.useType == 'dine-in'
|| this.order.selGoods.useType == 'dine-in-before'
this.order.selGoods.status == "return" ||
this.order.selGoods.useType == "dine-in" ||
this.order.selGoods.useType == "dine-in-before"
);
},
title() {
@@ -1521,6 +1543,16 @@ export default {
? "取消赠送"
: "赠送";
},
returnGiftTextshow() {
try {
// 选中的购物车里面是否已有
if (this.order.list.filter((i, v) => i.productId == this.order.list[this.order.selIndex].productId).length >= 2) {
return false;
} else {
return true;
}
} catch (error) { }
},
returnPackText() {
if (this.order.selIndex < 0) {
return "打包";
@@ -1634,8 +1666,8 @@ export default {
const cartNumber = this.order.list.reduce((a, b) => {
return a + b.number * 1;
}, 0);
const total = oldNumber + cartNumber
return (Math.floor(total) == total ? total : total.toFixed(2));
const total = oldNumber + cartNumber;
return Math.floor(total) == total ? total : total.toFixed(2);
},
selGoodsHide() {
this.selGoods.show = false;
@@ -1703,7 +1735,6 @@ export default {
}
},
"useTypes.sel": function (newval, oldval) {
console.log(newval);
this.setPostPay();
this.setUseType();
},
@@ -1737,7 +1768,6 @@ export default {
// }
// },
masterId: function (val) {
console.log(val);
},
isCreateOrder: function (val) {
if (!val) {
@@ -1754,8 +1784,6 @@ export default {
// masterId = res.masterId;
// }
// this.masterId = masterId;
console.log("this.createOrder.data");
console.log(this.createOrder.data);
if (this.order.status == "finish") {
return;
}
@@ -1790,20 +1818,17 @@ export default {
} else {
this.prveOrder.selCart = [];
}
console.log(this.prveOrder.selCart);
},
"prveOrder.sel": function (val) {
this.prveOrder.selCart =
this.prveOrder.list.length !== 0
? this.prveOrder.list[val].carList
: [];
console.log(this.prveOrder.selCart);
if (val < 0) {
this.prveOrde.show = false;
}
},
"order.allPack": function (val) {
console.log(val);
if (this.order.list.length <= 0) {
return;
}
@@ -1827,7 +1852,6 @@ export default {
const selItem = item.info[this.order.old.selIndex];
goods = selItem ? selItem : "";
}
console.log(goods);
if (val === -1) {
this.order.cacheNumber = 1;
} else {
@@ -1848,14 +1872,12 @@ export default {
return;
}
this.createOrderClose();
let item = this.order.list[this.order.selIndex];
console.log(item.specSnap);
const { productId, skuId, isPack, isGift, number } = item;
const oldGoods = this.order.old.list.find((v) => {
return v.productId === productId && v.skuId === skuId;
});
const newNum = this.order.number + (oldGoods ? oldGoods.number : 0)
const newNum = this.order.number + (oldGoods ? oldGoods.number : 0);
$updateCart({
cartId: item.id,
productId,
@@ -1897,7 +1919,7 @@ export default {
methods: {
//美团抖音团购券核销弹窗
refQuanHexiaoOpen() {
this.$refs.refQuanHexiao.open()
this.$refs.refQuanHexiao.open();
},
//称重商品弹窗
refWeightGoodsShow(item) {
@@ -1905,13 +1927,18 @@ export default {
},
//称重商品确认
async refWeightGoodsConfirm(item, number) {
console.log(item)
console.log(number)
this.goodsClick(item, number, true)
this.goodsClick(item, number, true);
},
//套餐下单
async dialogpackageconfirm(item, multipleSelection) {
this.goodsClick(item, 1, true, multipleSelection.flatMap(subArray => subArray.map(item => item.proId)))
this.goodsClick(
item,
1,
true,
multipleSelection.flatMap((subArray) =>
subArray.map((item) => item.proId)
)
);
},
//挂账人支付确认
guazhangPayConfirm(guazhangren, price) {
@@ -1930,14 +1957,13 @@ export default {
this.$refs.refPopTuanQuan.open();
},
tuanQuanConfirm(e) {
console.log(e);
this.tuanQuan = e;
},
//更新单品改价数据
updateCartItem(res) {
if (res) {
// this.order.list[this.order.selIndex] = res;
this.$set(this.order.list, this.order.selIndex, res)
this.$set(this.order.list, this.order.selIndex, res);
}
},
// 单品改价
@@ -1946,7 +1972,6 @@ export default {
this.$refs.refPopChangePrice.open(orderGoods);
},
returnProDiscount(row) {
console.log(row);
//相同商品抵扣券数组
const arr = this.quansSelArr.filter((v) => v.proId == row.proId);
const index = arr.findIndex((v) => v.id == row.id);
@@ -1975,7 +2000,6 @@ export default {
},
delQuan(row) {
const index = this.quansSelArr.findIndex((v) => v.id == row.id);
console.log(index);
if (index != -1) {
this.quansSelArr.splice(index, 1);
this.quansSelArr.map((v, index) => {
@@ -2012,7 +2036,6 @@ export default {
},
//根据积分输入值变化计算抵扣金额
pointsValueChange(e) {
console.log(e);
if (e == 0 || !e) {
return (this.points.toMoney = 0);
}
@@ -2026,7 +2049,6 @@ export default {
},
//积分抵扣类型改变
pointsChange(e) {
console.log(e);
if (e == 1) {
this.points.value = Math.min(
this.vipUser.accountPoints,
@@ -2047,7 +2069,6 @@ export default {
);
},
quansConfirm(e, goodsPayPriceMap) {
console.log(e);
// this.createOrder.discount = 1;
this.points.selected = "";
e.map((v, index) => {
@@ -2061,7 +2082,6 @@ export default {
$goodsPayPriceMap = goodsPayPriceMap;
},
searchInput(e) {
console.log(e);
this.tableList = $originTableList.filter((v) =>
$strMatch(v.name, e.trim())
);
@@ -2086,7 +2106,6 @@ export default {
return this.canXiadan;
},
changeOrderExtraSel(index, canChangeNumber, placeNum) {
// console.log(index,canChangeNumber,placeNum)
this.order.selIndex = -1;
this.order.selGoods = this.order.seatFee;
this.order.selPlaceNum = placeNum;
@@ -2151,7 +2170,6 @@ export default {
// ...this.order.old.list,
// { info: this.order.list, placeNum: nowPlaceNum + 1 },
// ];
console.log(this.order.old.list);
return res;
},
async payBeforeClear() {
@@ -2240,8 +2258,6 @@ export default {
//munchies 先付 restaurant 后付
this.payAfter = this.shopInfo.registerType == "munchies" ? false : true;
}
console.log("this.payAfter");
console.log(this.payAfter);
},
//获取店铺信息
async getShopInfo() {
@@ -2258,7 +2274,6 @@ export default {
if (this.order.old.list.length > 0) {
return this.$message("下单后不支持更改就餐方式");
}
console.log(type);
this.useTypes.sel = type;
},
//更改就餐人数
@@ -2279,12 +2294,10 @@ export default {
async onTableChange() {
this.order.list = [];
this.order.old.list = [];
console.log("onTableChange");
const perpole = this.perpole || "";
const tableRes = await $returnTableDetail({
tableId: this.table.tableId,
});
console.log(tableRes);
const orderId = tableRes.orderId || this.table.orderId;
if (orderId) {
return this.getOrderData({ orderId: orderId });
@@ -2351,7 +2364,6 @@ export default {
this.order.old.selIndex = -1;
// this.getCart();
this.getOrderData();
// console.log(this.order.selGoods);
},
// 台桌列表
@@ -2369,7 +2381,6 @@ export default {
);
$originTableList = this.tableList;
} catch (error) {
console.log(error);
}
},
async getTableDetail(tableId) {
@@ -2380,8 +2391,6 @@ export default {
return res;
},
async changeTable(item) {
console.log("changeTable");
console.log(this.table, this.table.tableId);
if (
(this.table && this.table.tableId) ||
(!this.table && !this.tableId && this.order.list.length <= 0)
@@ -2398,7 +2407,6 @@ export default {
if (this.table && this.order.list.length <= 0) {
this.table = item;
this.tableShow = false;
console.log(this.table);
this.onTableChange();
return;
}
@@ -2421,7 +2429,6 @@ export default {
}
);
} catch (e) {
console.log(e);
}
}
this.tableShow = false;
@@ -2495,10 +2502,9 @@ export default {
if (!canDiscount) {
return;
}
const amount = (this.createOrder.data.amount - this.productCouponDiscountAmount).toFixed(
2
);
console.log(amount);
const amount = (
this.createOrder.data.amount - this.productCouponDiscountAmount
).toFixed(2);
this.refToggle("refDiscount", true, {
amount,
discount: this.createOrder.discount * 100,
@@ -2513,7 +2519,6 @@ export default {
//购物车商品输入框数量输入
cartGoodsNumberInput(newval, index) {
const item = this.order.list[index];
console.log(item);
this.order.cacheNumber = newval;
item.number = newval;
},
@@ -2521,7 +2526,6 @@ export default {
cartGoodsNumberChange(newval, index) {
const item = this.order.list[index];
newval = `${newval}`.split(".")[0] * 1;
console.log(newval);
this.order.cacheNumber = newval;
this.order.number = newval;
},
@@ -2578,7 +2582,6 @@ export default {
},
//改变是否打印
changeIsPrint(e) {
console.log(e);
this.isPrint = e;
},
async refOrderNoteConfirm(note) {
@@ -2629,10 +2632,6 @@ export default {
if (this.order.payType == "deposit") {
return this.refToggle("refScanCode", true);
}
console.log({
orderId: this.createOrder.data.id,
payType: this.order.payType,
});
if (this.order.payType == "cash") {
return this.$confirm(
"是否确认已现金收款:" + this.yinFuJinE + "?",
@@ -2701,14 +2700,12 @@ export default {
// this.reset();
},
chooseTableConfirm(item) {
console.log(item);
this.table = item;
},
chooseTableOpen() {
this.$refs.refChooseTable.open();
},
chooseUserConfirm(user) {
console.log(user);
if (user) {
this.vipUser = user;
} else {
@@ -2719,7 +2716,6 @@ export default {
this.$refs.refChooseUser.open();
},
createOrderClose() {
console.log("createOrderClose");
this.isCreateOrder = false;
},
//生成订单
@@ -2737,8 +2733,6 @@ export default {
return;
}
}
console.log(this.createOrder.status);
if (
this.createOrder.status != "" &&
this.createOrder.status != "success"
@@ -2810,7 +2804,6 @@ export default {
//更新购物车商品数据
updateOrder(par = {}) {
let item = this.order.list[this.order.selIndex];
console.log(this.table);
const {
productId,
skuId,
@@ -2842,8 +2835,8 @@ export default {
});
},
keyboradAdd(n) {
if (this.selGoods.isSku != 'weight' && n == '.') {
return
if (this.selGoods.isSku != "weight" && n == ".") {
return;
}
if (Number(this.keyborad.number) === 0) {
return (this.keyborad.number = n);
@@ -2873,12 +2866,12 @@ export default {
},
changeKeyboradShow(show) {
if (show) {
this.selGoods = this.order.list[this.order.selIndex]
this.selGoods = this.order.list[this.order.selIndex];
this.keyborad.number = `${this.order.list[this.order.selIndex].number}`;
}
this.keyborad.show = show;
if (!show) {
this.selGoods = ''
this.selGoods = "";
}
},
// 获取本地缓存挂单
@@ -2891,25 +2884,13 @@ export default {
// });
// },
clicktransfertoPinpin() {
// 使用 reduce 方法统计指定值出现的次数
const count = this.tableList.reduce((acc, cur) => {
if (cur.status == 'using') {
return acc + 1;
}
return acc;
}, 0);
console.log(count)
if (count >= 2) {
// console.log(this.order, this.masterId, this.table.tableId, this.tableList)
// 订单信息,取餐码,用餐类型,桌台号id台桌列表
this.$refs.refransfertoPinpin.open(this.order, this.masterId, this.table.tableId, this.tableList);
} else {
this.$message({
message: '暂无可转台桌!',
type: 'warning'
})
return false;
}
// 订单信息,取餐码,用餐类型,桌台号id台桌列表
this.$refs.refransfertoPinpin.open(
this.order,
this.masterId,
this.table.tableId,
this.tableList
);
},
//右侧控制按钮点击事件
async orderBtnsClick(key) {
@@ -2921,7 +2902,6 @@ export default {
this.selGoods.title = orderGoods.name;
this.selGoods.isEdit = true;
const item = this.goods.list.find((v) => v.id == orderGoods.productId);
console.log(item);
return this.showSelGoods({ ...item, ...orderGoods });
}
if (key === "gift") {
@@ -2938,7 +2918,8 @@ export default {
return this.removeCart();
}
if (key === "print") {
const isPrint = (orderGoods.isPrint || orderGoods.isPrint === null) ? true : false;
const isPrint =
orderGoods.isPrint || orderGoods.isPrint === null ? true : false;
this.updateOrder({ isPrint: !isPrint });
return;
}
@@ -2952,10 +2933,10 @@ export default {
orderId: this.createOrder.data.id,
masterId: this.masterId,
tableId: this.table.tableId,
isWaitCall: !this.isAllWaitCall ? 1 : 0
})
isWaitCall: !this.isAllWaitCall ? 1 : 0,
});
this.isAllWaitCall = !this.isAllWaitCall;
this.getCart()
this.getCart();
return;
}
if (key === "save") {
@@ -2986,7 +2967,6 @@ export default {
return;
}
if (key === "returnCart") {
console.log(this.order);
let selGoods = undefined;
if (this.order.selPlaceNum == -10) {
selGoods = { ...this.order.seatFee, num: this.order.seatFee.number };
@@ -2996,7 +2976,6 @@ export default {
this.order.old.selIndex
];
}
console.log(selGoods);
this.refToggle("refReturnCart", true, selGoods);
}
},
@@ -3019,11 +2998,8 @@ export default {
isPending: false,
});
this.order.orderId = id;
console.log(this.order.orderId);
this.masterId = masterId;
this.isPrverOrder = true;
console.log(masterId);
const res = await getCart({
masterId,
tableId,
@@ -3060,7 +3036,6 @@ export default {
type: "warning",
}
).catch((err) => {
console.log(err);
});
if (!res) {
return;
@@ -3089,7 +3064,6 @@ export default {
this.prveOrder.list = res;
if (this.prveOrder.list.length && this.prveOrder.sel !== -1) {
const item = this.prveOrder.list[this.prveOrder.sel];
console.log(item);
if (item) {
this.prveOrder.selCart = item.carList;
}
@@ -3142,12 +3116,11 @@ export default {
},
// 点击订单里的加减改变购物车商品数量
async changeOrderNumber(index, isReduce) {
console.log(index, isReduce, '点击订单里的加减改变购物车商品数量')
if (index < 0) {
return;
}
this.changeOrderSel(index);
console.log(index);
console.log(isReduce);
const item = this.order.list[index];
const mumber = item.number * 1;
const newval = mumber + (isReduce ? -1 : 1);
@@ -3174,7 +3147,6 @@ export default {
return;
}
const item = this.order.list[this.order.selIndex];
console.log(item);
const mumber = item.number * 1;
const newval = mumber + (isReduce ? -1 : 1);
if (newval <= 0) {
@@ -3183,7 +3155,6 @@ export default {
if (newval >= 100000) {
return;
}
console.log(newval);
// this.order.list[this.order.selIndex].number = newval;
this.order.number = newval;
@@ -3276,7 +3247,6 @@ export default {
clearTimeout(this.timer);
this.timer = null;
}, 500);
console.log(this.timer);
},
async skuGoodsAdd() {
let name = this.selGoods.skuList.reduce((prve, cur) => {
@@ -3285,9 +3255,6 @@ export default {
name = name.substring(0, name.length - 1);
// const item = this.selGoods.data.specList.find((v) => v.specSnap === name);
const item = this.selGoods.skuMap[name];
console.log(this.selGoods, '调试1')
console.log(name, '调试2')
console.log(item, '调试1')
if (!item.isGrounding) {
//该商品已经下架
return this.$notify({
@@ -3296,8 +3263,6 @@ export default {
});
}
let res = "";
console.log(orderGoods);
//更改购物车订单商品规格数量
if (this.selGoods.isEdit) {
res = await $updateCart({
@@ -3319,13 +3284,11 @@ export default {
this.order.cacheNumber = this.skuGoods.number;
return;
}
const orderGoodsIndex = this.order.list.findIndex((V) => {
return V.skuId == item.id && V.productId == this.selGoods.data.id;
return V.skuId == item.id && V.productId == this.selGoods.data.id && V.isGift == 'false';
});
const orderGoods =
orderGoodsIndex != -1 ? this.order.list[orderGoodsIndex] : undefined;
if (orderGoods) {
//更新
const newNum =
@@ -3352,7 +3315,6 @@ export default {
}
} else {
//添加
console.log(this.table);
res = await addCart({
masterId: this.masterId,
vipUserId: this.vipUser.id,
@@ -3361,7 +3323,7 @@ export default {
tableId: this.table.tableId,
num: this.skuGoods.number, // 0会删除此商品
isPack: false, // 是否打包
isWaitCall: this.isAllWaitCall //是否等叫
isWaitCall: this.isAllWaitCall, //是否等叫
});
this.orderListPush({ ...res, specSnap: name });
// this.orderListPush({
@@ -3394,9 +3356,7 @@ export default {
}
return prve;
}, []);
console.log(selArr);
let selArrAllGroup = generateCombinations(selArr, selArr.length - 1);
console.log(selArrAllGroup);
const matchArr = [];
for (let key in this.selGoods.skuMap) {
const goods = this.selGoods.skuMap[key];
@@ -3408,9 +3368,7 @@ export default {
}
}
}
console.log(matchArr);
const skuList = this.selGoods.skuList;
console.log(skuList);
//全部规格都已下架
if (!matchArr.length) {
for (let k in skuList) {
@@ -3434,7 +3392,6 @@ export default {
}
return prve;
}, {});
console.log(includeSkuMap);
for (let i in includeSkuMap) {
for (let k in skuList) {
const index = skuList[k].valueArr.findIndex((val) => val === i);
@@ -3451,7 +3408,6 @@ export default {
}, "");
specSnap = specSnap.substring(0, specSnap.length - 1);
for (let sku of this.selGoods.skuList) {
console.log(sku);
}
this.setTagDisabled();
const canChooseGoods = this.selGoods.skuList.every((v) => v.sel);
@@ -3500,11 +3456,10 @@ export default {
this.order.orderId = "";
this.perpole = "";
this.useTypes.sel = "dine-in";
this.getTable()
this.getTable();
},
//设置购物车数据
setCart(res) {
console.log(res);
try {
const { seatFee } = res;
this.order.seatFee = seatFee
@@ -3516,7 +3471,6 @@ export default {
totalAmount: seatFee.priceAmount || seatFee.totalAmount,
}
: this.order.seatFee;
console.log(this.order.seatFee);
this.perpole = res.seatFee ? res.seatFee.totalNumber : 1;
const nowCart = res.records.find((v) => v.placeNum == 0);
// this.order.list = nowCart ? nowCart.info.filter(v=>v.isGift!=='true') : [];
@@ -3524,37 +3478,36 @@ export default {
const oldCart = res.records.filter((v) => v.placeNum != 0);
this.order.old.list = oldCart ? oldCart : [];
// this.order.gift.list = returnGiftArr(res.records);
console.log(this.order.old.list);
} catch (error) {
//当购物车数据发生错误时会导致页面报错购物车商品不展示
this.$confirm('购物车数据结构错误,是否清空购物车商品?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
$clearCart({
masterId: this.masterId,
tableId: this.table.tableId,
}).then((res) => {
this.order.list = [];
this.changeOrderSel(-1);
this.$confirm("购物车数据结构错误,是否清空购物车商品?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
$clearCart({
masterId: this.masterId,
tableId: this.table.tableId,
}).then((res) => {
this.order.list = [];
this.changeOrderSel(-1);
this.$message({
type: "success",
message: "清除成功!",
});
});
})
.catch(() => {
this.$message({
type: "success",
message: "清除成功!",
type: "info",
message: "已取消",
});
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
});
}
},
//获取购物车数据
async getCart() {
console.log(this.table);
const res = await getCart({
...this.order.query,
masterId: this.masterId,
@@ -3568,7 +3521,6 @@ export default {
// }
},
showSelGoods(item) {
console.log(item);
this.selGoods.data = item;
this.selGoods.skuMap = {};
const specList = item.specList;
@@ -3611,7 +3563,6 @@ export default {
const skuList = this.selGoods.skuList;
const goodsListMap = this.selGoods.skuMap;
const skuGoods = this.findGoods(skuList, goodsListMap);
console.log(skuGoods);
if (skuGoods) {
this.skuGoods.data = skuGoods;
this.skuGoods.number = skuGoods.suit || 1;
@@ -3642,40 +3593,34 @@ export default {
}
},
//根据右侧商品单规格多规格做不同处理
async goodsClick(item, number = 0, isConfirm = false, multipleSelection = '') {
async goodsClick(item, number = 0, isConfirm = false, multipleSelection = "") {
// if (!this.table) {
// return this.$message.error("暂不支持无桌台下单,请先选择桌台");
// }
if (item.type == 'weigh' && !isConfirm) {
return this.refWeightGoodsShow(item)
if (item.type == "weigh" && !isConfirm) {
return this.refWeightGoodsShow(item);
}
// 这是套餐
if (item.type == 'package' && !isConfirm) {
if (item.type == "package" && !isConfirm) {
this.$refs.refdialogpackage.open(item);
return false
return false;
}
if (item.typeEnum === "sku") {
this.selGoods.data = item;
this.selGoods.skuMap = {};
const specList = item.specList;
this.setSelGoodsSkuMap(specList);
console.log(this.selGoods.skuMap);
this.setSelGoodsSkuList(JSON.parse(item.skuResult.tagSnap));
this.setSkugoodsDefaultInit();
this.selGoods.title = item.name;
this.selGoods.show = true;
return;
}
//单规格
const orderGoodsIndex = this.order.list.findIndex((V) => {
return V.skuId == item.specList[0].id && V.productId == item.id;
//单规格
let orderGoodsIndex = this.order.list.findIndex((V) => { //默认选择添加不是赠送 V.isGift == 'false'
return V.skuId == item.specList[0].id && V.productId == item.id && V.isGift == 'false';
});
const orderGoods =
orderGoodsIndex != -1 ? this.order.list[orderGoodsIndex] : undefined;
// const orderGoods = this.order.list.find((V) => {
// return V.skuId == item.specList[0].id && V.productId == item.id;
// });
const orderGoods = orderGoodsIndex != -1 ? this.order.list[orderGoodsIndex] : undefined;
let res = "";
if (orderGoods) {
//更新
@@ -3686,13 +3631,12 @@ export default {
// tableId: this.table.tableId,
// num: orderGoods.number * 1 + item.specList[0].suit, // 0会删除此商品
// });
const suit = number || item.specList[0].suit
const suit = number || item.specList[0].suit;
orderGoods.number += suit * 1;
this.order.number = orderGoods.number;
this.changeOrderSel(orderGoodsIndex);
} else {
//增加
console.log(item);
if (item.specList.length <= 0) {
return this.$message.error("该商品缺少skuID,skuList是空数组");
}
@@ -3705,7 +3649,7 @@ export default {
num: number || item.specList[0].suit, // 0会删除此商品
isPack: false, // 是否打包
isWaitCall: this.isAllWaitCall, //是否等叫
groupProductIdList: multipleSelection
groupProductIdList: multipleSelection,
});
this.orderListPush(res);
}
@@ -3777,7 +3721,6 @@ export default {
this.getGoods();
this.getCategory();
this.getTable();
console.log(params);
if (key == "isJieZhang") {
if (params.orderId) {
@@ -3875,7 +3818,6 @@ export default {
}),
placeNum: key,
}));
console.log(this.order.old.list);
return res;
},
close() {
@@ -3898,7 +3840,6 @@ export default {
this.informationdialogshow = false;
},
haocaiConfirm() {
console.log(haocaiSelectedMap);
this.$emit("confirm", haocaiSelectedMap);
this.informationdialogshow = false;
@@ -5208,7 +5149,9 @@ input[type="number"]::-webkit-outer-spin-button {
.weight {
height: 15px;
background: linear-gradient(124deg, rgb(115, 201, 105) 6%, rgb(39, 146, 27) 93%);
background: linear-gradient(124deg,
rgb(115, 201, 105) 6%,
rgb(39, 146, 27) 93%);
border-radius: 2px;
font-size: 12px;
text-align: center;
@@ -5432,4 +5375,4 @@ input[type="number"]::-webkit-outer-spin-button {
max-width: 340px;
word-break: break-all;
}
</style>
</style>