Browse Source

feat(价格显示): 添加价格区间显示功能并更新样式

- 在回收组件中添加maxPrice字段用于价格区间计算
- 修改价格显示逻辑,支持显示价格范围
- 更新取消按钮的背景颜色样式
- 重构总价计算逻辑,基于实际价格区间计算
master
前端-胡立永 4 weeks ago
parent
commit
738b12d41a
3 changed files with 16 additions and 4 deletions
  1. +1
    -0
      pages/component/recycle.vue
  2. +1
    -0
      pages/index/index.vue
  3. +14
    -4
      pages/subcomponent/pickup.vue

+ 1
- 0
pages/component/recycle.vue View File

@ -734,6 +734,7 @@ export default {
icon: item.image,
quantity: item.quantity,
unitPrice: item.price,
maxPrice : item.maxPrice,
desc: item.brandName ? `品牌:${item.brandName}` : '允许脏破烂,160码以上'
}


+ 1
- 0
pages/index/index.vue View File

@ -301,6 +301,7 @@
.cancel-btn {
background-color: rgba(255, 253, 249);
color: #f7990c;
background-color: #f9ece5;
border: 1px solid rgba(249, 178, 71);
}


+ 14
- 4
pages/subcomponent/pickup.vue View File

@ -66,9 +66,9 @@
</view>
<!-- <view class="desc">{{ item.desc }}</view> -->
<view class="price-row">
<text class="price">{{ item.unitPrice }}/</text>
<text class="price">{{ item.price || item.unitPrice }}~{{ item.maxPrice || item.unitPrice }}/</text>
<text class="count">x{{ item.quantity }}</text>
<text class="amount">{{ item.unitPrice * item.quantity }}</text>
<text class="amount">{{ ((item.price || item.unitPrice) * item.quantity).toFixed(2) }}~{{ ((item.maxPrice || item.unitPrice) * item.quantity).toFixed(2) }}</text>
</view>
</view>
</view>
@ -240,8 +240,18 @@ export default {
},
totalPriceRange() {
if (this.selectedItems.length === 0) return '0-0'
const total = this.selectedItems.reduce((sum, item) => sum + (item.unitPrice * item.quantity), 0)
return `${(total * 0.92).toFixed(2)}~${(total * 1.1).toFixed(2)}`
let minTotal = 0
let maxTotal = 0
this.selectedItems.forEach(item => {
const minPrice = item.price || item.unitPrice || 0
const maxPrice = item.maxPrice || item.unitPrice || 0
minTotal += minPrice * item.quantity
maxTotal += maxPrice * item.quantity
})
return `${minTotal.toFixed(2)}~${maxTotal.toFixed(2)}`
},
canSubmit() {
return this.agreed && this.selectedItems.length > 0 && this.selectedTime && this.displayAddress


Loading…
Cancel
Save