fix: 优化立减金加载速度
This commit is contained in:
parent
ef0f8071e6
commit
71047d6415
|
@ -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 });
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue