|
|
@@ -7,16 +7,16 @@
|
|
|
<div class="content">
|
|
|
<p v-text="commodity.comCode">MRFE6S9045NF001</p>
|
|
|
<p class="color666" v-text="commodity.brandNameCn">PANFAEFQ</p>
|
|
|
- <p class="price" v-if="commodity.minPriceRMB">¥ {{commodity.minPriceRMB}}</p>
|
|
|
- <p class="price" v-if="!commodity.minPriceRMB">$ {{commodity.minPriceUSD || 0}}</p>
|
|
|
+ <p class="price" v-if="commodity.minPriceRMB">¥ {{commodity.minPriceRMB | currency}}</p>
|
|
|
+ <p class="price" v-if="!commodity.minPriceRMB">$ {{commodity.minPriceUSD | currency}}</p>
|
|
|
</div>
|
|
|
<div class="hover-show" :href="commodity.batchCode ? '/store/' + storeInfo.uuid + '/' + commodity.batchCode : '#'">
|
|
|
<a :href="commodity.batchCode ? '/store/' + storeInfo.uuid + '/' + commodity.batchCode : '#'" class="href">
|
|
|
<div class="title" v-text="commodity.comCode">MRFE6S9045NF001</div>
|
|
|
<div class="type" v-text="commodity.brandNameCn">PANFAEFQ</div>
|
|
|
<div class="hr"><span>抢购价</span></div>
|
|
|
- <div class="price" v-if="commodity.minPriceRMB">¥ {{commodity.minPriceRMB}}</div>
|
|
|
- <div class="price" v-if="!commodity.minPriceRMB">$ {{commodity.minPriceUSD || 0}}</div>
|
|
|
+ <div class="price" v-if="commodity.minPriceRMB">¥ {{commodity.minPriceRMB | currency}}</div>
|
|
|
+ <div class="price" v-if="!commodity.minPriceRMB">$ {{commodity.minPriceUSD | currency}}</div>
|
|
|
</a>
|
|
|
<div class="by-cart"><button title="加入购物车" @click="buyNow(false, commodity)"><img src="/images/store/icon/cart-blue.png"/></button></div>
|
|
|
<div class="buy-now"><button title="立即购买" @click="buyNow(true, commodity)">立即购买</button></div>
|
|
|
@@ -41,6 +41,32 @@
|
|
|
return this.$store.state.shop.storeInfo.store.data
|
|
|
}
|
|
|
},
|
|
|
+ filters: {
|
|
|
+ currency: function (num) {
|
|
|
+ if (typeof num === 'number') {
|
|
|
+ if (num <= 0.000001) {
|
|
|
+ num = 0.000001
|
|
|
+ } else {
|
|
|
+ if (num.toString().indexOf('.') === -1) {
|
|
|
+ num += '.00'
|
|
|
+ } else {
|
|
|
+ let inputStr = num.toString()
|
|
|
+ let arr = inputStr.split('.')
|
|
|
+ let floatNum = arr[1]
|
|
|
+ if (floatNum.length > 6) {
|
|
|
+ num = inputStr.substring(0, arr[0].length + 7)
|
|
|
+ if (Number(floatNum.charAt(6)) > 4) {
|
|
|
+ num = (Number(num) * 1000000 + 1) / 1000000
|
|
|
+ }
|
|
|
+ } else if (floatNum.length === 1) {
|
|
|
+ num = num + '0'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return num
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
buyNow: function (isBuy, item) {
|
|
|
if (!this.$store.state.option.user.logged) {
|