修改可退款金额计算公式

This commit is contained in:
YeMingfei666 2024-11-23 14:23:11 +08:00
parent 0906ab8523
commit 00b81e9f1b
3 changed files with 66 additions and 15 deletions

View File

@ -69,6 +69,10 @@
price: {
type: [Number,String],
default: 0
},
nowPrice:{
type: [Number,String],
default: 0
}
})
function currentPriceInput(newval){

View File

@ -347,27 +347,48 @@
}
const canTuiKuanPrice = computed(() => {
return props.data.reduce((prve, cur) => {
// const curTotal=cur.info.filter(v=>!v.userCouponId).reduce((a,b)=>{
// return a+b.priceAmount*1
// },0)
const curTotal = cur.info.filter(v => !v.userCouponId)
.reduce((a, b) => {
return a + b.priceAmount * 1
}, 0)
return prve + curTotal
}, 0)
})
const TuiKuanPrice = computed(() => {
return props.data.reduce((prve, cur) => {
// const curTotal=cur.info.filter(v=>!v.userCouponId).reduce((a,b)=>{
// return a+b.priceAmount*1
// },0)
const curTotal = cur.info.filter(v => isTui(v)&&!v.userCouponId)
.reduce((a, b) => {
return a + b.priceAmount * 1
}, 0)
return prve + curTotal
}, 0)
})
const noTuiKuanPrice=computed(()=>{
return props.data.reduce((prve, cur) => {
// const curTotal=cur.info.filter(v=>!v.userCouponId).reduce((a,b)=>{
// return a+b.priceAmount*1
// },0)
const curTotal = cur.info.filter(v => canTuiKuan(props.orderInfo, v) && !v.userCouponId)
const curTotal = cur.info.filter(v => !isTui(v)&&!v.userCouponId)
.reduce((a, b) => {
return a + b.priceAmount * 1
}, 0)
return prve + curTotal
}, 0)
})
function returnCanTuiMoney(item) {
console.log(canTuiKuanPrice.value);
if (props.orderInfo.status == 'unpaid') {
return returnTotalMoney(item)
} else {
if(props.orderInfo.pointsDiscountAmount>0||props.orderInfo.fullCouponDiscountAmount>0){
return (item.priceAmount / (canTuiKuanPrice.value + seatFeePrice.value * 1) * canTuiKuanPrice.value).toFixed(
2)
const bili=(item.priceAmount/canTuiKuanPrice.value*100).toFixed(2)/100
console.log(bili);
return ((props.orderInfo.amount)*bili).toFixed(2)
// return (item.priceAmount / (canTuiKuanPrice.value + seatFeePrice.value * 1) * props.orderInfo.amount).toFixed(
// 2)
}else{
return item.priceAmount
}

View File

@ -1,7 +1,7 @@
<template>
<view class="bg-gray min-page u-p-30 u-font-28">
<view class="u-p-t-60 u-p-b-60 u-text-center">
<template v-if="order.amount!=payPrice">
<template v-if="originPrice!=payPrice">
<view class="u-font-32 ">
<text class="price-fuhao"></text>
<!-- <text class="font-bold price">{{discount.currentPrice?discount.currentPrice:order.amount}}</text> -->
@ -9,7 +9,7 @@
</view>
<view class="u-m-t-10 color-999 old-price">
<text class=""></text>
<text class=" ">{{order.amount}}</text>
<text class=" ">{{originPrice}}</text>
</view>
<view class="u-m-t-10 u-flex u-row-center color-main">
<view @click="discountShow">修改</view>
@ -18,7 +18,7 @@
<template v-else>
<view class="u-font-32 ">
<text class="price-fuhao"></text>
<text class="font-bold price">{{order.amount}}</text>
<text class="font-bold price">{{originPrice}}</text>
</view>
<view class="u-m-t-10 u-flex u-row-center color-main">
<view @click="discountShow">修改</view>
@ -27,8 +27,17 @@
</view>
<view class="content bg-fff border-r-12">
<view class=" u-p-t-30 u-p-l-26 u-p-r-26 card top u-m-t-30">
<view class="border-bottom-dashed u-p-b-30">
<view class="u-p-l-26 u-p-r-26 card top u-m-t-30">
<view class="border-bottom-dashed u-p-b-30 u-p-t-30" v-if="vipDiscount*1>0">
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between ">
<view>会员优惠</view>
<view class="color-red">
-{{vipDiscount}}
</view>
</view>
</view>
<view class="border-bottom-dashed u-p-b-30 u-p-t-30">
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between " @click="toQuan">
<view>优惠券</view>
<view class="color-999 u-flex u-col-center">
@ -202,7 +211,8 @@
<edit-discount @confirm="editDiscountConfirm" title="优惠金额" :ref="setModel" name="editMoney"
<edit-discount :nowPrice="order.amount-productCouponDiscountAmount-fullCouponDiscountAmount"
@confirm="editDiscountConfirm" title="优惠金额" :ref="setModel" name="editMoney"
:price="order.amount-productCouponDiscountAmount" :discount="discount.discount"></edit-discount>
<up-modal :title="modal.title" :content="modal.content" :show="modal.show" :confirmText="modal.confirmText"
@ -266,6 +276,7 @@
}
confirmModelClose()
}
function confirmModelClose() {
modal.show = false
modal.key = ''
@ -726,6 +737,21 @@
fullCouponDiscountAmount.value - accountPoints.price * (accountPoints.sel ? 1 : 0)
return (total < 0 ? 0 : total).toFixed(2)
})
const vipDiscount = computed(() => {
if (!user.value.isVip) {
return 0
}
const goodsPrice = order.detailList.filter(v => v.gift != true && v.status !== "return" && (v.isMember &&
v.memberPrice) && (v.memberPrice != v.price)).reduce((
a,
b) => {
return a + (b.num * (b.price - b.memberPrice))
}, 0)
return goodsPrice.toFixed(2)
})
const originPrice = computed(() => {
return (order.amount || 0) * 1 + vipDiscount.value * 1
})
const fullCouponDiscountAmount = computed(() => {
return pays.quan.filter(v => v.type == 1).reduce((prve, cur) => {
return prve + cur.discountAmount * 1