This commit is contained in:
2024-11-20 15:07:02 +08:00
3 changed files with 64 additions and 45 deletions

View File

@@ -21,6 +21,9 @@ export function canTuiKuan(orderInfo, item) {
return orderInfo.status == 'closed' && item.status != 'return' && item.status != 'refund' && item.status !=
'refunding' && !item.userCouponId
}
export function isTuiCai(item) {
return item.status == 'return'
}
export function isTui(item) {
return item.status == 'return' || item.status == 'refund' || item.status == 'refunding'
}

View File

@@ -7,7 +7,7 @@
</view>
<view class="boxconstantbox_tow">
<text>用户消费结账时成功充值</text>
<input class="text" v-model="form.rechargeTimes"></input>
<input class="number" v-model="form.rechargeTimes"></input>
<text>倍的金额本单即可享受免单</text>
</view>
</view>
@@ -17,7 +17,7 @@
</view>
<view class="boxconstantbox_tow">
<text>订单支付金额需满</text>
<input class="text" v-model="form.rechargeThreshold"></input>
<input class="number" v-model="form.rechargeThreshold"></input>
<text> 才能使用</text>
</view>
</view>

View File

@@ -58,7 +58,7 @@
<view class="u-text-right u-m-t-28">
<template v-if="isTui(item)">
<view>0.00</view>
<view class="line-th color-666 ">{{returnTotalMoney(item)}}
<view class="line-th color-666 " >{{returnTotalMoney(item)}}
</view>
</template>
<template v-else-if="isGift(item)||item.userCouponId">
@@ -67,7 +67,8 @@
</view>
</template>
<template v-else>
<template v-if="user.isVip&&item.isMember&&returnVipMoney(item)>0&&returnVipMoney(item)!=returnTotalMoney(item)">
<template
v-if="user.isVip&&item.isMember&&returnVipMoney(item)>0&&returnVipMoney(item)!=returnTotalMoney(item)">
<view>{{returnVipMoney(item)}}</view>
<view class=" color-666 line-th">
{{returnTotalMoney(item)}}</view>
@@ -120,21 +121,21 @@
<view class="u-flex">
<view class="u-flex u-m-r-24" v-if="youhuiAllPrice>0">
<view class="color-red u-m-r-6 " >
<view class="color-red u-m-r-6 ">
已优惠{{youhuiAllPrice}}
</view>
<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>
</view>
</view>
</view>
<template v-if="orderInfo.status=='refund'">
<template v-if="orderInfo.refundAmount">
<view class="u-flex u-row-between u-m-t-32">
<view>退款金额</view>
<view class="color-999">
@@ -165,46 +166,47 @@
<my-button @tap="printOrder" type="cancel" :color="color.ColorMain">重新打印</my-button>
</view>
</view>
<up-popup :round="10" :show="pop.youhui" mode="center" closeOnClickOverlay @close="youhuiDetailHide" >
<up-popup :round="10" :show="pop.youhui" mode="center" closeOnClickOverlay @close="youhuiDetailHide">
<view class="u-p-30" style="width: 80vw;">
<view class="font-bold u-text-center">优惠详情</view>
<view class="u-m-t-32">
<!-- <view class="u-flex u-row-between u-m-b-18">
<view class="u-flex u-row-between u-m-b-18">
<view>会员优惠</view>
<view class="color-red">
<text></text>
<text>{{vipDiscountPrice}}</text>
</view>
</view> -->
</view>
<view class="u-flex u-row-between u-m-b-18" v-if="orderInfo.discountAmount*1>0">
<view>打折</view>
<view class="color-red">
<text></text>
<text>{{orderInfo.discountAmount}}</text>
<text>{{to2(orderInfo.discountAmount) }}</text>
</view>
</view>
<view class="u-flex u-row-between " v-if="orderInfo.fullCouponDiscountAmount*1>0">
<view class="u-flex u-row-between " v-if="orderInfo.fullCouponDiscountAmount*1>0">
<view>满减券抵扣</view>
<view class="color-red">
<text></text>
<text>{{orderInfo.fullCouponDiscountAmount}}</text>
<text>{{to2(orderInfo.fullCouponDiscountAmount) }}</text>
</view>
</view>
<view class="u-flex u-row-between u-m-t-18" v-if="orderInfo.productCouponDiscountAmount||productCoupPrice">
<view class="u-flex u-row-between u-m-t-18"
v-if="orderInfo.productCouponDiscountAmount||productCoupPrice">
<view>商品券抵扣</view>
<view class="color-red">
<text></text>
<text>{{orderInfo.productCouponDiscountAmount||productCoupPrice}}</text>
<text> {{to2(orderInfo.productCouponDiscountAmount||productCoupPrice) }}</text>
</view>
</view>
<view class="u-flex u-row-between u-m-t-18" v-if="orderInfo.pointsDiscountAmount">
<view>积分抵扣</view>
<view class="color-red">
<text></text>
<text>{{orderInfo.pointsDiscountAmount}}</text>
<text>{{to2(orderInfo.pointsDiscountAmount) }}</text>
</view>
</view>
</view>
</view>
</up-popup>
@@ -213,26 +215,31 @@
<script setup>
import {
computed, reactive
computed,
reactive
} from 'vue';
import color from '@/commons/color.js'
import {
hasPermission
} from '@/commons/utils/hasPermission.js'
import {
isTui,isGift,
isTui,
isTuiCai,
isGift,
canTuiKuan,
canTuicai,
numSum
} from '@/commons/utils/goodsUtil.js'
const pop=reactive({
youhui:false
const pop = reactive({
youhui: false
})
function youhuiDetailShow(){
pop.youhui=true
function youhuiDetailShow() {
pop.youhui = true
}
function youhuiDetailHide(){
pop.youhui=false
function youhuiDetailHide() {
pop.youhui = false
}
const props = defineProps({
orderInfo: {
@@ -311,12 +318,13 @@
}, 0)
return goodsPrice.toFixed(2)
})
const freePrice = computed(() => {
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.gift == true || isTui(v)).reduce((a,
const curTotal = cur.info.filter(v => v.gift == true || isGift(v)).reduce((a,
b) => {
return a + (b.num * b.price)
const price = (b.isMember && b.memberPrice) ? b.memberPrice : b.price
return a + (b.num * price)
}, 0)
return prve + curTotal
}, 0)
@@ -327,35 +335,43 @@
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((a,
const curTotal = cur.info.filter(v => v.gift != true && v.status !== "return" && !v
.userCouponId && (v.isMember && v.memberPrice) && (v.memberPrice != v.price)).reduce((
a,
b) => {
return a + (b.num * (b.price-b.memberPrice))
return a + (b.num * (b.price - b.memberPrice))
}, 0)
return prve + curTotal
}, 0)
return goodsPrice.toFixed(2)
})
const productCoupPrice=computed(()=>{
if(props.orderInfo.status=='closed'){
const productCoupPrice = computed(() => {
if (props.orderInfo.status == 'closed') {
return props.orderInfo.productCouponDiscountAmount
}
const goodsPrice = props.data.reduce((a, b) => {
const curTotal = b.info.filter(v => v.gift != true&& v.userCouponId).reduce((prve,
const curTotal = b.info.filter(v => v.gift != true && v.userCouponId).reduce((prve,
cur) => {
const isVip=props.user.isVip&&cur.isMember
const memberPrice=cur.memberPrice?cur.memberPrice:cur.price
const price=isVip?memberPrice:cur.price
const curTotal=price*cur.num
return prve+curTotal
const isVip = props.user.isVip && cur.isMember
const memberPrice = cur.memberPrice ? cur.memberPrice : cur.price
const price = isVip ? memberPrice : cur.price
const curTotal = price * cur.num
return prve + curTotal
}, 0)
return a + curTotal
}, 0)
return goodsPrice.toFixed(2)
})
const youhuiAllPrice=computed(()=>{
return (freePrice.value*1+vipDiscountPrice.value*1+props.orderInfo.fullCouponDiscountAmount+props.orderInfo.pointsDiscountAmount+productCoupPrice.value*1+(props.orderInfo.discountAmount||0)).toFixed(2)
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)
})
const packFee = computed(() => {
const goodsPrice = props.data.reduce((prve, cur) => {
@@ -369,8 +385,8 @@
})
const allPrice = computed(() => {
const n=goodsOriginAllPrice.value-youhuiAllPrice.value
return (n<0?0:n).toFixed(2)
const n = goodsOriginAllPrice.value - youhuiAllPrice.value
return (n < 0 ? 0 : n).toFixed(2)
})
const goodsNumber = computed(() => {