|
|
@@ -43,12 +43,16 @@
|
|
|
</text>
|
|
|
</view>
|
|
|
<text class="item-name">{{ item.productName }}</text>
|
|
|
+ <text v-if="item.giftLevelName" class="gift-badge">🎁购此送 {{ item.giftLevelName }}会员</text>
|
|
|
<text v-if="item.specDesc" class="item-spec">{{ item.specDesc }}</text>
|
|
|
<text v-if="item.supplierName" class="item-supplier">供应商: {{ item.supplierName }}</text>
|
|
|
<text class="item-delete" @click="onRemove(item.productId)">🗑</text>
|
|
|
</view>
|
|
|
<view class="item-bottom">
|
|
|
- <text class="item-price">{{ formatPriceWithSymbol(item.unitPrice) }}</text>
|
|
|
+ <view class="item-price-wrap">
|
|
|
+ <text class="item-price">{{ formatPriceWithSymbol(item.unitPrice) }}</text>
|
|
|
+ <text v-if="isMember && item.memberPrice && item.memberPrice > 0 && item.memberPrice < item.unitPrice" class="item-member-price">会员 {{ formatPriceWithSymbol(item.memberPrice) }}</text>
|
|
|
+ </view>
|
|
|
<view class="stepper">
|
|
|
<text class="stepper-btn" @click="decreaseQty(item)">−</text>
|
|
|
<text class="stepper-value">{{ item.quantity }}</text>
|
|
|
@@ -71,6 +75,18 @@
|
|
|
<view class="bottom-bar" v-if="items.length > 0">
|
|
|
<view class="bottom-left">
|
|
|
<text class="selected-count">已选 {{ selectedCount }} 件</text>
|
|
|
+ </view>
|
|
|
+ <view class="bottom-right" v-if="isMember">
|
|
|
+ <view class="price-compare">
|
|
|
+ <text class="price-original-label">原价</text>
|
|
|
+ <text class="price-original">{{ formatPriceWithSymbol(originalTotalAmount) }}</text>
|
|
|
+ </view>
|
|
|
+ <view class="price-compare">
|
|
|
+ <text class="price-estimate-label">预计支付</text>
|
|
|
+ <text class="price-estimate">{{ formatPriceWithSymbol(estimatedTotalAmount) }}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="bottom-right" v-else>
|
|
|
<text class="total-amount-label">合计: </text>
|
|
|
<text class="total-amount">{{ formatPriceWithSymbol(totalAmount) }}</text>
|
|
|
</view>
|
|
|
@@ -120,6 +136,45 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
return total
|
|
|
+ },
|
|
|
+ originalTotalAmount() {
|
|
|
+ var total = 0
|
|
|
+ for (var i = 0; i < this.items.length; i++) {
|
|
|
+ if (this.items[i].checked) {
|
|
|
+ var price = this.items[i].unitPrice || 0
|
|
|
+ total = total + (price * this.items[i].quantity)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return total
|
|
|
+ },
|
|
|
+ estimatedTotalAmount() {
|
|
|
+ var total = 0
|
|
|
+ for (var i = 0; i < this.items.length; i++) {
|
|
|
+ if (this.items[i].checked) {
|
|
|
+ var price = this.items[i].unitPrice || 0
|
|
|
+ // 会员可用会员价,优先用会员价
|
|
|
+ if (this.isMember && this.items[i].memberPrice && this.items[i].memberPrice > 0 && this.items[i].memberPrice < price) {
|
|
|
+ price = this.items[i].memberPrice
|
|
|
+ }
|
|
|
+ total = total + (price * this.items[i].quantity)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return total
|
|
|
+ },
|
|
|
+ hasGiftItems() {
|
|
|
+ for (var i = 0; i < this.items.length; i++) {
|
|
|
+ if (this.items[i].checked && this.items[i].giftLevelName) return true
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ },
|
|
|
+ giftLevelNames() {
|
|
|
+ var names = []
|
|
|
+ for (var i = 0; i < this.items.length; i++) {
|
|
|
+ if (this.items[i].checked && this.items[i].giftLevelName) {
|
|
|
+ names.push(this.items[i].giftLevelName)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return names
|
|
|
}
|
|
|
},
|
|
|
onLoad() {
|
|
|
@@ -265,6 +320,12 @@ export default {
|
|
|
if (this.items[i].specDesc) {
|
|
|
item.specDesc = this.items[i].specDesc
|
|
|
}
|
|
|
+ if (this.items[i].giftLevelName) {
|
|
|
+ item.giftLevelName = this.items[i].giftLevelName
|
|
|
+ }
|
|
|
+ if (this.items[i].memberPrice) {
|
|
|
+ item.memberPrice = this.items[i].memberPrice
|
|
|
+ }
|
|
|
selected.push(item)
|
|
|
}
|
|
|
}
|
|
|
@@ -518,4 +579,34 @@ export default {
|
|
|
color: #F97316;
|
|
|
font-weight: 500;
|
|
|
}
|
|
|
+.price-original {
|
|
|
+ font-size: 22rpx;
|
|
|
+ color: #94A3B8;
|
|
|
+ text-decoration: line-through;
|
|
|
+}
|
|
|
+.price-estimate {
|
|
|
+ font-size: 34rpx;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #F97316;
|
|
|
+}
|
|
|
+/* Gift badge */
|
|
|
+.gift-badge {
|
|
|
+ font-size: 20rpx;
|
|
|
+ color: #F97316;
|
|
|
+ background: #FFF7ED;
|
|
|
+ padding: 2rpx 8rpx;
|
|
|
+ border-radius: 6rpx;
|
|
|
+ margin-left: 8rpx;
|
|
|
+ border: 1rpx solid #FED7AA;
|
|
|
+}
|
|
|
+/* Member price */
|
|
|
+.item-member-price {
|
|
|
+ font-size: 22rpx;
|
|
|
+ color: #10B981;
|
|
|
+ margin-left: 8rpx;
|
|
|
+}
|
|
|
+.item-price-wrap {
|
|
|
+ display: flex;
|
|
|
+ align-items: baseline;
|
|
|
+}
|
|
|
</style>
|