订单管理详情,支付价格计算逻辑修改

This commit is contained in:
2024-11-21 18:10:19 +08:00
parent 84855194e8
commit b69159d965
6 changed files with 89 additions and 34 deletions

View File

@@ -38,7 +38,7 @@
</uni-tag>
</view>
<view class="u-m-r-20 u-flex " v-if="item.userCouponId">
<uni-tag text="商品券抵扣"
<uni-tag :text="'商品券抵扣'+item.priceAmount"
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
</uni-tag>
</view>
@@ -68,6 +68,15 @@
</template>
<template v-else>
<template
v-if="item.priceAmount*1!=returnTotalMoney(item)*1">
<view>{{item.priceAmount}}</view>
<view class=" color-666 line-th">
{{returnTotalMoney(item)}}</view>
</template>
<template v-else>
<view>{{returnTotalMoney(item)}}</view>
</template>
<!-- <template
v-if="user.isVip&&item.isMember&&returnVipMoney(item)>0&&returnVipMoney(item)!=returnTotalMoney(item)">
<view>{{returnVipMoney(item)}}</view>
<view class=" color-666 line-th">
@@ -75,7 +84,7 @@
</template>
<template v-else>
<view>{{returnTotalMoney(item)}}</view>
</template>
</template> -->
</template>
<view class="u-m-t-22 color-999 u-font-24">X{{item.number||item.num}}</view>
</view>
@@ -92,7 +101,7 @@
<template v-if="canTuiKuan(orderInfo,item)">
<view class="u-flex u-row-right gap-20 u-m-t-20">
<my-button :width="128" :height="48" plain shape="circle" @tap="tuikuan(item,index)"><text
class="no-wrap">退款</text> </my-button>
class="no-wrap">{{item.userCouponId?'退券':'退款' }}</text> </my-button>
</view>
</template>
@@ -162,6 +171,20 @@
<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></view>
<view>
<text>实付</text>
<text class="font-bold u-font-32">{{to2(orderInfo.amount) }}</text>
</view>
</view>
<!-- <view class="u-flex u-row-between u-m-t-20">
<view></view>
<view>
<text>原价</text>
<text class="font-bold u-font-32">{{to2(orderInfo.originAmount||0) }}</text>
</view>
</view> -->
<view class="u-m-t-24">
<my-button @tap="printOrder" type="cancel" :color="color.ColorMain">重新打印</my-button>
</view>
@@ -177,11 +200,11 @@
<text>{{vipDiscountPrice}}</text>
</view>
</view>
<view class="u-flex u-row-between u-m-b-18" v-if="orderInfo.discountAmount*1>0">
<view class="u-flex u-row-between u-m-b-18" v-if="discountAmount">
<view>打折</view>
<view class="color-red">
<text></text>
<text>{{to2(orderInfo.discountAmount) }}</text>
<text>{{to2(discountAmount) }}</text>
</view>
</view>
<view class="u-flex u-row-between " v-if="orderInfo.fullCouponDiscountAmount*1>0">
@@ -308,6 +331,13 @@
const n = props.seatFee.priceAmount * (isTui(props.seatFee) ? 0 : 1)
return n.toFixed(2)
})
const discountAmount=computed(()=>{
if(props.orderInfo.discountAmount){
return props.orderInfo.discountAmount
}
console.log(props.orderInfo.originAmount*(1-props.orderInfo.discountRatio));
return (props.orderInfo.originAmount*(1-props.orderInfo.discountRatio))
})
const goodsOriginAllPrice = computed(() => {
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.reduce((a,
@@ -318,6 +348,13 @@
}, 0)
return goodsPrice.toFixed(2)
})
const canTuiKuanPrice=computed(()=>{
const discountAmount=props.orderInfo.originAmount||(100-props.orderInfo.discountRatio)*props.orderInfo.originAmount/100
const n= props.orderInfo.originAmount-discountAmount
console.log(n);
return m
})
const freePrice = computed(() => {
const goodsPrice = props.data.reduce((prve, cur) => {
@@ -335,8 +372,7 @@
return 0
}
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.gift != true && v.status !== "return" && !v
.userCouponId && (v.isMember && v.memberPrice) && (v.memberPrice != v.price)).reduce((
const curTotal = cur.info.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))
@@ -365,8 +401,6 @@
})
const youhuiAllPrice = computed(() => {
console.log(freePrice.value * 1 , vipDiscountPrice.value * 1 , props.orderInfo.fullCouponDiscountAmount ,props
.orderInfo.pointsDiscountAmount , productCoupPrice.value * 1 , props.orderInfo.discountAmount);
return (freePrice.value * 1 + vipDiscountPrice.value * 1 + props.orderInfo.fullCouponDiscountAmount + props
.orderInfo.pointsDiscountAmount + productCoupPrice.value * 1 + (props.orderInfo.discountAmount ||
0)).toFixed(2)

View File

@@ -177,7 +177,7 @@
orderId,
num,
priceAmount,
price
price,userCouponId
} = goods
go.to('PAGES_ORDER_TUIKUAN', {
id,
@@ -190,7 +190,8 @@
number: 0,
productSkuName: productSkuName || '',
priceAmount:priceAmount?priceAmount:(num*price).toFixed(2),
price
price,
userCouponId:userCouponId?userCouponId:''
})
}

View File

@@ -47,9 +47,16 @@
<view class="u-m-l-18 color-999">x{{item.num}}</view>
</view>
<view class="u-flex">
<view class="color-red">
-{{item.discountAmount}}
</view>
<template v-if="item.type==1">
<view class="color-red">
-{{item.discountAmount}}
</view>
</template>
<template v-if="item.type==2">
<view class="color-red">
-{{(item.discountAmount*discount.discount/100).toFixed(2)}}
</view>
</template>
<view class="u-m-l-12" @click="delQuan(index)">
<up-icon :size="16" name="minus-circle-fill" color="rgb(255, 0, 0)"></up-icon>
</view>
@@ -359,7 +366,8 @@
go.to('PAGES_ORDER_QUAN', {
orderId: order.id,
memberId: order.memberId,
orderPrice: payPrice.value * 1 + coupAllPrice.value * 1
orderPrice: (payPrice.value * 1 + coupAllPrice.value * 1).toFixed(2),
discuount:discount.discount
})
}
async function discountShow() {
@@ -472,6 +480,7 @@
coup.num = num
coup.discountAmount = returnProductCoupAllPrice($goodsPayPriceMap[coup.proId],
proCoupStartIndex, num).toFixed(2)
console.log(coup.discountAmount);
}
}
productCoup = productCoup.filter(v => v.num >= 1)
@@ -674,7 +683,11 @@
}
const coupAllPrice = computed(() => {
return pays.quan.reduce((prve, cur) => {
return prve + cur.discountAmount * 1
if(cur.type==1){
return prve + cur.discountAmount * 1
}else{
return prve + (cur.discountAmount * discount.discount/100)
}
}, 0)
})
const payPrice = computed(() => {

View File

@@ -340,7 +340,8 @@
const option = reactive({
orderId: '',
memberId: '',
orderPrice: 0
orderPrice: 0,
discuount:100
})
function toEmitChooseQuan(item) {
@@ -361,7 +362,7 @@
const goodsQuan = myQuan.res.productCoupon.filter(v => v.checked)
const fullReductionCoupon = myQuan.fullReductionCouponSel.id ? [myQuan.fullReductionCouponSel] : []
let coupArr = [...fullReductionCoupon, ...goodsQuan]
return returnCouponAllPrice(coupArr, canDikouGoodsArr, user.value)
return returnCouponAllPrice(coupArr, canDikouGoodsArr, user.value,option.discuount)
})
const payPrice = computed(() => {
const pay = option.orderPrice - discountAmount.value

View File

@@ -206,8 +206,10 @@ export function returnFullReductionCouponAllPrice(coupArr) {
}
//计算优惠券总价格
export function returnCouponAllPrice(coupArr, goodsArr, vipUser) {
const poductAllprice = returnProductCouponAllPrice(coupArr, goodsArr, vipUser)
export function returnCouponAllPrice(coupArr, goodsArr, vipUser,discount) {
console.log(discount);
const poductAllprice = (returnProductCouponAllPrice(coupArr, goodsArr, vipUser)*discount/100)
console.log(poductAllprice);
const pointAllPrice = returnFullReductionCouponAllPrice(coupArr)
return (poductAllprice * 1 + pointAllPrice * 1).toFixed(2);
}

View File

@@ -20,7 +20,7 @@
</view>
<template v-if="option.productId=='-999'">
<view class="u-flex">
<view class="color-red">{{item.priceAmount}}</view>
<view class="color-red" >{{item.priceAmount}}</view>
<view class="u-flex u-m-l-32 u-col-center">
<view class="u-m-l-28 u-m-r-28">x{{item.number}}</view>
</view>
@@ -28,7 +28,7 @@
</template>
<template v-else>
<view class="u-flex">
<view class="color-red">{{item.priceAmount}}</view>
<view class="color-red" v-if="!option.userCouponId">{{item.priceAmount}}</view>
<view class="u-flex u-m-l-32 u-col-center">
<up-icon @click="changeItem(item,-1)" :size="20" name="minus-circle"></up-icon>
<view class="u-m-l-28 u-m-r-28">{{item.number}}</view>
@@ -39,21 +39,24 @@
</template>
</view>
</view>
<view class="bg-fff u-m-t-32 u-p-24 border-r-12 u-flex u-row-between">
<view>支付金额</view>
<view>
{{to2(totalPrice)}}
<template v-if="!option.userCouponId">
<view class="bg-fff u-m-t-32 u-p-24 border-r-12 u-flex u-row-between" >
<view>支付金额</view>
<view>
{{to2(totalPrice)}}
</view>
</view>
</view>
<view class="bg-fff u-m-t-32 u-p-24 border-r-12 u-flex u-row-between">
<view>退款金额</view>
<view class="color-red">
{{to2(tuikuanPrice)}}
<view class="bg-fff u-m-t-32 u-p-24 border-r-12 u-flex u-row-between" >
<view>退款金额</view>
<view class="color-red">
{{to2(tuikuanPrice)}}
</view>
</view>
</view>
</template>
<view class="bg-fff u-p-24 border-r-12 u-m-t-32">
<view>退回优惠券</view>
<view class="u-font-24 color-999 u-m-t-16">
<view class="u-font-24 color-999 u-m-t-16" v-if="!option.userCouponId">
该订单未使用优惠券
</view>
</view>
@@ -143,7 +146,8 @@
})
const tuikuanPrice = computed(() => {
return orderDetail.goodsList.reduce((prve, cur) => {
return prve + cur.number * cur.price
const n=(cur.number/cur.num*100) * cur.priceAmount
return prve + (n/100).toFixed(2)
}, 0)
})