Browse Source

优化对比页面

Xfy
Trae AI 4 days ago
parent
commit
d3d67e0141
  1. 3
      app.json
  2. 5
      pages/compare_price/index.js
  3. 6
      pages/compare_price/index.wxml

3
app.json

@ -24,7 +24,8 @@
"pages/company/company",
"pages/qrcode/index",
"pages/collection/index",
"pages/freight-calculator/index"
"pages/freight-calculator/index",
"pages/compare_price/index"
],
"subpackages": [
{

5
pages/compare_price/index.js

@ -365,6 +365,11 @@ Page({
item.totalStock = displayStock;
item.originalTotalStock = totalStock;
// 添加当前对比的规格信息
if (specWeight) {
item.currentSpec = specWeight;
}
// 处理地区信息,只显示省份
if (item.region) {
// 提取省份信息

6
pages/compare_price/index.wxml

@ -8,7 +8,7 @@
<view class="tips-icon">
<text class="check-icon">✓</text>
</view>
<text class="tips-text">您已完成选择,以下是{{currentGoods ? currentGoods.productName : '商品'}}({{selectedSpec || '43-44g'}})的价格对比结果</text>
<text class="tips-text">您已完成选择,以下是{{currentGoods ? (currentGoods.productName || currentGoods.name) : '商品'}}({{selectedSpec || '43-44g'}})的价格对比结果</text>
</view>
</view>
@ -28,7 +28,7 @@
<view class="current-goods-card">
<view class="goods-header">
<view class="brand-tag">品牌</view>
<text class="goods-name">{{currentGoods.productName}}</text>
<text class="goods-name">{{currentGoods.productName || currentGoods.name || '商品'}}</text>
<view class="price-container">
<text class="currency-symbol" style="color: {{currentGoods.priceDiff > 0 ? '#FF4D4F' : currentGoods.priceDiff < 0 ? '#10B981' : '#666666'}}">¥</text>
<text class="price-amount" style="color: {{currentGoods.priceDiff > 0 ? '#FF4D4F' : currentGoods.priceDiff < 0 ? '#10B981' : '#666666'}}">{{currentGoods.price}}</text>
@ -73,7 +73,7 @@
<text class="compare-price-amount" style="color: {{item.priceDiff > 0 ? '#FF4D4F' : item.priceDiff < 0 ? '#10B981' : '#666666'}}">{{item.price}}</text>
</view>
</view>
<text class="compare-item-spec">{{item.specification || (item.processedSpecs && item.processedSpecs.length > 0 ? item.processedSpecs.join(' | ') : '净重:45-50g')}} | 蛋壳:{{item.category || '绿壳'}} | 蛋黄:{{item.yolk || '无'}}</text>
<text class="compare-item-spec">{{item.currentSpec || item.specification || (item.processedSpecs && item.processedSpecs.length > 0 ? item.processedSpecs.join(' | ') : '净重:45-50g')}} | {{item.category || '绿壳'}} | {{item.yolk || '无'}} | 库存:{{item.totalStock || '450'}}</text>
<view class="compare-item-footer">
<view class="merchant-region">
<text class="compare-item-merchant">🏪 {{item.sourceType || '生态农场'}}</text>

Loading…
Cancel
Save