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 c6db0645
authored
Aug 17, 2026
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: support real order scene and merchant brand ids
1 parent
4f2c20f4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
245 additions
and
11 deletions
tabWorkOrder/pages/createOrder/services/customerDailyFields.helpers.js
tabWorkOrder/pages/createOrder/tests/customerDailyFields.helpers.test.mjs
tabWorkOrder/pages/createOrder/tests/submitPayload.helpers.test.mjs
tabWorkOrder/pages/createOrder/services/customerDailyFields.helpers.js
View file @
c6db064
...
...
@@ -8,7 +8,31 @@ export const BOUTIQUE_CUSTOMER_TAGS = [
const
CUSTOMER_TAG_ORDER
=
BOUTIQUE_CUSTOMER_TAGS
.
map
(
item
=>
item
.
value
)
const
BOUTIQUE_DELIVERY_SCENE_FRAGMENTS
=
[
'1.1'
,
'1.2'
,
'1.3'
]
const
FIVE_BOUNDARY_BRANDS
=
[
'问界'
,
'享界'
,
'智界'
,
'尚界'
,
'尊界'
]
const
BOUTIQUE_DELIVERY_SCENE_CODES
=
new
Set
([
'100101'
,
'100102'
,
'100103'
])
const
FIVE_BOUNDARY_BRANDS
=
[
'鸿蒙智行'
,
'问界'
,
'享界'
,
'智界'
,
'尚界'
,
'尊界'
]
const
FIVE_BOUNDARY_BRAND_IDS
=
new
Set
([
'3454'
,
'3503'
,
'3458'
,
'3574'
,
'3502'
,
'2695'
,
'2741'
,
'2698'
,
'2797'
,
'2740'
])
function
toTagValues
(
value
)
{
if
(
Array
.
isArray
(
value
))
return
value
...
...
@@ -52,23 +76,75 @@ function getBrandName(brand) {
)
}
function
includesSceneFragment
(
context
,
fragments
)
{
const
scene
Text
=
[
function
includesSceneFragment
(
context
,
fragments
,
sceneCodes
=
new
Set
()
)
{
const
scene
Values
=
[
context
?.
baseSceneName
,
context
?.
baseSceneCode
,
context
?.
sceneName
,
context
?.
sceneCode
]
.
filter
(
Boolean
)
.
join
(
' '
)
].
filter
(
value
=>
value
!==
undefined
&&
value
!==
null
&&
value
!==
''
)
if
(
sceneValues
.
some
(
value
=>
sceneCodes
.
has
(
String
(
value
).
trim
())))
{
return
true
}
const
sceneText
=
sceneValues
.
join
(
' '
)
return
fragments
.
some
(
fragment
=>
sceneText
.
includes
(
fragment
))
}
function
hasFiveBoundaryBrand
(
merchantBrands
)
{
return
(
Array
.
isArray
(
merchantBrands
)
?
merchantBrands
:
[]).
some
(
brand
=>
{
const
brandName
=
getBrandName
(
brand
)
return
FIVE_BOUNDARY_BRANDS
.
some
(
name
=>
brandName
.
includes
(
name
))
function
getBrandNodeId
(
brand
)
{
if
(
!
brand
||
typeof
brand
!==
'object'
)
return
''
if
(
Number
(
brand
.
brandId
)
>
0
)
return
String
(
brand
.
brandId
)
if
(
Number
(
brand
.
id
)
>
0
)
return
String
(
brand
.
id
)
return
''
}
function
getOperatingBrandNodes
(
merchantBrands
)
{
const
nodes
=
[]
;(
Array
.
isArray
(
merchantBrands
)
?
merchantBrands
:
[]).
forEach
(
brand
=>
{
if
(
!
brand
||
typeof
brand
!==
'object'
)
{
if
(
typeof
brand
===
'string'
&&
brand
.
trim
())
nodes
.
push
(
brand
)
return
}
if
(
Array
.
isArray
(
brand
.
childs
)
&&
brand
.
childs
.
length
)
{
brand
.
childs
.
forEach
(
child
=>
{
if
(
child
)
nodes
.
push
(
child
)
})
return
}
nodes
.
push
(
brand
)
})
return
nodes
}
function
getMerchantBrandNames
(
merchantBrands
)
{
const
names
=
[]
function
visit
(
brand
)
{
if
(
!
brand
)
return
const
name
=
getBrandName
(
brand
)
if
(
name
)
names
.
push
(
name
)
if
(
typeof
brand
===
'object'
&&
Array
.
isArray
(
brand
.
childs
))
{
brand
.
childs
.
forEach
(
visit
)
}
}
;(
Array
.
isArray
(
merchantBrands
)
?
merchantBrands
:
[]).
forEach
(
visit
)
return
names
}
function
hasMerchantBrandContext
(
merchantBrands
)
{
return
(
getOperatingBrandNodes
(
merchantBrands
).
some
(
brand
=>
getBrandNodeId
(
brand
)
||
getBrandName
(
brand
)
)
||
getMerchantBrandNames
(
merchantBrands
).
length
>
0
)
}
function
hasFiveBoundaryBrand
(
merchantBrands
)
{
const
hasBoundaryId
=
getOperatingBrandNodes
(
merchantBrands
).
some
(
brand
=>
FIVE_BOUNDARY_BRAND_IDS
.
has
(
getBrandNodeId
(
brand
))
)
if
(
hasBoundaryId
)
return
true
return
getMerchantBrandNames
(
merchantBrands
).
some
(
brandName
=>
FIVE_BOUNDARY_BRANDS
.
some
(
name
=>
brandName
.
includes
(
name
))
)
}
export
function
getBoutiqueCustomerTagOptions
(
merchantBrands
=
[])
{
...
...
@@ -85,7 +161,14 @@ export function isBoutiqueCustomerTagsVisible(salesType) {
}
export
function
isBoutiqueActualDeliveryDateVisible
(
context
=
{})
{
if
(
!
includesSceneFragment
(
context
,
BOUTIQUE_DELIVERY_SCENE_FRAGMENTS
))
{
if
(
!
includesSceneFragment
(
context
,
BOUTIQUE_DELIVERY_SCENE_FRAGMENTS
,
BOUTIQUE_DELIVERY_SCENE_CODES
)
||
!
hasMerchantBrandContext
(
context
.
merchantBrands
)
)
{
return
false
}
const
salesType
=
Number
(
context
.
salesType
)
...
...
tabWorkOrder/pages/createOrder/tests/customerDailyFields.helpers.test.mjs
View file @
c6db064
...
...
@@ -103,6 +103,127 @@ describe('customerDailyFields.helpers', () => {
)
})
it('IT-WO-DAILY-012: real scene codes use nested development and production merchant brand ids', () => {
const cases = [
{
name: 'development five-realm child rejects sales source',
context: {
salesType: 0,
baseSceneCode: 100101,
merchantBrands: [
{
id: 2978,
name: '鸿蒙智行',
childs: [{ id: '3454', name: 'AITO 问界' }]
}
]
},
expected: false
},
{
name: 'development five-realm child accepts delivery source',
context: {
salesType: 3,
baseSceneCode: '100101',
merchantBrands: [
{
id: 2978,
name: '鸿蒙智行',
childs: [{ id: 3454, name: 'AITO 问界' }]
}
]
},
expected: true
},
{
name: 'production five-realm child rejects sales source',
context: {
salesType: 0,
baseSceneCode: 100102,
merchantBrands: [
{
id: 2978,
name: '鸿蒙智行',
childs: [{ id: 2695 }]
}
]
},
expected: false
},
{
name: 'production five-realm child accepts delivery source',
context: {
salesType: 3,
baseSceneCode: 100102,
merchantBrands: [
{
id: 2978,
name: '鸿蒙智行',
childs: [{ id: 2695 }]
}
]
},
expected: true
},
{
name: 'other-brand child accepts sales source',
context: {
salesType: 0,
baseSceneCode: 100103,
merchantBrands: [
{
id: 2179,
name: '比亚迪',
childs: [{ id: 2180, name: '比亚迪' }]
}
]
},
expected: true
},
{
name: 'mixed brands use five-realm branch',
context: {
salesType: 0,
baseSceneCode: 100101,
merchantBrands: [
{
name: '经营品牌',
childs: [{ id: 2695 }, { id: 2180 }]
}
]
},
expected: false
},
{
name: 'nested brand name remains a compatibility fallback',
context: {
salesType: 0,
baseSceneCode: 100101,
merchantBrands: [
{
name: '经营品牌',
childs: [{ name: 'AITO 问界' }]
}
]
},
expected: false
},
{
name: 'missing merchant brands fails closed',
context: {
salesType: 3,
baseSceneCode: 100101,
merchantBrands: []
},
expected: false
}
]
for (const { name, context, expected } of cases) {
assert.equal(isBoutiqueActualDeliveryDateVisible(context), expected, name)
}
})
it('IT-WO-DAILY-005: reconciliation clears hidden and unavailable values', () => {
const natural = reconcileBoutiqueCustomerDailyFields(
{
...
...
tabWorkOrder/pages/createOrder/tests/submitPayload.helpers.test.mjs
View file @
c6db064
...
...
@@ -193,6 +193,7 @@ describe('submitPayload.helpers', () => {
const { submitObj } = prepareSubmitPayload(
{
...baseOrder,
baseSceneCode: 100104,
baseSceneName: '1.4 非适用场景',
customer: {
...baseOrder.customer,
...
...
@@ -206,4 +207,33 @@ describe('submitPayload.helpers', () => {
)
assert.equal(submitObj.customer.actualDeliveryDate, '')
})
it('IT-WO-SUB-018: numeric scene and production merchant brand tree retain eligible date', () => {
const { submitObj } = prepareSubmitPayload(
{
...baseOrder,
baseSceneCode: 100101,
baseSceneName: '',
customer: {
...baseOrder.customer,
salesType: 3,
actualDeliveryDate: '2026-08-04'
}
},
{
merchantBrands: [
{
id: 2978,
name: '鸿蒙智行',
childs: [{ id: 2695 }]
}
]
}
)
assert.equal(
submitObj.customer.actualDeliveryDate,
'2026-08-04 00:00:00'
)
})
})
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