问题修复,下单修复

This commit is contained in:
2025-09-29 16:54:35 +08:00
parent 719a513371
commit afa769579a
16 changed files with 417 additions and 167 deletions

View File

@@ -323,13 +323,12 @@
let noUseGoodsCoupon = []
let noUseDiscountCoupon = []
const user = uni.cache.get('shopUserInfo')
let shopInfo = uni.cache.get('shopInfo')||{}
if(!shopInfo.isMemberPrice){
shopInfo={}
let shopInfo = uni.cache.get('shopInfo') || {}
if (!shopInfo.isMemberPrice) {
shopInfo = {}
}
const goodsOrderPrice = uni.getStorageSync('goodsOrderPrice') || 0
const goodsList = uni.getStorageSync('canDikouGoodsArr') || []
const dinnerType = uni.getStorageSync('dinnerType')
const dinnerType = cartStore.dinnerType
const canDikouGoodsArr = UTILS.returnCanDikouGoods(cartStore.allGoods, [], user);
const shopId = uni.cache.get('shopId')
for (let i = 0; i < res.length; i++) {
@@ -339,7 +338,7 @@
coupon,
goodsOrderPrice,
user,
selCoupon: [],
selCoupon: quansSelArr.value,
shopInfo
})
const {
@@ -347,7 +346,7 @@
reason
} = canuseResult
if (coupon.type == 2) {
if (canUse) {
if (canUse || goodsCouponSel.value.id == coupon.id) {
canUseGoodsCoupon.push(coupon)
} else {
noUseGoodsCoupon.push({
@@ -356,7 +355,7 @@
})
}
} else {
if (canUse) {
if (canUse || couponSel.value.id == coupon.id) {
canUseDiscountCoupon.push(coupon)
} else {
noUseDiscountCoupon.push({
@@ -373,7 +372,7 @@
v,
user,
goodsOrderPrice,
[],
quansSelArr.value,
shopInfo
);
return {
@@ -505,15 +504,64 @@
}
onShow(() => {
const couponArr = cartStore.backendCoupons.filter(v => v.type != 2)
const goodsCouponArr = cartStore.backendCoupons.filter(v => v.type == 2)
if (couponArr.length) {
couponSel.value = couponArr[0]
}
if (goodsCouponArr.length) {
goodsCouponSel.value = goodsCouponArr[0]
}
getCouponList();
});
onLoad(() => {
getCouponShopsAjax();
});
watch(() => quansSelArr.value, (newval) => {
uni.$emit('selCoupon', newval)
const user = uni.cache.get('shopUserInfo')
let shopInfo = uni.cache.get('shopInfo') || {}
if (!shopInfo.isMemberPrice) {
shopInfo = {}
}
const goodsOrderPrice = uni.getStorageSync('goodsOrderPrice') || 0
const dinnerType = cartStore.dinnerType
const canDikouGoodsArr = UTILS.returnCanDikouGoods(cartStore.allGoods, [], user);
const shopId = uni.cache.get('shopId')
let goodsCoupon = newval.filter(v => v.type == 2)
let otherCoupon = newval.filter(v => v.type != 2)
goodsCoupon = goodsCoupon.map(v => {
const discount = UTILS.returnCouponDiscount(
canDikouGoodsArr,
v,
user,
goodsOrderPrice,
[],
shopInfo
);
return {
...v,
discount,
discountAmount: discount ? discount.discountPrice : v.discountAmount,
}
})
otherCoupon = otherCoupon.map(v => {
const discount = UTILS.returnCouponDiscount(
canDikouGoodsArr,
v,
user,
goodsOrderPrice,
goodsCoupon,
shopInfo
);
return {
...v,
discount,
discountAmount: discount ? discount.discountPrice : v.discountAmount,
}
})
uni.$emit('selCoupon', [...goodsCoupon, ...otherCoupon])
}, {
deep: true
})