优化价格显示的先后顺序

This commit is contained in:
gyq
2025-11-18 16:20:35 +08:00
parent bca332f7b8
commit bb06553701
4 changed files with 42 additions and 44 deletions

File diff suppressed because one or more lines are too long

View File

@@ -101,7 +101,7 @@ export const useGoods = defineStore("goods", {
},
// 清除会员信息
async clearVipUserInfo() {
console.log('清除会员信息');
// console.log('清除会员信息');
this.vipUserInfo = {};
this.showVipPrice = 0;
@@ -449,16 +449,16 @@ export const useGoods = defineStore("goods", {
this.goodsList.forEach(val => {
val.forEach((item, index) => {
console.log('this.goodsList.index', index);
console.log('this.goodsList.item', item);
console.log('this.goodsList.limitDiscountRes', this.limitDiscountRes);
console.log('this.goodsList.store.shopInfo', store.shopInfo);
console.log('this.goodsList.this.vipUserInfo', this.vipUserInfo);
// console.log('this.goodsList.index', index);
// console.log('this.goodsList.item', item);
// console.log('this.goodsList.limitDiscountRes', this.limitDiscountRes);
// console.log('this.goodsList.store.shopInfo', store.shopInfo);
// console.log('this.goodsList.this.vipUserInfo', this.vipUserInfo);
// console.log('this.goodsList.this.vipUserInfo', JSON.stringify(this.vipUserInfo));
console.log('this.goodsList.this.canUseLimitTimeDiscount', limitUtils.canUseLimitTimeDiscount(item,
this.limitDiscountRes,
store.shopInfo,
this.vipUserInfo, 'id'));
// console.log('this.goodsList.this.canUseLimitTimeDiscount', limitUtils.canUseLimitTimeDiscount(item,
// this.limitDiscountRes,
// store.shopInfo,
// this.vipUserInfo, 'id'));
item.showMore = false;
@@ -648,7 +648,7 @@ export const useGoods = defineStore("goods", {
completeGoodsInfo(item) {
const store = useUser()
console.log('补全商品信息===', item);
// console.log('补全商品信息===', item);
if (item.is_temporary) {
item.salePrice = item.discount_sale_amount
return item;
@@ -659,7 +659,7 @@ export const useGoods = defineStore("goods", {
flag = true;
let sku = val.skuList.find((sku) => sku.id == item.sku_id || sku.id == item.skuId);
console.log('sku===', sku);
// console.log('sku===', sku);
let group_text = "";
@@ -708,7 +708,7 @@ export const useGoods = defineStore("goods", {
},
// 补全历史订单列表商品信息
comleteOrderInfo(item) {
console.log('补全订单列表商品信息');
// console.log('补全订单列表商品信息');
const store = useUser()
this.originGoodsList.map((val) => {
@@ -792,15 +792,15 @@ export const useGoods = defineStore("goods", {
},
// 商品更新后,需要对购物车、订单进行更新
async updateGoodsList() {
console.log('选择用户后更新所有===', this.vipUserInfo);
// console.log('选择用户后更新所有===', this.vipUserInfo);
const socket = useSocket();
const store = useUser()
await this.getCategoryList();
await this.getGoodsList();
console.log('选择用户后更新所有.cartList===', this.cartList);
console.log('选择用户后更新所有.cartList===', this.orderList);
// console.log('选择用户后更新所有.cartList===', this.cartList);
// console.log('选择用户后更新所有.cartList===', this.orderList);
if (this.cartList.length || this.orderList.length) {
let data = {

View File

@@ -19,7 +19,7 @@
</div>
</template>
<template v-else>
<div class="price" v-if="item.is_time_discount == 1">
<div class="price" v-if="item.is_time_discount == 1 && item.discount_sale_amount <= 0">
<span class="dis">
{{ formatDecimal(+item.salePrice, 2, true) }}
</span>
@@ -34,15 +34,12 @@
</span>
</div>
<div class="price" v-else>
<template v-if="+props.item.discount_sale_amount">
<template v-if="+item.discount_sale_amount > 0">
<span class="dis">
{{ formatDecimal(goodsStore.showVipPrice ? +props.item.memberPrice ||
+props.item.lowPrice
: +props.item.lowPrice,
2, true) }}
{{ formatDecimal(+item.salePrice, 2, true) }}
</span>
<span>
{{ formatDecimal(+props.item.discount_sale_amount, 2, true) }}
{{ formatDecimal(+item.discount_sale_amount, 2, true) }}
</span>
</template>
<div class="flex" v-else>
@@ -78,7 +75,7 @@
</div>
<div class="num">
<div class="left">
<div class="icon_item zen" v-if="item.is_time_discount">
<div class="icon_item zen" v-if="item.is_time_discount && item.discount_sale_amount <= 0">
<span class="t">限时折扣</span>
</div>
<div class="icon_item zen" v-if="props.item.is_gift">

View File

@@ -19,20 +19,20 @@
</template>
<template v-else>
<template v-if="item.is_gift">
<span class="t_line">{{ formatDecimal(+item.lowPrice) }}</span>
<span class="t_line">{{ formatDecimal(+item.salePrice) }}</span>
0.00
</template>
<template v-else>
<template v-if="+item.discount_sale_amount">
<span class="t_line">
{{ formatDecimal(+item.lowPrice) }}
</span>
<template v-if="+item.discount_sale_amount > 0">
<!-- <span class="t_line">
{{ formatDecimal(+item.salePrice) }}
</span> -->
<span>
{{ formatDecimal(+item.discount_sale_amount) }}
</span>
</template>
<template v-else>
{{ formatDecimal(+item.lowPrice) }}
{{ formatDecimal(+item.salePrice) }}
</template>
</template>
</template>
@@ -85,7 +85,8 @@
</span>
</div>
</div>
<div class="gift_wrap" v-if="goodsStore.showVipPrice && item.memberPrice && !item.is_time_discount">
<div class="gift_wrap"
v-if="goodsStore.showVipPrice && item.memberPrice && !item.is_time_discount && item.discount_sale_amount <= 0">
<div class="name">
<span>[会员价]</span>
</div>
@@ -96,7 +97,7 @@
</span>
</div>
</div>
<div class="gift_wrap" v-if="item.is_time_discount">
<div class="gift_wrap" v-if="item.is_time_discount && item.discount_sale_amount <= 0">
<template v-if="item.time_dicount_mode == 'vip-price'">
<div class="name">
<span>[会员价]</span>