修复生产环境折扣价显示错误问题

This commit is contained in:
Waiting 2024-05-16 13:07:10 +08:00
parent 100744cfaf
commit 62c9994444
7 changed files with 25 additions and 12 deletions

View File

@ -85,7 +85,7 @@ const show = async (goodsId: string, fn: Function) => {
callback = fn;
goodsDetailBean.value = await getGoodsDetail(goodsId);
goodsDetailBean.value.consumePrice = Number((goodsDetailBean.value?.price * ((userInfo?.value?.levelEntity?.discount || 100) / 100)).toFixed(2));
goodsDetailBean.value.consumePrice = Number((goodsDetailBean.value?.price * userInfo?.value.userDiscount).toFixed(2));
if((goodsDetailBean.value?.stocks?.length || 0) <= 0) {
showToast('暂无库存');

View File

@ -22,8 +22,8 @@
@click.stop='goPath(`/pages/mall/subs/goods/detail?goodsId=${item.goodsId}`)'>
<image class='goods-image' :src='item.images||defaultImage' />
<text class='goods-name'>{{ item.goodsName || '未知' }}</text>
<text class='goods-price'>¥{{ (item.price * ((userInfo.levelEntity?.discount || 100) / 100)).toFixed(2) }}
<text v-if='userInfo.levelEntity?.discount>0&&userInfo.levelEntity?.discount<100'
<text class='goods-price'>¥{{ (item.price * userInfo.userDiscount).toFixed(2) }}
<text v-if='userInfo.userDiscount>0&&userInfo.userDiscount<1'
style='text-decoration: line-through;color: #999999;font-size: 25rpx'>¥{{ item.price }}
</text>
</text>

View File

@ -15,8 +15,8 @@
<view class='goods-info-view c-flex-column' style='margin-right: 10rpx'>
<view class='c-flex-row'>
<text class='goods-price accent-text-color'>
¥{{ ((goodsBean?.price || 0) * ((userInfo.levelEntity?.discount || 100) / 100)).toFixed(2) }}
<text v-if='userInfo.levelEntity?.discount>0&&userInfo.levelEntity?.discount<100'
¥{{ ((goodsBean?.price || 0) * userInfo.userDiscount).toFixed(2) }}
<text v-if='userInfo.userDiscount>0&&userInfo.userDiscount<1'
style='display:unset;text-decoration: line-through;font-size: 30rpx;color: #999999'>
¥{{ goodsBean?.price || 0 }}
</text>
@ -56,8 +56,8 @@
<view class='recommend-item c-flex-column'>
<image :src='item.images||defaultImage' />
<text>{{ item.goodsName || '未知' }}</text>
<text class='goods-price'>{{ (item.price * ((userInfo.levelEntity?.discount || 100) / 100)).toFixed(2) }}
<text v-if='userInfo.levelEntity?.discount>0&&userInfo.levelEntity?.discount<100'
<text class='goods-price'>{{ (item.price * userInfo.userDiscount).toFixed(2) }}
<text v-if='userInfo.userDiscount>0&&userInfo.userDiscount<1'
style='text-decoration: line-through;font-size: 25rpx;color: #999999'>{{ item.price }}
</text>
</text>

View File

@ -13,8 +13,8 @@
@click.stop='goPath(`/pages/mall/subs/goods/detail?goodsId=${item.goodsId}`)'>
<image class='goods-image' :src='item.images||defaultImage' />
<text class='goods-name'>{{ item.goodsName || '未知' }}</text>
<text class='goods-price'>¥{{ (item.price * ((userInfo.levelEntity?.discount || 100)/100)).toFixed(2) }}
<text v-if='userInfo.levelEntity?.discount>0&&userInfo.levelEntity?.discount<100'
<text class='goods-price'>¥{{ (item.price * userInfo.userDiscount).toFixed(2) }}
<text v-if='userInfo.userDiscount>0&&userInfo.userDiscount<1'
style='text-decoration: line-through;color: #999999;font-size: 25rpx'>¥{{ item.price }}
</text>
</text>

View File

@ -25,8 +25,8 @@
</view>
</view>
<text style='margin-top: 50rpx'>
{{ (item?.price * ((userInfo.levelEntity?.discount || 100) / 100)).toFixed(2) }}
<text v-if='userInfo.levelEntity?.discount>0&&userInfo.levelEntity?.discount<100'
{{ (item?.price * userInfo.userDiscount).toFixed(2) }}
<text v-if='userInfo.userDiscount>0&&userInfo.userDiscount<1'
style='text-decoration: line-through;color: #999999;font-size: 25rpx'>¥{{ item?.price }}
</text>
</text>

View File

@ -50,12 +50,24 @@ const useUserStore = defineStore('user', {
// getUserInfo(state: UserBean): UserBean {
// return { state };
// }
getUserDiscount(): number {
if(this.userInfo.levelEntity.discount > 0 && this.userInfo.levelEntity.discount < 10) {
return this.userInfo.levelEntity.discount / 10;
} else if(this.userInfo.levelEntity.discount >= 10 && this.userInfo.levelEntity.discount <= 100) {
return this.userInfo.levelEntity.discount / 100;
}
return 1;
},
},
actions: {
// 设置用户的信息
async setUserInfo(partial: Partial<UserBean>) {
this.userInfo = partial as UserBean;
this.userInfo.levelEntity.discount = 79;
this.userInfo.userDiscount = this.getUserDiscount;
await setCompanyId(this.userInfo.companyId);
await this.fetchTerminal();
await this.fetchCompanyInfo();

View File

@ -50,6 +50,7 @@ export interface UserBean {
updateTime: string;
useCouponsPrice: number;
wirelinedTelephone: string;
userDiscount:number
}
export type providerType =