增加商品券限制,过滤不满足使用条件的商品券
This commit is contained in:
@@ -37,6 +37,11 @@
|
|||||||
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
|
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
|
||||||
</uni-tag>
|
</uni-tag>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="u-m-r-20 u-flex " v-if="item.userCouponId">
|
||||||
|
<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.pack">
|
<view class="u-m-r-20 u-flex" v-if="item.pack">
|
||||||
<uni-tag
|
<uni-tag
|
||||||
custom-style="background-color: #E6F0FF; border-color: #E6F0FF; color: #318AFE;"
|
custom-style="background-color: #E6F0FF; border-color: #E6F0FF; color: #318AFE;"
|
||||||
@@ -56,7 +61,7 @@
|
|||||||
<view class="line-th color-666 ">¥{{returnTotalMoney(item)}}
|
<view class="line-th color-666 ">¥{{returnTotalMoney(item)}}
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="isGift(item)">
|
<template v-else-if="isGift(item)||item.userCouponId">
|
||||||
<view>¥0.00</view>
|
<view>¥0.00</view>
|
||||||
<view class="line-th color-666 ">¥{{returnTotalMoney(item)}}
|
<view class="line-th color-666 ">¥{{returnTotalMoney(item)}}
|
||||||
</view>
|
</view>
|
||||||
@@ -149,7 +154,6 @@
|
|||||||
<view></view>
|
<view></view>
|
||||||
<view>
|
<view>
|
||||||
<text>总计¥</text>
|
<text>总计¥</text>
|
||||||
<!-- <text class="font-bold u-font-32">{{numSum([allPrice,seatFeePrice,packFee]) }}</text> -->
|
|
||||||
<text class="font-bold u-font-32">{{to2(allPrice*1+seatFeePrice*1+packFee*1) }}</text>
|
<text class="font-bold u-font-32">{{to2(allPrice*1+seatFeePrice*1+packFee*1) }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -276,8 +280,7 @@
|
|||||||
return goodsPrice.toFixed(2)
|
return goodsPrice.toFixed(2)
|
||||||
})
|
})
|
||||||
const youhuiAllPrice=computed(()=>{
|
const youhuiAllPrice=computed(()=>{
|
||||||
console.log(freePrice.value);
|
return (freePrice.value*1+vipDiscountPrice.value*1+props.orderInfo.fullCouponDiscountAmount+props.orderInfo.productCouponDiscountAmount+props.orderInfo.pointsDiscountAmount).toFixed(2)
|
||||||
return (freePrice.value*1+vipDiscountPrice.value*1).toFixed(2)
|
|
||||||
})
|
})
|
||||||
const packFee = computed(() => {
|
const packFee = computed(() => {
|
||||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||||
@@ -291,7 +294,7 @@
|
|||||||
|
|
||||||
})
|
})
|
||||||
const allPrice = computed(() => {
|
const allPrice = computed(() => {
|
||||||
return (goodsOriginAllPrice.value-freePrice.value-vipDiscountPrice.value).toFixed(2)
|
return (goodsOriginAllPrice.value-youhuiAllPrice.value).toFixed(2)
|
||||||
})
|
})
|
||||||
|
|
||||||
const goodsNumber = computed(() => {
|
const goodsNumber = computed(() => {
|
||||||
|
|||||||
@@ -30,8 +30,7 @@
|
|||||||
<view class="u-m-t-32">
|
<view class="u-m-t-32">
|
||||||
<view class="u-font-32">{{goosZhonglei}}种商品,共{{goodsNumber}}件</view>
|
<view class="u-font-32">{{goosZhonglei}}种商品,共{{goodsNumber}}件</view>
|
||||||
<view class="border-bottom u-p-b-32">
|
<view class="border-bottom u-p-b-32">
|
||||||
<view class="" v-for="(item,index) in data.detailList"
|
<view class="" v-for="(item,index) in data.detailList" :key="index">
|
||||||
:key="index">
|
|
||||||
<view class="u-flex u-row-between u-col-top u-m-t-32" v-if="item.productId!=-999">
|
<view class="u-flex u-row-between u-col-top u-m-t-32" v-if="item.productId!=-999">
|
||||||
<view>
|
<view>
|
||||||
<view class=""> {{item.productName}}</view>
|
<view class=""> {{item.productName}}</view>
|
||||||
@@ -44,7 +43,7 @@
|
|||||||
<template v-if="item.gift">
|
<template v-if="item.gift">
|
||||||
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
||||||
<text class="line-th">¥{{goodsPriceAmount(item)}}</text>
|
<text class="line-th">¥{{goodsPriceAmount(item)}}</text>
|
||||||
<view class="u-absolute" style="bottom: 100%;right: 0;" >
|
<view class="u-absolute" style="bottom: 100%;right: 0;">
|
||||||
¥0
|
¥0
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -52,24 +51,25 @@
|
|||||||
<template v-else-if="data.memberId&&item.memberPrice&&item.memberPrice!=item.price">
|
<template v-else-if="data.memberId&&item.memberPrice&&item.memberPrice!=item.price">
|
||||||
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
||||||
<text class="line-th">¥{{goodsPriceAmount(item)}}</text>
|
<text class="line-th">¥{{goodsPriceAmount(item)}}</text>
|
||||||
<view class="u-absolute" style="bottom: 100%;right: 0;" >
|
<view class="u-absolute" style="bottom: 100%;right: 0;">
|
||||||
¥{{goodsVipPriceAmount(item)}}
|
¥{{goodsVipPriceAmount(item)}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
||||||
<text >¥{{goodsPriceAmount(item)}}</text>
|
<text>¥{{goodsPriceAmount(item)}}</text>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="border-bottom u-p-t-32 u-p-b-32" v-if="data.packFee>0||(data.seatInfo&&data.seatInfo.priceAmount>0)">
|
<view class="border-bottom u-p-t-32 u-p-b-32"
|
||||||
|
v-if="data.packFee>0||(data.seatInfo&&data.seatInfo.priceAmount>0)">
|
||||||
<view class="u-flex u-row-between u-col-top" v-if="data.packFee>0">
|
<view class="u-flex u-row-between u-col-top" v-if="data.packFee>0">
|
||||||
<view class="no-wrap u-m-r-32">打包费</view>
|
<view class="no-wrap u-m-r-32">打包费</view>
|
||||||
<view>¥{{data.packFee||0}}</view>
|
<view>¥{{data.packFee||0}}</view>
|
||||||
@@ -80,8 +80,24 @@
|
|||||||
<view>¥{{data.seatInfo.priceAmount}}</view>
|
<view>¥{{data.seatInfo.priceAmount}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="border-bottom u-p-b-32 u-m-t-32"
|
||||||
|
v-if="data.fullCouponDiscountAmount>0||data.productCouponDiscountAmount>0||data.pointsDiscountAmount>0">
|
||||||
|
<view class="u-flex u-row-between u-col-top" v-if="data.fullCouponDiscountAmount>0">
|
||||||
|
<view class="no-wrap u-m-r-32">满减券抵扣</view>
|
||||||
|
<view class="color-red">-¥{{data.fullCouponDiscountAmount||0}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-row-between u-m-t-32 u-col-top" v-if="data.productCouponDiscountAmount>0">
|
||||||
|
<view class="no-wrap u-m-r-32">商品券抵扣</view>
|
||||||
|
<view class="color-red">-¥{{data.productCouponDiscountAmount||0}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-row-between u-m-t-32 u-col-top" v-if="data.pointsDiscountAmount>0">
|
||||||
|
<view class="no-wrap u-m-r-32">积分抵扣</view>
|
||||||
|
<view class="color-red">-¥{{data.pointsDiscountAmount||0}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<view class="u-flex u-row-between border-bottom u-m-t-32 u-p-b-32 u-col-top">
|
<view class="u-flex u-row-between border-bottom u-m-t-32 u-p-b-32 u-col-top">
|
||||||
<view class="no-wrap u-m-r-32">订单备注</view>
|
<view class="no-wrap u-m-r-32">订单备注</view>
|
||||||
<view>{{data.remark||'无'}}</view>
|
<view>{{data.remark||'无'}}</view>
|
||||||
@@ -103,7 +119,11 @@
|
|||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import orderEnum from '@/commons/orderEnum.js'
|
import orderEnum from '@/commons/orderEnum.js'
|
||||||
import go from '@/commons/utils/go.js'
|
import go from '@/commons/utils/go.js'
|
||||||
import {isTui,canTuiKuan,canTuicai} from '@/commons/utils/goodsUtil.js'
|
import {
|
||||||
|
isTui,
|
||||||
|
canTuiKuan,
|
||||||
|
canTuicai
|
||||||
|
} from '@/commons/utils/goodsUtil.js'
|
||||||
import {
|
import {
|
||||||
computed,
|
computed,
|
||||||
reactive,
|
reactive,
|
||||||
@@ -115,11 +135,11 @@
|
|||||||
data: {
|
data: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {
|
default: () => {
|
||||||
return{
|
return {
|
||||||
packFee:0,
|
packFee: 0,
|
||||||
seatInfo:{
|
seatInfo: {
|
||||||
productName:'客座费',
|
productName: '客座费',
|
||||||
priceAmount:0
|
priceAmount: 0
|
||||||
},
|
},
|
||||||
detailList: []
|
detailList: []
|
||||||
}
|
}
|
||||||
@@ -133,14 +153,16 @@
|
|||||||
let $goodsMap = {}
|
let $goodsMap = {}
|
||||||
let goosZhonglei = ref(0)
|
let goosZhonglei = ref(0)
|
||||||
let goodsNumber = ref(0)
|
let goodsNumber = ref(0)
|
||||||
|
|
||||||
const priceSize = 9
|
const priceSize = 9
|
||||||
function goodsPriceAmount(item){
|
|
||||||
return (item.price*item.num).toFixed(2)
|
function goodsPriceAmount(item) {
|
||||||
|
return (item.price * item.num).toFixed(2)
|
||||||
}
|
}
|
||||||
function goodsVipPriceAmount(item){
|
|
||||||
const price=props.data.memberId?item.memberPrice: item.price
|
function goodsVipPriceAmount(item) {
|
||||||
return (price*item.num).toFixed(2)
|
const price = props.data.memberId ? item.memberPrice : item.price
|
||||||
|
return (price * item.num).toFixed(2)
|
||||||
}
|
}
|
||||||
// const packeFee=computed(()=>{
|
// const packeFee=computed(()=>{
|
||||||
// return props.data.detailList.reduce((prve,cur)=>{
|
// return props.data.detailList.reduce((prve,cur)=>{
|
||||||
@@ -153,9 +175,9 @@
|
|||||||
if (!item) {
|
if (!item) {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
const minW=`${item.price}`.length * priceSize + 15
|
const minW = `${item.price}`.length * priceSize + 15
|
||||||
return {
|
return {
|
||||||
'min-width':(minW<36?36:minW) + 'px'
|
'min-width': (minW < 36 ? 36 : minW) + 'px'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// const computedPriceStyle = computed(() => {
|
// const computedPriceStyle = computed(() => {
|
||||||
|
|||||||
@@ -46,14 +46,14 @@
|
|||||||
<view class="u-m-l-18">{{item.name}}</view>
|
<view class="u-m-l-18">{{item.name}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="color-red">
|
<view class="color-red">
|
||||||
¥{{item.discountAmount}}
|
-¥{{item.discountAmount}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="border-bottom u-p-b-30" v-if="payPrice!=order.amount">
|
<view class="border-bottom u-p-b-30" v-if="payPrice!=order.amount||accountPoints.sel">
|
||||||
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between u-p-t-30 "
|
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between u-p-t-30 "
|
||||||
v-if="discount.price&&discount.currentPrice!=order.amount">
|
v-if="discount.price&&discount.currentPrice!=order.amount">
|
||||||
<view>服务员改价</view>
|
<view>服务员改价</view>
|
||||||
|
|||||||
@@ -204,14 +204,14 @@
|
|||||||
console.log(order.value);
|
console.log(order.value);
|
||||||
const res = await $activateByOrderId(option)
|
const res = await $activateByOrderId(option)
|
||||||
canDikouGoodsArr = returnNewGoodsList(order.value.detailList || [])
|
canDikouGoodsArr = returnNewGoodsList(order.value.detailList || [])
|
||||||
res.fullReductionCoupon = res.fullReductionCoupon.filter((v) => !v.use)
|
res.fullReductionCoupon = res.fullReductionCoupon.filter((v) => v.use)
|
||||||
res.productCoupon = res.productCoupon.map(v => {
|
res.productCoupon = res.productCoupon.map(v => {
|
||||||
const calcCoup = returnProductCoupon(v, canDikouGoodsArr, user.value)
|
const calcCoup = returnProductCoupon(v, canDikouGoodsArr, user.value)
|
||||||
return {
|
return {
|
||||||
...calcCoup,
|
...calcCoup,
|
||||||
checked: false
|
checked: false
|
||||||
}
|
}
|
||||||
});
|
}).filter((v) => v.use);
|
||||||
myQuan.res = res
|
myQuan.res = res
|
||||||
myQuan.hasAjax = true;
|
myQuan.hasAjax = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ export function returnNewGoodsList(arr) {
|
|||||||
let goodsMap={}
|
let goodsMap={}
|
||||||
return arr.filter(v => !isTui(v))
|
return arr.filter(v => !isTui(v))
|
||||||
}
|
}
|
||||||
//根据当前购物车商品以及数量,已选券对应商品数量,判断该券是否可用
|
//根据当前购物车商品以及数量,已选券对应商品数量,判断该商品券是否可用
|
||||||
export function returnCoupCanUse(goodsArr=[],coup,selCoupArr=[]) {
|
export function returnCoupCanUse(goodsArr=[],coup,selCoupArr=[]) {
|
||||||
if(!coup.use){
|
// if(!coup.use){
|
||||||
return false
|
// return false
|
||||||
}
|
// }
|
||||||
const findGoods=goodsArr.filter(v=>v.productId==coup.proId)
|
const findGoods=goodsArr.filter(v=>v.productId==coup.proId)
|
||||||
if(!findGoods.length){
|
if(!findGoods.length){
|
||||||
return false
|
return false
|
||||||
@@ -36,10 +36,10 @@ export function returnCoupCanUse(goodsArr=[],coup,selCoupArr=[]) {
|
|||||||
if(selCoupNumber>=findGoodsTotalNumber){
|
if(selCoupNumber>=findGoodsTotalNumber){
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return findGoodsTotalNumber<coup.num?false:true
|
return findGoodsTotalNumber<(coup.num+selCoupNumber)?false:true
|
||||||
}
|
}
|
||||||
//查找购物车商品根据购物车商品数据返回商品券信息(抵扣价格以及是否满足可用需求)
|
//查找购物车商品根据购物车商品数据返回商品券信息(抵扣价格以及是否满足可用需求)
|
||||||
export function returnProductCoupon(coup, goodsArr, vipUser) {
|
export function returnProductCoupon(coup, goodsArr, vipUser,selCoupArr=[]) {
|
||||||
const newGoodsArr = returnNewGoodsList(goodsArr)
|
const newGoodsArr = returnNewGoodsList(goodsArr)
|
||||||
const item = newGoodsArr.find(v => v.productId == coup.proId);
|
const item = newGoodsArr.find(v => v.productId == coup.proId);
|
||||||
if(!item){
|
if(!item){
|
||||||
@@ -49,7 +49,9 @@ export function returnProductCoupon(coup, goodsArr, vipUser) {
|
|||||||
const price = item ? (vipUser.isVip ? memberPrice : item.price) : 0;
|
const price = item ? (vipUser.isVip ? memberPrice : item.price) : 0;
|
||||||
const discountAmount=(price*coup.num).toFixed(2)
|
const discountAmount=(price*coup.num).toFixed(2)
|
||||||
console.log(discountAmount);
|
console.log(discountAmount);
|
||||||
const canUse=!coup.use?false:(discountAmount>0)
|
|
||||||
|
const canUse=!coup.use?false:(discountAmount>0&&returnCoupCanUse(goodsArr,coup,selCoupArr))
|
||||||
|
// const canUse=discountAmount>0
|
||||||
return { ...coup, discountAmount: discountAmount,use:canUse}
|
return { ...coup, discountAmount: discountAmount,use:canUse}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user