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