Commit 0bf773d0 by 张立顺

docs: plan boutique main list daily display

1 parent 6de596f3
# Boutique Main List Daily Display Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Display customer tags and actual delivery date in the real boutique customer-work-order Tab while accepting nested-customer and root-level API fields.
**Architecture:** Extend the existing boutique list adapter to normalize each field with nested-customer priority and root-level fallback. Wire that adapter into `pages/tabWorkOrder/pages/index/index.js`, then render the normalized display state inside the page’s existing order information list.
**Tech Stack:** WeChat Mini Program JavaScript/WXML, Node.js built-in test runner, existing customer daily-field helpers.
## Global Constraints
- The real main Tab page is `pages/tabWorkOrder/pages/index/index`.
- Each field uses `item.customer.<field>` first and falls back to `item.<field>` only when the nested field is empty.
- Existing nested and root values that conflict resolve in favor of the nested customer value.
- Continue formatting 13-digit delivery timestamps through the shared UTC+8 formatter.
- Do not change equity behavior, detail/form/submit behavior, visibility rules, conditional required validation, picker limits, phone source, or the independent `tabWorkOrderRelevance` route.
- Preserve the user's unstaged `config.js` change and never stage or commit it.
---
### Task 1: Normalize both response shapes and render them in the main list
**Files:**
- Modify: `tabWorkOrder/pages/createOrder/services/customerDailyFields.helpers.js:205-207`
- Modify: `pages/tabWorkOrder/pages/index/index.js:1-15,736-748`
- Modify: `pages/tabWorkOrder/pages/index/index.wxml:109-138`
- Test: `tabWorkOrder/pages/createOrder/tests/customerDailyFields.helpers.test.mjs`
- Test: `tabWorkOrder/pages/createOrder/tests/customerDailyFields.ui.test.mjs`
**Interfaces:**
- Consumes: `buildBoutiqueCustomerDailyDisplay(customer): BoutiqueCustomerDailyDisplay`.
- Produces: `buildBoutiqueCustomerDailyListDisplay(orderItem = {}): BoutiqueCustomerDailyDisplay`, using nested-first per-field fallback.
- [ ] **Step 1: Add failing adapter and real-page tests**
Keep the existing nested-conflict assertion in `IT-WO-DAILY-019`, and change its root-only assertion so root values are displayed:
```js
assert.deepEqual(
customerDailyFields.buildBoutiqueCustomerDailyListDisplay({
customerTags: '1',
actualDeliveryDate: 1787068800000
}),
{
showCustomerTags: true,
showActualDeliveryDate: true,
customerTagLabels: ['已触客'],
customerTagsText: '已触客',
actualDeliveryDate: '2026-08-19'
}
)
```
Add a per-field fallback assertion showing nested tags and a root delivery date can be combined:
```js
assert.deepEqual(
customerDailyFields.buildBoutiqueCustomerDailyListDisplay({
actualDeliveryDate: 1787068800000,
customer: { customerTags: '3', actualDeliveryDate: '' }
}),
{
showCustomerTags: true,
showActualDeliveryDate: true,
customerTagLabels: ['已交付引荐'],
customerTagsText: '已交付引荐',
actualDeliveryDate: '2026-08-19'
}
)
```
Add `IT-WO-DAILY-UI-014` that reads the real main page JS/WXML and asserts:
```js
const mainListJs = read('../../../../pages/tabWorkOrder/pages/index/index.js')
const mainListWxml = read('../../../../pages/tabWorkOrder/pages/index/index.wxml')
assert.match(mainListJs, /buildBoutiqueCustomerDailyListDisplay/)
assert.match(
mainListJs,
/e\.customerDailyDisplay\s*=\s*buildBoutiqueCustomerDailyListDisplay\(e\)/
)
assert.match(mainListWxml, /li\.customerDailyDisplay\.showCustomerTags/)
assert.match(mainListWxml, /li\.customerDailyDisplay\.customerTagsText/)
assert.match(mainListWxml, /li\.customerDailyDisplay\.showActualDeliveryDate/)
assert.match(mainListWxml, /li\.customerDailyDisplay\.actualDeliveryDate/)
```
- [ ] **Step 2: Run focused tests and verify RED**
Run:
```bash
node --experimental-detect-module --test tabWorkOrder/pages/createOrder/tests/customerDailyFields.helpers.test.mjs tabWorkOrder/pages/createOrder/tests/customerDailyFields.ui.test.mjs
```
Expected: the root-only and mixed fallback assertions fail because the adapter currently ignores root fields; the UI contract fails because the real main page has neither adapter wiring nor WXML rows.
- [ ] **Step 3: Implement nested-first field normalization**
Replace the adapter body with:
```js
export function buildBoutiqueCustomerDailyListDisplay(orderItem = {}) {
const source = orderItem || {}
const nestedCustomer = source.customer || {}
return buildBoutiqueCustomerDailyDisplay({
...nestedCustomer,
customerTags: nestedCustomer.customerTags || source.customerTags || '',
actualDeliveryDate:
nestedCustomer.actualDeliveryDate || source.actualDeliveryDate || ''
})
}
```
- [ ] **Step 4: Wire the adapter into the real main Tab**
Import the helper in `pages/tabWorkOrder/pages/index/index.js`:
```js
import { buildBoutiqueCustomerDailyListDisplay } from '~/tabWorkOrder/pages/createOrder/services/customerDailyFields.helpers.js'
```
At the start of `data.list.map(e => {`, add:
```js
e.customerDailyDisplay = buildBoutiqueCustomerDailyListDisplay(e)
```
Inside the existing WXML `<view class="order-list">`, after the configured `orderObj` loop, add conditional rows:
```xml
<view class="order" wx:if="{{ li.customerDailyDisplay.showCustomerTags }}">
<view class="order-label">日报标签</view>
<view class="order-value">{{ li.customerDailyDisplay.customerTagsText }}</view>
</view>
<view class="order" wx:if="{{ li.customerDailyDisplay.showActualDeliveryDate }}">
<view class="order-label">实际交付日期</view>
<view class="order-value">{{ li.customerDailyDisplay.actualDeliveryDate }}</view>
</view>
```
- [ ] **Step 5: Verify GREEN and repository regression coverage**
Run:
```bash
node --experimental-detect-module --test tabWorkOrder/pages/createOrder/tests/customerDailyFields.helpers.test.mjs tabWorkOrder/pages/createOrder/tests/customerDailyFields.ui.test.mjs
npm run test:createOrder
npm test
```
Expected: every command exits `0`; nested values win, root-only values display, mixed fields combine, and the real main page exposes both rows.
- [ ] **Step 6: Commit only the five implementation files**
```bash
git add tabWorkOrder/pages/createOrder/services/customerDailyFields.helpers.js pages/tabWorkOrder/pages/index/index.js pages/tabWorkOrder/pages/index/index.wxml tabWorkOrder/pages/createOrder/tests/customerDailyFields.helpers.test.mjs tabWorkOrder/pages/createOrder/tests/customerDailyFields.ui.test.mjs
git diff --cached --name-only
git diff --cached --check
git commit -m "fix: show daily fields in boutique main list"
```
Before committing, verify the staged file list contains exactly those five paths and excludes `config.js`.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!