refactor(distribution): 移除不必要的时间参数构建逻辑

- 删除 buildQueryParams 方法及相关的 startTime 和 endTime 参数,简化数据查询逻辑
- 更新 loadOverviewData 和 loadBehavior 方法,直接调用 getDistributionOverviewV2,无需构建额外的查询参数
- 优化代码结构,提高可读性和维护性
This commit is contained in:
田香琪
2026-09-13 17:06:41 +08:00
parent f4a50cd854
commit dfb790e713

View File

@@ -243,8 +243,6 @@ export default {
year: item.year || "",
month: item.month || "",
storeId: item.storeId || "",
startTime: item.startTime || "",
endTime: item.endTime || "",
};
},
onTabChange(name) {
@@ -254,12 +252,6 @@ export default {
this.loadGoods();
}
},
buildQueryParams() {
return {
startTime: this.params.startTime || "",
endTime: this.params.endTime || "",
};
},
formatNumber(val) {
if (val == null || val === "") return 0;
const num = Number(val);
@@ -271,12 +263,11 @@ export default {
},
async loadOverviewData() {
const query = { ...this.params };
const v2Query = this.buildQueryParams();
const [overviewRes, distributorRes, goodsRes, overviewV2Res] = await Promise.all([
API_Statistics.getDistributionOverview(query),
API_Statistics.getDistributionRankDistributor(query),
API_Statistics.getDistributionRankGoods(query),
getDistributionOverviewV2(v2Query),
getDistributionOverviewV2(),
]);
if (overviewRes && overviewRes.success) {
this.overview = overviewRes.result || {};
@@ -294,7 +285,6 @@ export default {
loadBehavior() {
this.behaviorLoading = true;
getDistributionBehaviorV2({
...this.buildQueryParams(),
pageNumber: this.behaviorPage.pageNumber,
pageSize: this.behaviorPage.pageSize,
}).then((res) => {
@@ -312,7 +302,6 @@ export default {
loadGoods() {
this.goodsLoading = true;
getDistributionGoodsV2({
...this.buildQueryParams(),
pageNumber: this.goodsPage.pageNumber,
pageSize: this.goodsPage.pageSize,
}).then((res) => {