From 9ca647b8d5f8124e63ac802d43d87d2240d82f91 Mon Sep 17 00:00:00 2001 From: zhangds Date: Thu, 27 Oct 2022 15:48:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dkey=E6=89=B9=E6=AC=A1?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/plan/key/UseKeyAddEdit.jsx | 65 ++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 4 deletions(-) diff --git a/src/pages/plan/key/UseKeyAddEdit.jsx b/src/pages/plan/key/UseKeyAddEdit.jsx index c94db83c..4ed26e39 100644 --- a/src/pages/plan/key/UseKeyAddEdit.jsx +++ b/src/pages/plan/key/UseKeyAddEdit.jsx @@ -656,6 +656,66 @@ const UseKeyAddEdit = () => { setState({ drawerVisible: false }); }; + // 名字 + const changeKeyName = () => { + let falag = false; + let keyBatch_id = sessionStorage.getItem("keybatch_id"); + // 如果是 keyType 1兑换码 2优惠券 + if (state.keyType === 1) { + let editExchangeData = state.distdata.filter( + (item) => + item.checked === true && + (item.status === -1 || + item.status === 7 || + item.id === "" || + !item.id) + ); + if (isDisabled() && editExchangeData.length <= 0) { + falag = true; + } + } else { + let editCouponData = state.couponData.filter( + (item) => + item.checked === true && + (item.status === -1 || + item.status === 7 || + item.id === "" || + !item.id) + ); + if (isDisabled() && editCouponData.length <= 0) { + falag = true; + } + } + + if (falag) { + keyEditApproval(keyBatch_id, { + id: state.id, + batch_name: model.batch_name, + reseller_id: state.reseller.id, + reseller_name: state.reseller.name, + company_name: state.reseller.company_name, + receive_email: state.reseller.contact_email[0], + payment_direction: state.payment_direction[state.payType - 1], + }).then((res) => { + handelResponse( + res, + (req, msg) => { + setTimeout(() => { + window.history.back(); + }, 1000); + }, + (err) => { + Notify.error(err); + } + ); + }); + } else { + setState({ + audit_visible: true, + }); + } + }; + // 提交审核按钮 const examineBtn = () => { if (keyFormEl.current.validator()) { @@ -684,10 +744,7 @@ const UseKeyAddEdit = () => { Notify.error("绑定数不能为空"); return; } - - setState({ - audit_visible: true, - }); + changeKeyName(); } };