This commit is contained in:
YeMingfei666 2024-10-12 13:59:46 +08:00
commit 0e7f5885e0
1 changed files with 71 additions and 21 deletions

View File

@ -353,11 +353,12 @@
<div class="flex mt-14">
<template v-if="!postPay">
<template v-if="isCreateOrder">
<!-- <template v-if="false"> -->
<button
class="my-btn flex-1 default"
@click="createOrderClose"
>
<span>/返回</span>
<span>/返回</span>
</button>
</template>
<template v-else>
@ -1196,12 +1197,12 @@ export default {
{
name: "堂食",
value: "dine-in",
disabled:true
disabled: true,
},
{
name: "自取",
value: "takeout",
disabled:true
disabled: true,
},
],
sel: "dine-in",
@ -1647,7 +1648,14 @@ export default {
this.order.extra.selIndex = index;
},
async morePayClick() {
if (this.order.list.length <= 0) {
return this.$message("请选择菜品");
}
// if(this.isCreateOrder){
// return
// }
const res = await this.returnCreateOrderData();
this.payBeforeClear();
this.createOrder.data = res;
this.order.payType = "";
this.isCreateOrder = true;
@ -1662,8 +1670,8 @@ export default {
this.cachePay();
});
},
returnCreateOrderData() {
return $createOrder({
async returnCreateOrderData() {
const res = await $createOrder({
masterId: this.order.masterId || this.masterId,
vipUserId: this.vipUser.id,
tableId: this.table.tableId,
@ -1671,16 +1679,58 @@ export default {
postPay: this.postPay,
orderld: this.order.orderId,
});
this.createOrder.data = res;
this.createOrder.discount = 1;
// const lastItem = this.order.old.list[this.order.old.list.length - 1];
// const nowPlaceNum = lastItem ? lastItem.placeNum : 0;
// this.order.old.list = [
// ...this.order.old.list,
// { info: this.order.list, placeNum: nowPlaceNum + 1 },
// ];
this.order.list = [];
this.order.old.list = [];
return res;
},
async payBeforeClear() {
this.getMasterId().then(res=>{
this.masterId = res.masterId;
})
this.loading = false;
this.order.list = [];
this.order.query.page = 1;
this.goods.total = 0;
this.order.list = [];
this.order.selIndex = -1;
this.order.selPlaceNum = -1;
this.order.selGoods = "";
this.order.seatFee = { totalAmount: 0 }; //
this.prveOrder.list = [];
this.prveOrder.selIndex = -1;
this.order.old.selIndex = -1;
this.isCreateOrder = false;
this.createOrder.status = "";
this.createOrder.code = "";
this.note.content = "";
this.vipUser = { id: "" };
this.order.masterId = "";
this.allPack = false;
this.note.content = "";
this.isPrverOrder = false;
this.createOrder.discount = 1;
this.order.cacheNumber = 1;
this.key = "";
this.order.orderId = "";
this.perpole = "";
this.useTypes.sel = "dine-in";
},
async cachePay() {
const res = await this.returnCreateOrderData();
this.createOrder.data = res;
await this.returnCreateOrderData();
this.payBeforeClear({});
this.pays();
},
async scanPayClick() {
const res = await this.returnCreateOrderData();
this.createOrder.data = res;
this.createOrder.discount = 1;
await this.returnCreateOrderData();
this.payBeforeClear();
this.order.payType = "scanCode";
this.payTypeItemClick({ payType: "scanCode" });
},
@ -2919,9 +2969,9 @@ export default {
const shopInfo = await tbShopInfo(shopId);
for (let i in shopInfo.eatModel) {
let model = shopInfo.eatModel[i];
model=model=='take-out'?model.replace(/-/g,""):model;
model = model == "take-out" ? model.replace(/-/g, "") : model;
console.log(model);
const item=this.useTypes.list.find(v=>v.value==model);
const item = this.useTypes.list.find((v) => v.value == model);
console.log(item);
if (item) {
item.disabled = false;