Просмотр исходного кода

fix(frontend): 商城首页/搜索页商品价格显示放大100倍(漏除100)

asus 3 месяцев назад
Родитель
Сommit
4115d76b21
2 измененных файлов с 2 добавлено и 2 удалено
  1. 1 1
      cfc-frontend/pages/shop/index/index.vue
  2. 1 1
      cfc-frontend/pages/shop/search/search.vue

+ 1 - 1
cfc-frontend/pages/shop/index/index.vue

@@ -284,7 +284,7 @@ export default {
     },
     },
     formatPriceWithSymbol(price) {
     formatPriceWithSymbol(price) {
       if (price === null || price === undefined) return ''
       if (price === null || price === undefined) return ''
-      return '¥' + parseFloat(price).toFixed(2)
+      return '¥' + (Number(price) / 100).toFixed(2)
     },
     },
     getImageUrl: function(path) {
     getImageUrl: function(path) {
       return config.API_BASE_URL + path
       return config.API_BASE_URL + path

+ 1 - 1
cfc-frontend/pages/shop/search/search.vue

@@ -151,7 +151,7 @@ export default {
     },
     },
     formatPriceWithSymbol(price) {
     formatPriceWithSymbol(price) {
       if (price === null || price === undefined) return ''
       if (price === null || price === undefined) return ''
-      return '¥' + parseFloat(price).toFixed(2)
+      return '¥' + (Number(price) / 100).toFixed(2)
     }
     }
   }
   }
 }
 }