fix: 优化立减金加载速度

This commit is contained in:
zhangds 2022-10-14 14:08:42 +08:00
parent ef0f8071e6
commit 71047d6415
1 changed files with 54 additions and 51 deletions

View File

@ -864,21 +864,6 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
addProductBtnLoading: true,
scopePopType: "addProduct",
});
} else {
//
sessionStorage.setItem(
"knockGold_effectDate",
JSON.stringify({
begin_time: form_info_data.date_time[0],
end_time: form_info_data.date_time[1],
})
);
setState({
product_title: "新增立减金",
addGoldBtnLoading: true,
scopePopType: "addKnockGold",
});
}
//
let param = {
reseller_id: direct_reseller_ids,
@ -901,6 +886,25 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
}
);
});
} else {
//
sessionStorage.setItem(
"knockGold_effectDate",
JSON.stringify({
begin_time: form_info_data.date_time[0],
end_time: form_info_data.date_time[1],
})
);
setState({
product_title: "新增立减金",
addGoldBtnLoading: true,
scopePopType: "addKnockGold",
productData: null,
});
setState({
showScopePop: true,
});
}
} catch (err) {
setState({ addProductBtnLoading: false, addGoldBtnLoading: false });
}
@ -920,17 +924,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
setState({
tableLoading: true,
});
//
let param = {
reseller_id: direct_reseller_ids,
};
getProductInfoSelect(param).then((res) => {
setState({ tableLoading: false });
handelResponse(
res,
(req, msg) => {
//
sessionStorage.setItem("productsList", JSON.stringify(req.data));
//
/* 区分立减金 */
if (rowData.type === 2) {
let obj = rowData.only;
@ -942,11 +936,20 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
table_index: index,
});
} else {
let param = {
reseller_id: direct_reseller_ids,
};
getProductInfoSelect(param).then((res) => {
setState({ tableLoading: false });
handelResponse(
res,
(req, msg) => {
//
sessionStorage.setItem("productsList", JSON.stringify(req.data));
// code_batch_id
if (state.isState === "1") {
delete rowData.code_batch_id;
}
console.log("rowData =>", rowData);
setState({
product_title: "编辑商品",
productData: rowData,
@ -954,13 +957,13 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
showScopePop: true,
table_index: index,
});
}
},
(err) => {
console.log("err =>", err);
}
);
});
}
} catch (err) {
setState({ tableLoading: false });
}