Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-life-system
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b8b848ed
authored
May 22, 2026
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix 自测bug
1 parent
ac15d59a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
35 deletions
src/views/systemConfig/merchant/financialRules/components/financialCalculationDialog.vue
src/views/systemConfig/merchant/financialRules/utils/buildDivisionRuleTestParams.js
tests/unit/financialRules/buildDivisionRuleTestParams.spec.js
src/views/systemConfig/merchant/financialRules/components/financialCalculationDialog.vue
View file @
b8b848e
...
@@ -184,6 +184,10 @@ export default {
...
@@ -184,6 +184,10 @@ export default {
maxReachedStep
:
this
.
maxReachedStep
,
maxReachedStep
:
this
.
maxReachedStep
,
step1Paid
:
this
.
uiState
.
step1Paid
step1Paid
:
this
.
uiState
.
step1Paid
}
}
},
/** 与父页财务详情一致,唯一来源(financialRulesEnv) */
divisionRuleId
()
{
return
this
.
financialRulesEnv
.
divisionRuleId
}
}
},
},
watch
:
{
watch
:
{
...
@@ -204,7 +208,7 @@ export default {
...
@@ -204,7 +208,7 @@ export default {
deep
:
true
,
deep
:
true
,
handler
()
{
handler
()
{
if
(
!
this
.
visible
)
return
if
(
!
this
.
visible
)
return
this
.
testObj
=
normalizeDivisionTest
Payload
(
this
.
financialCalculationObj
)
this
.
testObj
=
this
.
normalizeTestObj
Payload
(
this
.
financialCalculationObj
)
this
.
applySubProgress
(
this
.
testObj
.
subProgress
,
this
.
testObj
)
this
.
applySubProgress
(
this
.
testObj
.
subProgress
,
this
.
testObj
)
}
}
}
}
...
@@ -220,6 +224,13 @@ export default {
...
@@ -220,6 +224,13 @@ export default {
this
.
teardownWs
()
this
.
teardownWs
()
},
},
methods
:
{
methods
:
{
normalizeTestObjPayload
(
payload
=
{})
{
const
id
=
this
.
divisionRuleId
const
merged
=
id
!=
null
&&
id
!==
''
?
{
...
payload
,
divisionRuleId
:
id
}
:
payload
return
normalizeDivisionTestPayload
(
merged
)
},
setViewStep
(
step
)
{
setViewStep
(
step
)
{
const
target
=
Number
(
step
)
const
target
=
Number
(
step
)
if
(
target
<
1
||
target
>
3
)
return
if
(
target
<
1
||
target
>
3
)
return
...
@@ -232,12 +243,9 @@ export default {
...
@@ -232,12 +243,9 @@ export default {
if
(
p
<
1
||
p
>
3
)
return
if
(
p
<
1
||
p
>
3
)
return
if
(
this
.
lastSyncedProgress
===
p
)
return
if
(
this
.
lastSyncedProgress
===
p
)
return
const
divisionRuleId
=
this
.
testObj
.
divisionRuleId
??
this
.
financialRulesEnv
.
divisionRuleId
const
paymentChannelId
=
this
.
testObj
.
paymentChannelId
const
paymentChannelId
=
this
.
testObj
.
paymentChannelId
const
params
=
buildDivisionRuleTestUpdateMainProgressParams
({
const
params
=
buildDivisionRuleTestUpdateMainProgressParams
({
divisionRuleId
,
divisionRuleId
:
this
.
divisionRuleId
,
paymentChannelId
,
paymentChannelId
,
progress
:
p
progress
:
p
})
})
...
@@ -269,7 +277,7 @@ export default {
...
@@ -269,7 +277,7 @@ export default {
this
.
setViewStep
(
viewStep
)
this
.
setViewStep
(
viewStep
)
},
},
bootstrapFromProps
()
{
bootstrapFromProps
()
{
this
.
testObj
=
normalizeDivisionTest
Payload
(
this
.
financialCalculationObj
)
this
.
testObj
=
this
.
normalizeTestObj
Payload
(
this
.
financialCalculationObj
)
const
sp
=
resolveDivisionTestSubProgress
(
this
.
testObj
,
this
.
testObj
.
subProgress
)
const
sp
=
resolveDivisionTestSubProgress
(
this
.
testObj
,
this
.
testObj
.
subProgress
)
this
.
resetWizardNavigation
(
sp
)
this
.
resetWizardNavigation
(
sp
)
this
.
applySubProgress
(
sp
,
this
.
testObj
)
this
.
applySubProgress
(
sp
,
this
.
testObj
)
...
@@ -313,23 +321,17 @@ export default {
...
@@ -313,23 +321,17 @@ export default {
const
routerInfo
=
this
.
financialRulesEnv
.
routerInfo
||
{}
const
routerInfo
=
this
.
financialRulesEnv
.
routerInfo
||
{}
const
{
merchantId
,
scene
:
sceneType
}
=
routerInfo
const
{
merchantId
,
scene
:
sceneType
}
=
routerInfo
const
baseSceneCode
=
resolveBaseSceneCodeFromRouter
(
routerInfo
)
const
baseSceneCode
=
resolveBaseSceneCodeFromRouter
(
routerInfo
)
const
divisionRuleId
=
this
.
testObj
.
divisionRuleId
??
this
.
financialRulesEnv
.
divisionRuleId
return
buildDivisionRuleTestParams
({
return
buildDivisionRuleTestParams
({
merchantId
,
merchantId
,
sceneType
,
sceneType
,
paymentChannelId
:
this
.
testObj
.
paymentChannelId
,
paymentChannelId
:
this
.
testObj
.
paymentChannelId
,
divisionRuleId
,
divisionRuleId
:
this
.
divisionRuleId
,
baseSceneCode
baseSceneCode
})
})
},
},
buildRetestParams
()
{
buildRetestParams
()
{
const
divisionRuleId
=
this
.
testObj
.
divisionRuleId
??
this
.
financialRulesEnv
.
divisionRuleId
return
buildDivisionRuleTestRetestParams
({
return
buildDivisionRuleTestRetestParams
({
divisionRuleId
,
divisionRuleId
:
this
.
divisionRuleId
,
paymentChannelId
:
this
.
testObj
.
paymentChannelId
paymentChannelId
:
this
.
testObj
.
paymentChannelId
})
})
},
},
...
@@ -345,7 +347,7 @@ export default {
...
@@ -345,7 +347,7 @@ export default {
}
}
return
divisionRuleTestGet
(
params
).
then
((
result
)
=>
{
return
divisionRuleTestGet
(
params
).
then
((
result
)
=>
{
if
(
!
result
)
return
if
(
!
result
)
return
this
.
testObj
=
normalizeDivisionTest
Payload
({
...
this
.
testObj
,
...
result
})
this
.
testObj
=
this
.
normalizeTestObj
Payload
({
...
this
.
testObj
,
...
result
})
this
.
applySubProgress
(
result
.
subProgress
,
this
.
testObj
)
this
.
applySubProgress
(
result
.
subProgress
,
this
.
testObj
)
this
.
syncViewStepIfSubProgress36
()
this
.
syncViewStepIfSubProgress36
()
if
(
!
this
.
uiState
.
step1Paid
&&
this
.
testOrderCode
)
{
if
(
!
this
.
uiState
.
step1Paid
&&
this
.
testOrderCode
)
{
...
@@ -436,7 +438,7 @@ export default {
...
@@ -436,7 +438,7 @@ export default {
divisionRuleTestRetest
(
params
)
divisionRuleTestRetest
(
params
)
.
then
((
result
)
=>
{
.
then
((
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
this
.
testObj
=
normalizeDivisionTest
Payload
({
...
this
.
testObj
,
...
result
})
this
.
testObj
=
this
.
normalizeTestObj
Payload
({
...
this
.
testObj
,
...
result
})
}
}
this
.
step2AllocationCache
=
{}
this
.
step2AllocationCache
=
{}
this
.
uiState
.
step1Paid
=
false
this
.
uiState
.
step1Paid
=
false
...
@@ -465,7 +467,7 @@ export default {
...
@@ -465,7 +467,7 @@ export default {
this
.
subProgress
=
34
this
.
subProgress
=
34
this
.
resetWizardNavigation
(
34
)
this
.
resetWizardNavigation
(
34
)
const
mockCode
=
this
.
testOrderCode
||
`TEST
${
Date
.
now
()}
`
const
mockCode
=
this
.
testOrderCode
||
`TEST
${
Date
.
now
()}
`
this
.
testObj
=
normalizeDivisionTest
Payload
({
this
.
testObj
=
this
.
normalizeTestObj
Payload
({
...
this
.
testObj
,
...
this
.
testObj
,
orderCode
:
mockCode
,
orderCode
:
mockCode
,
divisionRuleTestItem
:
{
divisionRuleTestItem
:
{
...
@@ -509,9 +511,7 @@ export default {
...
@@ -509,9 +511,7 @@ export default {
const
params
=
buildDivisionRuleTestMoneyValidParams
({
const
params
=
buildDivisionRuleTestMoneyValidParams
({
testObj
:
this
.
testObj
,
testObj
:
this
.
testObj
,
testMerchantDivisions
,
testMerchantDivisions
,
divisionRuleId
:
divisionRuleId
:
this
.
divisionRuleId
this
.
testObj
.
divisionRuleId
??
this
.
financialRulesEnv
.
divisionRuleId
})
})
if
(
params
.
divisionRuleId
==
null
||
params
.
divisionRuleId
===
''
)
{
if
(
params
.
divisionRuleId
==
null
||
params
.
divisionRuleId
===
''
)
{
this
.
$message
.
warning
(
'缺少分账规则 ID,请刷新后重试'
)
this
.
$message
.
warning
(
'缺少分账规则 ID,请刷新后重试'
)
...
...
src/views/systemConfig/merchant/financialRules/utils/buildDivisionRuleTestParams.js
View file @
b8b848e
...
@@ -46,11 +46,8 @@ export function buildDivisionRuleTestRetestParams(ctx = {}) {
...
@@ -46,11 +46,8 @@ export function buildDivisionRuleTestRetestParams(ctx = {}) {
export
function
buildDivisionRuleTestMoneyValidParams
({
export
function
buildDivisionRuleTestMoneyValidParams
({
testObj
=
{},
testObj
=
{},
testMerchantDivisions
,
testMerchantDivisions
,
divisionRuleId
:
divisionRuleIdOverride
divisionRuleId
}
=
{})
{
}
=
{})
{
const
divisionRuleId
=
divisionRuleIdOverride
??
testObj
.
divisionRuleId
const
params
=
{
const
params
=
{
testMerchantDivisions
:
testMerchantDivisions
||
[]
testMerchantDivisions
:
testMerchantDivisions
||
[]
}
}
...
...
tests/unit/financialRules/buildDivisionRuleTestParams.spec.js
View file @
b8b848e
...
@@ -46,7 +46,7 @@ describe("buildDivisionRuleTestParams", () => {
...
@@ -46,7 +46,7 @@ describe("buildDivisionRuleTestParams", () => {
})
})
})
})
it
(
"buildDivisionRuleTestMoneyValidParams
uses divisionRuleId and paymentChannel
Id"
,
()
=>
{
it
(
"buildDivisionRuleTestMoneyValidParams
requires explicit divisionRule
Id"
,
()
=>
{
const
testMerchantDivisions
=
[
const
testMerchantDivisions
=
[
{
merchantId
:
"m1"
,
distributionMoney
:
"1.0"
,
confirmDivisionMoney
:
"1.0"
}
{
merchantId
:
"m1"
,
distributionMoney
:
"1.0"
,
confirmDivisionMoney
:
"1.0"
}
]
]
...
@@ -54,22 +54,26 @@ describe("buildDivisionRuleTestParams", () => {
...
@@ -54,22 +54,26 @@ describe("buildDivisionRuleTestParams", () => {
testObj
:
{
paymentChannelId
:
"ch1"
,
divisionRuleId
:
100
},
testObj
:
{
paymentChannelId
:
"ch1"
,
divisionRuleId
:
100
},
testMerchantDivisions
testMerchantDivisions
})
})
expect
(
params
).
toEqual
({
expect
(
params
.
divisionRuleId
).
toBeUndefined
()
divisionRuleId
:
100
,
expect
(
params
.
paymentChannelId
).
toBe
(
"ch1"
)
paymentChannelId
:
"ch1"
,
expect
(
params
.
testMerchantDivisions
).
toEqual
(
testMerchantDivisions
)
testMerchantDivisions
})
expect
(
params
.
goodsTypeGroupDivisionId
).
toBeUndefined
()
})
})
it
(
"buildDivisionRuleTestMoneyValidParams divisionRuleId from override"
,
()
=>
{
it
(
"buildDivisionRuleTestMoneyValidParams uses explicit divisionRuleId and paymentChannelId"
,
()
=>
{
const
testMerchantDivisions
=
[
{
merchantId
:
"m1"
,
distributionMoney
:
"1.0"
,
confirmDivisionMoney
:
"1.0"
}
]
const
params
=
buildDivisionRuleTestMoneyValidParams
({
const
params
=
buildDivisionRuleTestMoneyValidParams
({
testObj
:
{
paymentChannelId
:
"ch2"
},
testObj
:
{
paymentChannelId
:
"ch2"
},
testMerchantDivisions
:
[]
,
testMerchantDivisions
,
divisionRuleId
:
4928
divisionRuleId
:
4928
})
})
expect
(
params
.
divisionRuleId
).
toBe
(
4928
)
expect
(
params
).
toEqual
({
expect
(
params
.
paymentChannelId
).
toBe
(
"ch2"
)
divisionRuleId
:
4928
,
paymentChannelId
:
"ch2"
,
testMerchantDivisions
})
expect
(
params
.
goodsTypeGroupDivisionId
).
toBeUndefined
()
})
})
it
(
"buildDivisionRuleTestUpdateMainProgressParams three fields"
,
()
=>
{
it
(
"buildDivisionRuleTestUpdateMainProgressParams three fields"
,
()
=>
{
...
...
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