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,6 +864,28 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
addProductBtnLoading: true, addProductBtnLoading: true,
scopePopType: "addProduct", scopePopType: "addProduct",
}); });
//
let param = {
reseller_id: direct_reseller_ids,
};
getProductInfoSelect(param).then((res) => {
setState({ addProductBtnLoading: false, addGoldBtnLoading: false });
handelResponse(
res,
(req, msg) => {
// !!!!!!!!!!!!!! 使 productsList
sessionStorage.setItem("productsList", JSON.stringify(req.data));
// !!!!!!!!!!!!!! 使 productsList
setState({ productData: null });
setState({
showScopePop: true,
});
},
(err) => {
console.log("err =>", err);
}
);
});
} else { } else {
// //
sessionStorage.setItem( sessionStorage.setItem(
@ -877,30 +899,12 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
product_title: "新增立减金", product_title: "新增立减金",
addGoldBtnLoading: true, addGoldBtnLoading: true,
scopePopType: "addKnockGold", scopePopType: "addKnockGold",
productData: null,
});
setState({
showScopePop: true,
}); });
} }
//
let param = {
reseller_id: direct_reseller_ids,
};
getProductInfoSelect(param).then((res) => {
setState({ addProductBtnLoading: false, addGoldBtnLoading: false });
handelResponse(
res,
(req, msg) => {
// !!!!!!!!!!!!!! 使 productsList
sessionStorage.setItem("productsList", JSON.stringify(req.data));
// !!!!!!!!!!!!!! 使 productsList
setState({ productData: null });
setState({
showScopePop: true,
});
},
(err) => {
console.log("err =>", err);
}
);
});
} catch (err) { } catch (err) {
setState({ addProductBtnLoading: false, addGoldBtnLoading: false }); setState({ addProductBtnLoading: false, addGoldBtnLoading: false });
} }
@ -920,33 +924,32 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
setState({ setState({
tableLoading: true, tableLoading: true,
}); });
// //
let param = { /* 区分立减金 */
reseller_id: direct_reseller_ids, if (rowData.type === 2) {
}; let obj = rowData.only;
getProductInfoSelect(param).then((res) => { setState({
setState({ tableLoading: false }); product_title: "编辑立减金",
handelResponse( productData: obj,
res, scopePopType: "addKnockGold",
(req, msg) => { showScopePop: true,
// table_index: index,
sessionStorage.setItem("productsList", JSON.stringify(req.data)); });
/* 区分立减金 */ } else {
if (rowData.type === 2) { let param = {
let obj = rowData.only; reseller_id: direct_reseller_ids,
setState({ };
product_title: "编辑立减金", getProductInfoSelect(param).then((res) => {
productData: obj, setState({ tableLoading: false });
scopePopType: "addKnockGold", handelResponse(
showScopePop: true, res,
table_index: index, (req, msg) => {
}); //
} else { sessionStorage.setItem("productsList", JSON.stringify(req.data));
// code_batch_id // code_batch_id
if (state.isState === "1") { if (state.isState === "1") {
delete rowData.code_batch_id; delete rowData.code_batch_id;
} }
console.log("rowData =>", rowData);
setState({ setState({
product_title: "编辑商品", product_title: "编辑商品",
productData: rowData, productData: rowData,
@ -954,13 +957,13 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
showScopePop: true, showScopePop: true,
table_index: index, table_index: index,
}); });
},
(err) => {
console.log("err =>", err);
} }
}, );
(err) => { });
console.log("err =>", err); }
}
);
});
} catch (err) { } catch (err) {
setState({ tableLoading: false }); setState({ tableLoading: false });
} }