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(); } };