diff --git a/src/utils/util.js b/src/utils/util.js index 32c39b2..1215307 100644 --- a/src/utils/util.js +++ b/src/utils/util.js @@ -19,7 +19,9 @@ export const getCookies = key => { // 保留两位小数; // num export function toFixedNoRounding(num) { - return Math.floor(num * 100) / 100; + + var re = /([0-9]+.[0-9]{2})[0-9]*/; + return `${num}`.replace(re, "$1"); } export const removeCookies = key => { return Cookies.remove(key); diff --git a/src/views/product/addProduct/index.vue b/src/views/product/addProduct/index.vue index eb43602..8d7b435 100644 --- a/src/views/product/addProduct/index.vue +++ b/src/views/product/addProduct/index.vue @@ -2108,7 +2108,7 @@ const defaultObj = { ot_price: null, svip_price: null, select: false, - proportion:0.6, + proportion:0.60, coupon:'', growth:0, stock: null, @@ -2247,7 +2247,7 @@ export default { value: '0.50', label: '0.50', coupon:0.4, - growth:0.6 + growth:0.60 }, { value: '0.45', @@ -2270,7 +2270,7 @@ export default { { value: '0.30', label: '0.30', - coupon:0.6, + coupon:0.60, growth:0.8 }, { @@ -2545,7 +2545,7 @@ export default { price: null, cost: null, ot_price: null, - proportion:0.6, + proportion:0.60, coupon:'', stock: null, // growth:0, @@ -2583,7 +2583,7 @@ export default { cost: '', ot_price: '', svip_price: '', - proportion:'0.6', + proportion:'0.60', coupon:'', gist_url:'', growth:0, @@ -2724,7 +2724,7 @@ export default { // 规格值变化 handleCost(val,i,e,type){ if(type == 'batchAdd'){ - i=='price'?val.cost = toFixedNoRounding(val.price * 0.6):'' + i=='price'?val.cost = toFixedNoRounding(val.price * val.proportion):'' } if(i=='price'){ val.price=val.price.replace(/^([0-9-]\d*\.?\d{0,2})?.*$/,'$1') @@ -3217,7 +3217,7 @@ export default { weight: 0, volume: 0, growth:0, - proportion:'0.6', + proportion:'0.60', coupon:'', extension_one: 0, extension_two: 0 @@ -3257,7 +3257,7 @@ export default { weight: 0, volume: 0, growth:0, - proportion:'0.6', + proportion:'0.60', coupon:'', extension_one: 0, extension_two: 0, @@ -3525,7 +3525,7 @@ export default { ot_price: null, svip_price: null, stock: null, - proportion:0.6, + proportion:0.60, coupon:'', growth:0, bar_code: '', @@ -3552,7 +3552,7 @@ export default { bar_code: '', weight: null, volume: null, - proportion:0.6, + proportion:0.60, coupon:'', growth:0, gist_url:'' @@ -3687,7 +3687,7 @@ export default { }, []); this.formValidate.attr[idx].inputVisible = false; } else { - this.$message.warning("请添加属性"); + if(this.formValidate.attr[idx].inputVisible)this.$message.warning("请添加属性"); } this.attrs = this.formValidate.attr; }, @@ -3814,7 +3814,7 @@ export default { ot_price: null, svip_price: null, stock: null, - proportion:0.6, + proportion:0.60, coupon:'', growth:0, // cdkey: {}, diff --git a/src/views/product/productList/proDetails.vue b/src/views/product/productList/proDetails.vue index 23ffc1f..33841aa 100644 --- a/src/views/product/productList/proDetails.vue +++ b/src/views/product/productList/proDetails.vue @@ -409,14 +409,14 @@ -
  • +