待客下单更新:

先付款模式下必须完成支付才能离开支付页面
This commit is contained in:
2024-10-11 15:44:10 +08:00
parent 6ef7ce8d89
commit f0b3a35d87

View File

@@ -37,8 +37,8 @@
<my-tabs :list="pays.list" v-model="pays.selIndex"></my-tabs>
<template v-if="pays.selIndex==0">
<view class="list">
<view class="item" @click="changePayType(index,item)" v-for="(item,index) in pays.payTypes.list"
:key="index">
<view class="item" @click="changePayType(index,item)"
v-for="(item,index) in pays.payTypes.list" :key="index">
<view class="u-flex u-row-between u-p-t-30 u-p-b-30 border-bottom">
<view class="u-flex">
<image class="icon" :src="item.icon" mode=""></image>
@@ -60,12 +60,10 @@
<my-button @click="payOrderClick">确认付款</my-button>
</view>
</template>
<template v-else>
<view class="">
<view class="u-font-32 u-m-t-40 u-text-center">请让顾客使用微信扫码</view>
<template v-if="pays.selIndex==1">
<view class="u-font-32 u-m-t-40 u-text-center">请让顾客使用微信/支付宝扫码</view>
<view class="u-flex u-row-center u-m-t-40">
<up-qrcode :size="140" :val="payCodeUrl"></up-qrcode>
</view>
<up-qrcode cid="code" :size="140" :val="payCodeUrl"></up-qrcode>
</view>
</template>
</view>
@@ -114,24 +112,38 @@
onBeforeUnmount
} from 'vue';
import {
onLoad
onLoad,
onBackPress
} from '@dcloudio/uni-app'
import * as Api from '@/http/yskApi/Instead.js'
import {queryAllShopUser} from '@/http/yskApi/shop-user.js'
import {
queryAllShopUser
} from '@/http/yskApi/shop-user.js'
import * as orderApi from '@/http/yskApi/order.js'
import infoBox from '@/commons/utils/infoBox.js'
import editDiscount from '@/components/my-components/edit-discount.vue'
let option = {isNowPay:false}
let payFinish=ref(false)
onBackPress(() => {
if (option.isNowPay&&!payFinish.value) {
infoBox.showToast('先付费模式,请先结算订单')
return true
}
return false
})
let payStatus = ref(null) //loading success
let timer = null
let user=ref({amount:0});
let user = ref({
amount: 0
});
function clear() {
clearInterval(timer)
timer = null
}
function to2(n) {
if (!n) {
return ''
@@ -202,9 +214,10 @@
infoBox.showToast('支付成功')
setTimeout(() => {
// uni.$emit('orderDetail:update')
payFinish.value=true
uni.$emit('update:createOrderIndex')
uni.navigateBack({
delta: 2
delta: 1
})
}, 500)
}
@@ -278,12 +291,15 @@
const res = await orderApi.tbOrderInfoDetail(order.orderId)
Object.assign(order, res)
if (order.userId) {
queryAllShopUser({id:order.userId}).then(res=>{
queryAllShopUser({
id: order.userId
}).then(res => {
user.value = res.content[0] || opt
})
}
getPayUrl()
}
function getPayUrl() {
orderApi.$getOrderPayUrl({
orderId: order.id,
@@ -294,6 +310,7 @@
}
onLoad(async (opt) => {
console.log(opt);
option = opt
Object.assign(order, opt)
const payTypeList = await Api.$getPayType()
pays.payTypes.list = payTypeList