Files
guilixu-admin/.workbuddy/memory/2026-07-23.md
赵忠林 44e416525d fix(shopOrder): 修复导出商品总数量和完善导出字段
- 新增 getGoodsTotalNum 函数,基于订单商品明细求总数量,修正商品总数量计算错误
- 修改导出商品总数量列,避免使用订单级 totalNum 字段,确保数量正确
- 补齐导出字段,从8列扩展至15列,包含收货人、联系电话、配送方式等物流关键字段
- 导出数据信息同步商品明细,通过 Promise.all 调用逐单获取商品详情
- 支持按当前标签筛选导出,确保导出数据符合当前视图筛选条件
- 增加辅助函数优化代码结构,如 getShopName、getDeliveryTypeLabel 等
2026-07-23 08:00:34 +08:00

25 lines
2.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 2026-07-23
## 订单导出字段补齐(物流部发货用)
- 文件:`src/views/shop/shopOrder/components/search.vue``handleExport`
- 原来只导出 8 列(订单编号/订单标题[实际是 comments]/买家姓名/手机/实付金额/支付方式/付款时间/下单时间),且缺物流发货关键字段。
- 新增并补齐到 15 列:收货人、联系电话、收货地址、配送方式(0快递/1自提/2商家送货)、商品明细(商品名x数量)、商品总数量、实付金额、配送时间、自提码、发货/自提店铺、买家备注、支付方式、发货状态(10未发/20已发/30部分)、下单时间。
- 新增辅助函数:`getDeliveryTypeLabel` / `getDeliveryStatusLabel` / `getGoodsSummary` / `getShopName`
- 注意:枚举值与 `deliveryModal.vue` 一致deliveryType 0快递 1无需发货/自提 2商家送货
- 环境提示:本机 Grep 工具因缺 libpcre2 不可用,搜代码改用 Python 脚本遍历。
## 导出跟随当前标签筛选(避免混入非待发货订单)
- index.vue新增 `statusFilterForExport` computed = `getStatusFilterByTab(activeKey)`,并通过 `:status-filter` 传给 `<search>`
- search.vue给 props 加 `statusFilter?`,导出请求改为 `listShopOrder({ ...where, statusFilter: props.statusFilter })`
- 效果:导出所见即所得——切到「待发货」标签再导出,只导出待发货;其它标签同理。全部标签下 statusFilter=undefined 不额外过滤。
## 修复:导出的商品明细为空
- 根因:`listShopOrder`(非分页列表接口)不返回 `orderGoods` 嵌套;页面表格/详情用的是 `pageShopOrder` 和单独的 `listShopOrderGoods` 取明细。
- 修复:导出时在 `search.vue` 中用 `Promise.all``orderId` 逐个调 `listShopOrderGoods({orderId})` 补齐商品明细,再写入「商品明细」列。
- 商品明细格式升级为 `商品名(规格) x数量`,规格取自 ShopOrderGoods.spec便于物流发对型号。
- 单订单请求失败时 `.catch(() => [])` 兜底,不影响其它订单。
## 修复:商品总数量计算不对
- 根因:「商品总数量」列原本用订单级 `d.totalNum`,但 `listShopOrder` 列表接口未返回该字段(与 orderGoods 同理),导致算错/为空。
- 修复:新增 `getGoodsTotalNum(goods)`,对 `listShopOrderGoods` 取到的明细 `goodsList[idx]` 逐行 `totalNum` 求和。改动后「商品总数量」与「商品明细」列同源,必然对得上。