代客下单修复

当点击仅下单时请求报错提示请选择就餐人数后。未改变订单请求状态导致点击无反应
This commit is contained in:
YeMingfei666 2024-09-20 17:41:21 +08:00
parent d6836d240c
commit 6afa9a3c48
1 changed files with 26 additions and 19 deletions

View File

@ -1122,7 +1122,7 @@ import {
$returnCart, $returnCart,
$printOrder, $printOrder,
tbShopTableGet, tbShopTableGet,
$changeUseType $changeUseType,
} from "@/api/table"; } from "@/api/table";
import { tbShopCategoryGet } from "@/api/shop"; import { tbShopCategoryGet } from "@/api/shop";
import { import {
@ -1423,7 +1423,7 @@ export default {
}, },
watch: { watch: {
"useTypes.sel": function (newval, oldval) { "useTypes.sel": function (newval, oldval) {
console.log(newval) console.log(newval);
this.setPostPay(); this.setPostPay();
this.setUseType(); this.setUseType();
}, },
@ -1589,30 +1589,26 @@ export default {
this.getShopInfo(); this.getShopInfo();
}, },
methods: { methods: {
changeOrderUseType(useType){ changeOrderUseType(useType) {
if(useType&&this.order.list.length){ if (useType && this.order.list.length) {
$changeUseType({ $changeUseType({
useType, useType,
cartIds: this.order.list.map((v) => v.id), cartIds: this.order.list.map((v) => v.id),
}) });
} }
}, },
// //
setUseType() { setUseType() {
// //
let useType='takeout' let useType = "takeout";
if (this.useTypes.sel == "takeout") { if (this.useTypes.sel == "takeout") {
localStorage.setItem("useType", "takeout"); localStorage.setItem("useType", "takeout");
} else { } else {
// //
useType=`dine-in-${this.postPay ? "after" : "before"}` useType = `dine-in-${this.postPay ? "after" : "before"}`;
localStorage.setItem( localStorage.setItem("useType", useType);
"useType",
useType
);
} }
this.changeOrderUseType(useType) this.changeOrderUseType(useType);
}, },
// //
setPostPay() { setPostPay() {
@ -1638,8 +1634,8 @@ export default {
}, },
// //
changeUseType(type) { changeUseType(type) {
if(this.order.old.list.length > 0){ if (this.order.old.list.length > 0) {
return this.$message('下单后不支持更改就餐方式'); return this.$message("下单后不支持更改就餐方式");
} }
console.log(type); console.log(type);
this.useTypes.sel = type; this.useTypes.sel = type;
@ -1902,6 +1898,8 @@ export default {
}, },
// //
toCreateOrderDebounce(isNowPay) { toCreateOrderDebounce(isNowPay) {
console.log(this.createOrder.status);
if ( if (
this.createOrder.status != "" && this.createOrder.status != "" &&
this.createOrder.status != "success" this.createOrder.status != "success"
@ -1914,7 +1912,9 @@ export default {
async toCreateOrder(isNowPay = false) { async toCreateOrder(isNowPay = false) {
console.log(this.order); console.log(this.order);
console.log(this.order.orderId); console.log(this.order.orderId);
const res = await $createOrder({ let res=''
try {
res = await $createOrder({
masterId: this.order.masterId || this.masterId, masterId: this.order.masterId || this.masterId,
vipUserId: this.vipUser.id, vipUserId: this.vipUser.id,
tableId: this.table.tableId, tableId: this.table.tableId,
@ -1922,6 +1922,13 @@ export default {
postPay: this.postPay, postPay: this.postPay,
orderld: this.order.orderId, orderld: this.order.orderId,
}); });
} catch (error) {
}
if(!res){
this.createOrder.status = "success";
return
}
// //
console.log(this.postPay); console.log(this.postPay);
console.log(isNowPay); console.log(isNowPay);
@ -2569,7 +2576,7 @@ export default {
this.key = ""; this.key = "";
this.order.orderId = ""; this.order.orderId = "";
this.perpole = ""; this.perpole = "";
this.useTypes.sel='dine-in' this.useTypes.sel = "dine-in";
}, },
// //
async getCart() { async getCart() {