diff --git a/src/api/product.js b/src/api/product.js index a5d064f..bac1947 100644 --- a/src/api/product.js +++ b/src/api/product.js @@ -299,6 +299,12 @@ export function seckillChangeApi(id, status) { export function toVirtualSalesApi(id) { return request.get(`store/product/ficti/form/${id}`) } +/** + * @description 商品列表 -- 标记标记 + */ +export function setTagNameApi(id) { + return request.get(`store/product/tag_name/form/${id}`) +} /** * @description 预售 -- 列表 */ diff --git a/src/views/product/productExamine/editAttr.vue b/src/views/product/productExamine/editAttr.vue index ecfe174..916e02b 100644 --- a/src/views/product/productExamine/editAttr.vue +++ b/src/views/product/productExamine/editAttr.vue @@ -358,12 +358,22 @@ export default { } }, + calculatePercentage(number) { + // 假设输入的是0.6,50% + // 首先计算百分比 + var percentage = 100 - (number - 0.1) * 100; + // 确保百分比在0到100之间 + percentage = Math.min(Math.max(percentage, 0), 100); + // 返回百分比 + return percentage + "%"; + }, handleCost(val,i){ switch(i){ case 'cost': val.cost=val.cost.replace(/^([0-9-]\d*\.?\d{0,2})?.*$/,'$1') - val.growth = parseInt(val.price*(0.9-(val.cost/val.price))) + // val.growth = parseInt(val.price*(0.9-(val.cost/val.price))) val.proportion = (val.cost/val.price).toFixed(2) + val.growth = parseInt(val.price*val.proportion) break; case 'ot_price': val.ot_price=val.ot_price.replace(/^([0-9-]\d*\.?\d{0,2})?.*$/,'$1') @@ -373,8 +383,8 @@ export default { break; case 'price': val.price=val.price.replace(/^([0-9-]\d*\.?\d{0,2})?.*$/,'$1') - val.growth = parseInt(val.price*(0.9-(val.cost/val.price))) val.proportion = (val.cost/val.price).toFixed(2) + val.growth = parseInt(val.price*val.proportion) break; case 'growth': val.growth=val.growth.replace(/[^\d]/g,'') diff --git a/src/views/product/productExamine/index.vue b/src/views/product/productExamine/index.vue index 2e8f59c..a69d12e 100644 --- a/src/views/product/productExamine/index.vue +++ b/src/views/product/productExamine/index.vue @@ -51,6 +51,9 @@ + + + +