tapd相关修改更新

This commit is contained in:
GaoHao
2025-03-19 18:19:34 +08:00
parent 994cf8bf2b
commit f01bc839f7
53 changed files with 1084 additions and 1032 deletions

View File

@@ -4,7 +4,7 @@ export function isTui(item) {
}
//是否使用会员价
export function isUseVipPrice(vipUser,goods){
return vipUser.id&&vipUser.isVip&&goods.isMember
return vipUser.id&&vipUser.isVip&&uni.getStorageSync("shopInfo").isMemberPrice
}
//计算商品券优惠价格
@@ -90,8 +90,9 @@ export function returnProductAllCoup(coupArr, goodsArr, vipUser) {
}
//返回商品实际支付价格
export function returnProductPayPrice(goods,vipUser){
const memberPrice = goods.memberPrice ? goods.memberPrice : goods.price;
const price = isUseVipPrice(vipUser,goods) ? memberPrice : goods.price;
let memberPrice = goods.memberPrice ? goods.memberPrice : goods.unitPrice;
let price = isUseVipPrice(vipUser,goods) ? memberPrice : goods.unitPrice;
price = goods.memberPrice != goods.unitPrice&& goods.price != goods.unitPrice ? goods.unitPrice : price
return price
}
//返回商品券抵扣的商品价格
@@ -101,9 +102,9 @@ export function returnProductCoupAllPrice(productPriceArr,startIndex,num,isMembe
if(typeof cur==='object'){
curPrice=isMember?cur.memberPrice*1:cur.price
}else{
curPrice=cur*1
curPrice = cur*1
}
return prve+curPrice
return prve + curPrice
},0)
}
@@ -172,24 +173,24 @@ export function returnProductCouponAllPrice(coupArr, goodsArr, vipUser) {
for(let i in arr){
const coup=arr[i]
if(!goodsMap.hasOwnProperty(coup.proId)){
goodsMap[coup.proId]=goodsArr.filter(v=>v.productId==coup.proId).map(v=>{
goodsMap[coup.proId]= goodsArr.filter(v=>v.productId==coup.proId).map((v,i)=>{
return {
...v,
payPrice:returnProductPayPrice(v,vipUser)
payPrice: returnProductPayPrice(v,vipUser)
}
}).sort((a,b)=>{
const aPrice=a.payPrice
const bPrice=b.payPrice
let aPrice=a.payPrice
let bPrice=b.payPrice
return aPrice-bPrice
})
goodsPayPriceMap[coup.proId]=goodsMap[coup.proId].reduce((prve,cur)=>{
const arr=new Array(cur.number).fill(cur.payPrice)
goodsPayPriceMap[coup.proId] = goodsMap[coup.proId].reduce((prve,cur)=>{
const arr=new Array(cur.num).fill(cur.payPrice)
prve.push(...arr)
return prve
},[])
}
const proCoupStartIndex=returnProCoupStartIndex(arr,i)
const coupNum = Math.min(goodsPayPriceMap[coup.proId].length,coup.number)
const coupNum = Math.min(coupMap[coup.proId].length)
total+=returnProductCoupAllPrice(goodsPayPriceMap[coup.proId],proCoupStartIndex,coupNum)
}
}
@@ -230,7 +231,7 @@ export function returnCanUseFullReductionCoupon(coupArr, payPrice, selCoup) {
}
return {
...v,
use: v.use && isfullAmount
use: isfullAmount
}
})
}