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

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