fix: 修复key批次绑定对象

This commit is contained in:
zhangds 2022-10-27 15:48:43 +08:00
parent 5258d98c60
commit 9ca647b8d5
1 changed files with 61 additions and 4 deletions

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