代客下单增加台桌切换
当台桌切换时重新获取取餐码,购物车数据,订单数据,就餐人数
This commit is contained in:
@@ -281,21 +281,19 @@
|
||||
</div>
|
||||
</template>
|
||||
<!-- 餐位费 -->
|
||||
<template v-if="order.seatFee&&order.seatFee.totalAmount>0">
|
||||
<div class="carts_list_title">
|
||||
餐位费
|
||||
</div>
|
||||
<cart-item
|
||||
@itemClick="changeOrderOldSel"
|
||||
:canChangeNumber="false"
|
||||
key="seatFee"
|
||||
:index="0"
|
||||
:item="order.seatFee"
|
||||
isSeatFee
|
||||
:selIndex="order.old.selIndex"
|
||||
:placeNum="-1"
|
||||
:selPlaceNum="order.selPlaceNum"
|
||||
></cart-item>
|
||||
<template v-if="order.seatFee && order.seatFee.totalAmount > 0">
|
||||
<div class="carts_list_title">餐位费</div>
|
||||
<cart-item
|
||||
@itemClick="changeOrderOldSel"
|
||||
:canChangeNumber="false"
|
||||
key="seatFee"
|
||||
:index="0"
|
||||
:item="order.seatFee"
|
||||
isSeatFee
|
||||
:selIndex="order.old.selIndex"
|
||||
:placeNum="-1"
|
||||
:selPlaceNum="order.selPlaceNum"
|
||||
></cart-item>
|
||||
</template>
|
||||
<div class="order_remark" v-if="note.content">
|
||||
订单备注: {{ note.content }}
|
||||
@@ -759,7 +757,9 @@
|
||||
</div>
|
||||
<div class="detail_form_item">
|
||||
<div class="left">餐位费/附加费</div>
|
||||
<div class="right">¥{{order.seatFee.totalAmount|to2}}</div>
|
||||
<div class="right">
|
||||
¥{{ order.seatFee.totalAmount | to2 }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="detail_form_item">
|
||||
<div class="left">总价</div>
|
||||
@@ -1048,6 +1048,7 @@
|
||||
<choose-diners-number
|
||||
ref="refChooseDinersNumber"
|
||||
@confirm="chooseDinersNumberConfirm"
|
||||
:max="table.maxCapacity || 99"
|
||||
></choose-diners-number>
|
||||
|
||||
<return-cart
|
||||
@@ -1089,6 +1090,7 @@ import {
|
||||
$choseCount,
|
||||
$returnCart,
|
||||
$printOrder,
|
||||
tbShopTableGet
|
||||
} from "@/api/table";
|
||||
import { tbShopCategoryGet } from "@/api/shop";
|
||||
import {
|
||||
@@ -1098,7 +1100,6 @@ import {
|
||||
returnReverseVal,
|
||||
} from "./util.js";
|
||||
import $status from "../status.js";
|
||||
import { tbShopTableGet } from "@/api/table";
|
||||
export default {
|
||||
components: {
|
||||
returnCart,
|
||||
@@ -1340,9 +1341,6 @@ export default {
|
||||
const cartNumber = this.order.list.reduce((a, b) => {
|
||||
return a + b.number * 1;
|
||||
}, 0);
|
||||
console.log(oldNumber);
|
||||
console.log(cartNumber);
|
||||
|
||||
return oldNumber + cartNumber;
|
||||
},
|
||||
selGoodsHide() {
|
||||
@@ -1377,7 +1375,7 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
perpole(newval) {
|
||||
if (newval) {
|
||||
if (newval&&this.table.tableId) {
|
||||
$choseCount({
|
||||
masterId: this.masterId,
|
||||
tableId: this.table.tableId,
|
||||
@@ -1388,14 +1386,17 @@ export default {
|
||||
}
|
||||
},
|
||||
table(oldval, newval) {
|
||||
if (oldval && newval) {
|
||||
console.log(oldval, newval);
|
||||
$choseTable({
|
||||
orderId: 4462,
|
||||
oldTableId: oldval.tableId,
|
||||
newTableId: newval.tableId,
|
||||
});
|
||||
}
|
||||
if(oldval&&newval) {
|
||||
this.onTableChange()
|
||||
}
|
||||
// if (oldval && newval) {
|
||||
// console.log(oldval, newval);
|
||||
// $choseTable({
|
||||
// orderId: 4462,
|
||||
// oldTableId: oldval.tableId,
|
||||
// newTableId: newval.tableId,
|
||||
// });
|
||||
// }
|
||||
},
|
||||
masterId: function (val) {
|
||||
console.log(val);
|
||||
@@ -1531,6 +1532,22 @@ export default {
|
||||
// this.refToggle("refDiscount", true);
|
||||
},
|
||||
methods: {
|
||||
//台桌变化时重新获取取餐号、购物车数据,如果是正在结账状态,创建订单到待支付页面
|
||||
async onTableChange() {
|
||||
const res = await this.getMasterId();
|
||||
this.masterId = res.masterId;
|
||||
this.getCart();
|
||||
if (this.isCreateOrder) {
|
||||
this.toCreateOrder(true);
|
||||
}
|
||||
},
|
||||
// 获取台桌详情
|
||||
async getTableDetail(){
|
||||
const res=await tbShopTableGet({
|
||||
qrcode:this.table.tableId
|
||||
})
|
||||
console.log(res)
|
||||
},
|
||||
//打印制作单
|
||||
printOrder() {
|
||||
this.$confirm("是否打印当前台桌菜品", "提示", {
|
||||
@@ -1566,7 +1583,7 @@ export default {
|
||||
const { content, total } = await tbShopTableGet({
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
});
|
||||
this.tableList = content;
|
||||
this.tableList = content.filter(v=>v.status!='closed');
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
@@ -2429,21 +2446,18 @@ export default {
|
||||
},
|
||||
//获取购物车数据
|
||||
async getCart() {
|
||||
this.order.list = [];
|
||||
this.order.old.list = [];
|
||||
console.log(this.table)
|
||||
const res = await getCart({
|
||||
...this.order.query,
|
||||
masterId: this.masterId,
|
||||
tableId: this.table.tableId,
|
||||
});
|
||||
this.order.seatFee=res.seatFee;
|
||||
for (let i in res.records) {
|
||||
if (res.records[i].placeNum == 0) {
|
||||
this.order.list = res.records[i].info;
|
||||
} else {
|
||||
this.order.old.list.push(res.records[i]);
|
||||
}
|
||||
}
|
||||
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:[];
|
||||
// if (this.key|| res.records.length) {
|
||||
// this.order.old.list = res.records;
|
||||
// } else {
|
||||
|
||||
Reference in New Issue
Block a user