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