From 8656fb7811534a3dff1e5fca30d0d2cb06b37095 Mon Sep 17 00:00:00 2001 From: 15820893422 <1978476055@qq.com> Date: Mon, 29 Apr 2024 09:15:14 +0800 Subject: [PATCH] edit --- src/api/product.js | 6 ++++++ src/views/product/productExamine/editAttr.vue | 14 ++++++++++++-- src/views/product/productExamine/index.vue | 15 +++++++++++++-- 3 files changed, 31 insertions(+), 4 deletions(-) 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 @@ + + + +