订单结算更新

This commit is contained in:
2025-11-12 13:43:35 +08:00
parent 378cddb582
commit d0cee95145
6 changed files with 395 additions and 429 deletions

View File

@@ -1,27 +1,29 @@
<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">
<view class="u-font-32">
<text class="price-fuhao"></text>
<text class="font-bold price">{{
orderCostSummary.finalPayAmount
}}</text>
</view>
<view class="u-m-t-10 color-999 old-price" v-if="orderCostSummary.merchantReduction.actualAmount">
<text class=""></text>
<text class=" ">{{ returnMerchantReductionBeforeMoney }}</text>
</view>
<view class="u-m-t-10 u-flex u-row-center color-main">
<view @click="discountShow">修改</view>
</view>
<view class="u-m-t-10 u-flex u-row-center color-main">
<view @click="chooseUser()">选择用户</view>
</view>
<view class="u-font-32">
<text class="price-fuhao"></text>
<text class="font-bold price">{{
orderCostSummary.finalPayAmount
}}</text>
</view>
<view
class="u-m-t-10 color-999 old-price"
v-if="orderCostSummary.merchantReduction.actualAmount"
>
<text class=""></text>
<text class=" ">{{ returnMerchantReductionBeforeMoney }}</text>
</view>
<view class="u-m-t-10 u-flex u-row-center color-main">
<view @click="discountShow">修改</view>
</view>
<view class="u-m-t-10 u-flex u-row-center color-main">
<view @click="chooseUser()">选择用户</view>
</view>
</view>
<view class="content bg-fff border-r-12">
<view class="u-p-l-26 u-p-r-26 card top u-m-t-30">
<view
<view
class="border-bottom-dashed u-p-b-30 u-p-t-30"
v-if="orderCostSummary.newUserDiscount"
>
@@ -584,28 +586,7 @@ const discountSaleAmount = computed(() => {
}
});
/**
* 优惠券金额
*/
const fullCouponDiscountAmount = computed(() => {
return pays.quan
.filter((v) => v.type == 1)
.reduce((prve, cur) => {
// console.log("优惠券金额",prve + cur.discountAmount * 1)
return prve + cur.discountAmount * 1;
}, 0);
});
/**
* 商品券金额
*/
const productCouponDiscountAmount = computed(() => {
return pays.quan
.filter((v) => v.type == 2)
.reduce((prve, cur) => {
return prve + cur.discountAmount * 1;
}, 0);
});
// 计算商家减免前金额使用bignumber.js确保精度
const returnMerchantReductionBeforeMoney = computed(() => {
@@ -752,7 +733,7 @@ watch(
}
);
watch(
() => payPrice.value,
() => orderCostSummary.value.finalPayAmount,
(newval) => {
if (pageData.payUrlShow) {
setTimeout(() => {
@@ -940,9 +921,6 @@ function changeAccountPoints() {
}
}
/**
* 选择优惠券
*/
@@ -1015,28 +993,28 @@ function chooseUser() {
function watchChooseuser() {
uni.$off("choose-user");
uni.$on("choose-user", (data) => {
if(pageData.user.id!=data.id){
selCoupon.value=[]
accountPoints.sel=false;
}
if (pageData.user.id != data.id) {
selCoupon.value = [];
accountPoints.sel = false;
}
pageData.user = data;
if(data.id){
getNewUserDiscount()
}
if (data.id) {
getNewUserDiscount();
}
init();
});
}
//获取用户新客立减
function getNewUserDiscount(){
getDiscountByUserId({
shopUserId: pageData.user.id
}).then(res=>{
if(res.data){
newUserDiscount.value=res.data.amount||0
}
})
function getNewUserDiscount() {
getDiscountByUserId({
shopUserId: pageData.user.id,
}).then((res) => {
if (res.data) {
newUserDiscount.value = res.data.amount || 0;
}
});
}
/**
@@ -1281,6 +1259,7 @@ function objToArrary(obj) {
item.map((v) => {
v.salePrice = v.salePrice ? v.salePrice : v.price;
v.number = v.num;
v.packFee = v.packAmount || 0;
return v;
});
arr = [...arr, ...item];