fix: 修复优惠券新建商品选择

This commit is contained in:
zhangds 2022-10-26 14:16:47 +08:00
parent c31f1f697f
commit 6ef022a3f5
3 changed files with 8 additions and 5 deletions

View File

@ -42,10 +42,12 @@ const UseGoodsScopePop = forwardRef((props, ref) => {
Number(form_model.quantity) Number(form_model.quantity)
); );
form_model.effectDate = "-"; form_model.effectDate = "-";
console.log("new_tableData[table_index] 1=>", new_tableData[table_index]);
if (product_title === "编辑商品") { if (product_title === "编辑商品") {
if (table_index !== -1) { if (table_index !== -1) {
form_model.checked = false; let ck = new_tableData[table_index].checked;
new_tableData[table_index] = form_model; new_tableData[table_index] = form_model;
new_tableData[table_index].checked = ck;
} }
} else { } else {
new_tableData.push(form_model); new_tableData.push(form_model);
@ -58,11 +60,13 @@ const UseGoodsScopePop = forwardRef((props, ref) => {
let new_tableData = tableData; let new_tableData = tableData;
let form_model = knockGold_el.current.state.form_data; let form_model = knockGold_el.current.state.form_data;
let table_obj = knockGoldFun(form_model); let table_obj = knockGoldFun(form_model);
console.log("new_tableData[table_index] 2=>", new_tableData[table_index]);
if (product_title === "编辑立减金") { if (product_title === "编辑立减金") {
if (table_index !== -1) { if (table_index !== -1) {
table_obj.checked = false; let ck = new_tableData[table_index].checked;
new_tableData[table_index] = table_obj; new_tableData[table_index] = table_obj;
new_tableData[table_index].only = form_model; new_tableData[table_index].only = form_model;
new_tableData[table_index].checked = ck;
} }
} else { } else {
new_tableData.push(table_obj); new_tableData.push(table_obj);

View File

@ -198,7 +198,7 @@ const UseProductPop = forwardRef((props, ref) => {
setModel({ setModel({
goods_id: productData.goods_id, goods_id: productData.goods_id,
cost_price: productData.cost_price, cost_price: productData.cost_price,
weight: productData.weight, weight: String(productData.weight),
quantity: productData.quantity, quantity: productData.quantity,
contract_price: productData.contract_price, contract_price: productData.contract_price,
product_name: productData.product_name, product_name: productData.product_name,
@ -532,7 +532,7 @@ const UseProductPop = forwardRef((props, ref) => {
setModel({ weight: e }); setModel({ weight: e });
}} }}
onClearItem={(e) => { onClearItem={(e) => {
setModel({ weight: "" }); setModel({ weight: 0 });
}} }}
value={model.weight} value={model.weight}
placeholder={"请输入"} placeholder={"请输入"}

View File

@ -1,7 +1,6 @@
import { divNum } from "./number"; import { divNum } from "./number";
// 立减金对象重构 // 立减金对象重构
export const knockGoldFun = (item) => { export const knockGoldFun = (item) => {
console.log("库存", item.stock);
let table_obj = {}; let table_obj = {};
table_obj.type = 2; // 类型 table_obj.type = 2; // 类型
table_obj.upstream = String(item.channel) === "1" ? "支付宝" : "微信"; // 上游平台 table_obj.upstream = String(item.channel) === "1" ? "支付宝" : "微信"; // 上游平台