修改订单支付,0元禁止扫码和储值卡支付,修复扫码支付未传比例问题
This commit is contained in:
@@ -61,7 +61,7 @@
|
||||
|
||||
</view>
|
||||
|
||||
<view class="border-bottom u-p-b-30" v-if="discount.price||accountPoints.sel">
|
||||
<view class="border-bottom u-p-b-30" v-if="(discount.price&&discount.currentPrice!=order.amount)||accountPoints.sel">
|
||||
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between u-p-t-30 "
|
||||
v-if="discount.price&&discount.currentPrice!=order.amount">
|
||||
<view>服务员改价</view>
|
||||
@@ -84,7 +84,7 @@
|
||||
<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)"
|
||||
<view class="item" @click="changePayType(index,item)" :class="{disabled:item.disabled}"
|
||||
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">
|
||||
@@ -106,16 +106,18 @@
|
||||
<text>{{user.accountPoints||'0'}}</text>
|
||||
</view> -->
|
||||
</view>
|
||||
<view :class="{op3:item.disabled}">
|
||||
<my-radio @click="changePayType(index,item)"
|
||||
:modelValue="index==pays.payTypes.selIndex">
|
||||
</my-radio>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="border-bottom-dashed "></view>
|
||||
<view class="u-flex u-row-between u-p-t-24" v-if="user.id"
|
||||
@click="changeAccountPoints">
|
||||
<view class="u-flex u-row-between u-p-t-24" v-if="user.id" @click="changeAccountPoints">
|
||||
<view class="u-flex ">
|
||||
<view class="">积分抵扣</view>
|
||||
<view class="color-999 u-m-l-10">
|
||||
@@ -127,7 +129,7 @@
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
|
||||
<view class="u-flex" >
|
||||
<view class="u-flex">
|
||||
<view><text>{{accountPoints.num}}</text></view>
|
||||
<view v-if="accountPoints.calcRes.usable" @click.stop="refPointsOpen">
|
||||
<up-icon name="edit-pen" size="16" color="#999"></up-icon>
|
||||
@@ -203,6 +205,10 @@
|
||||
<edit-discount @confirm="editDiscountConfirm" title="优惠金额" :ref="setModel" name="editMoney"
|
||||
:price="order.amount"></edit-discount>
|
||||
|
||||
<up-modal :title="modal.title" :content="modal.content" :show="modal.show" :confirmText="modal.confirmText"
|
||||
:cancelText="modal.cancelText" showCancelButton closeOnClickOverlay @confirm="confirmModelConfirm"
|
||||
@cancel="confirmModelCancel" @close="confirmModelCancel" width="300px" />
|
||||
|
||||
<edit-accountPoints @confirm="pointsConfirm" :price="accountPoints.num" :accountPoints="accountPoints"
|
||||
ref="refPoints"></edit-accountPoints>
|
||||
</view>
|
||||
@@ -240,14 +246,44 @@
|
||||
returnProductCoupAllPrice,
|
||||
returnProductCanUseNum
|
||||
} from '../quan_util.js'
|
||||
|
||||
const modal = reactive({
|
||||
title: '提示',
|
||||
cancelText: '取消',
|
||||
confirmText: '确认',
|
||||
content: '',
|
||||
key: 'cash',
|
||||
show: false,
|
||||
data: ''
|
||||
})
|
||||
|
||||
function confirmModelCancel() {
|
||||
modal.show=false
|
||||
modal.key=''
|
||||
modal.data=''
|
||||
}
|
||||
|
||||
function cashConfirmShow() {
|
||||
modal.content = '是否确认已现金收款' + payPrice.value
|
||||
modal.key='cash'
|
||||
modal.show=true
|
||||
}
|
||||
async function confirmModelConfirm() {
|
||||
if (modal.key == 'cash') {
|
||||
await pay()
|
||||
setModalShow('cash', false)
|
||||
}
|
||||
}
|
||||
|
||||
//商品数量从0到n每一个对应的价格
|
||||
let $goodsPayPriceMap = {}
|
||||
|
||||
const refPoints = ref(null)
|
||||
|
||||
function delQuan(i){
|
||||
pays.quan.splice(i,1)
|
||||
function delQuan(i) {
|
||||
pays.quan.splice(i, 1)
|
||||
}
|
||||
|
||||
function refPointsOpen() {
|
||||
if (!accountPoints.calcRes.usable && accountPoints.sel) {
|
||||
return
|
||||
@@ -480,7 +516,7 @@
|
||||
|
||||
//打折相关数据
|
||||
const discount = reactive({
|
||||
|
||||
discount: 100
|
||||
})
|
||||
|
||||
function editDiscountConfirm(form) {
|
||||
@@ -491,10 +527,18 @@
|
||||
|
||||
async function getPayType() {
|
||||
const payTypeList = await Api.$getPayType()
|
||||
pays.payTypes.list = payTypeList
|
||||
pays.payTypes.list = payTypeList.map(v => {
|
||||
return {
|
||||
...v,
|
||||
disabled: false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function changePayType(i, item) {
|
||||
if (item.disabled) {
|
||||
return infoBox.showToast(item.payName + '不可用')
|
||||
}
|
||||
pays.payTypes.selIndex = i
|
||||
if (item.payType == 'vipPay') {
|
||||
chooseUser()
|
||||
@@ -522,6 +566,9 @@
|
||||
if (payType == 'scanCode' || payType == 'deposit') {
|
||||
return saomaPay()
|
||||
}
|
||||
if (payType == 'cash' && payPrice.value * 1 > 0) {
|
||||
return cashConfirmShow()
|
||||
}
|
||||
payOrder()
|
||||
}
|
||||
const tipsMap = {
|
||||
@@ -534,6 +581,7 @@
|
||||
infoBox.showToast('余额不足')
|
||||
return
|
||||
}
|
||||
|
||||
if (payStatus) {
|
||||
return infoBox.showToast(tipsMap[payStatus])
|
||||
}
|
||||
@@ -545,7 +593,7 @@
|
||||
orderId: order.id || order.orderId,
|
||||
payType,
|
||||
vipUserId: order.memberId,
|
||||
discount: 1,
|
||||
discount: discount.discount / 100,
|
||||
code: '',
|
||||
pointsNum: accountPoints.sel ? accountPoints.num : 0,
|
||||
userCouponInfos: pays.quan.map(v => {
|
||||
@@ -561,6 +609,28 @@
|
||||
payStatus = ''
|
||||
}
|
||||
}
|
||||
async function pay(par) {
|
||||
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
|
||||
payStatus = 'paying'
|
||||
await Api.$payOrder({
|
||||
tableId: order.tableId,
|
||||
masterId: order.masterId,
|
||||
orderId: order.id || order.orderId,
|
||||
payType,
|
||||
vipUserId: order.memberId,
|
||||
discount: discount.discount / 100,
|
||||
code: '',
|
||||
pointsNum: accountPoints.sel ? accountPoints.num : 0,
|
||||
userCouponInfos: pays.quan.map(v => {
|
||||
return {
|
||||
userCouponId: v.id,
|
||||
num: v.num
|
||||
}
|
||||
}),
|
||||
...par
|
||||
})
|
||||
paySuccess()
|
||||
}
|
||||
|
||||
const order = reactive({
|
||||
amount: 0
|
||||
@@ -578,7 +648,7 @@
|
||||
Api.$payOrder({
|
||||
orderId: order.id || order.orderId,
|
||||
payType: item.payType, //
|
||||
discount: order.discount,
|
||||
discount: discount.discount / 100,
|
||||
code: res.result,
|
||||
tableId: order.tableId,
|
||||
masterId: order.masterId,
|
||||
@@ -647,8 +717,24 @@
|
||||
const calcPrice = discountPrice - coupAllPrice.value - accountPoints.price * (accountPoints.sel ? 1 : 0)
|
||||
return (calcPrice <= 0 ? 0 : calcPrice).toFixed(2)
|
||||
})
|
||||
watch(() => payPrice.value, () => {
|
||||
watch(() => payPrice.value, (newval) => {
|
||||
getPayUrl()
|
||||
if (newval <= 0) {
|
||||
const arr = ['cash', 'vipPay']
|
||||
pays.payTypes.list.map(v => {
|
||||
if (arr.includes(v.payType)) {
|
||||
v.disabled = false
|
||||
} else {
|
||||
v.disabled = true
|
||||
}
|
||||
})
|
||||
const index = pays.payTypes.list.findIndex(v => !v.disabled)
|
||||
pays.payTypes.selIndex = index
|
||||
} else {
|
||||
pays.payTypes.list.map(v => {
|
||||
v.disabled = false
|
||||
})
|
||||
}
|
||||
})
|
||||
const pointCanDicountPrice = computed(() => {
|
||||
const discountPrice = discount.currentPrice ? discount.currentPrice : order.amount
|
||||
@@ -676,6 +762,10 @@
|
||||
<style lang="scss" scoped>
|
||||
$quan-color: #318AFE;
|
||||
|
||||
.op3 {
|
||||
opacity: .3;
|
||||
}
|
||||
|
||||
.hui {
|
||||
// background-color: $quan-color;
|
||||
background-image: linear-gradient(to right bottom, rgb(254, 103, 4), rgb(241, 50, 42));
|
||||
@@ -707,6 +797,12 @@
|
||||
}
|
||||
|
||||
.list {
|
||||
.item {
|
||||
&.disabled {
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.item:last-child {
|
||||
.border-bottom {
|
||||
border-bottom: none;
|
||||
|
||||
Reference in New Issue
Block a user