代客下单增加扫码支付
This commit is contained in:
@@ -950,8 +950,16 @@
|
||||
<!-- 支付时的键盘弹窗 -->
|
||||
<money-keyboard ref="refMoneyKeyboard" :title="moneyKeyboard.title">
|
||||
</money-keyboard>
|
||||
|
||||
<!-- 扫码支付 -->
|
||||
<!-- 扫码支付 -->
|
||||
<scan-pay
|
||||
ref="refWxScanCode"
|
||||
defaultTips="请使用扫码枪扫描微信/支付宝收款码"
|
||||
title="扫码支付"
|
||||
:openSwitch="false"
|
||||
:price="createOrder.data.amount * createOrder.discount"
|
||||
@confirm="scanPayConfirm"
|
||||
></scan-pay>
|
||||
<!-- 储值卡支付 -->
|
||||
<scan-pay
|
||||
ref="refScanCode"
|
||||
title="扫码支付"
|
||||
@@ -1410,14 +1418,26 @@ export default {
|
||||
//扫码支付弹窗确认
|
||||
scanPayConfirm(code) {
|
||||
this.createOrder.code = code;
|
||||
this.payOrder();
|
||||
if(!code){
|
||||
return this.$message.error("请输入或扫付款码")
|
||||
}
|
||||
this.pays();
|
||||
},
|
||||
payTypeItemClick(item) {
|
||||
console.log(item);
|
||||
if (item.payType == "deposit") {
|
||||
//扫码支付
|
||||
this.refToggle("refScanCode", true);
|
||||
console.log(this.vipUser.id);
|
||||
if(item.payType=='vipPay'){
|
||||
return this.refChooseUserOpen()
|
||||
}
|
||||
if (item.payType == "deposit") {
|
||||
//储值卡支付
|
||||
return this.refToggle("refScanCode", true);
|
||||
}
|
||||
if (item.payType == "scanCode") {
|
||||
//扫码支付
|
||||
return this.refToggle("refWxScanCode", true);
|
||||
}
|
||||
|
||||
},
|
||||
ChangeDiscount(discount) {
|
||||
this.createOrder.discount = discount;
|
||||
@@ -1513,29 +1533,43 @@ export default {
|
||||
refNoteShow() {
|
||||
this.$refs.refOrderNote.open(this.note.content);
|
||||
},
|
||||
// 支付订单
|
||||
// 支付订单前的处理
|
||||
async payOrder() {
|
||||
|
||||
if(this.order.payType=='vipPay'&&!this.vipUser.id){
|
||||
return this.refChooseUserOpen()
|
||||
}
|
||||
if(this.order.payType=='scanCode'){
|
||||
return this.refToggle("refWxScanCode", true);
|
||||
}
|
||||
if(this.order.payType=='deposit'){
|
||||
return this.refToggle("refScanCode", true);
|
||||
}
|
||||
console.log({
|
||||
orderId: this.createOrder.data.id,
|
||||
payType: this.order.payType,
|
||||
});
|
||||
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;
|
||||
}
|
||||
this.pays()
|
||||
},
|
||||
// 支付订单
|
||||
async pays() {
|
||||
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({
|
||||
title: "支付成功",
|
||||
|
||||
Reference in New Issue
Block a user