修改订单详情支付逻辑
This commit is contained in:
parent
a2a4a1bf96
commit
c9caed9579
|
|
@ -98,10 +98,10 @@
|
|||
}
|
||||
console.log(item);
|
||||
if (props.orderInfo.pointsDiscountAmount > 0 || props.orderInfo.fullCouponDiscountAmount > 0) {
|
||||
const shengyuKeTui=canTuiKuanPrice.value
|
||||
const bili = Math.floor((item.priceAmount / shengyuKeTui) * 100) / 100
|
||||
console.log(bili);
|
||||
return Math.floor((props.orderInfo.amount-props.orderInfo.refundAmount) * bili * 100) / 100
|
||||
return item.canReturnAmount
|
||||
// const shengyuKeTui=canTuiKuanPrice.value
|
||||
// const bili = Math.floor((item.priceAmount / shengyuKeTui) * 100) / 100
|
||||
// return Math.floor((props.orderInfo.amount-props.orderInfo.refundAmount) * bili * 100) / 100
|
||||
} else {
|
||||
return item.priceAmount
|
||||
}
|
||||
|
|
@ -141,7 +141,7 @@
|
|||
}
|
||||
|
||||
function tuikuan() {
|
||||
emits('tuikuan', {...props.data,priceAmount:seatFeePrice.value})
|
||||
emits('tuikuan', {...props.data,priceAmount:props.data.canReturnAmount})
|
||||
}
|
||||
|
||||
function tuicai() {
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@
|
|||
<template v-if="orderInfo.status=='unpaid'">
|
||||
<view>
|
||||
<text>总计¥</text>
|
||||
<text class="font-bold u-font-32">{{to2(allPrice*1+seatFeePrice*1+packFee*1) }}</text>
|
||||
<text class="font-bold u-font-32">{{orderInfo.amount }}</text>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
|
|
@ -358,6 +358,7 @@
|
|||
return prve + curTotal
|
||||
}, 0)
|
||||
console.log(goodsTotal);
|
||||
console.log(seatFeePrice.value);
|
||||
return (goodsTotal+seatFeePrice.value*1).toFixed(2)
|
||||
})
|
||||
const TuiKuanPrice = computed(() => {
|
||||
|
|
@ -388,16 +389,14 @@
|
|||
return seatFee
|
||||
})
|
||||
function returnCanTuiMoney(item) {
|
||||
return item.canReturnAmount
|
||||
if (props.orderInfo.status == 'unpaid') {
|
||||
return returnTotalMoney(item)
|
||||
} else {
|
||||
if(props.orderInfo.pointsDiscountAmount>0||props.orderInfo.fullCouponDiscountAmount>0){
|
||||
console.log(canTuiKuanPrice.value);
|
||||
const bili=Math.floor((item.priceAmount/canTuiKuanPrice.value )*100)/100
|
||||
console.log(bili);
|
||||
return Math.floor((allPrice.value)*bili*100)/100
|
||||
// return (item.priceAmount / (canTuiKuanPrice.value + seatFeePrice.value * 1) * props.orderInfo.amount).toFixed(
|
||||
// 2)
|
||||
return item.canReturnAmount
|
||||
// const bili=Math.floor((item.priceAmount/canTuiKuanPrice.value )*100)/100
|
||||
// return Math.floor((allPrice.value)*bili*100)/100
|
||||
}else{
|
||||
return item.priceAmount
|
||||
}
|
||||
|
|
@ -420,7 +419,7 @@
|
|||
if (res) {
|
||||
emits('tuikuan', {
|
||||
...item,
|
||||
priceAmount: returnCanTuiMoney(item)
|
||||
priceAmount: item.canReturnAmount
|
||||
}, index)
|
||||
}
|
||||
})
|
||||
|
|
@ -504,14 +503,16 @@
|
|||
})
|
||||
|
||||
const youhuiAllPrice = computed(() => {
|
||||
if(props.orderInfo.status!='unpaid'){
|
||||
const seatfee=(props.orderInfo.amount==0&&allPrice.value==0)?seatFeePrice.value:0
|
||||
return (goodsOriginAllPrice.value-allPrice.value+seatfee*1).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 n= props.orderInfo.originAmount-props.orderInfo.amount+vipDiscountPrice.value*1
|
||||
return (n<0?0:n).toFixed(2)
|
||||
// if(props.orderInfo.status!='unpaid'){
|
||||
// const seatfee=(props.orderInfo.amount==0&&allPrice.value==0)?seatFeePrice.value:0
|
||||
// return (goodsOriginAllPrice.value-allPrice.value+seatfee*1).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(() => {
|
||||
|
|
@ -527,13 +528,21 @@
|
|||
|
||||
})
|
||||
const allPrice = computed(() => {
|
||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||
const curTotal = cur.info.reduce((a,
|
||||
b) => {
|
||||
return a + b.canReturnAmount*1
|
||||
}, 0)
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
return goodsPrice.toFixed(2)
|
||||
if (props.orderInfo.status == 'unpaid') {
|
||||
const n = goodsOriginAllPrice.value - youhuiAllPrice.value
|
||||
return (n < 0 ? 0 : n).toFixed(2)
|
||||
}
|
||||
const returnAmount=props.orderInfo.seatInfo&&props.orderInfo.seatInfo.returnAmount?props.orderInfo.seatInfo.returnAmount:0
|
||||
console.log(cantuiSeatFee.value);
|
||||
const total=props.orderInfo.amount-(returnAmount?returnAmount:cantuiSeatFee.value*1)
|
||||
const canReturnAmount=props.orderInfo.seatInfo&&props.orderInfo.seatInfo.canReturnAmount?props.orderInfo.seatInfo.canReturnAmount:0
|
||||
const total=props.orderInfo.amount-(returnAmount?returnAmount:canReturnAmount)
|
||||
return (total<=0?0:total).toFixed(2)
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -332,13 +332,14 @@
|
|||
function pointsConfirm(e) {
|
||||
accountPoints.num = e
|
||||
}
|
||||
async function calcUsablePoints() {
|
||||
async function calcUsablePoints(orderAmount) {
|
||||
if (!order.memberId) {
|
||||
return
|
||||
}
|
||||
console.log(orderAmount);
|
||||
const res = await Api.$calcUsablePoints({
|
||||
memberId: order.memberId,
|
||||
orderAmount: payPrice.value
|
||||
orderAmount: orderAmount ? orderAmount : payPrice.value
|
||||
})
|
||||
accountPoints.calcRes = res
|
||||
accountPoints.num = res.maxUsablePoints
|
||||
|
|
@ -350,12 +351,18 @@
|
|||
}
|
||||
})
|
||||
async function calcDeDuctionPoints() {
|
||||
if (accountPoints.num <= 0) {
|
||||
accountPoints.price = 0
|
||||
return ''
|
||||
}
|
||||
const res = await Api.$calcDeDuctionPoints({
|
||||
memberId: order.memberId,
|
||||
orderAmount: order.amount,
|
||||
orderAmount: originPrice.value,
|
||||
points: accountPoints.num
|
||||
})
|
||||
if (res) {
|
||||
accountPoints.price = res
|
||||
}
|
||||
return res
|
||||
}
|
||||
watch(() => accountPoints.num, (newval) => {
|
||||
|
|
@ -470,9 +477,7 @@
|
|||
})
|
||||
}
|
||||
|
||||
function watchChooseQuan() {
|
||||
uni.$off('choose-quan')
|
||||
uni.$on('choose-quan', (arr) => {
|
||||
function setQuan(arr) {
|
||||
console.log(arr);
|
||||
discount.discount = 100
|
||||
discount.value = 0
|
||||
|
|
@ -512,6 +517,12 @@
|
|||
console.log(productCoup);
|
||||
pays.quan = [...manjianCoup, ...productCoup]
|
||||
console.log(pays.quan);
|
||||
}
|
||||
|
||||
function watchChooseQuan() {
|
||||
uni.$off('choose-quan')
|
||||
uni.$on('choose-quan', (arr) => {
|
||||
setQuan(arr)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -702,9 +713,19 @@
|
|||
const orderRes = await orderApi.tbOrderInfoDetail(order.orderId)
|
||||
Object.assign(order, orderRes)
|
||||
$goodsPayPriceMap = returnGoodsPayPriceMap(order.detailList)
|
||||
console.log($goodsPayPriceMap);
|
||||
const hasSelQuan = orderRes.couponInfoList ? JSON.parse(orderRes.couponInfoList) : {
|
||||
fullReductionCoupon: [],
|
||||
productCoupon: []
|
||||
};
|
||||
const fullReductionCoupon = hasSelQuan.fullReductionCoupon.filter(v => v.type == 1)
|
||||
const productCoupon = hasSelQuan.productCoupon.filter(v => v.type == 2)
|
||||
setQuan([...fullReductionCoupon, ...productCoupon])
|
||||
|
||||
if (orderRes.memberId) {
|
||||
calcUsablePoints()
|
||||
if (orderRes.pointsNum) {
|
||||
accountPoints.sel = true
|
||||
}
|
||||
queryAllShopUser({
|
||||
id: orderRes.memberId
|
||||
}).then(res => {
|
||||
|
|
@ -733,7 +754,8 @@
|
|||
// 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)
|
||||
const total = (order.amount || 0) - productCouponDiscountAmount.value - discount.value -
|
||||
const total = (originPrice.value) - vipDiscount.value - productCouponDiscountAmount.value - discount
|
||||
.value -
|
||||
fullCouponDiscountAmount.value - accountPoints.price * (accountPoints.sel ? 1 : 0)
|
||||
return (total < 0 ? 0 : total).toFixed(2)
|
||||
})
|
||||
|
|
@ -750,7 +772,10 @@
|
|||
return goodsPrice.toFixed(2)
|
||||
})
|
||||
const originPrice = computed(() => {
|
||||
const n=(order.amount || 0) * 1 + vipDiscount.value * 1
|
||||
const n = (order.amount || 0) * 1 + vipDiscount.value * 1 + (order.fullCouponDiscountAmount || 0) + (order
|
||||
.productCouponDiscountAmount || 0) +
|
||||
(order.pointsDiscountAmount || 0)
|
||||
|
||||
return n.toFixed(2)
|
||||
})
|
||||
const fullCouponDiscountAmount = computed(() => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue