代客下单修改部分代码逻辑

This commit is contained in:
2024-09-25 09:58:38 +08:00
parent da70ad3aa6
commit 6f952970d6

View File

@@ -1571,7 +1571,8 @@ export default {
// this.refToggle('refScanCode',true) // this.refToggle('refScanCode',true)
// this.refToggle("refDiscount", true); // this.refToggle("refDiscount", true);
this.getShopInfo(); this.getShopInfo();
this.open(this.$route.query||''); console.log(this.$route.query.tableId)
this.open(this.$route.query.tableId?this.$route.query:'');
}, },
methods: { methods: {
changeOrderUseType(useType) { changeOrderUseType(useType) {
@@ -1645,6 +1646,8 @@ export default {
await this.changePerpole(); await this.changePerpole();
} }
this.getCart(); this.getCart();
this.getCacheOrder();
console.log(this.isCreateOrder)
if (this.isCreateOrder) { if (this.isCreateOrder) {
this.toCreateOrder(true); this.toCreateOrder(true);
} }
@@ -1884,12 +1887,12 @@ export default {
this.$refs.refChooseUser.open(); this.$refs.refChooseUser.open();
}, },
createOrderClose() { createOrderClose() {
console.log('createOrderClose')
this.isCreateOrder = false; this.isCreateOrder = false;
}, },
//生成订单 //生成订单
toCreateOrderDebounce(isNowPay) { toCreateOrderDebounce(isNowPay) {
console.log(this.createOrder.status); console.log(this.createOrder.status);
if ( if (
this.createOrder.status != "" && this.createOrder.status != "" &&
this.createOrder.status != "success" this.createOrder.status != "success"
@@ -2100,17 +2103,19 @@ export default {
this.masterId = masterId; this.masterId = masterId;
this.isPrverOrder = true; this.isPrverOrder = true;
console.log(masterId); console.log(masterId);
const { records } = await getCart({ const res = await getCart({
masterId, masterId,
tableId, tableId,
vipUserId: userId != "null" ? userId : "", vipUserId: userId != "null" ? userId : "",
}); });
console.log(records); this.setCart(res);
this.order.list = [];
this.order.masterId = masterId;
this.order.list = records;
this.prveOrder.show = false; this.prveOrder.show = false;
this.note.content = remark || ""; // this.order.list = [];
// this.order.masterId = masterId;
// this.order.list = records;
// this.prveOrder.show = false;
// this.note.content = remark || "";
// this.delPrveOrder(false); // this.delPrveOrder(false);
}, },
//删除挂单 //删除挂单
@@ -2171,7 +2176,6 @@ export default {
}, },
//获取挂起订单 //获取挂起订单
async getCacheOrder(isReturn = false) { async getCacheOrder(isReturn = false) {
this.createOrderClose();
if (isReturn) { if (isReturn) {
return $getCacheOrder({ tableId: this.table.tableId }); return $getCacheOrder({ tableId: this.table.tableId });
} }
@@ -2568,6 +2572,15 @@ export default {
this.perpole = ""; this.perpole = "";
this.useTypes.sel = "dine-in"; this.useTypes.sel = "dine-in";
}, },
//设置购物车数据
setCart(res){
this.order.seatFee = res.seatFee ? res.seatFee : 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 : [];
const oldCart = res.records.filter((v) => v.placeNum != 0);
this.order.old.list = oldCart ? oldCart : [];
},
//获取购物车数据 //获取购物车数据
async getCart() { async getCart() {
console.log(this.table); console.log(this.table);
@@ -2576,12 +2589,7 @@ export default {
masterId: this.masterId, masterId: this.masterId,
tableId: this.table.tableId, tableId: this.table.tableId,
}); });
this.order.seatFee = res.seatFee ? res.seatFee : this.order.seatFee; this.setCart(res);
this.perpole = res.seatFee ? res.seatFee.totalNumber : 1;
const nowCart = res.records.find((v) => v.placeNum == 0);
this.order.list = nowCart ? nowCart.info : [];
const oldCart = res.records.filter((v) => v.placeNum != 0);
this.order.old.list = oldCart ? oldCart : [];
// if (this.key|| res.records.length) { // if (this.key|| res.records.length) {
// this.order.old.list = res.records; // this.order.old.list = res.records;
// } else { // } else {
@@ -2735,6 +2743,7 @@ export default {
this.getGoods(); this.getGoods();
this.getCategory(); this.getCategory();
this.getTable(); this.getTable();
console.log(params)
if (!params) { if (!params) {
//无台桌代客下单 //无台桌代客下单
return; return;
@@ -2743,6 +2752,9 @@ export default {
key = params.key, key = params.key,
perpoleNumber = params.num; perpoleNumber = params.num;
//有台桌时的代客下单 //有台桌时的代客下单
this.key = key;
this.isCreateOrder =this.key == "isPayOrder"? true:false;
this.perpole = perpoleNumber;
this.table = item; this.table = item;
if (item && item.useType) { if (item && item.useType) {
localStorage.setItem("useType", item.useType); localStorage.setItem("useType", item.useType);
@@ -2751,20 +2763,8 @@ export default {
? item.useType ? item.useType
: item.useType.replace(/-after|-before/g, ""); : item.useType.replace(/-after|-before/g, "");
} }
this.key = key;
if (this.key == "isPayOrder") {
this.isCreateOrder = true;
}
this.informationdialogshow;
this.informationdialogshow = true;
if (item) {
const res = await this.getMasterId();
this.masterId = res.masterId;
}
this.perpole = perpoleNumber;
if (this.key == "isPayOrder") {
this.toCreateOrder(true);
}
if (!this.shopInfo.isTableFee && item&&this.perpole>0) { if (!this.shopInfo.isTableFee && item&&this.perpole>0) {
//不免餐位费 //不免餐位费
await $choseCount({ await $choseCount({
@@ -2774,11 +2774,10 @@ export default {
}); });
} }
this.getCart(); // this.getCart();
this.getGoods(); // this.getGoods();
this.getCategory(); // this.getCategory();
this.getCacheOrder(); // this.getTable();
this.getTable();
}, },
close() { close() {
this.$router.push({ path: "/table/table_list"}); this.$router.push({ path: "/table/table_list"});
@@ -3492,6 +3491,7 @@ input[type="number"]::-webkit-outer-spin-button {
display: flex; display: flex;
flex: 1; flex: 1;
margin-top: 10px; margin-top: 10px;
max-height: calc(100vh - 280px);
.choose-user { .choose-user {
padding-bottom: 10px; padding-bottom: 10px;
border-bottom: 1px solid #ebebeb; border-bottom: 1px solid #ebebeb;