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 b88d5e0d
authored
Jun 04, 2026
by
chenwq
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
新增市场费下载参数构建函数,并更新相关逻辑和单元测试
1 parent
cfceedc0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
11 deletions
src/views/financeManage/accountStateManage/marketTransfer.js
src/views/financeManage/components/MarketTransferDialog.vue
tests/unit/accountStateManage/marketTransfer.spec.js
src/views/financeManage/accountStateManage/marketTransfer.js
View file @
b88d5e0
...
@@ -91,6 +91,15 @@ export function buildMarketTransferSubmitParams(form = {}, excludeExpenseCategor
...
@@ -91,6 +91,15 @@ export function buildMarketTransferSubmitParams(form = {}, excludeExpenseCategor
return
params
;
return
params
;
}
}
export
function
buildMarketTransferDownloadParams
(
form
=
{},
excludeExpenseCategoryIds
=
[])
{
const
expenseCategoryIds
=
Array
.
isArray
(
form
.
expenseCategoryIds
)
?
form
.
expenseCategoryIds
:
[];
return
{
reconciliationBillId
:
form
.
reconciliationBillId
,
expenseCategoryIds
:
expenseCategoryIds
.
filter
(
id
=>
!
excludeExpenseCategoryIds
.
includes
(
id
)),
};
}
export
function
normalizeApprovedMarketTransferFees
(
list
=
[])
{
export
function
normalizeApprovedMarketTransferFees
(
list
=
[])
{
const
amountMap
=
{};
const
amountMap
=
{};
const
expenseCategoryIds
=
[];
const
expenseCategoryIds
=
[];
...
@@ -122,6 +131,6 @@ export function mapMarketFeeResults(data = {}) {
...
@@ -122,6 +131,6 @@ export function mapMarketFeeResults(data = {}) {
return
{
return
{
amountMap
,
amountMap
,
totalAmount
:
data
.
expenseCategoryTotalResult
||
0
,
totalAmount
:
data
?
.
expenseCategoryTotalResult
||
0
,
};
};
}
}
src/views/financeManage/components/MarketTransferDialog.vue
View file @
b88d5e0
...
@@ -124,6 +124,7 @@ import { deepClone } from "@/common/util";
...
@@ -124,6 +124,7 @@ import { deepClone } from "@/common/util";
import
util
from
"@/libs/util"
;
import
util
from
"@/libs/util"
;
import
{
baseConfig
}
from
"@/main"
;
import
{
baseConfig
}
from
"@/main"
;
import
{
import
{
buildMarketTransferDownloadParams
,
buildMarketTransferFormData
,
buildMarketTransferFormData
,
buildMarketTransferSubmitParams
,
buildMarketTransferSubmitParams
,
EXPENSE_CATEGORY_OPTIONS
,
EXPENSE_CATEGORY_OPTIONS
,
...
@@ -289,7 +290,7 @@ export default {
...
@@ -289,7 +290,7 @@ export default {
// value: item.merchantId || item.id || item.bankAccountNo,
// value: item.merchantId || item.id || item.bankAccountNo,
// label: this.formatBankAccountLabel(item),
// label: this.formatBankAccountLabel(item),
value
:
item
.
merchantId
,
value
:
item
.
merchantId
,
label
:
item
.
bankAccountName
,
label
:
item
.
bankAccountName
+
" / "
+
item
.
bankAccountNo
,
}));
}));
});
});
},
},
...
@@ -345,7 +346,7 @@ export default {
...
@@ -345,7 +346,7 @@ export default {
}
}
});
});
},
},
applyExpenseAmountMap
(
amountMap
=
{})
{
applyExpenseAmountMap
(
amountMap
=
{}
,
totalAmount
)
{
EXPENSE_CATEGORY_OPTIONS
.
forEach
((
item
)
=>
{
EXPENSE_CATEGORY_OPTIONS
.
forEach
((
item
)
=>
{
if
(
!
this
.
transferForm
.
expenseCategoryIds
.
includes
(
item
.
id
))
{
if
(
!
this
.
transferForm
.
expenseCategoryIds
.
includes
(
item
.
id
))
{
this
.
$set
(
this
.
transferForm
,
`amount_
${
item
.
id
}
`
,
""
);
this
.
$set
(
this
.
transferForm
,
`amount_
${
item
.
id
}
`
,
""
);
...
@@ -353,9 +354,7 @@ export default {
...
@@ -353,9 +354,7 @@ export default {
}
}
this
.
$set
(
this
.
transferForm
,
`amount_
${
item
.
id
}
`
,
amountMap
[
item
.
id
]
??
""
);
this
.
$set
(
this
.
transferForm
,
`amount_
${
item
.
id
}
`
,
amountMap
[
item
.
id
]
??
""
);
});
});
this
.
transferForm
.
transferTotalAmount
=
this
.
transferForm
.
expenseCategoryIds
.
reduce
((
total
,
id
)
=>
{
this
.
transferForm
.
transferTotalAmount
=
totalAmount
||
0
;
return
total
+
(
Number
(
amountMap
[
id
])
||
0
);
},
0
);
},
},
handleExpenseChange
(
value
)
{
handleExpenseChange
(
value
)
{
const
expenseCategoryIds
=
this
.
mergeLockedExpenseCategoryIds
(
value
);
const
expenseCategoryIds
=
this
.
mergeLockedExpenseCategoryIds
(
value
);
...
@@ -379,14 +378,18 @@ export default {
...
@@ -379,14 +378,18 @@ export default {
this
.
applyExpenseAmountMap
({
this
.
applyExpenseAmountMap
({
...
result
.
amountMap
,
...
result
.
amountMap
,
...
this
.
lockedExpenseAmountMap
,
...
this
.
lockedExpenseAmountMap
,
});
}
,
result
.
totalAmount
);
});
});
},
},
handleDownloadDetail
()
{
handleDownloadDetail
()
{
const
params
=
{
const
params
=
buildMarketTransferDownloadParams
(
{
reconciliationBillId
:
this
.
info
.
id
,
reconciliationBillId
:
this
.
info
.
id
,
expenseCategoryIds
:
this
.
transferForm
.
expenseCategoryIds
,
expenseCategoryIds
:
this
.
transferForm
.
expenseCategoryIds
,
};
},
this
.
lockedExpenseCategoryIds
);
if
(
!
params
.
expenseCategoryIds
.
length
)
{
this
.
$message
.
error
(
"请选择新的费用类型"
);
return
;
}
downloadMarketTransferDetail
(
params
).
then
((
res
)
=>
{
downloadMarketTransferDetail
(
params
).
then
((
res
)
=>
{
console
.
log
(
"下载任务已创建"
,
res
);
console
.
log
(
"下载任务已创建"
,
res
);
util
.
open
(
res
);
util
.
open
(
res
);
...
...
tests/unit/accountStateManage/marketTransfer.spec.js
View file @
b88d5e0
...
@@ -3,6 +3,7 @@ import {
...
@@ -3,6 +3,7 @@ import {
EXPENSE_CATEGORY_OPTIONS
,
EXPENSE_CATEGORY_OPTIONS
,
FORM_COMPONENT_RULE
,
FORM_COMPONENT_RULE
,
buildMarketTransferFormData
,
buildMarketTransferFormData
,
buildMarketTransferDownloadParams
,
buildMarketTransferSubmitParams
,
buildMarketTransferSubmitParams
,
getVisibleAmountFields
,
getVisibleAmountFields
,
normalizeApprovedMarketTransferFees
,
normalizeApprovedMarketTransferFees
,
...
@@ -22,11 +23,11 @@ describe("marketTransfer helpers", () => {
...
@@ -22,11 +23,11 @@ describe("marketTransfer helpers", () => {
{
expenseCategoryId
:
706
,
expenseCategoryResult
:
11
},
{
expenseCategoryId
:
706
,
expenseCategoryResult
:
11
},
{
expenseCategoryId
:
900
,
expenseCategoryResult
:
22
}
{
expenseCategoryId
:
900
,
expenseCategoryResult
:
22
}
],
],
expenseCategoryTotalResult
:
33
expenseCategoryTotalResult
:
1.17
})
})
expect
(
result
.
amountMap
).
toEqual
({
706
:
11
,
900
:
22
})
expect
(
result
.
amountMap
).
toEqual
({
706
:
11
,
900
:
22
})
expect
(
result
.
totalAmount
).
toBe
(
33
)
expect
(
result
.
totalAmount
).
toBe
(
1.17
)
})
})
it
(
"normalizes approved market transfer fees for default checked readonly categories"
,
()
=>
{
it
(
"normalizes approved market transfer fees for default checked readonly categories"
,
()
=>
{
...
@@ -98,4 +99,16 @@ describe("marketTransfer helpers", () => {
...
@@ -98,4 +99,16 @@ describe("marketTransfer helpers", () => {
expect
(
params
.
id
).
toBe
(
"bill-1"
)
expect
(
params
.
id
).
toBe
(
"bill-1"
)
expect
(
params
.
remark
).
toBe
(
"ok"
)
expect
(
params
.
remark
).
toBe
(
"ok"
)
})
})
it
(
"downloads details only for unchecked approval expense categories"
,
()
=>
{
const
params
=
buildMarketTransferDownloadParams
({
reconciliationBillId
:
"bill-1"
,
expenseCategoryIds
:
[
706
,
808
,
900
]
},
[
706
,
900
])
expect
(
params
).
toEqual
({
reconciliationBillId
:
"bill-1"
,
expenseCategoryIds
:
[
808
]
})
})
})
})
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