Merge branch 'couponV2.0' of codeup.aliyun.com:5f9118049cffa29cfdd3be1c/marketing/frontend into couponV2.0

This commit is contained in:
wangsongsole 2022-10-28 10:20:13 +08:00
commit 73c5188a37
4 changed files with 76 additions and 7 deletions

View File

@ -506,6 +506,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
validator = true; validator = true;
} else { } else {
validator = false; validator = false;
return validator;
} }
// //
@ -514,6 +515,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
validator = true; validator = true;
} else { } else {
validator = false; validator = false;
return validator;
} }
if (validator) { if (validator) {
@ -929,6 +931,9 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
}); });
} else { } else {
let obj = rowData.only; let obj = rowData.only;
if (state.KeyPcType === "2") {
delete obj.id;
}
setState({ setState({
product_title: "编辑立减金", product_title: "编辑立减金",
productData: obj, productData: obj,

View File

@ -186,18 +186,20 @@ const UseExchangeAddEdit = forwardRef((props, ref) => {
const submit = () => { const submit = () => {
let validator = false; let validator = false;
if (codeInfoEl.current.validator()) { if (codeInfoEl.current.validator()) {
validator = true; validator = true;
} else { } else {
validator = false; validator = false;
return validator;
} }
if (codeRuleEl.current.validator()) { if (codeRuleEl.current.validator()) {
validator = true; validator = true;
} else { } else {
validator = false; validator = false;
return validator;
} }
if (validator) { if (validator) {
if (state.rank.length > 0) { if (state.rank.length > 0) {
let arr = state.tableData.filter((item) => item.checked); let arr = state.tableData.filter((item) => item.checked);
@ -472,6 +474,9 @@ const UseExchangeAddEdit = forwardRef((props, ref) => {
}); });
} else { } else {
let obj = rowData.only; let obj = rowData.only;
if (state.KeyPcType === "2") {
delete obj.id;
}
setState({ setState({
product_title: "编辑立减金", product_title: "编辑立减金",
productData: obj, productData: obj,

View File

@ -233,7 +233,7 @@ export default class add extends React.Component {
} }
async onNextStep() { async onNextStep() {
if (this.state.curstep >= 1) { if (this.state.curstep >= 1) {
if ((await this.refs.step1.submit()) == true) { if (await this.refs.step1.submit()) {
this.setState({ isload: true }); this.setState({ isload: true });
this.setState({ curstep: 2 }); this.setState({ curstep: 2 });
} else { } else {
@ -397,9 +397,11 @@ export default class add extends React.Component {
this.setState({ is_Edit: true }); this.setState({ is_Edit: true });
if (await this.refs.step1.submit(plan_id)) { if (await this.refs.step1.submit(plan_id)) {
setTimeout(() => { setTimeout(() => {
this.props.history.push("/home/plan-list/");
this.setState({ is_Edit: false }); this.setState({ is_Edit: false });
this.props.history.push("/home/plan-list/");
}, 1500); }, 1500);
} else {
this.setState({ is_Edit: false });
} }
} }
} }

View File

@ -656,6 +656,66 @@ const UseKeyAddEdit = () => {
setState({ drawerVisible: false }); 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 = () => { const examineBtn = () => {
if (keyFormEl.current.validator()) { if (keyFormEl.current.validator()) {
@ -684,10 +744,7 @@ const UseKeyAddEdit = () => {
Notify.error("绑定数不能为空"); Notify.error("绑定数不能为空");
return; return;
} }
changeKeyName();
setState({
audit_visible: true,
});
} }
}; };