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 d37f0935
authored
Jun 03, 2026
by
chenwq
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: 添加市场费转账查询功能,优化相关数据处理逻辑
1 parent
943fb272
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
94 additions
and
26 deletions
src/api/accountManage.js
src/views/financeManage/accountStateManage/marketTransfer.js
src/views/financeManage/components/MarketTransferDialog.vue
tests/unit/accountStateManage/marketTransfer.spec.js
src/api/accountManage.js
View file @
d37f093
...
...
@@ -200,6 +200,12 @@ export function downloadMarketTransferDetail(data) {
return
request
(
data
,
"post"
);
}
// 市场费转账 - 查询对账单已发起审批或审批通过的费用类型
export
function
queryMarketTransferFee
(
data
)
{
data
.
method
=
"dj.api.smartcarlife.reconciliationBill.transfer.market.fee.query"
;
return
request
(
data
,
"post"
);
}
// 市场费转账-收款账户
export
function
getMarketTransferBankAccounts
(
data
)
{
data
.
method
=
"dj.api.smartcarlife.merchantBankEnterpriseAccount.listWithPage"
;
...
...
src/views/financeManage/accountStateManage/marketTransfer.js
View file @
d37f093
...
...
@@ -89,6 +89,25 @@ export function buildMarketTransferSubmitParams(form = {}) {
return
params
;
}
export
function
normalizeApprovedMarketTransferFees
(
list
=
[])
{
const
amountMap
=
{};
const
expenseCategoryIds
=
[];
(
list
||
[]).
forEach
((
item
)
=>
{
const
id
=
item
&&
item
.
expenseCategoryId
;
if
(
id
===
undefined
||
id
===
null
)
return
;
if
(
!
expenseCategoryIds
.
includes
(
id
))
expenseCategoryIds
.
push
(
id
);
amountMap
[
id
]
=
item
.
expenseCategoryResult
;
});
return
{
expenseCategoryIds
,
amountMap
,
totalAmount
:
Object
.
keys
(
amountMap
).
reduce
((
total
,
id
)
=>
total
+
(
Number
(
amountMap
[
id
])
||
0
),
0
),
};
}
export
function
getVisibleAmountFields
(
expenseCategoryIds
=
[])
{
return
EXPENSE_CATEGORY_OPTIONS
.
filter
(
item
=>
expenseCategoryIds
.
includes
(
item
.
id
));
}
...
...
src/views/financeManage/components/MarketTransferDialog.vue
View file @
d37f093
...
...
@@ -33,6 +33,7 @@
@
change=
"handleExpenseChange"
>
<el-checkbox
v-for=
"item in expenseCategoryOptions"
:key=
"item.id"
:disabled=
"isExpenseCategoryDisabled(item.id)"
:label=
"item.id"
>
{{
item
.
label
}}
</el-checkbox>
...
...
@@ -114,6 +115,7 @@ import {
getMarketTransferBankAccounts
,
getMarketTransferFeeShow
,
getMarketTransferPlatformMerchants
,
queryMarketTransferFee
,
submitMarketTransferFee
,
}
from
"@api/accountManage"
;
import
GlOssApi
from
"glsk-oss-jssdk"
;
...
...
@@ -128,6 +130,7 @@ import {
getVisibleAmountFields
,
mapMarketFeeResults
,
MARKET_TRANSFER_UPLOAD_RULE
,
normalizeApprovedMarketTransferFees
,
}
from
"../accountStateManage/marketTransfer"
;
export
default
{
...
...
@@ -151,6 +154,8 @@ export default {
platformMerchantList
:
[],
bankAccountList
:
[],
expenseCategoryOptions
:
EXPENSE_CATEGORY_OPTIONS
,
lockedExpenseCategoryIds
:
[],
lockedExpenseAmountMap
:
{},
uploadRule
:
MARKET_TRANSFER_UPLOAD_RULE
,
uploadFileList
:
[],
detailInfo
:
{},
...
...
@@ -303,6 +308,7 @@ export default {
// this.getTransferDetail();
this
.
getBankAccountList
();
this
.
step
=
2
;
this
.
queryApprovedMarketTransferFee
();
});
return
;
}
...
...
@@ -315,23 +321,64 @@ export default {
const
formRef
=
this
.
$refs
.
transferFormRef
?.
$refs
?.[
this
.
transferChildRef
];
formRef
&&
formRef
.
clearValidate
(
field
);
},
isExpenseCategoryDisabled
(
id
)
{
return
this
.
lockedExpenseCategoryIds
.
includes
(
id
);
},
mergeLockedExpenseCategoryIds
(
ids
=
[])
{
return
[...
new
Set
([...
this
.
lockedExpenseCategoryIds
,
...
ids
])];
},
getUnlockedExpenseCategoryIds
(
ids
=
[])
{
return
ids
.
filter
(
id
=>
!
this
.
lockedExpenseCategoryIds
.
includes
(
id
));
},
queryApprovedMarketTransferFee
()
{
queryMarketTransferFee
({
reconciliationBillId
:
this
.
info
.
id
,
}).
then
((
res
)
=>
{
const
result
=
normalizeApprovedMarketTransferFees
(
res
||
[]);
this
.
lockedExpenseCategoryIds
=
result
.
expenseCategoryIds
;
this
.
lockedExpenseAmountMap
=
result
.
amountMap
;
const
expenseCategoryIds
=
this
.
mergeLockedExpenseCategoryIds
(
this
.
transferForm
.
expenseCategoryIds
);
this
.
transferForm
.
expenseCategoryIds
=
expenseCategoryIds
;
this
.
applyExpenseAmountMap
(
this
.
lockedExpenseAmountMap
);
if
(
this
.
getUnlockedExpenseCategoryIds
(
expenseCategoryIds
).
length
)
{
this
.
handleExpenseChange
(
expenseCategoryIds
);
}
});
},
applyExpenseAmountMap
(
amountMap
=
{})
{
EXPENSE_CATEGORY_OPTIONS
.
forEach
((
item
)
=>
{
if
(
!
this
.
transferForm
.
expenseCategoryIds
.
includes
(
item
.
id
))
{
this
.
$set
(
this
.
transferForm
,
`amount_
${
item
.
id
}
`
,
""
);
return
;
}
this
.
$set
(
this
.
transferForm
,
`amount_
${
item
.
id
}
`
,
amountMap
[
item
.
id
]
??
""
);
});
this
.
transferForm
.
transferTotalAmount
=
this
.
transferForm
.
expenseCategoryIds
.
reduce
((
total
,
id
)
=>
{
return
total
+
(
Number
(
amountMap
[
id
])
||
0
);
},
0
);
},
handleExpenseChange
(
value
)
{
const
expenseCategoryIds
=
this
.
mergeLockedExpenseCategoryIds
(
value
);
if
(
expenseCategoryIds
.
length
!==
value
.
length
)
this
.
transferForm
.
expenseCategoryIds
=
expenseCategoryIds
;
this
.
clearTransferValidate
(
"expenseCategoryIds"
);
this
.
visibleAmountFields
.
forEach
((
item
)
=>
{
this
.
$set
(
this
.
transferForm
,
`amount_
${
item
.
id
}
`
,
""
);
});
if
(
!
value
.
length
)
{
const
unlockedExpenseCategoryIds
=
this
.
getUnlockedExpenseCategoryIds
(
expenseCategoryIds
);
if
(
!
expenseCategoryIds
.
length
)
{
this
.
transferForm
.
transferTotalAmount
=
""
;
return
;
}
if
(
!
unlockedExpenseCategoryIds
.
length
)
{
this
.
applyExpenseAmountMap
(
this
.
lockedExpenseAmountMap
);
return
;
}
getMarketTransferFeeShow
({
reconciliationBillId
:
this
.
info
.
id
,
expenseCategoryIds
:
value
,
expenseCategoryIds
:
unlockedExpenseCategoryIds
,
}).
then
((
res
)
=>
{
const
result
=
mapMarketFeeResults
(
res
||
{});
this
.
transferForm
.
transferTotalAmount
=
result
.
totalAmount
;
Object
.
keys
(
result
.
amountMap
).
forEach
((
id
)
=>
{
this
.
$set
(
this
.
transferForm
,
`amount_
${
id
}
`
,
result
.
amountMap
[
id
]);
this
.
applyExpenseAmountMap
({
...
result
.
amountMap
,
...
this
.
lockedExpenseAmountMap
,
});
});
},
...
...
tests/unit/accountStateManage/marketTransfer.spec.js
View file @
d37f093
...
...
@@ -5,8 +5,8 @@ import {
buildMarketTransferFormData
,
buildMarketTransferSubmitParams
,
getVisibleAmountFields
,
mapMarketFeeResult
s
,
buildMarketFeeDownloadTask
normalizeApprovedMarketTransferFee
s
,
mapMarketFeeResults
}
from
"@/views/financeManage/accountStateManage/marketTransfer"
describe
(
"marketTransfer helpers"
,
()
=>
{
...
...
@@ -14,7 +14,6 @@ describe("marketTransfer helpers", () => {
const
fields
=
getVisibleAmountFields
([
706
,
900
])
expect
(
fields
.
map
(
item
=>
item
.
id
)).
toEqual
([
706
,
900
])
expect
(
fields
.
map
(
item
=>
item
.
amountLabel
)).
toEqual
([
"管理层市场费1金额"
,
"资源费金额"
])
})
it
(
"maps market fee result rows by expense category id"
,
()
=>
{
...
...
@@ -30,24 +29,21 @@ describe("marketTransfer helpers", () => {
expect
(
result
.
totalAmount
).
toBe
(
33
)
})
it
(
"builds one async download task for all selected categories"
,
()
=>
{
const
task
=
buildMarketFeeDownloadTask
({
id
:
"bill-1"
},
[
706
,
808
])
const
exportParam
=
JSON
.
parse
(
task
.
exportParam
)
it
(
"normalizes approved market transfer fees for default checked readonly categories"
,
()
=>
{
const
result
=
normalizeApprovedMarketTransferFees
([
{
expenseCategoryId
:
706
,
expenseCategoryResult
:
11
},
{
expenseCategoryId
:
706
,
expenseCategoryResult
:
12
},
{
expenseCategoryId
:
900
,
expenseCategoryResult
:
22
},
{
expenseCategoryId
:
null
,
expenseCategoryResult
:
33
}
])
expect
(
task
.
name
).
toBe
(
"市场费转账明细"
)
expect
(
exportParam
.
id
).
toBe
(
"bill-1"
)
expect
(
exportParam
.
expenseCategoryIds
).
toEqual
([
706
,
808
])
expect
(
exportParam
.
method
).
toBe
(
"dj.api.smartcarlife.reconciliationBill.transfer.market.fee.download"
)
expect
(
result
.
expenseCategoryIds
).
toEqual
([
706
,
900
])
expect
(
result
.
amountMap
).
toEqual
({
706
:
12
,
900
:
22
})
expect
(
result
.
totalAmount
).
toBe
(
34
)
})
it
(
"keeps the expense category options fixed"
,
()
=>
{
expect
(
EXPENSE_CATEGORY_OPTIONS
).
toEqual
([
{
id
:
706
,
label
:
"管理层市场费1"
,
amountLabel
:
"管理层市场费1金额"
},
{
id
:
808
,
label
:
"管理层市场费2"
,
amountLabel
:
"管理层市场费2金额"
},
{
id
:
809
,
label
:
"阳光激励费"
,
amountLabel
:
"阳光激励费金额"
},
{
id
:
901
,
label
:
"阳光激励费2"
,
amountLabel
:
"阳光激励费2金额"
},
{
id
:
900
,
label
:
"资源费"
,
amountLabel
:
"资源费金额"
}
])
it
(
"keeps the expense category ids fixed"
,
()
=>
{
expect
(
EXPENSE_CATEGORY_OPTIONS
.
map
(
item
=>
item
.
id
)).
toEqual
([
706
,
808
,
809
,
901
,
900
])
})
it
(
"uses the requested voucher upload rule"
,
()
=>
{
...
...
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