# Low-Price Order Approval Completion Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Complete the low-price order flow by restricting it to normal orders, requiring approval confirmation, returning successful submissions to the pending list, and rejecting invalid price boundaries.
**Architecture:** Reuse the existing low-price approval sheet and pure approval-list builder. Add low-price-aware order-type helpers, a pure price-boundary helper consumed by both input and submit paths, and a small success-navigation helper so ordinary orders retain their current flow.
**Tech Stack:** WeChat Mini Program JavaScript, ES modules, Node.js built-in test runner.
## Global Constraints
- Preserve the user's existing `config.js` and `yarn.lock` changes.
- Use only `价格未触发最低价,其他正常单请到生意助手侧录单` when no goods triggers the minimum price.
- A low-price order is eligible when any submitted goods entry has `validMinSellPrice === 'Y'` and a current base price strictly below numeric `minSellPrice`.
- Low-price orders allow only order type `1` (`正常订单`).
- Reject prices below `0` with `商品价格不能小于0元` and prices above `100000` with `商品价格不能大于100000元`.
- Do not add dependencies, APIs, or `import.meta` to mini-program runtime files.
-[x] Change tests to require only normal order for `lowPriceFlag=1`, while normal restricted scenes retain normal and internal settlement.
-[x] Run `node scripts/run-node-tests.mjs tabWorkOrder/pages/createOrder/tests/orderMerchantConfig.test.mjs` and verify the new assertions fail under the two-type implementation.
-[x] Add the optional `lowPriceFlag` argument and pass `orderObj.lowPriceFlag` from `applyOrderTypeConfig`; normalize low-price order data to type `1`.
-[x] Re-run the focused test and verify it passes.
### Task 2: Restore the approval confirmation gate
- Calls: `page.openMinPriceApprovalSheet(items, save)` on the first valid low-price submission.
- Calls: `finishSubmit(save, true)` only after `onConfirmMinPriceApprovalSubmit`.
-[x] Add tests proving approval comparison uses `minSellPrice` and first submit opens the sheet without requesting the API.
-[x] Run the two focused tests and verify failures show the missing gate and old `upgradeShopMinPrice` preference.
-[x] Import and invoke `buildMinPriceApprovalList` in `finishSubmit`; when low-price items exist and `skipApprovalSheet` is false, open the sheet and return.
-[x] Keep confirmation using `executeAfterApproval` so the API is invoked exactly once.
-[x] Re-run the focused tests and verify they pass.
### Task 3: Return successful low-price submissions to pending
- Low-price success: refresh and patch the source low-price list page before navigating back; `onShow` performs the refreshed search. If the previous page is not that list, fall back to `/pages/tabWorkOrder/pages/index/index?activeIndex=1`.
-[x] Add tests for low-price versus ordinary success navigation and route-option tab synchronization.
-[x] Run focused tests and verify current `confirmOrder` redirect fails the expectations.
-[x] Implement the pure patch helper, update list `onRoute` to synchronize both tab indexes, and branch successful submission by `lowPriceFlag`.
-[x] Re-run focused tests and verify low-price and ordinary paths pass.
- Stores invalid input metadata on the affected goods object as `priceBoundaryError` without changing the last valid price.
-[x] Add pure tests for `-1`, `100000.01`, `0`, `100000`, and two-decimal normalization.
-[x] Add page tests proving invalid values show the exact message, do not update price, and block submission until corrected.
-[x] Run focused tests and verify failures under the current sanitizing/clamping behavior.
-[x] Implement the helper, use it in low-price `changePrice` and `changeMealPrice`, and recheck the stored values during low-price goods submission validation.
-[x] Re-run focused tests and verify they pass.
### Task 5: Update living documentation and verify
**Files:**
- Modify: `docs/tabWorkOrder/createOrder.md`
- Modify: `docs/order-lifecycle/README.md`
- Modify only if an in-scope regression is found elsewhere.
-[x] Update approval-flow and low-price order-type documentation; remove statements saying the approval entry is disabled.
-[x] Run `npm run test:createOrder`.
-[x] Run `npm run test:workOrder`.
-[x] Run `git diff --check`.
-[x] Scan mini-program runtime JavaScript for new `import.meta` and verify no new occurrence exists under the modified runtime files.
-[x] Inspect `git diff --stat` and `git status --short`; preserve unrelated `config.js` and `yarn.lock` modifications.