代码更新
This commit is contained in:
@@ -1,548 +0,0 @@
|
||||
<template>
|
||||
<view class="default-box-padding bg-fff border-r-24 u-m-t-32" v-if="data.length">
|
||||
<view class=" font-bold u-p-b-32 border-bottom u-m-b-24" v-if="orderInfo.tableName">
|
||||
<text class="">桌号:</text>
|
||||
<text class="">{{orderInfo.tableName||""}}</text>
|
||||
</view>
|
||||
<view class=" color-999 border-bottom u-p-b-24">
|
||||
<text>共</text>
|
||||
<text class="color-333 "> {{goodsNumber}}</text>
|
||||
<text>份菜品</text>
|
||||
</view>
|
||||
<view class="u-m-b-20 " v-for="(order,orderIndex) in data" :key="orderIndex">
|
||||
<view class="u-p-t-24"> 第{{ order.placeNum }}次下单
|
||||
</view>
|
||||
<view class="u-m-t-24 list">
|
||||
<view class="item u-m-b-32" v-for="(item,index) in order.info" :key="index">
|
||||
<view class="u-flex u-col-top">
|
||||
<view class="u-flex">
|
||||
<image class="img" :src="item.coverImg||item.productImg" mode=""></image>
|
||||
</view>
|
||||
<view class="u-p-l-32 u-flex-1">
|
||||
<view class="u-flex u-row-between u-col-top">
|
||||
|
||||
<view class="">
|
||||
<view class="u-flex">
|
||||
<view class="tui" v-if="isTui(item)">
|
||||
{{item.status=='refunding'?'退款中':'已退'}}
|
||||
</view>
|
||||
<view
|
||||
:class="{'line-th':item.status=='return'||item.status=='refund'||item.status=='refunding'}">
|
||||
{{item.name||item.productName}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-8">
|
||||
<view class="u-m-r-20 u-flex " v-if="item.gift">
|
||||
<uni-tag text="赠送"
|
||||
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
|
||||
</uni-tag>
|
||||
</view>
|
||||
<view class="u-m-r-20 u-flex " v-if="item.userCouponId">
|
||||
<uni-tag :text=" productCouponDikou(item)"
|
||||
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
|
||||
</uni-tag>
|
||||
</view>
|
||||
<view class="u-m-r-20 u-flex" v-if="item.pack">
|
||||
<uni-tag
|
||||
custom-style="background-color: #E6F0FF; border-color: #E6F0FF; color: #318AFE;"
|
||||
size="small" text="打包" inverted type="success" />
|
||||
</view>
|
||||
<view class="u-m-r-20 u-font-24 u-flex" v-if="item.returnAmount">
|
||||
<view class="color-666">退款金额:</view>
|
||||
<view class="color-999 u-m-l-6">{{item.returnAmount}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="color-999 u-font-24 u-m-t-8">{{item.productSkuName||''}}</view>
|
||||
|
||||
|
||||
<view class="u-m-t-12 color-666 u-font-24" v-if="item.note">
|
||||
备注:{{item.note}}
|
||||
</view>
|
||||
</view>
|
||||
<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>
|
||||
</template>
|
||||
<template v-else-if="isGift(item)||item.userCouponId">
|
||||
<view>¥0.00</view>
|
||||
<view class="line-th color-666 ">¥{{returnTotalMoney(item)}}
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="returnCanTuiMoney(item)*1!=returnTotalMoney(item)*1">
|
||||
<view>¥{{returnCanTuiMoney(item)}}</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">
|
||||
¥{{returnTotalMoney(item)}}</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view>¥{{returnTotalMoney(item)}}</view>
|
||||
</template> -->
|
||||
</template>
|
||||
<view class="u-m-t-22 color-999 u-font-24">X{{item.number||item.num}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<template v-if="canTuicai(orderInfo,item)">
|
||||
<view class="u-flex u-row-right gap-20 u-m-t-24">
|
||||
<!-- <my-button :height="60" color="#333" plain type="cancel" shape="circle">更多操作</my-button> -->
|
||||
<my-button :width="128" :height="48" plain shape="circle" @tap="tuicai(item,index)"><text
|
||||
class="no-wrap">退菜</text></my-button>
|
||||
</view>
|
||||
</template>
|
||||
<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">{{item.userCouponId?'退券':'退款' }}</text> </my-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="bg-gray u-p-20 u-m-t-20" v-if="orderInfo.remark">
|
||||
<view>备注</view>
|
||||
<view class="u-m-t-10">{{orderInfo.remark}}</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<view class="u-m-t-32">
|
||||
<view class="u-flex u-row-between border-top u-p-t-32">
|
||||
<view>
|
||||
<template v-if="orderInfo.status=='unpaid'">
|
||||
<view class="tag no-pay">
|
||||
未支付
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="orderInfo.status=='refund'">
|
||||
<view class="tag refund">
|
||||
退款成功
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
<view class="u-flex">
|
||||
<view class="u-flex u-m-r-24" v-if="youhuiAllPrice>0">
|
||||
<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.refundAmount">
|
||||
<view class="u-flex u-row-between u-m-t-32">
|
||||
<view>退款金额</view>
|
||||
<view class="color-999">
|
||||
<text class="">{{(orderInfo.refundAmount).toFixed(2)}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-32">
|
||||
<view>退款原因</view>
|
||||
<view class="color-999">
|
||||
<text class="">{{orderInfo.refundRemark||''}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-32 u-p-b-24 border-bottom">
|
||||
<view></view>
|
||||
<view class="">
|
||||
<text class="">退款成功</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view></view>
|
||||
<view>
|
||||
<text>总计¥</text>
|
||||
<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>
|
||||
</view>
|
||||
<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" v-if="vipDiscountPrice*1>0">
|
||||
<view>会员优惠</view>
|
||||
<view class="color-red">
|
||||
<text>¥</text>
|
||||
<text>{{vipDiscountPrice}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-b-18" v-if="discountAmount">
|
||||
<view>打折</view>
|
||||
<view class="color-red">
|
||||
<text>¥</text>
|
||||
<text>{{to2(discountAmount) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between " v-if="orderInfo.fullCouponDiscountAmount*1>0">
|
||||
<view>满减券抵扣</view>
|
||||
<view class="color-red">
|
||||
<text>¥</text>
|
||||
<text>{{to2(orderInfo.fullCouponDiscountAmount) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-18" v-if="productCouponDiscountAmount*1>0">
|
||||
<view>商品券抵扣</view>
|
||||
<view class="color-red">
|
||||
<text>¥</text>
|
||||
<text> {{productCouponDiscountAmount }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="u-flex u-row-between u-m-t-18"
|
||||
v-if="orderInfo.productCouponDiscountAmount||productCoupPrice*1>0">
|
||||
<view>商品券抵扣</view>
|
||||
<view class="color-red">
|
||||
<text>¥</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>{{to2(orderInfo.pointsDiscountAmount) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
reactive
|
||||
} from 'vue';
|
||||
import color from '@/commons/color.js'
|
||||
import {
|
||||
hasPermission
|
||||
} from '@/commons/utils/hasPermission.js'
|
||||
import {
|
||||
isTui,
|
||||
isTuiCai,
|
||||
isGift,
|
||||
canTuiKuan,
|
||||
canTuicai,
|
||||
numSum
|
||||
} from '@/commons/utils/goodsUtil.js'
|
||||
const pop = reactive({
|
||||
youhui: false
|
||||
})
|
||||
|
||||
function youhuiDetailShow() {
|
||||
pop.youhui = true
|
||||
}
|
||||
|
||||
function productCouponDikou(item) {
|
||||
return '商品券抵扣¥' + returnProductCoupPrice(item)
|
||||
}
|
||||
|
||||
function youhuiDetailHide() {
|
||||
pop.youhui = false
|
||||
}
|
||||
const props = defineProps({
|
||||
orderInfo: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
seatFee: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
user: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
id: '',
|
||||
isVip: false
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
function returnProductCoupPrice(item) {
|
||||
if (!item.isMember) {
|
||||
return item.price * item.num
|
||||
}
|
||||
const price = item.memberPrice ? item.memberPrice : item.price
|
||||
return price * item.num
|
||||
}
|
||||
const productCouponDiscountAmount = computed(() => {
|
||||
// if(props.orderInfo.productCouponDiscountAmount){
|
||||
// return orderInfo.productCouponDiscountAmount.toFixed(2)
|
||||
// }
|
||||
if (!props.data.length) {
|
||||
return 0
|
||||
}
|
||||
const n = props.data.reduce((prve, cur) => {
|
||||
const curTotal = cur.info.filter(v => v.userCouponId).reduce((a, b) => {
|
||||
return a + returnProductCoupPrice(b)
|
||||
}, 0)
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
console.log(n);
|
||||
return n.toFixed(2)
|
||||
})
|
||||
const emits = defineEmits(['tuicai', 'tuikuan', 'printOrder'])
|
||||
|
||||
function returnVipMoney(item) {
|
||||
if (!item.memberPrice || !props.user.isVip) {
|
||||
return 0
|
||||
}
|
||||
return (item.memberPrice * item.num).toFixed(2)
|
||||
}
|
||||
|
||||
function returnTotalMoney(item) {
|
||||
return (item.price * item.num).toFixed(2)
|
||||
}
|
||||
|
||||
const canTuiKuanPrice = computed(() => {
|
||||
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)
|
||||
})
|
||||
function returnCanTuiMoney(item) {
|
||||
console.log(canTuiKuanPrice.value);
|
||||
if(props.orderInfo.status=='unpaid'){
|
||||
return returnTotalMoney(item)
|
||||
}else{
|
||||
return (item.priceAmount/(canTuiKuanPrice.value+seatFeePrice.value*1)*props.orderInfo.amount).toFixed(2)
|
||||
}
|
||||
}
|
||||
|
||||
function to2(n) {
|
||||
if (!n) {
|
||||
return 0
|
||||
}
|
||||
return n.toFixed(2)
|
||||
}
|
||||
|
||||
function tuicai(item, index) {
|
||||
emits('tuicai', item, index)
|
||||
}
|
||||
|
||||
function tuikuan(item, index) {
|
||||
hasPermission('允许退款').then(res => {
|
||||
if (res) {
|
||||
emits('tuikuan', {...item,priceAmount:returnCanTuiMoney(item)}, index)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function printOrder() {
|
||||
emits('printOrder')
|
||||
}
|
||||
|
||||
|
||||
const seatFeePrice = computed(() => {
|
||||
if (!props.seatFee.priceAmount) {
|
||||
return 0
|
||||
}
|
||||
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,
|
||||
b) => {
|
||||
return a + (b.num * b.price)
|
||||
}, 0)
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
return goodsPrice.toFixed(2)
|
||||
})
|
||||
|
||||
|
||||
|
||||
const freePrice = computed(() => {
|
||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||
const curTotal = cur.info.filter(v => v.gift == true || isGift(v)).reduce((a,
|
||||
b) => {
|
||||
const price = (b.isMember && b.memberPrice) ? b.memberPrice : b.price
|
||||
return a + (b.num * price)
|
||||
}, 0)
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
return goodsPrice.toFixed(2)
|
||||
})
|
||||
const vipDiscountPrice = computed(() => {
|
||||
if (!props.user.isVip) {
|
||||
return 0
|
||||
}
|
||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||
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))
|
||||
}, 0)
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
return goodsPrice.toFixed(2)
|
||||
})
|
||||
|
||||
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,
|
||||
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
|
||||
}, 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 + (props.orderInfo.status == 'unpaid' ? productCoupPrice.value :
|
||||
productCouponDiscountAmount.value) * 1 + (props.orderInfo.discountAmount ||
|
||||
0)).toFixed(2)
|
||||
|
||||
})
|
||||
const packFee = computed(() => {
|
||||
//不是退菜只要有打包费的都计算,包括赠送
|
||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||
const curTotal = cur.info.filter(v => v.status !== "return").reduce((a,
|
||||
b) => {
|
||||
return a + b.packAmount
|
||||
}, 0)
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
return goodsPrice.toFixed(2)
|
||||
|
||||
})
|
||||
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
|
||||
})
|
||||
|
||||
const goodsNumber = computed(() => {
|
||||
let result = 0
|
||||
result = props.data.reduce((a, b) => {
|
||||
const bTotal = b.info.reduce((prve, cur) => {
|
||||
return prve + (cur.number || cur.num) * 1;
|
||||
}, 0);
|
||||
return a + bTotal
|
||||
}, 0)
|
||||
return result
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.img {
|
||||
width: 152rpx;
|
||||
height: 152rpx;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.border-top {
|
||||
border-color: #F6F6F6;
|
||||
}
|
||||
|
||||
.border-r-24 {
|
||||
border-radius: 24rpx;
|
||||
}
|
||||
|
||||
.border-bottom {
|
||||
// border-color: rgb(240, 240, 240);
|
||||
border-color: #F6F6F6;
|
||||
}
|
||||
|
||||
.line-th {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.tag {
|
||||
padding: 4rpx 8rpx 2rpx 10rpx;
|
||||
border-radius: 8rpx;
|
||||
font-size: 24rpx;
|
||||
|
||||
&.no-pay {
|
||||
background-color: rgb(170, 170, 170);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&.refund {
|
||||
background-color: #FCE7E7;
|
||||
padding: 8rpx 20rpx 6rpx 22rpx;
|
||||
color: #EB4F4F;
|
||||
}
|
||||
}
|
||||
|
||||
.tui {
|
||||
background-color: rgb(239, 239, 239);
|
||||
border-radius: 4rpx;
|
||||
margin-right: 6rpx;
|
||||
color: #666;
|
||||
padding: 0 4rpx;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -17,8 +17,7 @@
|
||||
<text>份菜品</text>
|
||||
</view>
|
||||
<view class="u-m-b-20 " v-for="(order,orderIndex) in data" :key="orderIndex">
|
||||
<view class="u-p-t-24"> 第{{ order.placeNum }}次下单
|
||||
</view>
|
||||
<view class="u-p-t-24"> 第{{ order.placeNum }}次下单 </view>
|
||||
<view class="u-m-t-24 list">
|
||||
<view class="item u-m-b-32" v-for="(item,index) in order.info" :key="index">
|
||||
<view class="u-flex u-col-top">
|
||||
@@ -39,7 +38,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-8">
|
||||
<view class="u-m-r-20 u-flex " v-if="item.gift">
|
||||
<view class="u-m-r-20 u-flex " v-if="item.payAmount<=0">
|
||||
<uni-tag text="赠送"
|
||||
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
|
||||
</uni-tag>
|
||||
@@ -49,7 +48,7 @@
|
||||
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
|
||||
</uni-tag>
|
||||
</view>
|
||||
<view class="u-m-r-20 u-flex" v-if="item.pack">
|
||||
<view class="u-m-r-20 u-flex" v-if="item.packNumber > 0">
|
||||
<uni-tag
|
||||
custom-style="background-color: #E6F0FF; border-color: #E6F0FF; color: #318AFE;"
|
||||
size="small" text="打包" inverted type="success" />
|
||||
@@ -62,8 +61,8 @@
|
||||
<view class="color-999 u-font-24 u-m-t-8">{{item.productSkuName||''}}</view>
|
||||
|
||||
|
||||
<view class="u-m-t-12 color-666 u-font-24" v-if="item.note">
|
||||
备注:{{item.note}}
|
||||
<view class="u-m-t-12 color-666 u-font-24" v-if="item.remark">
|
||||
备注:{{item.remark}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-text-right u-m-t-28">
|
||||
@@ -86,15 +85,7 @@
|
||||
<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">
|
||||
¥{{returnTotalMoney(item)}}</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view>¥{{returnTotalMoney(item)}}</view>
|
||||
</template> -->
|
||||
|
||||
</template>
|
||||
<view class="u-m-t-22 color-999 u-font-24">X{{item.number||item.num}}</view>
|
||||
</view>
|
||||
@@ -117,10 +108,6 @@
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="bg-gray u-p-20 u-m-t-20" v-if="orderInfo.remark">
|
||||
<view>备注</view>
|
||||
<view class="u-m-t-10">{{orderInfo.remark}}</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<view class="u-m-t-32">
|
||||
@@ -143,7 +130,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>
|
||||
@@ -178,13 +164,13 @@
|
||||
<template v-if="orderInfo.status=='unpaid'">
|
||||
<view>
|
||||
<text>总计¥</text>
|
||||
<text class="font-bold u-font-32">{{orderInfo.amount }}</text>
|
||||
<text class="font-bold u-font-32">{{orderInfo.orderAmount }}</text>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view>
|
||||
<text>总计¥</text>
|
||||
<text class="font-bold u-font-32">{{orderInfo.amount}}</text>
|
||||
<text class="font-bold u-font-32">{{orderInfo.payAmount}}</text>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -226,14 +212,6 @@
|
||||
<text> {{productCouponDiscountAmount }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="u-flex u-row-between u-m-t-18"
|
||||
v-if="orderInfo.productCouponDiscountAmount||productCoupPrice*1>0">
|
||||
<view>商品券抵扣</view>
|
||||
<view class="color-red">
|
||||
<text>¥</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">
|
||||
@@ -303,7 +281,45 @@
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* 转桌/并桌
|
||||
*/
|
||||
function rotatingTables() {
|
||||
let arr = []
|
||||
props.data.forEach(ele => {
|
||||
ele.info.forEach(res => {
|
||||
// 头像 coverImg
|
||||
res.coverImg = res.productImg
|
||||
// 名字 name
|
||||
res.name = res.productName
|
||||
// 金额 salePrice
|
||||
res.salePrice = res.price
|
||||
// 数量 number
|
||||
res.number = res.num
|
||||
res.masterId = props.orderInfo.masterId
|
||||
res.useType = props.orderInfo.useType
|
||||
res.tableId = props.orderInfo.tableId
|
||||
arr.push(res)
|
||||
})
|
||||
})
|
||||
uni.navigateTo({
|
||||
url: '/pagesCreateOrder/confirm-order/rotatingTables?item=' + JSON.stringify(arr) + '&tableId=' + props
|
||||
.orderInfo.tableId
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 计算菜品数量
|
||||
*/
|
||||
const goodsNumber = computed(() => {
|
||||
let result = 0
|
||||
result = props.data.reduce((a, b) => {
|
||||
const bTotal = b.info.reduce((prve, cur) => {
|
||||
return prve + (cur.number || cur.num) * 1;
|
||||
}, 0);
|
||||
return a + bTotal
|
||||
}, 0)
|
||||
return result
|
||||
})
|
||||
function returnProductCoupPrice(item) {
|
||||
if (!item.isMember) {
|
||||
return item.price * item.num
|
||||
@@ -337,17 +353,14 @@
|
||||
}
|
||||
|
||||
function returnTotalMoney(item) {
|
||||
return (item.price * item.num).toFixed(2)
|
||||
return (item.payAmount * item.num).toFixed(2)
|
||||
}
|
||||
|
||||
const canTuiKuanPrice = computed(() => {
|
||||
const goodsTotal = 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 => !isTui(v) && !v.userCouponId)
|
||||
.reduce((a, b) => {
|
||||
return a + b.priceAmount * 1
|
||||
return a + b.payAmount * 1
|
||||
}, 0)
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
@@ -357,12 +370,9 @@
|
||||
})
|
||||
const TuiKuanPrice = computed(() => {
|
||||
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 => isTui(v) && !v.userCouponId)
|
||||
.reduce((a, b) => {
|
||||
return a + b.priceAmount * 1
|
||||
return a + b.payAmount * 1
|
||||
}, 0)
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
@@ -371,29 +381,27 @@
|
||||
return props.data.reduce((prve, cur) => {
|
||||
const curTotal = cur.info.filter(v => !isTui(v) && !v.userCouponId)
|
||||
.reduce((a, b) => {
|
||||
return a + b.priceAmount * 1
|
||||
return a + b.payAmount * 1
|
||||
}, 0)
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
})
|
||||
const cantuiSeatFee = computed(() => {
|
||||
let seatFee = props.orderInfo.seatInfo ? (props.orderInfo.seatInfo.priceAmount) : 0
|
||||
let seatFee = props.orderInfo.seatInfo ? (props.orderInfo.seatInfo.seatAmount) : 0
|
||||
const bili = Math.floor((seatFee / canTuiKuanPrice.value) * 100) / 100
|
||||
seatFee = Math.floor((props.orderInfo.amount - props.orderInfo.refundAmount) * bili * 100) / 100
|
||||
return seatFee
|
||||
})
|
||||
|
||||
function returnCanTuiMoney(item) {
|
||||
return props.orderInfo.status == 'unpaid' ? item.priceAmount : item.priceAmount
|
||||
return props.orderInfo.status == 'unpaid' ? item.payAmount : item.payAmount
|
||||
if (props.orderInfo.status == 'unpaid') {
|
||||
return returnTotalMoney(item)
|
||||
} else {
|
||||
if (props.orderInfo.pointsDiscountAmount > 0 || props.orderInfo.fullCouponDiscountAmount > 0) {
|
||||
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
|
||||
return item.payAmount
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -414,7 +422,7 @@
|
||||
if (res) {
|
||||
emits('tuikuan', {
|
||||
...item,
|
||||
priceAmount: item.priceAmount
|
||||
payAmount: item.payAmount
|
||||
}, index)
|
||||
}
|
||||
})
|
||||
@@ -426,10 +434,10 @@
|
||||
|
||||
|
||||
const seatFeePrice = computed(() => {
|
||||
if (!props.seatFee.priceAmount) {
|
||||
if (!props.seatFee.seatAmount) {
|
||||
return 0
|
||||
}
|
||||
const n = props.seatFee.priceAmount * (isTui(props.seatFee) ? 0 : 1)
|
||||
const n = props.seatFee.seatAmount * (isTui(props.seatFee) ? 0 : 1)
|
||||
return n.toFixed(2)
|
||||
})
|
||||
const discountAmount = computed(() => {
|
||||
@@ -528,8 +536,8 @@
|
||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||
const curTotal = cur.info.reduce((a,
|
||||
b) => {
|
||||
return a + (b.status == 'unpaid' ? b.priceAmount : b.status == 'return' ? 0 : b
|
||||
.priceAmount * 1)
|
||||
return a + (b.status == 'unpaid' ? b.payAmount : b.status == 'return' ? 0 : b
|
||||
.payAmount * 1)
|
||||
}, 0)
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
@@ -539,47 +547,15 @@
|
||||
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
|
||||
const returnAmount = props.orderInfo.seatInfo && props.orderInfo.seatInfo.seatAmount ? props.orderInfo
|
||||
.seatInfo.seatAmount : 0
|
||||
const canReturnAmount = props.orderInfo.seatInfo && props.orderInfo.seatInfo.canReturnAmount ? props
|
||||
.orderInfo.seatInfo.canReturnAmount : 0
|
||||
const total = props.orderInfo.amount - (returnAmount ? returnAmount : canReturnAmount)
|
||||
const total = props.orderInfo.amount - (seatAmount ? seatAmount : canReturnAmount)
|
||||
return (total <= 0 ? 0 : total).toFixed(2)
|
||||
})
|
||||
|
||||
function rotatingTables() {
|
||||
let arr = []
|
||||
props.data.forEach(ele => {
|
||||
ele.info.forEach(res => {
|
||||
// 头像 coverImg
|
||||
res.coverImg = res.productImg
|
||||
// 名字 name
|
||||
res.name = res.productName
|
||||
// 金额 salePrice
|
||||
res.salePrice = res.price
|
||||
// 数量 number
|
||||
res.number = res.num
|
||||
res.masterId = props.orderInfo.masterId
|
||||
res.useType = props.orderInfo.useType
|
||||
res.tableId = props.orderInfo.tableId
|
||||
arr.push(res)
|
||||
})
|
||||
})
|
||||
uni.navigateTo({
|
||||
url: '/pagesCreateOrder/confirm-order/rotatingTables?item=' + JSON.stringify(arr) + '&tableId=' + props
|
||||
.orderInfo.tableId
|
||||
})
|
||||
}
|
||||
const goodsNumber = computed(() => {
|
||||
let result = 0
|
||||
result = props.data.reduce((a, b) => {
|
||||
const bTotal = b.info.reduce((prve, cur) => {
|
||||
return prve + (cur.number || cur.num) * 1;
|
||||
}, 0);
|
||||
return a + bTotal
|
||||
}, 0)
|
||||
return result
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-24">
|
||||
<view>订单类型</view>
|
||||
<view>{{returnUseType(data.useType)}}</view>
|
||||
<view>{{returnUseType(data.dineMode)}}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-24">
|
||||
<view>桌位号</view>
|
||||
@@ -20,14 +20,9 @@
|
||||
<view>支付方式</view>
|
||||
<view>{{data.payType||''}}</view>
|
||||
</view>
|
||||
<!-- <view class="u-flex u-row-between u-m-t-24">
|
||||
<view>预约时间</view>
|
||||
<view></view>
|
||||
</view> -->
|
||||
<view class="u-flex u-row-between u-m-t-24">
|
||||
<view>下单时间</view>
|
||||
<view><up-text v-if="data.createdAt" mode="date" format="yyyy-mm-dd hh:MM:ss"
|
||||
:text="data.createdAt"></up-text></view>
|
||||
<view><up-text v-if="data.createTime" mode="date" format="yyyy-mm-dd hh:MM:ss" :text="data.createTime"></up-text></view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-24">
|
||||
<view>订单编号</view>
|
||||
@@ -38,16 +33,13 @@
|
||||
<up-icon name="/static/copy.svg" :size="16"></up-icon>
|
||||
</up-copy>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-24 u-col-top">
|
||||
<view class="no-wrap">商家备注</view>
|
||||
<view class="u-p-l-32 " style="max-width: 522rpx; word-wrap: break-word;">
|
||||
{{data.remark}}
|
||||
</view>
|
||||
<!-- <my-button plain shape="circle" :width="160" :height="60">编辑</my-button> -->
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -80,7 +72,7 @@
|
||||
if (!useType) {
|
||||
return ''
|
||||
}
|
||||
return useType == "takeout" ? '自取' : '堂食';
|
||||
return useType == "take-out" ? '自取' : '堂食';
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<view class="u-flex u-row-between u-m-t-20 border-bottom u-p-b-20">
|
||||
<view class="u-flex">
|
||||
<up-avatar :size="30" :src="user.headImg"></up-avatar>
|
||||
<view class="color-666 u-m-l-30">{{user.telephone||'未绑定手机号'}}</view>
|
||||
<view class="color-666 u-m-l-30">{{user.phone||'未绑定手机号'}}</view>
|
||||
</view>
|
||||
<view>
|
||||
<my-button @click="toOrder" :height="60" plain shape="circle">他的订单</my-button>
|
||||
|
||||
@@ -1,19 +1,11 @@
|
||||
<template>
|
||||
<view class="min-page bg-gray u-font-28 u-p-30">
|
||||
<user-vue :orderInfo="orderDetail.info" :user="user"></user-vue>
|
||||
<!-- <view class="default-box-padding bg-fff border-r-12 u-m-t-32">
|
||||
<text class="">桌位号:</text>
|
||||
<text class="">{{orderDetail.info.tableName}}</text>
|
||||
</view> -->
|
||||
|
||||
<goods-list @printOrder="onPrintOrder" @tuikuan="onTuikuan" :orderInfo="orderDetail.info"
|
||||
:user="user"
|
||||
:data="orderDetail.goodsList" :seatFee="orderDetail.seatFee" @tuicai="onTuiCai"></goods-list>
|
||||
<!-- <template v-if="orderDetail.seatFee.totalNumber&&orderDetail.seatFee.totalAmount"> -->
|
||||
|
||||
<!-- <view class="default-box-padding bg-fff border-r-12 u-m-t-20 u-flex u-row-between" v-if="orderDetail.info.discountAmount>0">
|
||||
<view>服务员改价</view>
|
||||
<view class="color-red">-¥{{orderDetail.info.discountAmount}}</view>
|
||||
</view> -->
|
||||
|
||||
<template v-if="true">
|
||||
<extra-vue @tuicai="onSeatFeeTuicai" @tuikuan="onSeatFeeTuiKuan" :orderInfo="orderDetail.info"
|
||||
:data="orderDetail.seatFee"></extra-vue>
|
||||
@@ -64,21 +56,73 @@
|
||||
import go from '@/commons/utils/go.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import {hasPermission} from '@/commons/utils/hasPermission.js'
|
||||
import {
|
||||
onLoad,
|
||||
onShow,
|
||||
onHide
|
||||
} from '@dcloudio/uni-app';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import {
|
||||
reactive,
|
||||
ref
|
||||
} from 'vue';
|
||||
import OrderDetail from './page.js'
|
||||
import { getHistoryOrder } from '@/api/order.js'
|
||||
import { shopStaffDetail } from '@/api/staff.js'
|
||||
import { shopUserDetail } from '@/api/shopUser.js'
|
||||
|
||||
|
||||
const tuicai = reactive({
|
||||
show: false,
|
||||
isSeatFee: false,
|
||||
selGoods: {}
|
||||
})
|
||||
const orderDetail = reactive({
|
||||
goodsList: [],
|
||||
info: {},
|
||||
seatFee: {
|
||||
totalAmount: 0
|
||||
}
|
||||
})
|
||||
const options = reactive({})
|
||||
// 监听选择用户事件
|
||||
let user = ref({
|
||||
headImg:'',
|
||||
telephone:'',
|
||||
amount:'0.00',
|
||||
accountPoints:'0.00'
|
||||
})
|
||||
onLoad((opt) => {
|
||||
Object.assign(options, opt)
|
||||
console.log(options);
|
||||
})
|
||||
onShow(() => {
|
||||
watchEmit()
|
||||
watchChooseuser()
|
||||
getOrderDetail()
|
||||
})
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取订单详情
|
||||
*/
|
||||
async function getOrderDetail () {
|
||||
let res = await getHistoryOrder({orderId: options.id})
|
||||
console.log(res)
|
||||
if(res.userId){
|
||||
shopUserDetail({id:res.userId}).then(res=>{
|
||||
if(res){
|
||||
user.value = res
|
||||
}
|
||||
})
|
||||
}
|
||||
orderDetail.seatFee = {
|
||||
seatNum: res.seatNum,
|
||||
seatAmount: res.seatAmount,
|
||||
}
|
||||
orderDetail.goodsList = Object.entries(res.detailMap).map(([key, value]) => ({
|
||||
info: value,
|
||||
placeNum: key
|
||||
}))
|
||||
console.log(orderDetail.goodsList);
|
||||
orderDetail.info = res
|
||||
}
|
||||
|
||||
function onSeatFeeTuicai(seatFee) {
|
||||
seatFee={...seatFee,num:seatFee.num,productName:seatFee.productName}
|
||||
@@ -223,7 +267,7 @@
|
||||
name: options.name || orderDetail.info.tableName,
|
||||
masterId:orderDetail.info.masterId,
|
||||
type: 'add',
|
||||
vipUserId:orderDetail.memberId?orderDetail.memberId:''
|
||||
vipUserId:orderDetail.userId?orderDetail.userId:''
|
||||
})
|
||||
}
|
||||
|
||||
@@ -232,7 +276,7 @@
|
||||
if(!canJieZhang){
|
||||
return
|
||||
}
|
||||
const memberId=orderDetail.info.memberId||''
|
||||
const userId=orderDetail.info.userId||''
|
||||
clearEmit()
|
||||
go.to('PAGES_ORDER_PAY', {
|
||||
tableId: options.tableId|| orderDetail.info.tableId,
|
||||
@@ -240,79 +284,10 @@
|
||||
masterId: options.masterId,
|
||||
orderId: orderDetail.info.id,
|
||||
discount: 1,
|
||||
memberId
|
||||
userId
|
||||
})
|
||||
}
|
||||
|
||||
const orderDetail = reactive({
|
||||
goodsList: [],
|
||||
info: {},
|
||||
seatFee: {
|
||||
totalAmount: 0
|
||||
}
|
||||
})
|
||||
const options = reactive({})
|
||||
async function init() {
|
||||
const res = await orderApi.tbOrderInfoDetail(options.id)
|
||||
if(res.memberId){
|
||||
queryAllShopUser({id:res.memberId}).then(res=>{
|
||||
if(res.content[0]){
|
||||
user.value=res.content[0]
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
if (res.detailList.length) {
|
||||
uni.setStorageSync('useType', res.detailList[0].useType)
|
||||
}
|
||||
const masterId = res.masterId
|
||||
options.masterId = res.masterId
|
||||
// if (res.status == 'unpaid') {
|
||||
if (false) {
|
||||
const {
|
||||
records,
|
||||
seatFee
|
||||
} = await Api.getCart({
|
||||
masterId,
|
||||
tableId: res.tableId,
|
||||
page: 1,
|
||||
size: 200
|
||||
})
|
||||
orderDetail.goodsList = records
|
||||
orderDetail.seatFee = seatFee ? seatFee : orderDetail.seatFee
|
||||
} else {
|
||||
const goodsMap = {}
|
||||
for (let i in res.detailList) {
|
||||
const goods = res.detailList[i]
|
||||
if (goods.productName != '客座费') {
|
||||
if (goodsMap.hasOwnProperty(goods.placeNum)) {
|
||||
goodsMap[goods.placeNum].push(goods)
|
||||
} else {
|
||||
goodsMap[goods.placeNum] = [goods]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
console.log(res.seatInfo);
|
||||
orderDetail.seatFee = res.seatInfo|| {
|
||||
// name: '客座费',
|
||||
// number: res.seatCount,
|
||||
// num: res.seatCount,
|
||||
// totalNumber: res.seatCount,
|
||||
// priceAmount: res.seatAmount,
|
||||
// status:'',
|
||||
totalNumber:0,
|
||||
}
|
||||
orderDetail.goodsList = Object.entries(goodsMap).map(([key, value]) => ({
|
||||
info: value,
|
||||
placeNum: key
|
||||
}))
|
||||
console.log(orderDetail.goodsList);
|
||||
}
|
||||
console.log(res,'debug121')
|
||||
orderDetail.info = res
|
||||
}
|
||||
|
||||
function watchEmit() {
|
||||
uni.$off('orderDetail:update')
|
||||
@@ -322,13 +297,7 @@
|
||||
})
|
||||
}
|
||||
|
||||
// 监听选择用户事件
|
||||
let user = ref({
|
||||
headImg:'',
|
||||
telephone:'',
|
||||
amount:'0.00',
|
||||
accountPoints:'0.00'
|
||||
})
|
||||
|
||||
//更新选择用户
|
||||
async function setUser(par) {
|
||||
const submitPar = {
|
||||
@@ -359,15 +328,7 @@
|
||||
})
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
watchEmit()
|
||||
watchChooseuser()
|
||||
init()
|
||||
})
|
||||
onLoad((opt) => {
|
||||
Object.assign(options, opt)
|
||||
console.log(options);
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
<view class="u-m-t-26">
|
||||
<view class="u-flex u-col-bottom u-font-24 color-999">
|
||||
<up-avatar :size="33"></up-avatar>
|
||||
<view class="u-m-l-16">{{formatTime(data.createdAt)}}</view>
|
||||
<view class="u-m-l-16">{{formatTime(data.createTime)}}</view>
|
||||
</view>
|
||||
<view class="u-m-t-32">
|
||||
<view class="u-font-32">{{goosZhonglei}}种商品,共{{goodsNumber}}件</view>
|
||||
<view class="border-bottom u-p-b-32">
|
||||
<view class="" v-for="(item,index) in data.detailList" :key="index">
|
||||
<view class="" v-for="(item,index) in data.goods" :key="index">
|
||||
<view class="u-flex u-row-between u-col-top u-m-t-32" v-if="item.productId!=-999">
|
||||
<view>
|
||||
<view class=""> {{item.productName}}</view>
|
||||
@@ -48,7 +48,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else-if="item.isMember&&data.memberId&&item.memberPrice&&item.memberPrice!=item.price">
|
||||
<template v-else-if="item.isMember&&data.userId&&item.memberPrice&&item.memberPrice!=item.price">
|
||||
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
||||
<text class="line-th">¥{{goodsPriceAmount(item)}}</text>
|
||||
<view class="u-absolute" style="bottom: 100%;right: 0;">
|
||||
@@ -141,7 +141,7 @@
|
||||
productName: '客座费',
|
||||
priceAmount: 0
|
||||
},
|
||||
detailList: []
|
||||
goods: []
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -168,7 +168,7 @@
|
||||
return (price * item.num).toFixed(2)
|
||||
}
|
||||
// const packeFee=computed(()=>{
|
||||
// return props.data.detailList.reduce((prve,cur)=>{
|
||||
// return props.data.goods.reduce((prve,cur)=>{
|
||||
// return prve+cur.packAmount
|
||||
// },0).toFixed(2)
|
||||
// })
|
||||
@@ -182,8 +182,8 @@
|
||||
// })
|
||||
|
||||
function goodsMapInit() {
|
||||
for (let i in props.data.detailList) {
|
||||
const goods = props.data.detailList[i]
|
||||
for (let i in props.data.goods) {
|
||||
const goods = props.data.goods[i]
|
||||
if ($goodsMap.hasOwnProperty(goods.productId)) {
|
||||
$goodsMap[goods.productId] += goods.num * 1
|
||||
goodsNumber.value += goods.num * 1
|
||||
@@ -195,7 +195,7 @@
|
||||
}
|
||||
}
|
||||
goodsMapInit()
|
||||
watch(() => props.data.detailList.length, (newval) => {
|
||||
watch(() => props.data.goods.length, (newval) => {
|
||||
goodsNumber.value = 0
|
||||
goodsMapInit()
|
||||
})
|
||||
|
||||
@@ -44,8 +44,8 @@
|
||||
list: [],
|
||||
total: 0,
|
||||
query: {
|
||||
platformType: "admin-app",
|
||||
orderNo: "",
|
||||
platformType: "APP",
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
startTime: today.start,
|
||||
@@ -140,9 +140,6 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,17 +1,17 @@
|
||||
<template>
|
||||
<view class="u-p-l-30 u-p-r-30 u-p-t-30 u-font-28 ">
|
||||
<up-sticky offset-top="0">
|
||||
<my-tabs v-model="myQuan.types.sel" :list="myQuan.types.list"></my-tabs>
|
||||
<my-tabs v-model="pageData.types.sel" :list="pageData.types.list"></my-tabs>
|
||||
</up-sticky>
|
||||
<view class="u-m-t-32">
|
||||
<template v-if="myQuan.types.sel==0">
|
||||
<template v-if="pageData.types.sel==0">
|
||||
<view class="" @click="changeFullReductionCouponSel(item)"
|
||||
v-for="(item,index) in myQuan.res.fullReductionCoupon" :class="{filtergray:!item.use}" :key="index">
|
||||
v-for="(item,index) in pageData.fullReductionCoupon" :class="{filtergray:!item.use}" :key="index">
|
||||
<view class="quan u-row-between u-flex u-col-center u-m-b-32 border-r-10 ">
|
||||
<view class="no-use" v-if="!item.use">
|
||||
<image class="img" src="/pagesOrder/static/image/no-use.svg" mode=""></image>
|
||||
</view>
|
||||
<view class="sel u-abso" v-if="item.id==myQuan.fullReductionCouponSel.id ">
|
||||
<view class="sel u-abso" v-if="item.id == pageData.fullReductionCouponSel.id ">
|
||||
<up-icon name="checkbox-mark" color="#fff"></up-icon>
|
||||
</view>
|
||||
<view class="u-p-t-32 u-p-b-32 u-p-l-24 u-p-r-24 left">
|
||||
@@ -41,13 +41,13 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<template v-if="myQuan.res.fullReductionCoupon.length<=0&&myQuan.hasAjax">
|
||||
<template v-if="pageData.fullReductionCoupon.length <= 0 && pageData.hasAjax">
|
||||
<my-img-empty tips="暂无可用优惠券"></my-img-empty>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<template v-if="myQuan.types.sel==1">
|
||||
<view class="" @click="changeProductCoupon(item)" v-for="(item,index) in myQuan.res.productCoupon"
|
||||
<template v-if="pageData.types.sel==1">
|
||||
<view class="" @click="changeProductCoupon(item)" v-for="(item,index) in pageData.productCoupon"
|
||||
:class="{filtergray:!item.use}" :key="index">
|
||||
<view class="quan goods u-row-between u-flex u-col-center u-m-b-32 border-r-10 u-relative">
|
||||
<view class="no-use" v-if="!item.use">
|
||||
@@ -74,9 +74,6 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="right u-flex u-flex-col u-col-bottom u-row-center">
|
||||
<!-- <view class="u-flex u-row-center w-full">
|
||||
<view class="color-red font-bold u-m-b-24 ">¥{{item.discountAmount}}</view>
|
||||
</view> -->
|
||||
<view class="u-flex ">
|
||||
<view class="use-btn" @click.stop="toEmitChooseQuan(item)">去使用</view>
|
||||
</view>
|
||||
@@ -84,7 +81,7 @@
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<template v-if="myQuan.res.productCoupon.length<=0&&myQuan.hasAjax">
|
||||
<template v-if="pageData.productCoupon.length <= 0 && pageData.hasAjax">
|
||||
<my-img-empty tips="暂无可用优惠券"></my-img-empty>
|
||||
</template>
|
||||
</template>
|
||||
@@ -133,31 +130,13 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
watch,
|
||||
computed,
|
||||
onMounted
|
||||
} from 'vue';
|
||||
import { onLoad, onReady } from '@dcloudio/uni-app'
|
||||
import { ref, reactive, watch, computed, onMounted } from 'vue';
|
||||
import color from '@/commons/color.js'
|
||||
import dayjs from 'dayjs';
|
||||
import {
|
||||
getSafeBottomHeight
|
||||
} from '@/commons/utils/safe-bottom.js'
|
||||
import { getSafeBottomHeight } from '@/commons/utils/safe-bottom.js'
|
||||
import go from '@/commons/utils/go.js'
|
||||
import {
|
||||
onLoad,
|
||||
onReady
|
||||
} from '@dcloudio/uni-app'
|
||||
import * as orderApi from '@/http/yskApi/order.js'
|
||||
import {
|
||||
$activateByOrderId
|
||||
} from '@/http/yskApi/Instead.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import {
|
||||
queryAllShopUser
|
||||
} from '@/http/yskApi/shop-user.js'
|
||||
import {
|
||||
returnNewGoodsList,
|
||||
returnCoupCanUse,
|
||||
@@ -165,6 +144,10 @@
|
||||
returnProductCoupon,
|
||||
returnCanUseFullReductionCoupon
|
||||
} from '../quan_util.js'
|
||||
import { getHistoryOrder } from '@/api/order.js'
|
||||
import { shopUserDetail } from '@/api/shopUser.js'
|
||||
import { getCouponList } from '@/api/coupon.js'
|
||||
|
||||
|
||||
const modal = reactive({
|
||||
title: '提示',
|
||||
@@ -176,20 +159,116 @@
|
||||
data: ''
|
||||
})
|
||||
|
||||
const option = reactive({
|
||||
orderId: '',
|
||||
userId: '',
|
||||
orderPrice: 0
|
||||
})
|
||||
const pageData = reactive({
|
||||
order: null,
|
||||
user: null,
|
||||
types: {
|
||||
list: ['满减券(单选)', '商品券(多选)'],
|
||||
sel: 0
|
||||
},
|
||||
fullReductionCouponSel: {
|
||||
id: ''
|
||||
},
|
||||
fullReductionCoupon: [],
|
||||
productCoupon: [],
|
||||
hasAjax: false
|
||||
})
|
||||
let canDikouGoodsArr = []
|
||||
let safebottomHeight = ref(0)
|
||||
|
||||
onLoad((opt) => {
|
||||
Object.assign(option, opt)
|
||||
getQuan()
|
||||
})
|
||||
watch(() => pageData.types.sel, (newval) => {
|
||||
if (newval == 0) {
|
||||
pageData.fullReductionCoupon = returnCanUseFullReductionCoupon(pageData.fullReductionCoupon, payPrice.value,
|
||||
pageData.fullReductionCouponSel)
|
||||
}
|
||||
if (newval == 1) {
|
||||
|
||||
}
|
||||
})
|
||||
onReady(() => {
|
||||
getSafeBottomHeight('bottom', 0).then(height => {
|
||||
safebottomHeight.value = height
|
||||
})
|
||||
})
|
||||
|
||||
/**
|
||||
* 抵扣金额
|
||||
*/
|
||||
const discountAmount = computed(() => {
|
||||
const goodsQuan = pageData.productCoupon.filter(v => v.checked)
|
||||
const fullReductionCoupon = pageData.fullReductionCouponSel.id ? [pageData.fullReductionCouponSel] : []
|
||||
let coupArr = [...fullReductionCoupon, ...goodsQuan]
|
||||
return returnCouponAllPrice(coupArr, canDikouGoodsArr, pageData.user)
|
||||
})
|
||||
const payPrice = computed(() => {
|
||||
const pay = option.orderPrice - discountAmount.value
|
||||
return (pay < 0 ? 0 : pay).toFixed(2)
|
||||
})
|
||||
|
||||
/**
|
||||
* 获取优惠券
|
||||
*/
|
||||
async function getQuan() {
|
||||
shopUserDetail({ id: option.userId }).then(res=>{
|
||||
pageData.user = res
|
||||
})
|
||||
pageData.order = await getHistoryOrder({orderId:option.orderId})
|
||||
|
||||
console.log(pageData.order);
|
||||
const res = await getCouponList()
|
||||
let fullReductionCoupon = res.filter(v => v.type == 1)
|
||||
let productCoupon = res.filter(v => v.type == 2)
|
||||
|
||||
canDikouGoodsArr = returnNewGoodsList(pageData.order.detailMap || [])
|
||||
fullReductionCoupon = fullReductionCoupon.map((v) => {
|
||||
if(option.orderPrice<=0){
|
||||
return {...v,use:false}
|
||||
}else{
|
||||
return{
|
||||
...v,
|
||||
use:v.use && option.orderPrice * 1 >= v
|
||||
.fullAmount * 1
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
productCoupon = productCoupon.map(v => {
|
||||
const calcCoup = returnProductCoupon(v, pageData.order.detailMap, pageData.user)
|
||||
return {
|
||||
...calcCoup,
|
||||
checked: false,
|
||||
use:option.orderPrice<=0?false:v.use
|
||||
}
|
||||
}).filter((v) => v.use);
|
||||
pageData.fullReductionCoupon = fullReductionCoupon
|
||||
pageData.productCoupon = productCoupon
|
||||
console.log(pageData)
|
||||
pageData.hasAjax = true;
|
||||
}
|
||||
|
||||
function confirmModelCancel() {
|
||||
setModalShow('clear', false, '')
|
||||
}
|
||||
|
||||
async function confirmModelConfirm() {
|
||||
if (modal.key == 'clear') {
|
||||
myQuan.fullReductionCouponSel = {
|
||||
pageData.fullReductionCouponSel = {
|
||||
id: ''
|
||||
}
|
||||
const item = modal.data
|
||||
item.checked = !item.checked
|
||||
const CheckedArr = myQuan.res.productCoupon.filter(v => v.checked)
|
||||
const noCheckedArr = myQuan.res.productCoupon.filter(v => !v.checked)
|
||||
const CheckedArr = pageData.productCoupon.filter(v => v.checked)
|
||||
const noCheckedArr = pageData.productCoupon.filter(v => !v.checked)
|
||||
noCheckedArr.map(v => {
|
||||
console.log(returnCoupCanUse(canDikouGoodsArr, v, CheckedArr));
|
||||
v.use = returnCoupCanUse(canDikouGoodsArr, v, CheckedArr)
|
||||
})
|
||||
setModalShow('clear', false, '')
|
||||
@@ -207,36 +286,20 @@
|
||||
function back() {
|
||||
uni.navigateBack()
|
||||
}
|
||||
let order = ref({
|
||||
|
||||
})
|
||||
let canDikouGoodsArr = []
|
||||
const myQuan = reactive({
|
||||
fullReductionCouponSel: {
|
||||
id: ''
|
||||
},
|
||||
res: {
|
||||
fullReductionCoupon: [],
|
||||
productCoupon: []
|
||||
},
|
||||
types: {
|
||||
list: ['满减券(单选)', '商品券(多选)'],
|
||||
sel: 0
|
||||
},
|
||||
list: [],
|
||||
sel: -1,
|
||||
hasAjax: false
|
||||
})
|
||||
|
||||
/**
|
||||
* 商品券选择
|
||||
* @param {Object} item
|
||||
*/
|
||||
function changeProductCoupon(item) {
|
||||
if (!item.use) {
|
||||
return
|
||||
}
|
||||
if (myQuan.fullReductionCouponSel.id && !item.checked) {
|
||||
const goodsQuan = myQuan.res.productCoupon.filter(v => v.checked)
|
||||
const fullReductionCoupon = myQuan.fullReductionCouponSel.id ? [myQuan.fullReductionCouponSel] : []
|
||||
if (pageData.fullReductionCouponSel.id && !item.checked) {
|
||||
const goodsQuan = pageData.productCoupon.filter(v => v.checked)
|
||||
const fullReductionCoupon = pageData.fullReductionCouponSel.id ? [pageData.fullReductionCouponSel] : []
|
||||
let coupArr = [...goodsQuan, item]
|
||||
const payPrice = option.orderPrice - returnCouponAllPrice(coupArr, canDikouGoodsArr, user.value)
|
||||
const payPrice = option.orderPrice - returnCouponAllPrice(coupArr, canDikouGoodsArr, pageData.user)
|
||||
if (payPrice<=0) {
|
||||
modal.content = '选择该商品券后支付金额将为0,继续选择将取消选择的满减券'
|
||||
modal.cancelText = '取消'
|
||||
@@ -244,7 +307,7 @@
|
||||
setModalShow('clear', true, item)
|
||||
return
|
||||
}
|
||||
if (myQuan.fullReductionCouponSel.fullAmount > payPrice) {
|
||||
if (pageData.fullReductionCouponSel.fullAmount > payPrice) {
|
||||
modal.content = '选择该商品券后将不满足选择抵扣券的最低满减需求,继续选择将取消选择的满减券'
|
||||
modal.cancelText = '取消'
|
||||
modal.confirmText = '继续选择'
|
||||
@@ -254,142 +317,65 @@
|
||||
}
|
||||
|
||||
item.checked = !item.checked
|
||||
const CheckedArr = myQuan.res.productCoupon.filter(v => v.checked)
|
||||
const CheckedArr = pageData.productCoupon.filter(v => v.checked)
|
||||
if (CheckedArr.length <= 0) {
|
||||
return myQuan.res.productCoupon.map(v => {
|
||||
return pageData.productCoupon.map(v => {
|
||||
v.use = true
|
||||
})
|
||||
}
|
||||
const noCheckedArr = myQuan.res.productCoupon.filter(v => !v.checked)
|
||||
const noCheckedArr = pageData.productCoupon.filter(v => !v.checked)
|
||||
noCheckedArr.map(v => {
|
||||
console.log(returnCoupCanUse(canDikouGoodsArr, v, CheckedArr));
|
||||
v.use = returnCoupCanUse(canDikouGoodsArr, v, CheckedArr)
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 优惠券选择
|
||||
* @param {Object} item
|
||||
*/
|
||||
function changeFullReductionCouponSel(item) {
|
||||
if (!item.use) {
|
||||
return
|
||||
// return
|
||||
}
|
||||
console.log(item);
|
||||
if (item.id == myQuan.fullReductionCouponSel.id) {
|
||||
myQuan.fullReductionCouponSel = {
|
||||
if (item.id == pageData.fullReductionCouponSel.id) {
|
||||
pageData.fullReductionCouponSel = {
|
||||
id: ''
|
||||
}
|
||||
} else {
|
||||
myQuan.fullReductionCouponSel = item
|
||||
pageData.fullReductionCouponSel = item
|
||||
}
|
||||
myQuan.res.fullReductionCoupon = returnCanUseFullReductionCoupon($fullReductionCoupon, payPrice.value, myQuan
|
||||
pageData.fullReductionCoupon = returnCanUseFullReductionCoupon(pageData.fullReductionCoupon, payPrice.value, pageData
|
||||
.fullReductionCouponSel)
|
||||
}
|
||||
|
||||
function formatStr(str) {
|
||||
return str.replaceAll('"', '')
|
||||
// return str.replaceAll('"', '')
|
||||
}
|
||||
|
||||
function toUse(item) {
|
||||
|
||||
}
|
||||
let user = reactive({
|
||||
isVip: false
|
||||
})
|
||||
|
||||
let $fullReductionCoupon = []
|
||||
let $productCoupon = []
|
||||
async function getQuan() {
|
||||
order.value = await orderApi.tbOrderInfoDetail(option.orderId)
|
||||
if (order.value.memberId) {
|
||||
const userRes = await queryAllShopUser({
|
||||
id: order.value.memberId
|
||||
})
|
||||
if (userRes.content[0]) {
|
||||
user.value = userRes.content[0]
|
||||
}
|
||||
}
|
||||
|
||||
console.log(order.value);
|
||||
const res = await $activateByOrderId({
|
||||
orderId: option.orderId,
|
||||
memberId: option.memberId
|
||||
})
|
||||
canDikouGoodsArr = returnNewGoodsList(order.value.detailList || [])
|
||||
res.fullReductionCoupon = res.fullReductionCoupon.map((v) => {
|
||||
if(option.orderPrice<=0){
|
||||
return {...v,use:false}
|
||||
}else{
|
||||
return{
|
||||
...v,
|
||||
use:v.use && option.orderPrice * 1 >= v
|
||||
.fullAmount * 1
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
res.productCoupon = res.productCoupon.map(v => {
|
||||
const calcCoup = returnProductCoupon(v, canDikouGoodsArr, user.value)
|
||||
return {
|
||||
...calcCoup,
|
||||
checked: false,
|
||||
use:option.orderPrice<=0?false:v.use
|
||||
}
|
||||
}).filter((v) => v.use);
|
||||
$fullReductionCoupon = res.fullReductionCoupon
|
||||
$productCoupon = res.productCoupon
|
||||
myQuan.res = res
|
||||
myQuan.hasAjax = true;
|
||||
}
|
||||
const option = reactive({
|
||||
orderId: '',
|
||||
memberId: '',
|
||||
orderPrice: 0
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* 优惠券选择确认
|
||||
* @param {Object} item
|
||||
*/
|
||||
function toEmitChooseQuan(item) {
|
||||
let arr = []
|
||||
if (item) {
|
||||
arr = [item]
|
||||
} else {
|
||||
if (myQuan.fullReductionCouponSel.id) {
|
||||
arr.push(myQuan.fullReductionCouponSel)
|
||||
if (pageData.fullReductionCouponSel.id) {
|
||||
arr.push(pageData.fullReductionCouponSel)
|
||||
}
|
||||
const goodsQuan = myQuan.res.productCoupon.filter(v => v.checked)
|
||||
const goodsQuan = pageData.productCoupon.filter(v => v.checked)
|
||||
arr.push(...goodsQuan)
|
||||
}
|
||||
uni.$emit('choose-quan', arr)
|
||||
back()
|
||||
}
|
||||
const discountAmount = computed(() => {
|
||||
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)
|
||||
})
|
||||
const payPrice = computed(() => {
|
||||
const pay = option.orderPrice - discountAmount.value
|
||||
return (pay < 0 ? 0 : pay).toFixed(2)
|
||||
})
|
||||
watch(() => myQuan.types.sel, (newval) => {
|
||||
if (newval == 0) {
|
||||
myQuan.res.fullReductionCoupon = returnCanUseFullReductionCoupon($fullReductionCoupon, payPrice.value,
|
||||
myQuan.fullReductionCouponSel)
|
||||
}
|
||||
if (newval == 1) {
|
||||
|
||||
}
|
||||
})
|
||||
onLoad((opt) => {
|
||||
Object.assign(option, opt)
|
||||
getQuan()
|
||||
})
|
||||
let safebottomHeight = ref(0)
|
||||
onReady(() => {
|
||||
getSafeBottomHeight('bottom', 0).then(height => {
|
||||
console.log(height);
|
||||
safebottomHeight.value = height
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export function isTui(item) {
|
||||
console.log("isTui",item.status);
|
||||
return item.status == 'return' || item.status == 'refund' || item.status == 'refunding'
|
||||
}
|
||||
//是否使用会员价
|
||||
@@ -19,8 +20,11 @@ export function returnProductCouponPrice(coup, goodsArr, vipUser) {
|
||||
}
|
||||
//返回新的商品列表,过滤掉退菜的,退单的商品
|
||||
export function returnNewGoodsList(arr) {
|
||||
let goodsMap = {}
|
||||
return arr.filter(v => !isTui(v))
|
||||
let goods_list = []
|
||||
Object.values(arr).forEach(item=>{
|
||||
goods_list = [...goods_list,...item]
|
||||
})
|
||||
return goods_list.filter(v => !isTui(v))
|
||||
}
|
||||
//根据当前购物车商品以及数量,已选券对应商品数量,判断该商品券是否可用
|
||||
export function returnCoupCanUse(goodsArr = [], coup, selCoupArr = []) {
|
||||
@@ -128,11 +132,15 @@ export function returnProCoupStartIndex(coupArr,index){
|
||||
}
|
||||
//返回商品数量从0到n每一个对应的价格对照表
|
||||
export function returnGoodsPayPriceMap(goodsArr){
|
||||
return goodsArr.reduce((prve,cur)=>{
|
||||
let goods_arr = []
|
||||
Object.values(goodsArr).forEach(item=>{
|
||||
goods_arr = [...goods_arr,...item]
|
||||
})
|
||||
return goods_arr.reduce((prve,cur)=>{
|
||||
if(!prve.hasOwnProperty(cur.productId)){
|
||||
prve[cur.productId]=[]
|
||||
}
|
||||
const arr=new Array(cur.num).fill(cur).map(v=>{
|
||||
let arr=new Array(cur.num).fill(cur).map(v=>{
|
||||
return {
|
||||
memberPrice:v.memberPrice?v.memberPrice:v.price,
|
||||
price:v.price
|
||||
@@ -141,6 +149,7 @@ export function returnGoodsPayPriceMap(goodsArr){
|
||||
prve[cur.productId].push(...arr)
|
||||
return prve
|
||||
},{})
|
||||
|
||||
}
|
||||
//计算商品券总优惠价格
|
||||
export function returnProductCouponAllPrice(coupArr, goodsArr, vipUser) {
|
||||
@@ -155,6 +164,7 @@ export function returnProductCouponAllPrice(coupArr, goodsArr, vipUser) {
|
||||
let coupMap={}
|
||||
for(let i in coupArr){
|
||||
const coup=coupArr[i]
|
||||
console.log(coup)
|
||||
if(coupMap.hasOwnProperty(coup.proId)){
|
||||
coupMap[coup.proId].push(coup)
|
||||
}else{
|
||||
@@ -178,15 +188,15 @@ export function returnProductCouponAllPrice(coupArr, goodsArr, vipUser) {
|
||||
return aPrice-bPrice
|
||||
})
|
||||
goodsPayPriceMap[coup.proId]=goodsMap[coup.proId].reduce((prve,cur)=>{
|
||||
const arr=new Array(cur.num).fill(cur.payPrice)
|
||||
const arr=new Array(cur.number).fill(cur.payPrice)
|
||||
console.log(arr);
|
||||
prve.push(...arr)
|
||||
return prve
|
||||
},[])
|
||||
}
|
||||
const proCoupStartIndex=returnProCoupStartIndex(arr,i)
|
||||
console.log(proCoupStartIndex);
|
||||
const coupNum=Math.min(goodsPayPriceMap[coup.proId].length,coup.num)
|
||||
console.log(coup);
|
||||
const coupNum = Math.min(goodsPayPriceMap[coup.proId].length,coup.number)
|
||||
console.log(coupNum);
|
||||
total+=returnProductCoupAllPrice(goodsPayPriceMap[coup.proId],proCoupStartIndex,coupNum)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user