代客下单修复多规格商品按钮禁用问题

增加用餐模式切换
This commit is contained in:
YeMingfei666 2024-09-19 16:38:45 +08:00
parent 5f1688173f
commit d6836d240c
2 changed files with 28 additions and 2 deletions

View File

@ -417,3 +417,14 @@ export function $printDishes(data) {
});
}
// 就餐模式切换
export function $changeUseType(data) {
return request({
url: '/api/place/choseModel',
method: "put",
data:{
shopId: localStorage.getItem("shopId"),
...data
}
});
}

View File

@ -1122,6 +1122,7 @@ import {
$returnCart,
$printOrder,
tbShopTableGet,
$changeUseType
} from "@/api/table";
import { tbShopCategoryGet } from "@/api/shop";
import {
@ -1422,6 +1423,7 @@ export default {
},
watch: {
"useTypes.sel": function (newval, oldval) {
console.log(newval)
this.setPostPay();
this.setUseType();
},
@ -1587,18 +1589,30 @@ export default {
this.getShopInfo();
},
methods: {
changeOrderUseType(useType){
if(useType&&this.order.list.length){
$changeUseType({
useType,
cartIds: this.order.list.map((v) => v.id),
})
}
},
//
setUseType() {
//
let useType='takeout'
if (this.useTypes.sel == "takeout") {
localStorage.setItem("useType", "takeout");
} else {
//
useType=`dine-in-${this.postPay ? "after" : "before"}`
localStorage.setItem(
"useType",
`dine-in-${this.postPay ? "after" : "before"}`
useType
);
}
this.changeOrderUseType(useType)
},
//
setPostPay() {
@ -1627,6 +1641,7 @@ export default {
if(this.order.old.list.length > 0){
return this.$message('下单后不支持更改就餐方式');
}
console.log(type);
this.useTypes.sel = type;
},
//
@ -2487,7 +2502,7 @@ export default {
.filter((v) => v.specSnap.match(i))
.every((v) => {
// return isCanBuy(v,this.selGoods.data.isStock)
return isCanBuy(v);
return !isCanBuy(v);
});
}
}