refactor(ecom): 订单状态统计规则从单一开关升级为多维度独立控制

- ec_order_status 表 auto_statistics 拆分为四个独立字段:include_sales_amount / include_product_cost / include_freight_cost / include_other_cost / include_refund
- CompanyOverviewServiceImpl / ShopOverviewStatisticsServiceImpl / ProductOverviewServiceImpl / ExportStatusRangeHelper 全部改为按各维度独立统计
- OrderStatus PO/DTO/VO 层字段更新,Service 层校验逻辑同步调整
- ProductSpecImportHelper 导入逻辑适配新字段
- 前端订单状态配置页适配新字段及展示
- 新增 OrderStatusCard.vue 卡片组件
- 更新 ec_design.sql 设计文档
This commit is contained in:
小蟑螂
2026-05-05 21:09:46 +08:00
parent a1953d5447
commit c6025a7c2c
22 changed files with 1173 additions and 616 deletions
@@ -0,0 +1,23 @@
-- 订单状态表:移除「自动参与统计」「是否退款」,改为五个独立统计维度(0/1)
-- 兼容旧数据:原 auto_statistics=1 则四项成本/销售额维度置 1;原 is_refund=1 则退款维度置 1
ALTER TABLE `ec_order_status`
ADD COLUMN `include_sales_amount` tinyint NOT NULL DEFAULT 0 COMMENT '是否计入销售额/单量等统计 0否 1是' AFTER `sort_order`,
ADD COLUMN `include_product_cost` tinyint NOT NULL DEFAULT 0 COMMENT '是否计入商品成本统计 0否 1是' AFTER `include_sales_amount`,
ADD COLUMN `include_freight_cost` tinyint NOT NULL DEFAULT 0 COMMENT '是否计入运费成本统计 0否 1是' AFTER `include_product_cost`,
ADD COLUMN `include_other_cost` tinyint NOT NULL DEFAULT 0 COMMENT '是否计入其他成本统计 0否 1是' AFTER `include_freight_cost`,
ADD COLUMN `include_refund` tinyint NOT NULL DEFAULT 0 COMMENT '是否计入退款金额统计 0否 1是' AFTER `include_other_cost`;
UPDATE `ec_order_status`
SET
`include_sales_amount` = IF(`auto_statistics` = 1, 1, 0),
`include_product_cost` = IF(`auto_statistics` = 1, 1, 0),
`include_freight_cost` = IF(`auto_statistics` = 1, 1, 0),
`include_other_cost` = IF(`auto_statistics` = 1, 1, 0),
`include_refund` = IF(`is_refund` = 1, 1, 0);
ALTER TABLE `ec_order_status`
DROP INDEX `idx_auto_statistics`,
DROP INDEX `idx_is_refund`,
DROP COLUMN `auto_statistics`,
DROP COLUMN `is_refund`;