Authored by zhangwenxue

商品详情: 调整变现与交易的判断条件

变现:bid_moster_price > 0 || bid_skup != null
可交易: storage_num > 0 && least_price > 0
... ... @@ -95,13 +95,19 @@ export default {
const name = info.size_name.split(/\s+/);
// 区分交易(buy|sell),变现
const isTradable = info.storage_num > 0 && price !== '-';
const isMarketable = info.bid_moster_price > 0;
return {
size_id: info.size_id,
name: name[0],
subName: name[1],
price,
storage_id: info.storage_id,
available: info.storage_num > 0 && price !== '-',
available: isTradable || isMarketable,
isTradable,
isMarketable,
};
},
simplePriceMap(info) {
... ...
... ... @@ -18,9 +18,9 @@
@select="onSelectSize"
@add="onAdd" />
<transition name="slide-up">
<div class="footer" v-if="isTradable">
<div class="footer" v-if="isAvailable">
<cube-button v-if="config.type === 'sell'" @click="convertToCash" :class="{active: isMarketable}">变现<span> <i>¥</i>{{cashPrice}}</span></cube-button>
<cube-button @click="select" class="active">{{config.title}}</cube-button>
<cube-button @click="select" :class="{active: isTradable}">{{config.title}}</cube-button>
</div>
</transition>
</div>
... ... @@ -87,11 +87,15 @@ export default {
return get(this.product, 'goods_list[0].canAddSize', false);
},
isAvailable() {
return this.selectedSize && this.selectedSize.size_id > 0;
},
/**
* 可交易(购买|出售)
*/
isTradable() {
return this.selectedSize && this.selectedSize.size_id;
return this.isAvailable && this.selectedSize.storage_num > 0 && this.selectedSize.least_price !== '-';
},
/**
... ... @@ -106,10 +110,11 @@ export default {
},
/**
* 是否可变现
* 可变现
* 通过bid_moster_price或bid_skup判断
*/
isMarketable() {
return this.cashPrice !== '-' && this.cashPrice > 0;
return this.cashPrice > 0;
}
},
mounted() {
... ... @@ -140,6 +145,7 @@ export default {
productId: this.product.product_id,
storageId: this.selectedSize.storage_id,
skup: this.selectedSize.skup,
bid_skup: this.selectedSize.bid_skup,
});
},
convertToCash() {
... ...