Browse Source

产品详情页输入数量为0时价格计算修改

yangc 8 years ago
parent
commit
1568f22990
1 changed files with 2 additions and 2 deletions
  1. 2 2
      components/store/CommodityInfo.vue

+ 2 - 2
components/store/CommodityInfo.vue

@@ -178,7 +178,7 @@ export default {
   },
   filters: {
     currency: function (num) {
-      if (typeof num === 'number') {
+      if (typeof num === 'number' && num > 0) {
         if (num <= 0.000001) {
           num = 0.000001
         } else {
@@ -216,7 +216,7 @@ export default {
     },
     calculate () {
       this.fragment.total = this.fragment.price * this.fragment.num
-      return Math.ceil(this.fragment.total * Math.pow(10, 2)) / Math.pow(10, 2)
+      return Math.ceil(this.fragment.total * Math.pow(10, 6)) / Math.pow(10, 6)
     },
     user () {
       return this.$store.state.option.user