会员修复

This commit is contained in:
2025-10-10 09:26:39 +08:00
parent e2dd540bb8
commit f0fee9085d
5 changed files with 529 additions and 442 deletions

View File

@@ -474,7 +474,9 @@
}) })
Object.assign(pointsRes, res) Object.assign(pointsRes, res)
maxPointDiscount.value = res.maxDeductionAmount maxPointDiscount.value = res.maxDeductionAmount
if(usePoints.value){
cartStore.setUserPoints(res.maxUsablePoints || 0) cartStore.setUserPoints(res.maxUsablePoints || 0)
}
console.log('getMaxPointsDiscount:cartStore.orderCostSummary.pointUsed', cartStore.orderCostSummary.pointUsed); console.log('getMaxPointsDiscount:cartStore.orderCostSummary.pointUsed', cartStore.orderCostSummary.pointUsed);
} }
watch(() => maxMoney.value, (newval) => { watch(() => maxMoney.value, (newval) => {

View File

@@ -221,10 +221,9 @@
if (newval && newval.id) { if (newval && newval.id) {
disablePayType.value = ['余额支付'] disablePayType.value = ['余额支付']
paymentMethodref.value.groupChanges(2) paymentMethodref.value.groupChanges(2)
} else { return
disablePayType.value = []
} }
console.log('orderVIP.value.amount',orderVIP.value.amount);
if (!orderVIP.value.amount) { if (!orderVIP.value.amount) {
disablePayType.value = ['余额支付'] disablePayType.value = ['余额支付']
if (paymentMethodref.value) { if (paymentMethodref.value) {

View File

@@ -146,7 +146,8 @@
import { import {
ref, ref,
reactive, reactive,
computed computed,
watch
} from "vue" } from "vue"
import { import {
joinMember, joinMember,
@@ -195,14 +196,14 @@
openType: 'CONDITION' openType: 'CONDITION'
}) })
const pay_menus = ref([{ const $pay_menus=[{
name: '赠送成长值', name: '赠送成长值',
desc: '赠送成长值', desc: '赠送成长值',
icon: '/user/static/buy-vip/Frame_220.png', icon: '/user/static/buy-vip/Frame_220.png',
}, },
{ {
name: '优惠券', name: '优惠券',
desc: '每月赠送2张优惠券', desc: '',
icon: '/user/static/buy-vip/Frame_221.png' icon: '/user/static/buy-vip/Frame_221.png'
}, },
{ {
@@ -212,7 +213,7 @@
}, },
{ {
name: '会员折扣', name: '会员折扣',
desc: '全店折扣98折', desc: '',
icon: '/user/static/buy-vip/Frame_223.png' icon: '/user/static/buy-vip/Frame_223.png'
}, },
{ {
@@ -225,7 +226,9 @@
desc: '', desc: '',
icon: '/user/static/buy-vip/Frame_225.png' icon: '/user/static/buy-vip/Frame_225.png'
} }
]) ]
const pay_menus = ref($pay_menus)
let tiaojian_menus =ref( [{ let tiaojian_menus =ref( [{
name: '享会员价', name: '享会员价',
@@ -295,7 +298,7 @@
if (res) { if (res) {
if(!res.memberConfig.isMemberPrice){ if(!res.memberConfig.isMemberPrice){
tiaojian_menus.value=tiaojian_menus.value.filter(v=>v.name!='享会员价') tiaojian_menus.value=tiaojian_menus.value.filter(v=>v.name!='享会员价')
pay_menus.value=pay_menus.value.filter(v=>v.name!='享会员价') pay_menus.value=$pay_menus.filter(v=>v.name!='享会员价')
} }
if (res.memberConfig.isSubmitInfo && (shopUserInfo.value.sex === null || shopUserInfo.value.sex === if (res.memberConfig.isSubmitInfo && (shopUserInfo.value.sex === null || shopUserInfo.value.sex ===
undefined || !shopUserInfo.value.nickName || !shopUserInfo.value.birthDay || !shopUserInfo.value undefined || !shopUserInfo.value.nickName || !shopUserInfo.value.birthDay || !shopUserInfo.value
@@ -319,8 +322,9 @@
configList.value = res.memberConfig.configList configList.value = res.memberConfig.configList
Object.assign(state, res.memberConfig) Object.assign(state, res.memberConfig)
memberLevel.value = res.memberLevel const first_lv=(res.memberLevelList||[])[0]
memberLevel.value = res.memberLevel||first_lv
filterPay_menus()
} }
} }
const returnReward = computed(() => { const returnReward = computed(() => {
@@ -389,6 +393,36 @@
},1000) },1000)
} }
} }
//过滤掉部分未开启的菜单相
function filterPay_menus(){
pay_menus.value=$pay_menus.filter(v=>{
if(!state.isMemberPrice&&v.name=='享会员价'){
return false
}
if (state.isSubmitInfo && (shopUserInfo.value.sex === null || shopUserInfo.value.sex ===
undefined || !shopUserInfo.value.nickName || !shopUserInfo.value.birthDay || !shopUserInfo.value
.phone)) {
memberOpen.value = true;
}
const viplv= configList.value[vipSel.value]
if(viplv.couponList.length==0&&v.name=='优惠券'){
return false
}
if((!memberLevel.value||!memberLevel.value.isCostRewardPoints)&&v.name=='消费送积分'){
return false
}
if((!memberLevel.value||!memberLevel.value.isCycleReward)&&v.name=='周期福利'){
return false
}
return true
})
}
watch(()=>vipSel.value,(newval,oldval)=>{
console.log('vipSel.value',newval);
filterPay_menus()
})
</script> </script>

View File

@@ -47,7 +47,8 @@
</view> </view>
<view class="font-14 color-333 text-center u-m-t-4 u-flex u-flex-center"> <view class="font-14 color-333 text-center u-m-t-4 u-flex u-flex-center">
<text class="no-wrap u-m-r-4">{{ item.name }}</text> <text class="no-wrap u-m-r-4">{{ item.name }}</text>
<up-icon @click="modelShow(item.name)" size="12" name="question-circle" color="#333" v-if="showQuestion(index)"></up-icon> <up-icon @click="modelShow(item.name)" size="12" name="question-circle" color="#333"
v-if="showQuestion(index)"></up-icon>
</view> </view>
<view class="font-12 color-666 text-center">{{ item.desc }}</view> <view class="font-12 color-666 text-center">{{ item.desc }}</view>
</view> </view>
@@ -79,10 +80,19 @@
<script setup> <script setup>
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { onLoad } from '@dcloudio/uni-app'; import {
onLoad
} from '@dcloudio/uni-app';
import * as vipApi from '@/common/api/market/vip.js'; import * as vipApi from '@/common/api/market/vip.js';
import { APIusershopInfodetail, APIshopUserInfo } from '@/common/api/member.js'; import {
import { ref, reactive, computed } from 'vue'; APIusershopInfodetail,
APIshopUserInfo
} from '@/common/api/member.js';
import {
ref,
reactive,
computed
} from 'vue';
const model = reactive({ const model = reactive({
show: false, show: false,
title: '' title: ''
@@ -105,7 +115,8 @@ function modelShow(name) {
} }
if (name == '周期福利') { if (name == '周期福利') {
model.title = '周期福利'; model.title = '周期福利';
modelContent.value = `${memberLevel.value.cycleUnit}赠送${memberLevel.value.cycleRewardPoints}积分,${memberLevel.value.cycleRewardCouponList.length}张优惠券`; modelContent.value =
`${memberLevel.value.cycleUnit}赠送${memberLevel.value.cycleRewardPoints}积分,${memberLevel.value.cycleRewardCouponList.length}张优惠券`;
} }
if (name == '会员说明') { if (name == '会员说明') {
model.title = '会员说明'; model.title = '会员说明';
@@ -122,15 +133,14 @@ const state = reactive({
openType: 'CONDITION' openType: 'CONDITION'
}); });
let pay_menus = [ let pay_menus = [{
{
name: '赠送成长值', name: '赠送成长值',
desc: '', desc: '',
icon: '/user/static/Frame_220.png' icon: '/user/static/Frame_220.png'
}, },
{ {
name: '优惠券', name: '优惠券',
desc: '每月赠送2张优惠券', desc: '',
icon: '/user/static/Frame_221.png' icon: '/user/static/Frame_221.png'
}, },
{ {
@@ -155,8 +165,7 @@ let pay_menus = [
} }
]; ];
let tiaojian_menus = [ let tiaojian_menus = [{
{
name: '享会员价', name: '享会员价',
desc: '全店会员价', desc: '全店会员价',
icon: '/user/static/Frame_222.png' icon: '/user/static/Frame_222.png'
@@ -224,12 +233,30 @@ async function init(shopId) {
shopId: shopId shopId: shopId
}); });
if (res) { if (res) {
res.memberLevel.cycleRewardCouponList = res.memberLevel.cycleRewardCouponList || []
res.memberLevel = res.memberLevel || {}
Object.assign(state, res.memberConfig); Object.assign(state, res.memberConfig);
memberLevelList.value = res.memberLevelList; memberLevelList.value = res.memberLevelList;
pay_menus = pay_menus.map((v) => { pay_menus = pay_menus.filter(v => {
if (!res.memberLevel.isCostRewardPoints && v.name == '消费送积分') {
return false
}
if (!res.memberLevel.isCycleReward && v.name == '周期福利') {
return false
}
if (!res.memberLevel.cycleRewardCouponList || res.memberLevel.cycleRewardCouponList.length <=
0 && v.name == '优惠券') {
return false
}
return true
}).map((v) => {
if (v.name == '赠送成长值' && res.memberLevel) {
v.desc = `赠送${res.memberLevel.experienceValue}成长值`
}
if (v.name == '优惠券') { if (v.name == '优惠券') {
if (res.memberLevel.cycleRewardCouponList.length) { if (res.memberLevel.cycleRewardCouponList.length) {
v.desc = `${res.memberLevel.cycleUnit}赠送${res.memberLevel.cycleRewardCouponList.length}张优惠券`; v.desc =
`${res.memberLevel.cycleUnit}赠送${res.memberLevel.cycleRewardCouponList.length}张优惠券`;
} else { } else {
v.desc = ''; v.desc = '';
} }
@@ -239,10 +266,23 @@ async function init(shopId) {
} }
return v; return v;
}); });
tiaojian_menus = tiaojian_menus.map((v) => { tiaojian_menus = tiaojian_menus.filter(v => {
if (!state.isCostRewardPoints && v.name == '消费送积分') {
return false
}
if (!state.isCycleReward && v.name == '周期福利') {
return false
}
if (!res.memberLevel.cycleRewardCouponList || res.memberLevel.cycleRewardCouponList.length <=
0 && v.name == '优惠券') {
return false
}
return true
}).map((v) => {
if (v.name == '优惠券') { if (v.name == '优惠券') {
if (res.memberLevel.cycleRewardCouponList.length) { if (res.memberLevel.cycleRewardCouponList.length) {
v.desc = `${res.memberLevel.cycleUnit}赠送${res.memberLevel.cycleRewardCouponList.length}张优惠券`; v.desc =
`${res.memberLevel.cycleUnit}赠送${res.memberLevel.cycleRewardCouponList.length}张优惠券`;
} else { } else {
v.desc = ''; v.desc = '';
} }
@@ -328,6 +368,7 @@ page {
padding-right: 64rpx; padding-right: 64rpx;
padding-bottom: 24rpx; padding-bottom: 24rpx;
position: relative; position: relative;
.bg { .bg {
width: 100%; width: 100%;
height: 100%; height: 100%;
@@ -378,8 +419,7 @@ page {
} }
.rule { .rule {
.exp { .exp {}
}
.desc { .desc {
color: #273d7a; color: #273d7a;
@@ -446,6 +486,7 @@ page {
color: #999; color: #999;
font-size: 12px; font-size: 12px;
} }
.buy-btn { .buy-btn {
margin: 98rpx 48rpx 48rpx 48rpx; margin: 98rpx 48rpx 48rpx 48rpx;
padding: 32rpx 32rpx; padding: 32rpx 32rpx;

View File

@@ -81,7 +81,6 @@ export function returnCanDikouGoodsArr(canDikouGoodsArr, selCoupon, user) {
prev.push(...goodsWithType); prev.push(...goodsWithType);
return prev; return prev;
}, []); }, []);
const arr = _.cloneDeep(canDikouGoodsArr) const arr = _.cloneDeep(canDikouGoodsArr)
.map((v) => { .map((v) => {
const findCart = goodsCouponGoods.find((carts) => carts.id == v.id); const findCart = goodsCouponGoods.find((carts) => carts.id == v.id);
@@ -139,7 +138,6 @@ export function returnCouponCanUse(args) {
// 计算门槛金额 // 计算门槛金额
let fullAmount = goodsOrderPrice; let fullAmount = goodsOrderPrice;
canDikouGoodsArr = returnCanDikouGoodsArr(canDikouGoodsArr, selCoupon, user, shopInfo); canDikouGoodsArr = returnCanDikouGoodsArr(canDikouGoodsArr, selCoupon, user, shopInfo);
//优惠券指定门槛商品列表 //优惠券指定门槛商品列表
let canCalcGoodsArr = [...canDikouGoodsArr] let canCalcGoodsArr = [...canDikouGoodsArr]
//部分商品参与门槛计算 //部分商品参与门槛计算
@@ -200,7 +198,13 @@ export function returnCouponCanUse(args) {
// 商品兑换券,第二件半价和买一送一判断是否有可用商品 // 商品兑换券,第二件半价和买一送一判断是否有可用商品
if ([2, 4, 5].includes(coupon.type)) { if ([2, 4, 5].includes(coupon.type)) {
// 没有符合条件的商品 // 没有符合条件的商品
if (!isDikouAll && canCalcGoodsArr.length === 0) { if (isDikouAll && canDikouGoodsArr.length === 0) {
return {
canUse: false,
reason: "没有符合条件的商品"
};
}
if (!isDikouAll && canUseGoodsArr.length === 0) {
return { return {
canUse: false, canUse: false,
reason: "没有符合条件的商品" reason: "没有符合条件的商品"
@@ -299,12 +303,12 @@ export function calcDiscountGoodsArrPrice(discountGoodsArr, discountNum, user,sh
*/ */
export function returnCouponDiscount(arr, coupon, user, goodsOrderPrice, selCoupon, shopInfo) { export function returnCouponDiscount(arr, coupon, user, goodsOrderPrice, selCoupon, shopInfo) {
const canDikouGoodsArr = returnCanDikouGoodsArr(arr, selCoupon, user); const canDikouGoodsArr = returnCanDikouGoodsArr(arr, selCoupon, user);
console.log('canDikouGoodsArr', canDikouGoodsArr);
if (coupon.type == 2) { if (coupon.type == 2) {
return returnCouponProductDiscount(canDikouGoodsArr, coupon, user, shopInfo); return returnCouponProductDiscount(canDikouGoodsArr, coupon, user, shopInfo);
} }
if (coupon.type == 6) { if (coupon.type == 6) {
return returnCouponBuyOneGiveOneDiscount(canDikouGoodsArr, coupon, user, shopInfo); const result = returnCouponBuyOneGiveOneDiscount(canDikouGoodsArr, coupon, user, shopInfo);
return result
} }
if (coupon.type == 4) { if (coupon.type == 4) {
return returnSecoendDiscount(canDikouGoodsArr, coupon, user, shopInfo); return returnSecoendDiscount(canDikouGoodsArr, coupon, user, shopInfo);
@@ -425,23 +429,28 @@ function returnCouponBuyOneGiveOneDiscount(canDikouGoodsArr, coupon, user,shopIn
//抵扣全部商品 //抵扣全部商品
if (useFoods.length === 0) { if (useFoods.length === 0) {
if (useRule == "price_asc") { if (useRule == "price_asc") {
discountGoods = canUseGoods[canUseGoods.length - 1]; discountGoods = canUseGoods[canUseGoods.length - 1]
} else { } else {
discountGoods = canUseGoods.slice(0, 1); discountGoods = canUseGoods[0];
} }
} else { } else {
//符合抵扣条件的商品 //符合抵扣条件的商品
const canUseGoods1 = canUseGoods.filter((v) => useFoods.find((food) => food.id == v.productId)); const canUseGoods1 = canUseGoods.filter((v) => useFoods.find((food) => food.id == v.productId));
if (useRule == "price_asc") { if (useRule == "price_asc") {
discountGoods = canUseGoods1[canUseGoods1.length - 1]; discountGoods = canUseGoods1[canUseGoods1.length - 1]
} else { } else {
discountGoods = canUseGoods1.slice(0, 1); discountGoods = canUseGoods1[0]
} }
} }
const discountPrice = returnGoodsPrice(discountGoods, user,shopInfo); let discountPrice = 0;
const hasDiscountGoodsArr = [discountGoods]; let hasDiscountGoodsArr = []
console.log('returnCouponBuyOneGiveOneDiscount:discountGoods',discountGoods);
if (discountGoods) {
discountPrice = returnGoodsPrice(discountGoods, user, shopInfo);
hasDiscountGoodsArr = [discountGoods];
}
return { return {
discountPrice, discountPrice:discountPrice<=0?0:discountPrice,
hasDiscountGoodsArr hasDiscountGoodsArr
}; };
} }
@@ -460,31 +469,33 @@ function returnSecoendDiscount(canDikouGoodsArr, coupon, user,shopInfo) {
} = coupon; } = coupon;
//抵扣商品 //抵扣商品
let discountGoods = undefined; let discountGoods = undefined;
//符合买一送一条件的商品 //符合条件的商品
const canUseGoods = canDikouGoodsArr.filter((v) => v.num >= 2); const canUseGoods = canDikouGoodsArr.filter((v) => v.num >= 2);
//抵扣全部商品 //抵扣全部商品
if (useFoods.length === 0) { if (useFoods.length === 0) {
if (useRule == "price_asc") { if (useRule == "price_asc") {
discountGoods = canUseGoods[canUseGoods.length - 1]; discountGoods = canUseGoods[canUseGoods.length - 1]
} else { } else {
discountGoods = canUseGoods.slice(0, 1); discountGoods = canUseGoods[0]
} }
} else { } else {
//符合抵扣条件的商品 //符合抵扣条件的商品
const canUseGoods1 = canUseGoods.filter((v) => useFoods.find((food) => food.id == v.productId)); const canUseGoods1 = canUseGoods.filter((v) => useFoods.find((food) => food.id == v.productId));
if (useRule == "price_asc") { if (useRule == "price_asc") {
discountGoods = canUseGoods1[canUseGoods1.length - 1]; discountGoods = canUseGoods1[canUseGoods1.length - 1]
} else { } else {
discountGoods = canUseGoods1.slice(0, 1); discountGoods = canUseGoods1[0]
} }
} }
console.log('returnSecoendDiscount:discountGoods',discountGoods); let discountPrice = 0;
const discountPrice = returnGoodsPrice(discountGoods[0], user,shopInfo); let hasDiscountGoodsArr = []
console.log('returnSecoendDiscount:discountPrice',discountPrice); if (discountGoods) {
const hasDiscountGoodsArr = [discountGoods]; discountPrice = returnGoodsPrice(discountGoods, user, shopInfo);
hasDiscountGoodsArr = [discountGoods];
}
//返回半价价格 //返回半价价格
return { return {
discountPrice: new BigNumber(discountPrice).dividedBy(2).toNumber(), discountPrice: discountPrice <= 0 ? 0 : new BigNumber(discountPrice).dividedBy(2).toNumber(),
hasDiscountGoodsArr, hasDiscountGoodsArr,
}; };
} }