feat: 优化
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
<!-- 无优惠券 -->
|
||||
<view class="flex-r-lr price-line" v-else>
|
||||
<text class="text-28 text-zi text-bold">¥{{ obj.price }}</text>
|
||||
<text class="text-24 sold">已售{{ obj.sales }}件</text>
|
||||
<text class="text-24 sold">全网销量{{ limit999(obj.sales) }}件</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -32,6 +32,13 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
limit999(n) {
|
||||
const num = Number(n);
|
||||
if (isNaN(num) || num < 10000) {
|
||||
return n != null && n !== '' ? String(n) : '0';
|
||||
}
|
||||
return `${Math.floor(num / 10000)}万+`;
|
||||
},
|
||||
onClick() {
|
||||
this.$emit('ok', this.obj.id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user