Commit 30848099 by chenwq

新增市场费转账功能,更新相关组件和测试用例

1 parent 126b5365
# 项目协作规则
## 沟通方式
- 向用户汇报成果时,用简洁明了的中文说明做了什么、发生了什么。
- 避免使用术语、技术实现细节和代码行话;按“向不懂代码的聪明人解释”的方式表达。
- 汇报前尽量先检查工作,能运行或测试的先运行或测试。
## 表单规则
- 后台页面新增或重写业务表单时,优先使用 `glsx-combi-form` 组件。
- 弹窗表单也按 `glsx-combi-form` 的配置化写法组织字段、校验和自定义插槽。
- 只有在 `glsx-combi-form` 无法满足交互时,才单独使用原生 `el-form`,并说明原因。
...@@ -176,6 +176,30 @@ export function getTransferRecord(data) { ...@@ -176,6 +176,30 @@ export function getTransferRecord(data) {
return request(data, "post") return request(data, "post")
} }
// 市场费转账-平台方选择
export function getMarketTransferPlatformMerchants(data) {
data.method = 'dj.api.smartcarlife.reconciliationBill.platform.merchant.select'
return request(data, "post")
}
// 市场费转账-金额展示
export function getMarketTransferFeeShow(data) {
data.method = 'dj.api.smartcarlife.reconciliationBill.transfer.market.fee.show'
return request(data, "post")
}
// 市场费转账-提交
export function submitMarketTransferFee(data) {
data.method = 'dj.api.smartcarlife.reconciliationBill.transfer.market.fee'
return request(data, "post")
}
// 市场费转账-收款账户
export function getMarketTransferBankAccounts(data) {
data.method = 'dj.api.smartcarlife.merchantBankEnterpriseAccount.listWithPage'
return request(data, "post")
}
// 应收应付列表 // 应收应付列表
export function getJdBillList(data) { export function getJdBillList(data) {
data.method = 'dj.smartcarlife.api.jdbill.page' data.method = 'dj.smartcarlife.api.jdbill.page'
......
...@@ -97,6 +97,7 @@ ...@@ -97,6 +97,7 @@
<edit-pay-receive v-if="payReceiveVisible" :payReceiveVisible="payReceiveVisible" :info="info" @handleConfirm="handleEditConfirm" @dialogClose="handleEditVisible"></edit-pay-receive> <edit-pay-receive v-if="payReceiveVisible" :payReceiveVisible="payReceiveVisible" :info="info" @handleConfirm="handleEditConfirm" @dialogClose="handleEditVisible"></edit-pay-receive>
<glsk-form-dialog v-if="billSplitVisible" :selectVisible="billSplitVisible" :dialogConfig="billSplitDialogConfig" label-width="200px" :formRules="billSplitRules" :editData="billSplitEditData" :editFormData="billSplitEditFormData" :baseData="baseData" @handleClose="splitDialogVisible" @handleConfirm="handleSplitConfirm"></glsk-form-dialog> <glsk-form-dialog v-if="billSplitVisible" :selectVisible="billSplitVisible" :dialogConfig="billSplitDialogConfig" label-width="200px" :formRules="billSplitRules" :editData="billSplitEditData" :editFormData="billSplitEditFormData" :baseData="baseData" @handleClose="splitDialogVisible" @handleConfirm="handleSplitConfirm"></glsk-form-dialog>
<CreateServiceDialog :account-visible="accountVisible" v-if="accountVisible" :scene="7" :editForm="serviceInfo" @custTmpl="handleCustTmpl" @handleConfirm="handleServiceConfirm" @accountClose="createServiceVisible" /> <CreateServiceDialog :account-visible="accountVisible" v-if="accountVisible" :scene="7" :editForm="serviceInfo" @custTmpl="handleCustTmpl" @handleConfirm="handleServiceConfirm" @accountClose="createServiceVisible" />
<market-transfer-dialog v-if="marketTransferVisible" :marketTransferVisible="marketTransferVisible" :info="merchantInfo" @handleConfirm="handleMarketTransferConfirm" @dialogClose="handleMarketTransferVisible"></market-transfer-dialog>
<tmpl-drawer v-if="tmplDrawerVisible" :tmplDrawerVisible="tmplDrawerVisible" :type="tmplInfo.type" :tmplSelectList="tmplInfo.tmplSelectList" @handleConfirm="handleCustConfirm" @handleClose="handleCustVisible"></tmpl-drawer> <tmpl-drawer v-if="tmplDrawerVisible" :tmplDrawerVisible="tmplDrawerVisible" :type="tmplInfo.type" :tmplSelectList="tmplInfo.tmplSelectList" @handleConfirm="handleCustConfirm" @handleClose="handleCustVisible"></tmpl-drawer>
</div> </div>
</template> </template>
...@@ -114,6 +115,7 @@ import EditTransfer from "../components/EditTransfer" ...@@ -114,6 +115,7 @@ import EditTransfer from "../components/EditTransfer"
import RecordTransfer from "../components/RecordTransfer" import RecordTransfer from "../components/RecordTransfer"
import EditPayReceive from "../components/EditPayReceive" import EditPayReceive from "../components/EditPayReceive"
import CreateServiceDialog from "../components/CreateServiceDialog" import CreateServiceDialog from "../components/CreateServiceDialog"
import MarketTransferDialog from "../components/MarketTransferDialog"
import tmplDrawer from "../components/TmplDrawer" import tmplDrawer from "../components/TmplDrawer"
export default { export default {
name: 'AccountStateManage', name: 'AccountStateManage',
...@@ -126,6 +128,7 @@ export default { ...@@ -126,6 +128,7 @@ export default {
RecordTransfer, RecordTransfer,
EditPayReceive, EditPayReceive,
CreateServiceDialog, CreateServiceDialog,
MarketTransferDialog,
tmplDrawer tmplDrawer
}, },
data() { data() {
...@@ -304,6 +307,7 @@ export default { ...@@ -304,6 +307,7 @@ export default {
handleRadioChange: () => { } handleRadioChange: () => { }
}], }],
accountVisible: false, accountVisible: false,
marketTransferVisible: false,
serviceInfo: {}, serviceInfo: {},
tmplDrawerVisible: false, tmplDrawerVisible: false,
tmplInfo: { tmplInfo: {
...@@ -698,6 +702,21 @@ export default { ...@@ -698,6 +702,21 @@ export default {
handleTransferRecordConfirm() { handleTransferRecordConfirm() {
this.handleTransferRecordVisible() this.handleTransferRecordVisible()
},
// 市场费转账
handleMarketTransfer(row) {
this.merchantInfo = row
this.handleMarketTransferVisible()
},
handleMarketTransferVisible() {
this.marketTransferVisible = !this.marketTransferVisible
},
handleMarketTransferConfirm() {
this.handleMarketTransferVisible()
this.$refs.recordTable.refreshTable(false, true)
} }
} }
} }
......
export const EXPENSE_CATEGORY_OPTIONS = [
{ 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: "资源费金额" }
]
export const MARKET_TRANSFER_UPLOAD_RULE = {
extensions: [".xls", ".xlsx", ".doc", ".docx", ".pdf", ".jpg", ".jpeg", ".png", ".bmp"],
maxSizeMb: 10,
maxCount: 4,
accept: ".xls,.xlsx,.doc,.docx,.pdf,.jpg,.jpeg,.png,.bmp"
}
export const FORM_COMPONENT_RULE = {
component: "glsx-combi-form",
requiredFor: ["finance dialog forms", "new business forms"]
}
export function buildMarketTransferFormData() {
return [
{
label: "所属平台方",
name: "platformMerchantName",
type: "showTxt"
},
{
label: "所属服务商",
name: "billMerchantName",
type: "showTxt"
},
{
label: "费用类型",
name: "expenseCategoryIds",
addHtml: "expenseCategoryHtml"
},
{
label: "",
name: "downloadDetail",
addHtml: "downloadDetailHtml"
},
{
label: "收款账户",
name: "transferInMerchantId",
type: "select",
attrs: {
popperClass: "market-transfer-account-popper"
},
isClear: true,
optionList: [],
optionId: "value",
optionLabel: "label",
optionsName: "bankAccountList"
},
{
label: "转账金额",
name: "transferTotalAmount",
type: "showTxt"
},
{
label: "发票及其他说明",
name: "invoiceRemark",
type: "input",
maxlength: 100
},
{
label: "转账凭证",
name: "fileUrlList",
addHtml: "fileHtml"
},
{
label: "备注",
name: "remark",
type: "input",
maxlength: 50
}
]
}
export function getVisibleAmountFields(expenseCategoryIds = []) {
return EXPENSE_CATEGORY_OPTIONS.filter(item => expenseCategoryIds.includes(item.id))
}
export function mapMarketFeeResults(data = {}) {
const amountMap = {}
;(data.list || []).forEach(item => {
amountMap[item.expenseCategoryId] = item.expenseCategoryResult
})
return {
amountMap,
totalAmount: data.expenseCategoryTotalResult || 0
}
}
export function buildMarketFeeDownloadTask(row, expenseCategoryIds = []) {
const params = {
id: row.id,
expenseCategoryIds,
method: "dj.api.smartcarlife.reconciliationBill.transfer.market.fee.download"
}
return {
name: "市场费转账明细",
exportParam: JSON.stringify(params),
status: "waiting",
timeid: new Date().getTime()
}
}
import {
MARKET_TRANSFER_UPLOAD_RULE,
EXPENSE_CATEGORY_OPTIONS,
FORM_COMPONENT_RULE,
buildMarketTransferFormData,
getVisibleAmountFields,
mapMarketFeeResults,
buildMarketFeeDownloadTask
} from "@/views/financeManage/accountStateManage/marketTransfer"
describe("marketTransfer helpers", () => {
it("shows amount fields only for selected expense categories", () => {
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", () => {
const result = mapMarketFeeResults({
list: [
{ expenseCategoryId: 706, expenseCategoryResult: 11 },
{ expenseCategoryId: 900, expenseCategoryResult: 22 }
],
expenseCategoryTotalResult: 33
})
expect(result.amountMap).toEqual({ 706: 11, 900: 22 })
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)
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")
})
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("uses the requested voucher upload rule", () => {
expect(MARKET_TRANSFER_UPLOAD_RULE.extensions).toEqual([
".xls",
".xlsx",
".doc",
".docx",
".pdf",
".jpg",
".jpeg",
".png",
".bmp"
])
expect(MARKET_TRANSFER_UPLOAD_RULE.maxSizeMb).toBe(10)
expect(MARKET_TRANSFER_UPLOAD_RULE.maxCount).toBe(4)
expect(MARKET_TRANSFER_UPLOAD_RULE.accept).toBe(".xls,.xlsx,.doc,.docx,.pdf,.jpg,.jpeg,.png,.bmp")
})
it("documents that finance forms should use glsx-combi-form", () => {
expect(FORM_COMPONENT_RULE.component).toBe("glsx-combi-form")
expect(FORM_COMPONENT_RULE.requiredFor).toContain("finance dialog forms")
})
it("keeps invoice remark before voucher in the market transfer form", () => {
const names = buildMarketTransferFormData().map(item => item.name)
expect(names.indexOf("invoiceRemark")).toBeLessThan(names.indexOf("fileUrlList"))
})
it("adds a horizontal-scroll popper class for bank account options", () => {
const bankAccount = buildMarketTransferFormData().find(item => item.name === "transferInMerchantId")
expect(bankAccount.attrs.popperClass).toBe("market-transfer-account-popper")
})
})
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!