diff --git a/src/components/UseCouponAddEdit/index.jsx b/src/components/UseCouponAddEdit/index.jsx index daa73036..4cf669aa 100644 --- a/src/components/UseCouponAddEdit/index.jsx +++ b/src/components/UseCouponAddEdit/index.jsx @@ -506,6 +506,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => { validator = true; } else { validator = false; + return validator; } // 发放规则 @@ -514,6 +515,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => { validator = true; } else { validator = false; + return validator; } if (validator) { @@ -929,6 +931,9 @@ const UseCouponAddEdit = forwardRef((props, ref) => { }); } else { let obj = rowData.only; + if (state.KeyPcType === "2") { + delete obj.id; + } setState({ product_title: "编辑立减金", productData: obj, diff --git a/src/components/UseExchangeAddEdit/index.jsx b/src/components/UseExchangeAddEdit/index.jsx index eae73a54..a8bdf355 100644 --- a/src/components/UseExchangeAddEdit/index.jsx +++ b/src/components/UseExchangeAddEdit/index.jsx @@ -186,18 +186,20 @@ const UseExchangeAddEdit = forwardRef((props, ref) => { const submit = () => { let validator = false; - if (codeInfoEl.current.validator()) { validator = true; } else { validator = false; + return validator; } if (codeRuleEl.current.validator()) { validator = true; } else { validator = false; + return validator; } + if (validator) { if (state.rank.length > 0) { let arr = state.tableData.filter((item) => item.checked); @@ -472,6 +474,9 @@ const UseExchangeAddEdit = forwardRef((props, ref) => { }); } else { let obj = rowData.only; + if (state.KeyPcType === "2") { + delete obj.id; + } setState({ product_title: "编辑立减金", productData: obj, diff --git a/src/pages/plan/add/edit.js b/src/pages/plan/add/edit.js index f86cf3df..4ed149a8 100644 --- a/src/pages/plan/add/edit.js +++ b/src/pages/plan/add/edit.js @@ -233,7 +233,7 @@ export default class add extends React.Component { } async onNextStep() { if (this.state.curstep >= 1) { - if ((await this.refs.step1.submit()) == true) { + if (await this.refs.step1.submit()) { this.setState({ isload: true }); this.setState({ curstep: 2 }); } else { @@ -397,9 +397,11 @@ export default class add extends React.Component { this.setState({ is_Edit: true }); if (await this.refs.step1.submit(plan_id)) { setTimeout(() => { - this.props.history.push("/home/plan-list/"); this.setState({ is_Edit: false }); + this.props.history.push("/home/plan-list/"); }, 1500); + } else { + this.setState({ is_Edit: false }); } } } 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(); } };