Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-boutique-work-wechat
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d4937187
authored
Aug 25, 2026
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat bug修复
1 parent
12afa6a3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
384 additions
and
51 deletions
components/CustomerInfo/CustomerInfo.js
components/CustomerInfo/customerInfo.pagination.js
docs/generated/API-CALLER-INDEX.md
docs/generated/PROJECT-SUMMARY.md
docs/generated/domains/packageDynamicForm.md
docs/generated/knowledge-graph.json
packageDynamicForm/api/storeDailyReport.js
packageDynamicForm/docs/PAGES.md
packageDynamicForm/docs/daily-report-save-and-json.md
packageDynamicForm/pages/storeDailyReport/storeDailyReport.js
packageDynamicForm/tests/storeDailyReportDetail.test.mjs
packageDynamicForm/tests/storeDailyReportPage.contract.test.mjs
tabWorkOrder/pages/createOrder/createOrder.wxml
tests/customerInfo.pagination.test.mjs
tests/workOrderLowPriceGuard.test.mjs
components/CustomerInfo/CustomerInfo.js
View file @
d493718
...
...
@@ -33,8 +33,11 @@ Component({
}
},
apiType
:
Number
,
/** 仅新建精品工单传 1,用于客户档案列表查询低价单标记 */
lowPriceFlag
:
Number
/** 调用页显式传入时才下发,null 保持其他消费者原查询口径 */
lowPriceFlag
:
{
type
:
null
,
value
:
null
}
},
data
:
{
...
...
components/CustomerInfo/customerInfo.pagination.js
View file @
d493718
...
...
@@ -7,14 +7,14 @@ const DEFAULT_PAGE_SIZE = 20
/**
* 构建按工单查询客户档案的分页参数。
* lowPriceFlag 仅在调用页显式传 1 时下发,避免改变共享组件其他消费者的查询口径。
* lowPriceFlag 仅在调用页显式传
0 或
1 时下发,避免改变共享组件其他消费者的查询口径。
*
* @param {Object} options 查询上下文
* @param {number|string} [options.merchantId] 组件传入的门店 ID
* @param {number|string} [options.fallbackMerchantId] 当前登录用户的门店 ID
* @param {number} options.pageNum 当前页码
* @param {string} [options.keyword] 搜索关键字
* @param {number|string
} [options.lowPriceFlag] 低价工单查询标记
* @param {number|string
|null} [options.lowPriceFlag] 低价工单查询标记;null/undefined 不下发
* @returns {Object} getWorkPackageGoodsList 请求参数
*/
function
buildCustomerListRequestParams
({
...
...
@@ -32,8 +32,8 @@ function buildCustomerListRequestParams({
keyword
}
if
(
Number
(
lowPriceFlag
)
===
1
)
{
params
.
lowPriceFlag
=
1
if
(
[
0
,
1
,
'0'
,
'1'
].
includes
(
lowPriceFlag
)
)
{
params
.
lowPriceFlag
=
Number
(
lowPriceFlag
)
}
return
params
...
...
docs/generated/API-CALLER-INDEX.md
View file @
d493718
...
...
@@ -330,6 +330,9 @@
|
`packageDynamicForm/api/storeDailyReport.js#fetchReportDetail`
|
`packageDynamicForm/pages/storeDailyReport/storeDailyReport.js`
| — |
|
`packageDynamicForm/api/storeDailyReport.js#fetchSchema`
| — | — |
|
`packageDynamicForm/api/storeDailyReport.js#fetchWeeklyList`
|
`packageDynamicForm/pages/storeDailyReport/storeDailyReport.js`
| — |
|
`packageDynamicForm/api/storeDailyReport.js#hasValidDetailSchemaSnapshot`
|
`packageDynamicForm/pages/storeDailyReport/storeDailyReport.js`
| — |
|
`packageDynamicForm/api/storeDailyReport.js#isValidStoreDailySchemaList`
| — | — |
|
`packageDynamicForm/api/storeDailyReport.js#isValidStoreDailySnapshotField`
| — | — |
|
`packageDynamicForm/api/storeDailyReport.js#logStoreSaveRequestDebug`
| — | — |
|
`packageDynamicForm/api/storeDailyReport.js#normalizeDetailJsonContent`
| — | — |
|
`packageDynamicForm/api/storeDailyReport.js#normalizeDetailResponse`
| — | — |
...
...
docs/generated/PROJECT-SUMMARY.md
View file @
d493718
...
...
@@ -4,15 +4,15 @@
## 规模
-
节点:99
08
-
关系:227
72
-
节点:99
11
-
关系:227
80
-
未解析:151
## 节点类型
| 类型 | 数量 |
| --- | --- |
| apiOperation | 71
2
|
| apiOperation | 71
5
|
| component | 266 |
| document | 134 |
| domain | 15 |
...
...
@@ -29,14 +29,14 @@
| --- | --- |
| bindsEvent | 2463 |
| calls | 2511 |
| callsApi | 77
4
|
| callsApi | 77
5
|
| callsEndpoint | 491 |
| contains | 1866 |
| coveredBy | 41
3
|
| coveredBy | 41
4
|
| declares | 7124 |
| definesApi | 71
2
|
| definesApi | 71
5
|
| documentedBy | 530 |
| imports | 198
1
|
| imports | 198
4
|
| navigatesTo | 240 |
| readsState | 2728 |
| usesComponent | 866 |
...
...
docs/generated/domains/packageDynamicForm.md
View file @
d493718
...
...
@@ -21,7 +21,7 @@
| --- | --- |
| page | 5 |
| component | 18 |
| apiOperation | 21
5
|
| apiOperation | 21
8
|
| globalState | 1 |
| test | 88 |
| document | 25 |
...
...
@@ -205,6 +205,9 @@
| apiOperation |
`packageDynamicForm/api/storeDailyReport.js#fetchReportDetail`
|
| apiOperation |
`packageDynamicForm/api/storeDailyReport.js#fetchSchema`
|
| apiOperation |
`packageDynamicForm/api/storeDailyReport.js#fetchWeeklyList`
|
| apiOperation |
`packageDynamicForm/api/storeDailyReport.js#hasValidDetailSchemaSnapshot`
|
| apiOperation |
`packageDynamicForm/api/storeDailyReport.js#isValidStoreDailySchemaList`
|
| apiOperation |
`packageDynamicForm/api/storeDailyReport.js#isValidStoreDailySnapshotField`
|
| apiOperation |
`packageDynamicForm/api/storeDailyReport.js#logStoreSaveRequestDebug`
|
| apiOperation |
`packageDynamicForm/api/storeDailyReport.js#normalizeDetailJsonContent`
|
| apiOperation |
`packageDynamicForm/api/storeDailyReport.js#normalizeDetailResponse`
|
...
...
docs/generated/knowledge-graph.json
View file @
d493718
This file is too large to display.
packageDynamicForm/api/storeDailyReport.js
View file @
d493718
...
...
@@ -26,7 +26,12 @@ import {
}
from
'../form-engine/app-subform-json.js'
const
{
buildDailyReportSaveRequest
}
=
require
(
'../form-engine/save-request.js'
)
import
{
normalizeSchemaRoot
}
from
'../form-engine/schema-normalizer.js'
import
{
listSubforms
}
from
'../form-engine/field-types.js'
import
{
listSubforms
,
getSubformRowTemplate
,
getStaticGroupChildren
}
from
'../form-engine/field-types.js'
import
{
getFieldComponentMap
}
from
'../form-engine/field-types/registry.js'
import
{
resolveBaseSceneCode
}
from
'../form-engine/page-context.js'
...
...
@@ -119,6 +124,63 @@ function normalizeDetailJsonContent(jsonContent) {
return
JSON
.
stringify
(
list
)
}
const
STORE_DAILY_SNAPSHOT_FIELD_TYPES
=
new
Set
([
...
Object
.
keys
(
getFieldComponentMap
()),
'group'
])
function
isValidStoreDailySnapshotField
(
field
,
seenKeys
)
{
if
(
!
field
||
typeof
field
!==
'object'
||
Array
.
isArray
(
field
))
{
return
false
}
if
(
typeof
field
.
key
!==
'string'
||
!
field
.
key
.
trim
()
||
seenKeys
.
has
(
field
.
key
))
{
return
false
}
if
(
typeof
field
.
type
!==
'string'
||
!
STORE_DAILY_SNAPSHOT_FIELD_TYPES
.
has
(
field
.
type
)
)
{
return
false
}
seenKeys
.
add
(
field
.
key
)
if
(
field
.
type
===
'subform'
)
{
const
children
=
getSubformRowTemplate
(
field
)
return
(
children
.
length
>
0
&&
children
.
every
(
child
=>
isValidStoreDailySnapshotField
(
child
,
seenKeys
))
)
}
if
(
field
.
type
===
'group'
)
{
const
children
=
getStaticGroupChildren
(
field
)
return
(
children
.
length
>
0
&&
children
.
every
(
child
=>
isValidStoreDailySnapshotField
(
child
,
seenKeys
))
)
}
return
true
}
function
isValidStoreDailySchemaList
(
list
=
[])
{
if
(
!
Array
.
isArray
(
list
)
||
!
list
.
length
)
{
return
false
}
const
seenKeys
=
new
Set
()
return
(
list
.
some
(
field
=>
field
?.
type
!==
'divider'
)
&&
list
.
every
(
field
=>
isValidStoreDailySnapshotField
(
field
,
seenKeys
))
)
}
/**
* 判断门店日报详情是否包含可独立渲染的完整 schema 快照。
* @param {Object} [detail={}] 日报详情(含 jsonContent)
* @returns {boolean} 可直接使用历史快照时返回 true
*/
function
hasValidDetailSchemaSnapshot
(
detail
=
{})
{
return
isValidStoreDailySchemaList
(
normalizeJsonContentList
(
detail
.
jsonContent
))
}
/**
* 规范化用户信息,补齐 merchantId、staffUuid 等日报所需字段
* @param {Object} [userInfo={}] 原始用户信息
...
...
@@ -399,6 +461,29 @@ async function fetchSchema({
detail
,
detailValues
=
{}
}
=
{})
{
const
detailSchemaList
=
normalizeJsonContentList
(
detail
?.
jsonContent
)
const
hasValidDetailSchema
=
isValidStoreDailySchemaList
(
detailSchemaList
)
if
(
hasValidDetailSchema
)
{
// 详情 jsonContent 是保存时的完整模板快照,历史记录不能受当前模板变更影响。
const
normalizedDetailRoot
=
normalizeSchemaRoot
(
{
list
:
detailSchemaList
},
SCHEMA_OPTIONS_MAP
)
const
initialValues
=
mergeTemplateDefaultsIntoInitialValues
(
normalizedDetailRoot
.
list
,
parseJsonContentDetailValues
(
detail
.
jsonContent
,
normalizedDetailRoot
.
list
)
)
warnIfDetailSubformEchoEmpty
(
detail
,
initialValues
,
normalizedDetailRoot
.
list
)
return
{
code
:
0
,
message
:
'ok'
,
data
:
stripValuesFromSchemaRoot
(
mergeAppJsonIntoSchema
(
normalizedDetailRoot
,
detail
)
),
initialValues
}
}
const
result
=
await
fetchSchemaRootAdapter
({
reportTemplateId
,
baseSceneCode
,
...
...
@@ -415,20 +500,15 @@ async function fetchSchema({
return
{
code
:
-
1
,
message
:
'加载表单模板失败'
,
data
:
null
}
}
const
normalizedRoot
=
normalizeSchemaRoot
(
data
,
SCHEMA_OPTIONS_MAP
)
let
schema
=
normalizedRoot
if
(
detail
?.
jsonContent
)
{
schema
=
mergeAppJsonIntoSchema
(
normalizedRoot
,
detail
)
}
const
initialValues
=
mergeTemplateDefaultsIntoInitialValues
(
normalizedRoot
.
list
,
resolveSchemaDetailValues
(
detail
,
normalizedRoot
.
list
,
detailValues
)
)
warnIfDetailSubformEchoEmpty
(
detail
,
initialValues
,
normalizedRoot
.
list
)
schema
=
stripValuesFromSchemaRoot
(
schema
)
return
{
code
:
0
,
message
:
'ok'
,
data
:
s
chema
,
data
:
s
tripValuesFromSchemaRoot
(
normalizedRoot
)
,
initialValues
}
}
...
...
@@ -670,12 +750,14 @@ async function fetchMonthlyPendingCount({ merchantId, reportDate, sceneType } =
* @param {Object} [options.userContext] 用户上下文(merchantId、staffUuid 等)
* @param {string} [options.baseSceneCode] 门店场景编码
* @param {number|string} [options.reportTemplateId] 模板 ID
* @param {boolean} [options.skipSchema=false] 历史详情使用 jsonContent 快照时不刷新当前模板
* @returns {Promise<void>}
*/
async
function
revalidateCachedMetadata
({
userContext
=
{},
baseSceneCode
,
reportTemplateId
reportTemplateId
,
skipSchema
=
false
}
=
{})
{
if
(
isStoreMockMode
(
'brand'
)
&&
...
...
@@ -689,17 +771,20 @@ async function revalidateCachedMetadata({
return
}
const
refreshOptions
=
{
skipCacheRead
:
true
}
await
Promise
.
allSettled
(
[
const
refreshTasks
=
[
fetchBrandAdapter
({
merchantId
},
refreshOptions
),
fetchSceneAdapter
(
{
merchantId
,
shopMerchantId
,
staffUuid
,
phone
,
sceneType
},
refreshOptions
),
fetchSchemaRootAdapter
(
)
]
if
(
!
skipSchema
)
{
refreshTasks
.
push
(
fetchSchemaRootAdapter
(
{
reportTemplateId
,
baseSceneCode
,
merchantId
},
refreshOptions
)
])
))
}
await
Promise
.
allSettled
(
refreshTasks
)
}
module
.
exports
=
{
...
...
@@ -715,6 +800,7 @@ module.exports = {
saveDraftForm
,
pushReportData
,
normalizeDetailResponse
,
hasValidDetailSchemaSnapshot
,
buildPageContextFromSources
,
normalizeUserInfo
,
revalidateCachedMetadata
...
...
packageDynamicForm/docs/PAGES.md
View file @
d493718
...
...
@@ -96,6 +96,8 @@
与驻店相同结构,使用
`loadStoreDailyForm`
+
`storeDailyReport.js`
。
`buildFormRequestContext`
额外透传
`sceneType`
给字段选项接口。
已有详情且
`jsonContent`
是合法、非空字段快照时,门店日报直接使用该快照的字段结构与值回显,前台加载和后台缓存刷新均不请求或混入当前配置中心模板;无详情或快照结构无效时才加载当前模板。历史字段(如 V2.3.0 之前的
`F2-58`
)因此不会因模板升级而丢失。
`loadFormData`
在
`engine.init`
+
`applyEngineView`
之后解析当前可见的本月待邀约字段(V2.3
**`F2-102`**
,兼容旧模板
**`F2-24`**
,异常共存时优先新字段)。仅当
**当天**
(
`isTodayReport`
)且字段
**无值**
时初始化:每月首日直接写
`0`
,不调用接口;非首日调用
`fetchMonthlyPendingCount`
(
`dj.api.smartcarlife.dailyReport.monthly.pending.get`
POST,
`merchantId`
为 4S 店、
`reportDate`
为选中日),把最近一次提交数值写回当前字段。历史日期或已有回显/填写不请求、不覆盖。开关:
`STORE_DAILY_API_SWITCH.monthlyPendingCount`
。
若当天可编辑且
**`F2-1` 今日驻店人员**
可见(如经营品牌含岚图),加载后及每次改选 F2-1 时,
**`F2-2` 今日驻店人数**
自动同步为选中人员数量(等价于 schema
`completeFun.result: "(list.length)"`
,不 eval 表达式);F2-1 不可见时不改动 F2-2。
**F2-1 已选至少 1 人时 F2-2 只读**
(未选人时可手动改人数)。见
[
`store-staff-count.js`
](
../utils/store-staff-count.js
)
、
[
store-template-features.md
](
./store-template-features.md
)
。
...
...
@@ -147,6 +149,9 @@
-
`IT-STORE-LOADER-*`
— loader
-
`IT-STORE-DETAIL-GET-001`
— detail.get templateType=2
-
`IT-STORE-DETAIL-007`
— 老模板详情直接使用 jsonContent schema 快照回显
-
`IT-STORE-DETAIL-008`
~
`009`
— 损坏快照回退当前模板、历史详情跳过后台 schema 刷新
-
`IT-STORE-DAILY-PAGE-004a`
— 页面把历史快照状态传给后台缓存刷新
-
`IT-STORE-BRAND-CACHE-001`
— brand 缓存
-
`IT-FIELD-OPT-004`
~
`006`
— fieldOptions
-
`IT-STORE-ENG-*`
— 门店 schema 显隐
...
...
packageDynamicForm/docs/daily-report-save-and-json.md
View file @
d493718
...
...
@@ -103,6 +103,8 @@ App 草稿 `saveReport` 仅做 childrenValue 序列化、**不产** fieldDataLis
**无记录成功**:接口 `
code
` 为 `
0
` / `
"0"
` 且 `
data: null
`(或空)视为成功,与 App 一致;[`
fetchReportDetail
`](../api/staffDailyReport.js) 经 [`
resolveDetailGetResponse
`](../utils/api-response.js) 映射为 `
buildEmptyDetail
`(`
dailyReportRecordId: null
`、`
values: {}
`),正常加载空白表单。
**门店日报历史模板兼容**:详情存在合法、非空的 `
jsonContent
` 时,其中的字段列表同时作为保存时的 schema 快照和值来源,直接用于回显,前台加载和后台缓存刷新均不请求、也不混入当前配置中心模板。这样旧模板字段即使已从新模板删除,仍能按保存时的 `
label
`、`
type
`、`
origin_children
` 与 `
childrenValue
` 展示。快照会校验字段类型、全局 key 唯一性以及 subform/group 子字段结构;仅在无详情或快照结构无效时,才加载当前门店模板作为新建/异常兜底。驻店日报和洽谈明细的加载策略不在此规则范围内。
| 步骤 | 函数 | 说明 |
|------|------|------|
| 解析 jsonContent | [`
normalizeJsonContentList
`](../form-engine/app-subform-json.js) | 兼容 string / array / `
{ list:
[
] }
` |
...
...
packageDynamicForm/pages/storeDailyReport/storeDailyReport.js
View file @
d493718
...
...
@@ -662,7 +662,9 @@ Page({
{
userContext
,
baseSceneCode
:
pageContext
.
baseSceneCode
,
reportTemplateId
:
this
.
reportTemplateId
reportTemplateId
:
this
.
reportTemplateId
,
skipSchema
:
storeDailyApi
.
hasValidDetailSchemaSnapshot
?.(
detail
)
===
true
},
seq
)
...
...
packageDynamicForm/tests/storeDailyReportDetail.test.mjs
View file @
d493718
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import { createRequire } from 'node:module'
const require = createRequire(import.meta.url)
...
...
@@ -15,6 +16,37 @@ const {
const { DEFAULT_REPORT_TEMPLATE_ID } = require('../api/mockStoreDynamicDetail.js')
const { loadSchemaFixture } = await import('./schemaFixture.mjs')
const storeDailyApiUrl = new URL('../api/storeDailyReport.js', import.meta.url)
function loadStoreDailyApi(overrides = {}) {
const apiRequire = createRequire(storeDailyApiUrl)
const actualAdapters = apiRequire('./storeDailyReportAdapters.js')
const requireForApi = specifier => {
if (specifier === '~/config.js') {
return { envIndex: 0 }
}
if (specifier === './dynamicDailyReport.js') {
return { dynamicDailyReportSave: async () => ({ code: 0, data: {} }) }
}
if (specifier === './storeDailyReportAdapters.js') {
return { ...actualAdapters, ...overrides }
}
return apiRequire(specifier)
}
const source = readFileSync(storeDailyApiUrl, 'utf8').replace(
/import\s*\{([\s\S]*?)\}\s*from\s*['"]([^'"]+)['"]/g,
(_match, imports, specifier) => `const {${imports}} = require('${specifier}')`
)
const module = { exports: {} }
new Function('require', 'module', 'exports', 'wx', source)(
requireForApi,
module,
module.exports,
{}
)
return module.exports
}
function selectValueMapId(value) {
if (value != null && typeof value === 'object' && !Array.isArray(value)) {
return value.id ?? value.value
...
...
@@ -34,6 +66,135 @@ function normalizeDetailFixture(detail = {}, reportTemplateId) {
}
describe('storeDailyReport detail response', () => {
it('IT-STORE-DETAIL-007: valid detail jsonContent is the schema snapshot without loading the current template', async () => {
let currentTemplateCalls = 0
const api = loadStoreDailyApi({
fetchSchemaRootAdapter: async () => {
currentTemplateCalls += 1
return {
code: 0,
message: 'ok',
data: {
list: [
{ key: 'F2-101', label: '新模板字段', type: 'numberInput' }
]
}
}
}
})
const historicalList = [
{
label: '其他品牌售后部数据 (轻改)',
key: 'F2-58',
type: 'subform',
rules: { maxRows: 20 },
origin_children: [
{
label: 'SA',
key: 'F2-58-1',
type: 'select',
optionsKey: '4sStaffList'
},
{ label: '今日谈客数', key: 'F2-58-2', type: 'numberInput' },
{ label: '今日成交数', key: 'F2-58-3', type: 'numberInput' },
{ label: '今日成交金额', key: 'F2-58-4', type: 'numberInput' }
],
childrenValue: [
{
'F2-58': {
'F2-58-1': {
text: '测试1230622',
value: '1a1ba1477f684b7886be8aa01440a260'
},
'F2-58-2': 2,
'F2-58-3': 3,
'F2-58-4': 15
}
}
]
}
]
const result = await api.fetchSchema({
reportTemplateId: 10002,
baseSceneCode: 100101,
merchantId: 'm-old-template',
detail: { jsonContent: JSON.stringify(historicalList) }
})
assert.equal(currentTemplateCalls, 0)
assert.equal(result.code, 0)
assert.deepEqual(result.data.list.map(field => field.key), ['F2-58'])
assert.equal(result.data.list[0].label, '其他品牌售后部数据 (轻改)')
assert.equal(
result.initialValues['F2-58'][0]['F2-58-1'].id,
'1a1ba1477f684b7886be8aa01440a260'
)
assert.equal(result.initialValues['F2-58'][0]['F2-58-2'], 2)
assert.equal(result.initialValues['F2-58'][0]['F2-58-3'], 3)
assert.equal(result.initialValues['F2-58'][0]['F2-58-4'], 15)
})
it('IT-STORE-DETAIL-008: incomplete detail schema falls back to the current template', async () => {
let currentTemplateCalls = 0
const api = loadStoreDailyApi({
fetchSchemaRootAdapter: async () => {
currentTemplateCalls += 1
return {
code: 0,
message: 'ok',
data: {
list: [
{ key: 'F2-101', label: '当前模板字段', type: 'numberInput' }
]
}
}
}
})
const result = await api.fetchSchema({
reportTemplateId: 10002,
baseSceneCode: 100101,
merchantId: 'm-invalid-snapshot',
detail: {
jsonContent: JSON.stringify([
{ key: 'F2-58', label: '损坏的历史子表单', type: 'subform' }
])
}
})
assert.equal(currentTemplateCalls, 1)
assert.equal(result.code, 0)
assert.deepEqual(result.data.list.map(field => field.key), ['F2-101'])
})
it('IT-STORE-DETAIL-009: detail snapshot revalidation skips only the current schema refresh', async () => {
const calls = { brand: 0, scene: 0, schema: 0 }
const api = loadStoreDailyApi({
fetchBrandAdapter: async () => {
calls.brand += 1
return { code: 0, data: [] }
},
fetchSceneAdapter: async () => {
calls.scene += 1
return { code: 0, data: [] }
},
fetchSchemaRootAdapter: async () => {
calls.schema += 1
return { code: 0, data: { list: [] } }
}
})
await api.revalidateCachedMetadata({
userContext: { merchantId: 'm-old-template', staffUuid: 's1' },
baseSceneCode: 100101,
reportTemplateId: 10002,
skipSchema: true
})
assert.deepEqual(calls, { brand: 1, scene: 1, schema: 0 })
})
it('IT-STORE-DETAIL-001: normalizeDetailResponse maps reportStatus', () => {
const data = normalizeDetailFixture(
{
...
...
packageDynamicForm/tests/storeDailyReportPage.contract.test.mjs
View file @
d493718
...
...
@@ -480,6 +480,58 @@ describe('storeDailyReport page contract', () => {
assert.match(loadSource, /finally\s*{[\s\S]*setData\(\{ loading: false \}\)[\s\S]*applyStoreDailyViewState\(\{ loading: false \}\)/)
})
it('IT-STORE-DAILY-PAGE-004a: historical detail skips background schema revalidation', async () => {
let scheduledParams = null
const detail = {
reportTemplateId: 10002,
dailyReportRecordId: 9001,
jsonContent: JSON.stringify([
{ key: 'F2-58', label: '历史模板字段', type: 'numberInput', value: 2 }
])
}
const storeDailyApi = createFallbackModule({
hasValidDetailSchemaSnapshot: candidate => candidate === detail
})
const { page } = createStorePageHarness({
modules: {
'../../api/storeDailyReport.js': storeDailyApi,
'../../services/storeDailyFormLoader.js': {
loadStoreDailyForm: async () => ({
code: 0,
data: {
pageContext: { baseSceneCode: 100101 },
schema: { list: [] },
initialValues: {},
detail
}
})
},
'../../utils/api-response.js': require('../utils/api-response.js')
}
})
Object.assign(page.data, {
reportDate: '2026-08-20',
timeBean: {},
loading: false
})
page.getRequestContext = () => ({ merchantId: 'm-old-template', staffUuid: 's1' })
page.getEngineKey = value => value
page.isStaleLoad = () => false
page.applyStoreDailyDetailState = () => {}
page.ensureEngine = () => ({ init: () => ({ values: {}, visibleList: [] }) })
page.applyEngineView = () => {}
page.scheduleMetadataCacheRevalidate = (_api, params) => {
scheduledParams = params
}
page.applyMonthlyPendingCountIfNeeded = async () => {}
page.applyStoreStaffCountIfNeeded = async () => {}
page.applyStoreDailyViewState = () => {}
await page.loadFormData()
assert.equal(scheduledParams.skipSchema, true)
})
it('IT-STORE-DAILY-PAGE-005: freezes write contexts and ignores stale async responses', () => {
const saveSource = js.slice(js.indexOf('async onSave()'), js.indexOf('\n\t/** @deprecated', js.indexOf('async onSave()')))
const pushSource = js.slice(js.indexOf('async pushReport()'), js.indexOf('\n\t/** @deprecated', js.indexOf('async pushReport()')))
...
...
tabWorkOrder/pages/createOrder/createOrder.wxml
View file @
d493718
...
...
@@ -908,7 +908,7 @@ value="{{ orderObj.remark }}"
></sku-goods>
<customerInfo
show="{{ customerInfoBox }}"
lowPriceFlag="{{
1
}}"
lowPriceFlag="{{
0
}}"
bindconfirm="chooseCustomerInfo"
bindcancel="onCustomerInfoCancel"
/>
...
...
tests/customerInfo.pagination.test.mjs
View file @
d493718
...
...
@@ -20,30 +20,46 @@ describe('customerInfo.pagination', () => {
assert.equal(canLoadMorePage(0, 1), false)
})
it('buildCustomerListRequestParams forwards lowPriceFlag only when explicitly enabled', () => {
const params = buildCustomerListRequestParams({
merchantId: '',
fallbackMerchantId: 1001,
pageNum: 2,
keyword: '张三',
lowPriceFlag: '1'
})
it('buildCustomerListRequestParams forwards explicit numeric flags', () => {
const cases = [
{ input: 0, expected: 0 },
{ input: '0', expected: 0 },
{ input: 1, expected: 1 },
{ input: '1', expected: 1 }
]
cases.forEach(({ input, expected }) => {
const params = buildCustomerListRequestParams({
merchantId: '',
fallbackMerchantId: 1001,
pageNum: 2,
keyword: '张三',
lowPriceFlag: input
})
assert.deepEqual(params, {
merchantId: 1001,
pageNum: 2,
pageSize: DEFAULT_PAGE_SIZE,
statusList: [1],
keyword: '张三',
lowPriceFlag: 1
assert.deepEqual(params, {
merchantId: 1001,
pageNum: 2,
pageSize: DEFAULT_PAGE_SIZE,
statusList: [1],
keyword: '张三',
lowPriceFlag: expected
})
})
})
it('buildCustomerListRequestParams omits absent or null lowPriceFlag', () => {
const cases = [{}, { lowPriceFlag: null }]
const defaultParams = buildCustomerListRequestParams({
merchantId: 1002,
fallbackMerchantId: 1001,
pageNum: 1
cases.forEach((extraOptions) => {
const params = buildCustomerListRequestParams({
merchantId: 1002,
fallbackMerchantId: 1001,
pageNum: 1,
...extraOptions
})
assert.equal(Object.hasOwn(params, 'lowPriceFlag'), false)
})
assert.equal(Object.hasOwn(defaultParams, 'lowPriceFlag'), false)
})
it('mapCustomerListWithCarType builds carType from customer fields', () => {
...
...
tests/workOrderLowPriceGuard.test.mjs
View file @
d493718
...
...
@@ -38,7 +38,7 @@ describe('work order low-price edit guard', () => {
assert.equal(LOW_PRICE_ORDER_EDIT_MESSAGE, '低价单不可以编辑')
})
it('wires lowPriceFlag=
1 only
from the create-order customer archive popup', () => {
it('wires lowPriceFlag=
0
from the create-order customer archive popup', () => {
const createOrderWxml = read(
'../tabWorkOrder/pages/createOrder/createOrder.wxml'
)
...
...
@@ -46,7 +46,7 @@ describe('work order low-price edit guard', () => {
assert.match(
createOrderWxml,
/<customerInfo[\s\S]*?lowPriceFlag="\{\{
1
\}\}"[\s\S]*?\/>/
/<customerInfo[\s\S]*?lowPriceFlag="\{\{
0
\}\}"[\s\S]*?\/>/
)
assert.match(customerInfoJs, /buildCustomerListRequestParams/)
})
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment