代客下单更新部分页面跳转请求。页面展示
This commit is contained in:
@@ -25,32 +25,49 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card bottom border-r-12 ">
|
||||
<my-tabs :list="pays.list"></my-tabs>
|
||||
<view class="list">
|
||||
<view class="item" @click="changePayType(index)" 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>
|
||||
<text class="u-m-l-10">{{item.payName}}</text>
|
||||
</view>
|
||||
<view class="u-flex color-999 u-font-24">
|
||||
<!-- <view class="u-m-r-20">
|
||||
<text>余额:</text>
|
||||
<text>¥0.00</text>
|
||||
</view> -->
|
||||
<my-radio @click="changePayType(index)" :modelValue="index==pays.payTypes.selIndex">
|
||||
</my-radio>
|
||||
<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)" 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>
|
||||
<text class="u-m-l-10">{{item.payName}}</text>
|
||||
</view>
|
||||
<view class="u-flex color-999 u-font-24">
|
||||
<!-- <view class="u-m-r-20">
|
||||
<text>余额:</text>
|
||||
<text>¥0.00</text>
|
||||
</view> -->
|
||||
<my-radio @click="changePayType(index)" :modelValue="index==pays.payTypes.selIndex">
|
||||
</my-radio>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-60 u-p-b-30">
|
||||
<my-button @click="payOrder">确认付款</my-button>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="">
|
||||
<view class="u-font-32 u-m-t-40 u-text-center">请让顾客使用微信扫码</view>
|
||||
<view class="u-flex u-row-center u-m-t-40">
|
||||
<image style="width: 300rpx;height: 300rpx;" src="@/static/logo.png" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
<view class="u-m-t-60 u-p-b-30">
|
||||
<my-button @click="payOrder">确认付款</my-button>
|
||||
|
||||
<view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card top border-r-12 ">
|
||||
|
||||
</view>
|
||||
<view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card bottom border-r-12 ">
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
<edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="order.amount"></edit-discount>
|
||||
</view>
|
||||
@@ -70,6 +87,7 @@
|
||||
import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue'
|
||||
const pays = reactive({
|
||||
list: ['扫码收款', '二维码收款'],
|
||||
selIndex: 0,
|
||||
payTypes: {
|
||||
list: [],
|
||||
selIndex: 0
|
||||
@@ -97,54 +115,70 @@
|
||||
function changePayType(i) {
|
||||
pays.payTypes.selIndex = i
|
||||
}
|
||||
|
||||
//支付成功回调
|
||||
function paySuccess(){
|
||||
infoBox.showToast('支付成功')
|
||||
setTimeout(() => {
|
||||
// uni.$emit('orderDetail:update')
|
||||
uni.navigateBack({delta:2})
|
||||
}, 500)
|
||||
}
|
||||
async function payOrder() {
|
||||
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
|
||||
await Api.$payOrder({
|
||||
tableId: order.tableId,
|
||||
masterId: order.masterId,
|
||||
orderId: order.id,
|
||||
orderId: order.id||order.orderId,
|
||||
payType,
|
||||
vipUserId: order.userId,
|
||||
discount: 1,
|
||||
code: ''
|
||||
})
|
||||
infoBox.showToast('支付成功')
|
||||
setTimeout(() => {
|
||||
uni.$emit('orderDetail:update')
|
||||
uni.navigateBack()
|
||||
}, 500)
|
||||
paySuccess()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getPayType()
|
||||
})
|
||||
const order = reactive({
|
||||
amount: 0
|
||||
})
|
||||
function saoma(){
|
||||
|
||||
function saomaPay() {
|
||||
const item = pays.payTypes.list[pays.payTypes.selIndex]
|
||||
uni.scanCode({
|
||||
onlyFromCamera: true,
|
||||
success: function (res) {
|
||||
success:function (res) {
|
||||
console.log('条码类型:' + res.scanType);
|
||||
console.log('条码内容:' + res.result);
|
||||
Api.$payOrder({
|
||||
"orderId": order.orderId, // 订单id
|
||||
"payType": item.payType, //
|
||||
"discount": order.discount,
|
||||
"code": res.result
|
||||
}).then(res=>{
|
||||
console.log(res);
|
||||
paySuccess()
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
watch(() => pays.payTypes.selIndex, (index) => {
|
||||
const item = pays.payTypes.list[index]
|
||||
watch(() => pays.payTypes.selIndex, (newval) => {
|
||||
const item = pays.payTypes.list[newval]
|
||||
if (item.payType == "vipPay") {
|
||||
return
|
||||
return
|
||||
}
|
||||
if (item.payType == "deposit") {
|
||||
//储值卡支付
|
||||
return saoma()
|
||||
return saomaPay('deposit')
|
||||
}
|
||||
if (item.payType == "scanCode") {
|
||||
//扫码支付
|
||||
return saoma()
|
||||
return saomaPay('scanCode')
|
||||
}
|
||||
})
|
||||
onLoad((opt) => {
|
||||
console.log(opt);
|
||||
Object.assign(order, opt)
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user