From 6ef022a3f58a618a70dbd3a108728643c30acfd5 Mon Sep 17 00:00:00 2001 From: zhangds Date: Wed, 26 Oct 2022 14:16:47 +0800 Subject: [PATCH 1/6] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=88=B8=E6=96=B0=E5=BB=BA=E5=95=86=E5=93=81=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/UseGoodsScopePop/index.jsx | 8 ++++++-- src/components/UseProductPop/index.jsx | 4 ++-- src/tools/index.js | 1 - 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/UseGoodsScopePop/index.jsx b/src/components/UseGoodsScopePop/index.jsx index 51d2259d..ce51787c 100644 --- a/src/components/UseGoodsScopePop/index.jsx +++ b/src/components/UseGoodsScopePop/index.jsx @@ -42,10 +42,12 @@ const UseGoodsScopePop = forwardRef((props, ref) => { Number(form_model.quantity) ); form_model.effectDate = "-"; + console.log("new_tableData[table_index] 1=>", new_tableData[table_index]); if (product_title === "编辑商品") { 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].checked = ck; } } else { new_tableData.push(form_model); @@ -58,11 +60,13 @@ const UseGoodsScopePop = forwardRef((props, ref) => { let new_tableData = tableData; let form_model = knockGold_el.current.state.form_data; let table_obj = knockGoldFun(form_model); + console.log("new_tableData[table_index] 2=>", new_tableData[table_index]); if (product_title === "编辑立减金") { 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].only = form_model; + new_tableData[table_index].checked = ck; } } else { new_tableData.push(table_obj); diff --git a/src/components/UseProductPop/index.jsx b/src/components/UseProductPop/index.jsx index d610495a..686d3ce7 100644 --- a/src/components/UseProductPop/index.jsx +++ b/src/components/UseProductPop/index.jsx @@ -198,7 +198,7 @@ const UseProductPop = forwardRef((props, ref) => { setModel({ goods_id: productData.goods_id, cost_price: productData.cost_price, - weight: productData.weight, + weight: String(productData.weight), quantity: productData.quantity, contract_price: productData.contract_price, product_name: productData.product_name, @@ -532,7 +532,7 @@ const UseProductPop = forwardRef((props, ref) => { setModel({ weight: e }); }} onClearItem={(e) => { - setModel({ weight: "" }); + setModel({ weight: 0 }); }} value={model.weight} placeholder={"请输入"} diff --git a/src/tools/index.js b/src/tools/index.js index 92d66a7e..4ae68846 100644 --- a/src/tools/index.js +++ b/src/tools/index.js @@ -1,7 +1,6 @@ import { divNum } from "./number"; // 立减金对象重构 export const knockGoldFun = (item) => { - console.log("库存", item.stock); let table_obj = {}; table_obj.type = 2; // 类型 table_obj.upstream = String(item.channel) === "1" ? "支付宝" : "微信"; // 上游平台 From ad7b1e5201d9b175ef8b01d717c24f3fcc0d8e7c Mon Sep 17 00:00:00 2001 From: zhangds Date: Wed, 26 Oct 2022 16:39:59 +0800 Subject: [PATCH 2/6] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/UseCouponAddEdit/index.jsx | 35 ++++++++++++++--------- src/components/UseProductPop/index.jsx | 1 + src/pages/coupon/list/index.jsx | 8 ++++-- src/pages/plan/key/UseKeyAddEdit.jsx | 4 +++ 4 files changed, 31 insertions(+), 17 deletions(-) diff --git a/src/components/UseCouponAddEdit/index.jsx b/src/components/UseCouponAddEdit/index.jsx index 5ef106be..daa73036 100644 --- a/src/components/UseCouponAddEdit/index.jsx +++ b/src/components/UseCouponAddEdit/index.jsx @@ -209,7 +209,6 @@ const UseCouponAddEdit = forwardRef((props, ref) => { examinePopShow: false, payType: 3, payment_direction: ["对私账户", "对公账户", "预付款扣除"], - isState: sessionStorage.getItem("isState"), // 是否编辑和复制 coupon_batch_id: "", oldProduct: {}, // 旧数据,为编辑做准备 id: "", @@ -217,6 +216,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => { statusDisabled: false, // 3未开始、1进行中、2暂停中,有数据的审核驳回 productType: 1, checkedProduct: [], + KeyPcType: sessionStorage.getItem("KeyPcType"), }); // 基础信息 @@ -243,6 +243,8 @@ const UseCouponAddEdit = forwardRef((props, ref) => { // 编辑/新增/复制 useEffect(() => { (async function init() { + let KeyPcType = sessionStorage.getItem("KeyPcType"); + console.log("KeyPcType UseCouponAddEdit 1编辑 2复制 3新增 =>", KeyPcType); // 第一步:1.判断组件是否是 优惠券管理 couponType if (couponType === 0) { // 如果是编辑 @@ -277,14 +279,14 @@ const UseCouponAddEdit = forwardRef((props, ref) => { editFun(); // 1.7 复制 - if (state.isState === "1") { + if (state.KeyPcType === "2") { setForm_info_data({ title: `${editData.title}_${editData.copy_count + 1}`, }); } // 1.8 编辑 - if (state.isState === "2") { + if (state.KeyPcType === "1") { setState({ oldProduct: editData.product, }); @@ -349,7 +351,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => { // 商品的数组 let goods_arr = editData.product.legal.map((item) => { // 如果是复制 删除id !!!!!!!! - if (state.isState === "1") { + if (state.KeyPcType === "2") { delete item.id; } return { @@ -367,7 +369,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => { // 立减金 let lj_arr = editData.product.reduce.map((item) => { // 如果是复制 删除id !!!!!!!! - if (state.isState === "1") { + if (state.KeyPcType === "2") { delete item.id; } let table_obj = knockGoldFun(item); @@ -412,7 +414,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => { // 状态不可修改 const statusDisabledFun = (status) => { // 第一步判断是否是复制: - if (state.isState === "1") { + if (state.KeyPcType === "2") { return; } else { if ([1, 2, 3].includes(status)) { @@ -598,8 +600,8 @@ const UseCouponAddEdit = forwardRef((props, ref) => { }; const onAuditSubmit = () => { - // 1新增 2编辑 - if (state.isState === "2") { + // 3新增 1编辑 + if (state.KeyPcType === "1") { let param = { payment_direction: state.payment_direction[state.payType - 1], title: form_info_data.title, @@ -696,7 +698,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => { }; }); // 复制id - if (state.isState === "1") { + if (state.KeyPcType === "2") { param.copy_code_batch_id = editData.id; } @@ -841,7 +843,8 @@ const UseCouponAddEdit = forwardRef((props, ref) => { // 获取已经选择的商品数据(禁用商品选择) const getCheckedProduct = () => { - let arr = state.tableData.map((item) => item.product_id); + console.log("已选 =>", state.tableData); + let arr = state.tableData.map((item) => Number(item.product_id)); return arr; }; @@ -917,7 +920,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => { }); // 如果是复制删除 code_batch_id 如果是计划中的创建中数据 let plan_status = sessionStorage.getItem("plan_status"); - if (state.isState === "1" || plan_status === "0") { + if (state.KeyPcType === "2" || plan_status === "0") { delete rowData.code_batch_id; } setState({ @@ -1044,7 +1047,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => { }; const timeFalse = () => { - if (state.isState === "1") { + if (state.KeyPcType === "2") { return false; } @@ -1123,7 +1126,9 @@ const UseCouponAddEdit = forwardRef((props, ref) => { options={state.plan_OPTIONS} value={form_info_data.plan_id} disabled={ - state.isState === "2" || state.isState === "1" ? true : false + state.KeyPcType === "2" || state.KeyPcType === "1" + ? true + : false } onChange={(e) => { changePlan(e); @@ -1141,7 +1146,9 @@ const UseCouponAddEdit = forwardRef((props, ref) => { options={state.key_OPTIONS} value={form_info_data.key_batch_id} disabled={ - state.isState === "2" || state.isState === "1" ? true : false + state.KeyPcType === "2" || state.KeyPcType === "1" + ? true + : false } onChange={(e) => { setForm_info_data({ key_batch_id: e }); diff --git a/src/components/UseProductPop/index.jsx b/src/components/UseProductPop/index.jsx index 686d3ce7..ca82f248 100644 --- a/src/components/UseProductPop/index.jsx +++ b/src/components/UseProductPop/index.jsx @@ -164,6 +164,7 @@ const UseProductPop = forwardRef((props, ref) => { setState({ productDataAll: req.data, }); + console.log("所有商品数据 =>", req.data); let optArr = req.data.map((item) => { return { key: item.id, diff --git a/src/pages/coupon/list/index.jsx b/src/pages/coupon/list/index.jsx index 960e8e2d..b7a8e905 100644 --- a/src/pages/coupon/list/index.jsx +++ b/src/pages/coupon/list/index.jsx @@ -249,7 +249,7 @@ const UseCouponList = () => { /* 新建/复制/编辑/兑换码 */ const addCodeFunction = (type, param) => { - console.log(param); + let KeyPcType = "3"; sessionStorage.setItem("knockGold_effectDate", JSON.stringify({})); let activerou = [ { @@ -280,6 +280,7 @@ const UseCouponList = () => { "datetime", JSON.stringify([param.begin_time, param.end_time]) ); + KeyPcType = "2"; } else if (type === 2) { activerou[0].pagetitle = "编辑"; activerou[0].items[1].name = `编辑:${param.title}`; @@ -289,15 +290,16 @@ const UseCouponList = () => { "datetime", JSON.stringify([param.begin_time, param.end_time]) ); + KeyPcType = "1"; } else { + KeyPcType = "3"; sessionStorage.setItem("datetime", ``); } - sessionStorage.setItem("code_id", param?.id); - sessionStorage.setItem("isState", type); sessionStorage.setItem("breaknav", JSON.stringify(activerou)); sessionStorage.setItem("pathname2", "/home/coupon-add-edit"); sessionStorage.setItem("keyType", "2"); + sessionStorage.setItem("KeyPcType", KeyPcType); // 1编辑 2复制 3新增 history.push("/home/coupon-add-edit"); }; diff --git a/src/pages/plan/key/UseKeyAddEdit.jsx b/src/pages/plan/key/UseKeyAddEdit.jsx index 6b0821bf..6024f218 100644 --- a/src/pages/plan/key/UseKeyAddEdit.jsx +++ b/src/pages/plan/key/UseKeyAddEdit.jsx @@ -270,6 +270,9 @@ const UseKeyAddEdit = () => { const init = () => { let planItem = sessionStorage.getItem("plan_item"); + let KeyPcType = sessionStorage.getItem("KeyPcType"); + console.log("KeyPcType UseKeyAddEdit 1编辑 2复制 3新增 =>", KeyPcType); + if (planItem) { let planObj = JSON.parse(planItem); setModel({ @@ -539,6 +542,7 @@ const UseKeyAddEdit = () => { // 编辑 const rowEditClick = (row, rowIndex) => { + console.log("编辑 -01"); if (state.keyType === 1) { setState({ draw_title: "编辑兑换码", From a21555f0d48e902c627eee6d3cf5f68735dd30e0 Mon Sep 17 00:00:00 2001 From: zhangds Date: Wed, 26 Oct 2022 16:48:04 +0800 Subject: [PATCH 3/6] =?UTF-8?q?fix:=20=E5=8C=BA=E5=88=86=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E5=92=8C=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/UseExchangeAddEdit/index.jsx | 3 ++- src/pages/plan/add/step2.js | 2 +- src/pages/plan/list/list.js | 6 ++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/UseExchangeAddEdit/index.jsx b/src/components/UseExchangeAddEdit/index.jsx index 072fe2a3..eae73a54 100644 --- a/src/components/UseExchangeAddEdit/index.jsx +++ b/src/components/UseExchangeAddEdit/index.jsx @@ -148,6 +148,7 @@ const UseExchangeAddEdit = forwardRef((props, ref) => { id: "", status: "", checkedProduct: [], + KeyPcType: sessionStorage.getItem("KeyPcType"), }); const [codeInfo, setCodeInfo] = useSetState({ code_name: "", @@ -462,7 +463,7 @@ const UseExchangeAddEdit = forwardRef((props, ref) => { }); // 如果是复制删除 code_batch_id 如果是计划中的创建中数据 let plan_status = sessionStorage.getItem("plan_status"); - if (state.isState === "1" || plan_status === "0") { + if (state.KeyPcType === "2" || plan_status === "0") { delete rowData.code_batch_id; } setState({ diff --git a/src/pages/plan/add/step2.js b/src/pages/plan/add/step2.js index 613054d0..6fdf9308 100644 --- a/src/pages/plan/add/step2.js +++ b/src/pages/plan/add/step2.js @@ -1010,7 +1010,7 @@ export default class acclist extends React.Component { (data) => { sessionStorage.setItem("productsList", JSON.stringify(data)); // 如果是复制 删除 code_batch_id - if (sessionStorage.getItem("isState") === "1") { + if (sessionStorage.getItem("KeyPcType") === "2") { delete rowData.code_batch_id; } this.setState({ diff --git a/src/pages/plan/list/list.js b/src/pages/plan/list/list.js index decc8273..8dca7a45 100644 --- a/src/pages/plan/list/list.js +++ b/src/pages/plan/list/list.js @@ -197,12 +197,12 @@ export default class acclist extends React.Component { }; } clickFn() { - sessionStorage.setItem("keyType", 1); + sessionStorage.setItem("isState", ""); let link = window.location.href.replace( window.location.hash, "#/home/plan-create" ); - sessionStorage.setItem("isState", ""); + sessionStorage.setItem("KeyPcType", "3"); window.open(link, "_blank"); } //分页 @@ -633,6 +633,7 @@ export default class acclist extends React.Component { window.location.hash, "#/home/plan-edit" ); + sessionStorage.setItem("KeyPcType", "1"); sessionStorage.setItem("isState", "2"); window.open(link, "_blank"); } @@ -659,6 +660,7 @@ export default class acclist extends React.Component { "#/home/plan-edit-copy" ); sessionStorage.setItem("isState", "1"); + sessionStorage.setItem("KeyPcType", "2"); window.open(link, "_blank"); } onFilterClose(prop) { From fc136f745b8c61db1720a0f3cdf9df0c5423aba6 Mon Sep 17 00:00:00 2001 From: zhangds Date: Wed, 26 Oct 2022 16:51:21 +0800 Subject: [PATCH 4/6] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E5=92=8C=E7=BC=96=E8=BE=91=E7=9A=84=E7=8A=B6=E6=80=81=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/plan/list/list.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/pages/plan/list/list.js b/src/pages/plan/list/list.js index 8dca7a45..0333af97 100644 --- a/src/pages/plan/list/list.js +++ b/src/pages/plan/list/list.js @@ -197,7 +197,6 @@ export default class acclist extends React.Component { }; } clickFn() { - sessionStorage.setItem("isState", ""); let link = window.location.href.replace( window.location.hash, "#/home/plan-create" @@ -634,7 +633,6 @@ export default class acclist extends React.Component { "#/home/plan-edit" ); sessionStorage.setItem("KeyPcType", "1"); - sessionStorage.setItem("isState", "2"); window.open(link, "_blank"); } // 一键复制 @@ -659,7 +657,6 @@ export default class acclist extends React.Component { window.location.hash, "#/home/plan-edit-copy" ); - sessionStorage.setItem("isState", "1"); sessionStorage.setItem("KeyPcType", "2"); window.open(link, "_blank"); } From 599c6e8b76de3929acdcd56e182bad25dfa31919 Mon Sep 17 00:00:00 2001 From: zhangds Date: Thu, 27 Oct 2022 09:57:32 +0800 Subject: [PATCH 5/6] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dkey=E6=89=B9?= =?UTF-8?q?=E6=AC=A1=E5=B7=B2=E4=BD=9C=E5=BA=9F=E4=B8=8D=E8=83=BD=E5=A4=8D?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/plan/key/UseKeyAddEdit.jsx | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/pages/plan/key/UseKeyAddEdit.jsx b/src/pages/plan/key/UseKeyAddEdit.jsx index 6024f218..869caaa9 100644 --- a/src/pages/plan/key/UseKeyAddEdit.jsx +++ b/src/pages/plan/key/UseKeyAddEdit.jsx @@ -100,7 +100,6 @@ const UseKeyAddEdit = () => { error_count: 0, exceldata: [], myfile: {}, - isCancel: false, audit_visible: false, key_status: -1, keyType: Number(sessionStorage.getItem("keyType")), @@ -427,10 +426,6 @@ const UseKeyAddEdit = () => { handelResponse( res, (req, msg) => { - if (Number(req.status) === 7) { - setState({ isCancel: true }); - } - setState({ key_status: req.status, id: req.id, keyCodeId: req.id }); editFun(req); }, @@ -1102,12 +1097,9 @@ const UseKeyAddEdit = () => {
- {state.isCancel ? null : ( - - )} - + From 38b6f766f5a4a9639245331ecb684bf2a2191144 Mon Sep 17 00:00:00 2001 From: zhangds Date: Thu, 27 Oct 2022 10:39:12 +0800 Subject: [PATCH 6/6] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E8=90=BD=E5=9C=B0=E9=A1=B5=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/plan/add/add.js | 1 + src/pages/plan/add/step3.js | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pages/plan/add/add.js b/src/pages/plan/add/add.js index c3cbeeb0..f8af64e4 100644 --- a/src/pages/plan/add/add.js +++ b/src/pages/plan/add/add.js @@ -89,6 +89,7 @@ export default class add extends React.Component { componentDidMount(e) { sessionStorage.setItem("white", 3); sessionStorage.setItem("plan_id", ""); + sessionStorage.setItem("keyType", "1"); } onConfirm(e) { diff --git a/src/pages/plan/add/step3.js b/src/pages/plan/add/step3.js index 5d8d888f..3a4c6447 100644 --- a/src/pages/plan/add/step3.js +++ b/src/pages/plan/add/step3.js @@ -52,8 +52,8 @@ export default class acclist extends React.Component { console.log("white =>", white); console.log("keyType =>", keyType); // 2 优惠券 - if (keyType == 2) { - if (white == 1) { + if (keyType === "2") { + if (white === "1") { // 并且是 白名单 params.page = 8; } else { @@ -61,7 +61,7 @@ export default class acclist extends React.Component { } } else { // 兑换码 - if (white == 1) { + if (white === "1") { // 并且是 白名单 params.page = 1; } else {