@@ -619,7 +619,12 @@
-
+
+
立即支付
@@ -788,24 +793,21 @@
+ class="my-btn disabled flex-1"
+ v-if="skuGoods.data.stockNumber <= 0"
+ disabled
+ >
+ 库存不足
+
-
-
+ class="my-btn success flex-1"
+ v-else
+ :disabled="CanConfirm"
+ @click="chooseSkuConfirm"
+ >
+ 确定
+
-
@@ -950,7 +952,14 @@
-
+
@@ -1004,6 +1013,8 @@ export default {
},
data() {
return {
+ //整体点餐页面loading
+ loading: false,
//台桌点餐页面打开时带来的参数 isAddGoods 加菜 isPayOrder结账
key: "",
//是否是从挂单里取出来的订单
@@ -1060,7 +1071,7 @@ export default {
total: 0,
},
order: {
- orderId:"",
+ orderId: "",
payType: "",
masterId: "",
allPack: false,
@@ -1133,10 +1144,13 @@ export default {
canUpdate: true,
//下单
createOrder: {
+ code: "",
status: "",
discount: 1,
form: {},
- data: {},
+ data: {
+ amount: 0,
+ },
quan: {
list: [],
sel: "",
@@ -1323,7 +1337,7 @@ export default {
},
"order.selIndex": function (val, oldval) {
console.log(val);
- this.order.old.selIndex=-1
+ this.order.old.selIndex = -1;
if (val === -1) {
// return (this.order.number = 1);
this.order.cacheNumber = 1;
@@ -1393,6 +1407,18 @@ export default {
// this.refToggle("refDiscount", true);
},
methods: {
+ //扫码支付弹窗确认
+ scanPayConfirm(code) {
+ this.createOrder.code = code;
+ this.payOrder();
+ },
+ payTypeItemClick(item) {
+ console.log(item);
+ if (item.payType == "scanCode") {
+ //扫码支付
+ this.refToggle("refScanCode", true);
+ }
+ },
ChangeDiscount(discount) {
this.createOrder.discount = discount;
},
@@ -1493,15 +1519,22 @@ export default {
orderId: this.createOrder.data.id,
payType: this.order.payType,
});
- const res = await $payOrder({
- tableId: this.table.tableId,
- masterId: this.masterId,
- orderId: this.createOrder.data.id,
- payType: this.order.payType,
- vipUserId: this.vipUser.id,
- discount: this.createOrder.discount,
- });
- this.payOrderSuccess();
+ this.loading = true;
+ try {
+ const res = await $payOrder({
+ tableId: this.table.tableId,
+ masterId: this.masterId,
+ orderId: this.createOrder.data.id,
+ payType: this.order.payType,
+ vipUserId: this.vipUser.id,
+ discount: this.createOrder.discount,
+ code: this.createOrder.code,
+ });
+ this.loading = false;
+ this.payOrderSuccess();
+ } catch (error) {
+ this.loading = false;
+ }
},
payOrderSuccess() {
this.$notify({
@@ -1533,29 +1566,32 @@ export default {
this.isCreateOrder = false;
},
//生成订单
- toCreateOrderDebounce(isNowPay){
- if(this.createOrder.status!=''&&this.createOrder.status!='success'){
- return
+ toCreateOrderDebounce(isNowPay) {
+ if (
+ this.createOrder.status != "" &&
+ this.createOrder.status != "success"
+ ) {
+ return;
}
- this.createOrder.status='loading'
- this.toCreateOrder(isNowPay)
+ this.createOrder.status = "loading";
+ this.toCreateOrder(isNowPay);
},
async toCreateOrder(isNowPay = false) {
- console.log(this.order)
- console.log(this.order.orderId)
+ console.log(this.order);
+ console.log(this.order.orderId);
const res = await $createOrder({
masterId: this.order.masterId || this.masterId,
vipUserId: this.vipUser.id,
tableId: this.table.tableId,
note: this.note.content,
postPay: this.postPay,
- orderld:this.order.orderId
+ orderld: this.order.orderId,
});
//后付款
console.log(this.postPay);
console.log(isNowPay);
console.log(this.postPay && isNowPay);
- this.createOrder.status='success'
+ this.createOrder.status = "success";
if (this.postPay && !isNowPay) {
this.$notify({
title: "下单成功",
@@ -1713,12 +1749,12 @@ export default {
// masterId:order.carList[0].masterId
// })
- const { masterId, tableId, userId, remark,id } = await $cacheOrder({
+ const { masterId, tableId, userId, remark, id } = await $cacheOrder({
orderId: this.prveOrder.list[this.prveOrder.sel].orderId,
isPending: false,
});
this.order.orderId = id;
- console.log( this.order.orderId)
+ console.log(this.order.orderId);
this.masterId = masterId;
this.isPrverOrder = true;
@@ -1739,8 +1775,8 @@ export default {
//删除挂单
async delPrveOrder(isRequest = true) {
const { sel } = this.prveOrder;
- if(this.prveOrder.list<=0||sel<0){
- return
+ if (this.prveOrder.list <= 0 || sel < 0) {
+ return;
}
const order = this.prveOrder.list[sel];
const orderMasterId = order.carList[0].masterId;
@@ -1816,7 +1852,7 @@ export default {
this.order.list = [];
this.order.selIndex = -1;
this.note.content = "";
- this.order.orderId=""
+ this.order.orderId = "";
this.$nextTick(() => {
this.getCacheOrder();
});
@@ -2116,13 +2152,13 @@ export default {
.filter((v) => v.specSnap.match(i))
.every((v) => {
// return isCanBuy(v,this.selGoods.data.isStock)
- return isCanBuy(v)
+ return isCanBuy(v);
});
}
}
return prve;
}, {});
- console.log(includeSkuMap)
+ console.log(includeSkuMap);
for (let i in includeSkuMap) {
for (let k in skuList) {
const index = skuList[k].valueArr.findIndex((val) => val === i);
@@ -2155,6 +2191,7 @@ export default {
},
reset() {
// this.goods.list = [];
+ this.loading = false;
this.order.masterId = "";
this.order.list = [];
this.order.query.page = 1;
@@ -2162,20 +2199,21 @@ export default {
this.order.list = [];
this.order.selIndex = -1;
this.order.old.list = [];
- this.prveOrder.list=[];
- this.prveOrder.selIndex=-1
+ this.prveOrder.list = [];
+ this.prveOrder.selIndex = -1;
this.order.old.selIndex = -1;
this.isCreateOrder = false;
- this.createOrder.status=""
+ this.createOrder.status = "";
+ this.createOrder.code = "";
this.note.content = "";
this.vipUser = { id: "" };
this.allPack = false;
this.note.content = "";
this.isPrverOrder = false;
this.createOrder.discount = 1;
- this.order.cacheNumber=1
+ this.order.cacheNumber = 1;
this.key = "";
- this.order.orderId=''
+ this.order.orderId = "";
},
//获取购物车数据
async getCart() {
@@ -2294,14 +2332,14 @@ export default {
} else {
//增加
console.log(item);
- const num= item.specList[0].suit
+ const num = item.specList[0].suit;
res = await addCart({
masterId: this.masterId,
vipUserId: this.vipUser.id,
productId: item.id,
skuId: item.specList[0].id,
tableId: this.table.tableId,
- num:num<=0?1:num, // 0会删除此商品
+ num: num <= 0 ? 1 : num, // 0会删除此商品
isPack: false, // 是否打包
});
this.orderListPush(res);
From 24a044427b9afb103e7ba6d383fa60017c8b1582 Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Thu, 5 Sep 2024 09:32:50 +0800
Subject: [PATCH 51/51] =?UTF-8?q?=E4=BB=A3=E5=AE=A2=E4=B8=8B=E5=8D=95?=
=?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=82=A8=E5=80=BC=E5=8D=A1=E4=B8=BA=E6=89=AB?=
=?UTF-8?q?=E7=A0=81=E6=94=AF=E4=BB=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/table/components/table-diancan.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/views/table/components/table-diancan.vue b/src/views/table/components/table-diancan.vue
index a77977b..1d6b52b 100644
--- a/src/views/table/components/table-diancan.vue
+++ b/src/views/table/components/table-diancan.vue
@@ -1414,7 +1414,7 @@ export default {
},
payTypeItemClick(item) {
console.log(item);
- if (item.payType == "scanCode") {
+ if (item.payType == "deposit") {
//扫码支付
this.refToggle("refScanCode", true);
}