From 625c5a8358e2b3a9fccdb7c481f710e813ee4e01 Mon Sep 17 00:00:00 2001 From: gonghaoxing <478185430@qq.com> Date: Mon, 27 Oct 2025 18:39:52 +0800 Subject: [PATCH] =?UTF-8?q?'=E7=A7=AF=E5=88=86=E5=8A=9F=E8=83=BD=E8=B0=83?= =?UTF-8?q?=E6=95=B4'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goods/components/list/list-goods-card.vue | 17 +++++++--- frontend/pages/goods/index.vue | 33 +++++++++++++++++++ .../s-goods-column/s-goods-column.vue | 26 +++++++-------- .../components/s-score-card/s-score-card.vue | 25 +++++--------- 4 files changed, 66 insertions(+), 35 deletions(-) diff --git a/frontend/pages/goods/components/list/list-goods-card.vue b/frontend/pages/goods/components/list/list-goods-card.vue index 6427ca8..a74e961 100644 --- a/frontend/pages/goods/components/list/list-goods-card.vue +++ b/frontend/pages/goods/components/list/list-goods-card.vue @@ -6,8 +6,8 @@ {{ title }} - 至高90%积分抵扣 - + 至高{{ scoreDiscountPercent }}%积分抵扣 + {{ price }} {{ originPrice }} {{ maxScoreText }} @@ -46,13 +46,20 @@ type: [String, Number], default: '', }, + scoreDiscountPercent: { + type: [String, Number], + default: 90, + }, + maxUseScore: { + type: [String, Number], + default: 0, + }, }); // 计算最高可使用积分 const maxScoreText = computed(() => { - if (props.price && !isNaN(props.price)) { - const maxScore = (parseFloat(props.price) * 0.9).toFixed(3); - return `最高可使用${maxScore}积分`; + if (props.maxUseScore && !isNaN(props.maxUseScore)) { + return `最高可使用${props.maxUseScore}积分`; } return '最高可使用0积分'; }); diff --git a/frontend/pages/goods/index.vue b/frontend/pages/goods/index.vue index 9265e18..dad0025 100644 --- a/frontend/pages/goods/index.vue +++ b/frontend/pages/goods/index.vue @@ -43,6 +43,17 @@ {{ formatSales(state.goodsInfo.sales_show_type, state.goodsInfo.sales) }} + + + + + 至高{{ state.goodsInfo.score_discount_percent }}%积分抵扣 + + + 最高可使用{{ state.goodsInfo.max_use_score }}积分 + + +
@@ -309,6 +320,28 @@ color: $gray-c; } + .score-discount-box { + .score-discount-tag { + font-size: 24rpx; + font-weight: 400; + color: #FF3000; + background: #ffffff; + border: 1px solid #FF3000; + border-radius: 8rpx; + padding: 4rpx 12rpx; + display: inline-block; + } + + .max-score-tag { + display: inline-block; + font-size: 20rpx; + background: #FF3000; + color: #ffffff; + border-radius: 8rpx; + padding: 4rpx 12rpx; + } + } + .discounts-box { .tag-content { flex: 1; diff --git a/frontend/sheep/components/s-goods-column/s-goods-column.vue b/frontend/sheep/components/s-goods-column/s-goods-column.vue index 67e34f1..0cc6bae 100644 --- a/frontend/sheep/components/s-goods-column/s-goods-column.vue +++ b/frontend/sheep/components/s-goods-column/s-goods-column.vue @@ -90,11 +90,11 @@ {{ data.title }} - 至高90%积分抵扣 + 至高{{ data.score_discount_percent }}%积分抵扣 @@ -127,7 +127,7 @@ - + {{ maxScoreText }} @@ -160,11 +160,11 @@ {{ data.title }} - 至高90%积分抵扣 + 至高{{ data.score_discount_percent }}%积分抵扣 @@ -193,7 +193,7 @@ {{ data.original_price }} - + {{ maxScoreText }} @@ -222,11 +222,11 @@ {{ data.title }} - 至高90%积分抵扣 + 至高{{ data.score_discount_percent }}%积分抵扣 @@ -255,7 +255,7 @@ {{ data.original_price }} - + {{ maxScoreText }} @@ -424,11 +424,9 @@ // 计算最高可使用积分 const maxScoreText = computed(() => { - // 计算价格的90%作为最高可使用积分 - const price = isArray(props.data.price) ? props.data.price[0] : props.data.price; - if (price && !isNaN(price)) { - const maxScore = (parseFloat(price) * 0.9).toFixed(3); - return `最高可使用${maxScore}积分`; + // 使用商品的max_use_score字段 + if (props.data.max_use_score && !isNaN(props.data.max_use_score)) { + return `最高可使用${props.data.max_use_score}积分`; } return '最高可使用0积分'; }); diff --git a/frontend/sheep/components/s-score-card/s-score-card.vue b/frontend/sheep/components/s-score-card/s-score-card.vue index 5351376..91ca666 100644 --- a/frontend/sheep/components/s-score-card/s-score-card.vue +++ b/frontend/sheep/components/s-score-card/s-score-card.vue @@ -20,11 +20,11 @@ {{ data.title }} - 至高90%积分抵扣 + 至高{{ data.score_discount_percent }}%积分抵扣 - + {{ maxScoreText }} @@ -77,11 +77,11 @@ {{ data.title }} - 至高90%积分抵扣 + 至高{{ data.score_discount_percent }}%积分抵扣 @@ -107,7 +107,7 @@ {{ data.original_price }} - + {{ maxScoreText }} @@ -273,16 +273,9 @@ // 计算最高可使用积分(针对积分商品) const maxScoreText = computed(() => { - // 优先使用商品的score字段(积分价格) - if (props.data.score && !isNaN(props.data.score)) { - const maxScore = (parseFloat(props.data.score) * 0.9).toFixed(3); - return `最高可使用${maxScore}积分`; - } - // 如果没有score字段,用价格计算 - const price = Array.isArray(props.data.price) ? props.data.price[0] : props.data.price; - if (price && !isNaN(price)) { - const maxScore = (parseFloat(price) * 0.9).toFixed(3); - return `最高可使用${maxScore}积分`; + // 使用商品的max_use_score字段 + if (props.data.max_use_score && !isNaN(props.data.max_use_score)) { + return `最高可使用${props.data.max_use_score}积分`; } return '最高可使用0积分'; });