diff --git a/src/components/UseCouponAddEdit/index.jsx b/src/components/UseCouponAddEdit/index.jsx index ae8cb322..01e9f6c6 100644 --- a/src/components/UseCouponAddEdit/index.jsx +++ b/src/components/UseCouponAddEdit/index.jsx @@ -387,22 +387,19 @@ const UseCouponAddEdit = forwardRef((props, ref) => { }; const selectionFun = (e) => { + console.log("e =>", e); let arr = []; _.map(e, (res) => { let obj = {}; - obj.key = res.only; + obj.key = res; obj.text = res.product_name; arr.push(obj); return obj; }); - - console.log("选中 =>", arr); setState({ rank: arr }); }; const onRankChange = (e) => { - console.log("e =>", e); - let new_table_data = state.tableData.map((item) => { item.checked = e.findIndex((checks) => { @@ -410,7 +407,6 @@ const UseCouponAddEdit = forwardRef((props, ref) => { }) > -1; return item; }); - console.log("new_table_data =>", new_table_data); setState({ tableData: new_table_data, rank: e }); }; @@ -444,10 +440,24 @@ const UseCouponAddEdit = forwardRef((props, ref) => { // 商品范围删除 const deleteGoodsScope = (index) => { + console.log(index); let new_table = state.tableData; - new_table = new_table.splice(index, 1); + if (index === 0) { + new_table = []; + } else { + new_table = new_table.splice(index, 1); + } + let select_opt = []; + new_table.map((item) => { + let obj = {}; + obj.key = item; // 确保差异 + obj.text = item.product_name; + select_opt.push(obj); + }); + selectionFun(new_table); setState({ tableData: new_table, + rankoptions: select_opt, }); }; diff --git a/src/components/UseGoodsScopePop/index.jsx b/src/components/UseGoodsScopePop/index.jsx index b8d39a96..bd9240a8 100644 --- a/src/components/UseGoodsScopePop/index.jsx +++ b/src/components/UseGoodsScopePop/index.jsx @@ -31,7 +31,7 @@ const UseGoodsScopePop = forwardRef((props, ref) => { const format_knockGold_model = () => { let form_model = knockGold_el.current.state.model; let table_obj = {}; - table_obj.old = form_model; // 存储就数据 编辑好用 + table_obj.only = form_model; // 存储就数据 编辑好用 table_obj.product_id = "-"; // 商品编号 table_obj.product_name = form_model.batch_goods_name; // 商品名