diff --git a/src/views/table/components/table-diancan.vue b/src/views/table/components/table-diancan.vue index d3a624e..acd9501 100644 --- a/src/views/table/components/table-diancan.vue +++ b/src/views/table/components/table-diancan.vue @@ -1122,7 +1122,7 @@ import { $returnCart, $printOrder, tbShopTableGet, - $changeUseType + $changeUseType, } from "@/api/table"; import { tbShopCategoryGet } from "@/api/shop"; import { @@ -1423,7 +1423,7 @@ export default { }, watch: { "useTypes.sel": function (newval, oldval) { - console.log(newval) + console.log(newval); this.setPostPay(); this.setUseType(); }, @@ -1589,30 +1589,26 @@ export default { this.getShopInfo(); }, methods: { - changeOrderUseType(useType){ - if(useType&&this.order.list.length){ + changeOrderUseType(useType) { + if (useType && this.order.list.length) { $changeUseType({ - useType, - cartIds: this.order.list.map((v) => v.id), - }) + useType, + cartIds: this.order.list.map((v) => v.id), + }); } }, //设置用餐类型 setUseType() { // 自取 - let useType='takeout' + let useType = "takeout"; if (this.useTypes.sel == "takeout") { localStorage.setItem("useType", "takeout"); } else { //堂食 - useType=`dine-in-${this.postPay ? "after" : "before"}` - localStorage.setItem( - "useType", - useType - ); + useType = `dine-in-${this.postPay ? "after" : "before"}`; + localStorage.setItem("useType", useType); } - this.changeOrderUseType(useType) - + this.changeOrderUseType(useType); }, //设置先付后付 setPostPay() { @@ -1638,8 +1634,8 @@ export default { }, //更改就餐方式 changeUseType(type) { - if(this.order.old.list.length > 0){ - return this.$message('下单后不支持更改就餐方式'); + if (this.order.old.list.length > 0) { + return this.$message("下单后不支持更改就餐方式"); } console.log(type); this.useTypes.sel = type; @@ -1902,6 +1898,8 @@ export default { }, //生成订单 toCreateOrderDebounce(isNowPay) { + console.log(this.createOrder.status); + if ( this.createOrder.status != "" && this.createOrder.status != "success" @@ -1914,7 +1912,9 @@ export default { async toCreateOrder(isNowPay = false) { console.log(this.order); console.log(this.order.orderId); - const res = await $createOrder({ + let res='' + try { + res = await $createOrder({ masterId: this.order.masterId || this.masterId, vipUserId: this.vipUser.id, tableId: this.table.tableId, @@ -1922,6 +1922,13 @@ export default { postPay: this.postPay, orderld: this.order.orderId, }); + } catch (error) { + + } + if(!res){ + this.createOrder.status = "success"; + return + } //后付款 console.log(this.postPay); console.log(isNowPay); @@ -2569,7 +2576,7 @@ export default { this.key = ""; this.order.orderId = ""; this.perpole = ""; - this.useTypes.sel='dine-in' + this.useTypes.sel = "dine-in"; }, //获取购物车数据 async getCart() {