代客下单修复

当点击仅下单时请求报错提示请选择就餐人数后。未改变订单请求状态导致点击无反应
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,
$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),
})
});
}
},
//
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() {