fix: calculate actual total item count for multi-item orders

This commit is contained in:
2026-04-07 17:57:00 +08:00
parent 41f6f612fa
commit 7d1083bf5c

View File

@ -24,7 +24,7 @@
<view class="good-info-right"> <view class="good-info-right">
<text class="good-total-price">¥{{ actual_price }}</text> <text class="good-total-price">¥{{ actual_price }}</text>
<text class="fs-24 app-fc-normal good-num"> <text class="fs-24 app-fc-normal good-num">
1 {{ totalCount }}
</text> </text>
</view> </view>
</view> </view>
@ -56,6 +56,11 @@
return sum + price * number; return sum + price * number;
}, 0).toFixed(2); }, 0).toFixed(2);
}, },
totalCount() {
return this.data.reduce((sum, item) => {
return sum + parseInt(item.number || 1);
}, 0);
},
}, },
mounted() { mounted() {
console.log(this.data,'--') console.log(this.data,'--')