Purpose: uni-app Vue 3 + TypeScript mini-program/H5 client for enterprise water supply, delivery, agent, package, order, and driver workflows.
Root: D:\phpstudy_pro\WWW\saiadmin6.x\water-mini
Status: Active development; transaction/catalog fixes were completed on 2026-10-08 and regression-checked on 2026-10-09. Browser interaction and device acceptance remain outstanding.
Stack and commands
Runtime: Node.js; uni-app/Vue 3; TypeScript.
Package manager: npm (package-lock.json).
Development: npm run dev:h5; WeChat DevTools imports dist/build/mp-weixin after a build.
Build: npm run build:h5, npm run build:mp-weixin.
Preview publish: npm run preview:publish copies H5 output to server/public/water-mini.
Verification: npm run type-check, npm test.
Structure and entry points
src/pages.json: page routing and navigation titles.
src/api/client.ts: API base URL and authenticated uni.request transport.
src/api/schema.ts: generated API types.
src/stores/session.ts / src/stores/state.ts: session and active identity state.
src/stores/cart.ts: local package cart; server quote/checkout validates the final amount.
src/components/PackageCard.vue: package card visual and add-to-cart action.
src/pages/agent/customers.vue: subordinate-user page matching the supplied mobile reference.
src/pages/common/map.vue: shared single-location and route map page.
src/utils/location.ts: routes existing map actions to the shared map page.
src/utils/amap.ts: H5 AMap JS API loader.
Architecture and integrations
Package data comes from public GET /api/mini/v1/packages; checkout quote and submission remain server-authoritative.
The current package API advertises category_filter=false and publishes only the all tab; the UI uses the returned categories without package-name or device-flag guesses. Category, validity, and device-service metadata currently return null.
H5 map pages load AMap JS API using VITE_AMAP_KEY and optional VITE_AMAP_SECURITY_CODE from ignored .env.local.
H5 route maps call AMap Driving with the driver route origin and stop coordinates; long routes are split into chunks of up to 18 points.
WeChat builds use the native <map> component and uni.openLocation; AMap Web JS cannot run directly inside a mini-program page.
The development API default is http://192.168.110.245:8787/api/mini/v1; production should use an HTTPS domain and WeChat legal-domain configuration.
Conventions and constraints
Do not invent business success for unavailable payment, commission, GPS, or map data; show the unavailable state.
Preserve server pagination, identity guards, idempotent command flows, and generated API schema boundaries.
Keep local credentials in .env.local; never record keys or secrets in this context file.
project.private.config.json/src/manifest.json currently disable WeChat URL checking for local LAN development. Re-enable it for release builds.
Known issues and follow-ups
The current backend package model exposes no managed category, validity, or original-price fields; the UI uses safe fallbacks until those fields are added to the admin/API contract.
H5 AMap requires a valid JS API key, security code, and allowed domain. If the map reports a Key/domain error, inspect water-mini/.env.local and the AMap console.
For WeChat route display, native map markers are shown and the user can open the native map; road-level AMap route drawing is H5-only.
If a rebuilt page is not visible, rebuild the target (h5 or mp-weixin) and recompile/reimport the corresponding output directory.
Decisions and change notes
2026-09-22: Reworked package catalog/card UI to match the supplied screenshot while retaining real backend catalog and cart/checkout logic.
2026-09-22: Added shared map page, H5 AMap loader, route-map entry from driver routes, and native WeChat map fallback.
2026-09-22: Switched local mini-program API default from loopback to LAN host 192.168.110.245 for device testing.
Verification
Last checked: 2026-10-09.
Result: npm run type-check and 21 npm test checks passed; H5 preview HTML and entry asset hashes match the current build. No new build/publish was performed; browser/device acceptance remains outstanding.