From c75b9c4a01d8c8352d8abf965854841ad650fcbe Mon Sep 17 00:00:00 2001 From: zhangds Date: Tue, 25 Oct 2022 14:23:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20key=E6=89=B9=E6=AC=A1=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=88=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/plan/key/UseKeyAddEdit.jsx | 35 +++++++++++++++------------- src/pages/plan/key/list.js | 4 ++-- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/pages/plan/key/UseKeyAddEdit.jsx b/src/pages/plan/key/UseKeyAddEdit.jsx index 7e3dfcc1..50fe66fa 100644 --- a/src/pages/plan/key/UseKeyAddEdit.jsx +++ b/src/pages/plan/key/UseKeyAddEdit.jsx @@ -57,7 +57,7 @@ const UseKeyAddEdit = () => { recall_visible: false, audit_visible: false, key_status: -1, - keyType: 1, + keyType: Number(sessionStorage.getItem("keyType")), rowIndex: -1, distdata: [], couponData: [], @@ -178,6 +178,8 @@ const UseKeyAddEdit = () => { reseller: {}, payment_direction: ["对私账户", "对公账户", "预付款扣除"], payType: 3, + copyKeyCodeId: "", + reseller_id: "", }); const keyFormEl = useRef(null); const bindObjEl = useRef(null); @@ -193,6 +195,7 @@ const UseKeyAddEdit = () => { stock: "", merge_stock: 1, mobile_excel: "", + mobile_repeat: [], }); //#endRegion data ***************************/ @@ -219,22 +222,23 @@ const UseKeyAddEdit = () => { }; const init = () => { - // KeyPcType 1编辑 2复制 3新增 - if (state.KeyPcType === "3") { - setState({ - pageTitle: "新增key", + let planItem = sessionStorage.getItem("plan_item"); + if (planItem) { + let planObj = JSON.parse(planItem); + console.log("plan item =>", planObj); + setModel({ + plan_title: planObj.title, }); - let planItem = sessionStorage.getItem("plan_item"); - if (planItem) { - let obj = JSON.parse(planItem); - console.log("plan item =>", obj); - setModel({ - plan_title: obj.title, - }); + setState({ + plan_id: planObj.id, + reseller_id: planObj.reseller_id, + }); + // KeyPcType 1编辑 2复制 3新增 + if (state.KeyPcType === "3") { setState({ - plan_id: obj.plan_id, + pageTitle: "新增key", }); - getResellerFun(obj.reseller_id); + getResellerFun(state.reseller_id); } } else if (state.KeyPcType === "1") { setState({ @@ -439,7 +443,7 @@ const UseKeyAddEdit = () => { style: model.style, quantity: model.quantity, bind_object: [state.keyType], - + copy_key_batch_id: state.copyKeyCodeId, allow_repetition: model.allow_repetition, allow_loss: model.allow_loss, @@ -459,7 +463,6 @@ const UseKeyAddEdit = () => { create_param.coupon = data; } console.log("大提交 =>", create_param); - return; addKeysBatchInfo(state.plan_id, create_param).then((res) => { handelResponse( res, diff --git a/src/pages/plan/key/list.js b/src/pages/plan/key/list.js index 4f69852c..fd2ed800 100644 --- a/src/pages/plan/key/list.js +++ b/src/pages/plan/key/list.js @@ -310,7 +310,7 @@ export default class acclist extends React.Component { (req, msg) => { console.log("req =>", req); if (req.data.length > 0) { - sessionStorage.setItem("bind_object", req.data[0].bind_object[0]); + sessionStorage.setItem("keyType", req.data[0].bind_object[0]); } const newData = req.data.map((item) => { if (![4, 5].includes(item.status)) { @@ -339,7 +339,7 @@ export default class acclist extends React.Component { // this.getKeyList(); } - clickFn2222() { + clickFn22() { this.props.history.push("/home/exchangecode-add"); sessionStorage.setItem("pathname2", "/home/exchangecode-add");