|
|
@@ -79,13 +79,13 @@
|
|
|
<div v-show="commodity.currencyName.indexOf('USD')==-1 || !commodity.prices">
|
|
|
<span>—</span>
|
|
|
</div>
|
|
|
- <div v-for="price in commodity.prices" v-text="price.uSDPrice"></div>
|
|
|
+ <div v-for="price in commodity.prices">{{price.uSDPrice | currency}}</div>
|
|
|
</td>
|
|
|
<td>
|
|
|
<div v-show="commodity.currencyName.indexOf('RMB')==-1 || !commodity.prices">
|
|
|
<span>—</span>
|
|
|
</div>
|
|
|
- <div v-for="price in commodity.prices" v-text="price.rMBPrice"></div>
|
|
|
+ <div v-for="price in commodity.prices" >{{price.rMBPrice | currency}}</div>
|
|
|
</td>
|
|
|
<td>
|
|
|
<div v-if="commodity.b2cMinDelivery">交期:
|
|
|
@@ -164,6 +164,31 @@ export default {
|
|
|
ids: null
|
|
|
}
|
|
|
},
|
|
|
+ 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 floatNum = inputStr.split('.')[1]
|
|
|
+ if (floatNum.length > 6) {
|
|
|
+ num = inputStr.substring(0, inputStr.length - 1)
|
|
|
+ if (Number(floatNum.charAt(6)) > 4) {
|
|
|
+ num = Number(num) + 0.000001
|
|
|
+ }
|
|
|
+ } else if (floatNum.length === 1) {
|
|
|
+ num = num + '0'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return num
|
|
|
+ }
|
|
|
+ },
|
|
|
computed: {
|
|
|
commodities () {
|
|
|
return this.$store.state.shop.storeInfo.storeCommodity.data
|