修改订单支付优惠券积分
This commit is contained in:
@@ -53,7 +53,7 @@
|
||||
|
||||
</view>
|
||||
|
||||
<view class="border-bottom u-p-b-30">
|
||||
<view class="border-bottom u-p-b-30" v-if="payPrice!=order.amount">
|
||||
<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>
|
||||
@@ -62,7 +62,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between u-p-t-30 "
|
||||
v-if="accountPoints.price">
|
||||
v-if="accountPoints.price&&accountPoints.sel">
|
||||
<view>积分抵扣</view>
|
||||
<view class=" u-flex u-col-center">
|
||||
<text style="color: rgb(255, 95, 46);">-¥{{to2(accountPoints.price)}}</text>
|
||||
@@ -169,7 +169,7 @@
|
||||
</view>
|
||||
<view class="bg-fff card bottom border-r-12 u-p-32">
|
||||
<view class="font-bold u-font-32 u-text-center">
|
||||
¥{{discount.currentPrice?discount.currentPrice: order.amount}}</view>
|
||||
¥{{payPrice}}</view>
|
||||
<view class="u-flex u-row-center u-m-t-24">
|
||||
<template v-if="order.status=='unpaid'">
|
||||
<up-loading-icon size="14" text="等待支付"></up-loading-icon>
|
||||
@@ -245,9 +245,12 @@
|
||||
price:0
|
||||
})
|
||||
async function calcUsablePoints(){
|
||||
if(!order.memberId){
|
||||
return
|
||||
}
|
||||
const res=await Api.$calcUsablePoints({
|
||||
memberId:order.memberId,
|
||||
orderAmount:order.amount
|
||||
orderAmount:pointCanDicountPrice.value
|
||||
})
|
||||
accountPoints.calcRes=res
|
||||
accountPoints.num=res.maxUsablePoints
|
||||
@@ -424,16 +427,7 @@
|
||||
const discount = reactive({
|
||||
|
||||
})
|
||||
const coupAllPrice=computed(()=>{
|
||||
return pays.quan.reduce((prve,cur)=>{
|
||||
return prve+cur.discountAmount*1
|
||||
},0)
|
||||
})
|
||||
const payPrice=computed(()=>{
|
||||
const discountPrice=discount.currentPrice?discount.currentPrice:order.amount
|
||||
const calcPrice=discountPrice-coupAllPrice.value-accountPoints.price*(accountPoints.sel?1:0)
|
||||
return (calcPrice<=0?0:calcPrice).toFixed(2)
|
||||
})
|
||||
|
||||
function editDiscountConfirm(form) {
|
||||
console.log(form);
|
||||
Object.assign(discount, form)
|
||||
@@ -486,7 +480,15 @@
|
||||
payType,
|
||||
vipUserId: order.memberId,
|
||||
discount: 1,
|
||||
code: ''
|
||||
code: '',
|
||||
pointsNum:accountPoints.sel?accountPoints.num:0,
|
||||
userCouponInfos:pays.quan.map(v=>{
|
||||
return {
|
||||
userCouponId:v.id,
|
||||
num:v.num
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
paySuccess()
|
||||
}
|
||||
@@ -553,11 +555,33 @@
|
||||
function getPayUrl() {
|
||||
orderApi.$getOrderPayUrl({
|
||||
orderId: order.id,
|
||||
payAmount: discount.currentPrice ? discount.currentPrice : order.amount
|
||||
payAmount: payPrice.value
|
||||
}).then(res => {
|
||||
payCodeUrl.value = res
|
||||
})
|
||||
}
|
||||
const coupAllPrice=computed(()=>{
|
||||
return pays.quan.reduce((prve,cur)=>{
|
||||
return prve+cur.discountAmount*1
|
||||
},0)
|
||||
})
|
||||
const payPrice=computed(()=>{
|
||||
const discountPrice=discount.currentPrice?discount.currentPrice:order.amount
|
||||
const calcPrice=discountPrice-coupAllPrice.value-accountPoints.price*(accountPoints.sel?1:0)
|
||||
return (calcPrice<=0?0:calcPrice).toFixed(2)
|
||||
})
|
||||
watch(()=>payPrice.value,()=>{
|
||||
getPayUrl()
|
||||
})
|
||||
const pointCanDicountPrice=computed(()=>{
|
||||
const discountPrice=discount.currentPrice?discount.currentPrice:order.amount
|
||||
const calcPrice=discountPrice-coupAllPrice.value
|
||||
return (calcPrice<=0?0:calcPrice).toFixed(2)
|
||||
})
|
||||
watch(()=>pointCanDicountPrice.value,(newval)=>{
|
||||
calcUsablePoints()
|
||||
})
|
||||
|
||||
onLoad(async (opt) => {
|
||||
console.log(opt);
|
||||
option = opt
|
||||
@@ -566,8 +590,9 @@
|
||||
pays.payTypes.list = payTypeList
|
||||
init()
|
||||
})
|
||||
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
console.log('onBeforeUnmount');
|
||||
clear()
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user