修改订单详情优惠等展示

This commit is contained in:
2024-11-22 18:29:34 +08:00
parent 3706573eab
commit d36afe0969
4 changed files with 591 additions and 26 deletions

View File

@@ -136,9 +136,8 @@
<view class="color-red u-m-r-6 ">
已优惠{{youhuiAllPrice}}
</view>
<up-icon name="info-circle" color="#999" :size="14" @click="youhuiDetailShow"></up-icon>
<!-- <up-icon name="info-circle" color="#999" :size="14" @click="youhuiDetailShow"></up-icon> -->
</view>
<view>
<text>小计</text>
<text class="font-bold u-font-32">{{allPrice}}</text>
@@ -174,13 +173,13 @@
<text class="font-bold u-font-32">{{to2(allPrice*1+seatFeePrice*1+packFee*1) }}</text>
</view>
</view>
<view class="u-flex u-row-between u-m-t-20" v-if="orderInfo.status=='closed'">
<!-- <view class="u-flex u-row-between u-m-t-20" v-if="orderInfo.status=='closed'">
<view></view>
<view>
<text>实付</text>
<text class="font-bold u-font-32">{{to2(orderInfo.amount) }}</text>
</view>
</view>
</view> -->
<!-- <view class="u-flex u-row-between u-m-t-20">
<view></view>
<view>
@@ -337,24 +336,32 @@
function returnTotalMoney(item) {
return (item.price * item.num).toFixed(2)
}
const canTuiKuanPrice = computed(() => {
return props.data.reduce((prve,cur)=>{
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).reduce((a,b)=>{
return a+b.priceAmount*1
},0)
return prve+curTotal
},0)
const curTotal = cur.info.filter(v => canTuiKuan(props.orderInfo, 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'){
if (props.orderInfo.status == 'unpaid') {
return returnTotalMoney(item)
}else{
return (item.priceAmount/(canTuiKuanPrice.value+seatFeePrice.value*1)*props.orderInfo.amount).toFixed(2)
} else {
if(props.orderInfo.pointsDiscountAmount>0||props.orderInfo.fullCouponDiscountAmount>0){
return (item.priceAmount / (canTuiKuanPrice.value + seatFeePrice.value * 1) * canTuiKuanPrice.value).toFixed(
2)
}else{
return item.priceAmount
}
}
}
@@ -372,7 +379,10 @@
function tuikuan(item, index) {
hasPermission('允许退款').then(res => {
if (res) {
emits('tuikuan', {...item,priceAmount:returnCanTuiMoney(item)}, index)
emits('tuikuan', {
...item,
priceAmount: returnCanTuiMoney(item)
}, index)
}
})
}
@@ -455,12 +465,14 @@
})
const youhuiAllPrice = computed(() => {
if(props.orderInfo.status!='unpaid'){
return (goodsOriginAllPrice.value-allPrice.value-discountAmount.value).toFixed(2)
}
return (freePrice.value * 1 + vipDiscountPrice.value * 1 + props.orderInfo.fullCouponDiscountAmount + props
.orderInfo.pointsDiscountAmount + (props.orderInfo.status == 'unpaid' ? productCoupPrice.value :
productCouponDiscountAmount.value) * 1 + (props.orderInfo.discountAmount ||
0)).toFixed(2)
})
const packFee = computed(() => {
//不是退菜只要有打包费的都计算,包括赠送
@@ -475,14 +487,14 @@
})
const allPrice = computed(() => {
const n = goodsOriginAllPrice.value - youhuiAllPrice.value
return (n < 0 ? 0 : n).toFixed(2)
// if (props.orderInfo.status == 'unpaid') {
// const n = goodsOriginAllPrice.value - youhuiAllPrice.value
// return (n < 0 ? 0 : n).toFixed(2)
// }
// return props.orderInfo.amount
if (props.orderInfo.status == 'unpaid') {
const n = goodsOriginAllPrice.value - youhuiAllPrice.value
return (n < 0 ? 0 : n).toFixed(2)
}
const seatFee=props.orderInfo.seatInfo?(props.orderInfo.seatInfo.priceAmount||props.orderInfo.seatInfo.returnAmount):0
console.log('seatFee');
console.log(seatFee);
return (props.orderInfo.amount-seatFee).toFixed(2)
})
const goodsNumber = computed(() => {