Authored by 李奇

商品列表显示市场价和原价

... ... @@ -4,12 +4,21 @@ Component({
properties: {
item: {
type: Object,
value: {}
value: {},
observer: '_itemChange'
}
},
data: {
showMarketPrice: false
},
methods: {
goDetail: function () {
router.go('productDetail', {productSkn: this.properties.item.skn});
},
_itemChange: function (item) {
this.setData({
showMarketPrice: +item.marketPrice > 0 && +item.marketPrice > +item.salesPrice
});
}
}
});
... ...
... ... @@ -4,8 +4,9 @@
<view class="item-detail">
<text class="item-title">{{item.productName}}</text>
<view class="item-price">
<text class="price1">¥{{helper.round(item.salesPrice)}}</text>
<!--<text class="price2">¥{{helper.round(item.marketPrice)}}</text>-->
<view class="price price1 {{showMarketPrice ? 'before-market-price' : ''}}">
¥{{helper.round(item.salesPrice)}}</view>
<view class="price price2" wx:if="{{showMarketPrice}}">¥{{helper.round(item.marketPrice)}}</view>
</view>
</view>
</view>
... ...
... ... @@ -20,6 +20,10 @@
letter-spacing: 0.28rpx;
}
.item-price .price {
display: inline-block;
}
.price1.before-market-price {
color: #d0021b!important;
}
... ...