From 0a744b052492d49d5c2ead2c68c1c4abc3738812 Mon Sep 17 00:00:00 2001 From: zhangds Date: Mon, 31 Oct 2022 15:43:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=AB=8B=E5=87=8F?= =?UTF-8?q?=E9=87=91=E5=A4=8D=E5=88=B6=E5=BA=93=E5=AD=98=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tools/index.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/tools/index.js b/src/tools/index.js index 4ae68846..f1b8cd65 100644 --- a/src/tools/index.js +++ b/src/tools/index.js @@ -1,4 +1,15 @@ import { divNum } from "./number"; + +// 判断 +const kgType = (item) => { + let type = sessionStorage.getItem("KeyPcType"); + if (type === "2" || type === "3") { + return divNum(item.all_budget, item.reduce_amount); + } else { + return item.stock; + } +}; + // 立减金对象重构 export const knockGoldFun = (item) => { let table_obj = {}; @@ -11,9 +22,7 @@ export const knockGoldFun = (item) => { table_obj.official_price = item.reduce_amount; // 官方价 table_obj.contract_price = item.price; // 合同价格 table_obj.quantity = item.total_stock; // 库存数量 - table_obj.stock = item.stock - ? item.stock - : divNum(item.all_budget, item.reduce_amount); // 剩余库存数量 + table_obj.stock = kgType(item); // 剩余库存数量 table_obj.channel_activity_id = item.channel_activity_id; // 批次号 table_obj.all_budget = Number(item.all_budget); // 总预算 table_obj.effectDate = `${item.time_limit.effect_time.start_time} 至 ${item.time_limit.effect_time.end_time}`; // 有效时间段