Commit 3b104bbf by yuzhenWang

Merge branch 'test' into 'dev'

Test

See merge request !109
parents 75ee40be 83d3cb8c
......@@ -33,6 +33,7 @@
"js-cookie": "3.0.5",
"jsencrypt": "3.3.2",
"jszip": "^3.10.1",
"lodash": "^4.18.1",
"nprogress": "0.2.0",
"p-limit": "^7.3.0",
"pinia": "3.0.2",
......
......@@ -9,7 +9,6 @@ export function getPolicyCommissionList(data) {
})
}
// 生成可出账记录
export function generateCommissionRecord(data) {
return request({
......@@ -55,7 +54,7 @@ export function downloadPolicyFortuneAccount(data) {
return request({
url: '/csf/api/fortune/download/account',
method: 'post',
data: data,
data: data
})
}
......@@ -257,7 +256,6 @@ export function commissionEntryEditRecords(data) {
})
}
// 获取保单发佣列表
export function policyNoCommissionPayRecord(data) {
return request({
......@@ -303,8 +301,8 @@ export function updateCommissionExpected(data) {
}
// 修改出账状态
export function updataPayrollStatus(data){
return request({
export function updataPayrollStatus(data) {
return request({
url: '/csf/api/fortune/update/status',
method: 'post',
data: data
......@@ -312,8 +310,8 @@ export function updataPayrollStatus(data){
}
// 批量新增检核记录
export function addPayrollCheckRecord(data){
return request({
export function addPayrollCheckRecord(data) {
return request({
url: '/csf/api/commission/addBatch',
method: 'post',
data: data
......@@ -321,8 +319,8 @@ export function addPayrollCheckRecord(data){
}
// 新增应收款
export function addReceivedFortune(data){
return request({
export function addReceivedFortune(data) {
return request({
url: '/csf/api/CommissionExpected/add',
method: 'post',
data: data
......@@ -330,23 +328,23 @@ export function addReceivedFortune(data){
}
// 新增出账记录
export function addPayRecord(data){
return request({
export function addPayRecord(data) {
return request({
url: '/csf/api/expectedFortune/add',
method: 'post',
data: data
})
}
// 获取销售员详情
export function userSaleExpandDetail(data){
return request({
export function userSaleExpandDetail(data) {
return request({
url: '/insurance/base/api/userSaleExpand/detail?userSaleBizId=' + data,
method: 'get',
method: 'get'
})
}
// 更新比对状态
export function updateCompareStatus(data){
return request({
export function updateCompareStatus(data) {
return request({
url: '/csf/api/commission/updateCompareStatus',
method: 'post',
data: data
......@@ -354,8 +352,8 @@ export function updateCompareStatus(data){
}
// 更新数据
export function updateCommissionRecord(data){
return request({
export function updateCommissionRecord(data) {
return request({
url: '/csf/api/commission/update',
method: 'post',
data: data
......@@ -363,8 +361,8 @@ export function updateCommissionRecord(data){
}
// 新增出账检核记录
export function addCheckRecordaddBatch(data){
return request({
export function addCheckRecordaddBatch(data) {
return request({
url: '/csf/api/fortune/addBatch',
method: 'post',
data: data
......@@ -372,8 +370,8 @@ export function addCheckRecordaddBatch(data){
}
// 设置本期出账金额
export function updatePayoutAmount(data){
return request({
export function updatePayoutAmount(data) {
return request({
url: '/csf/api/fortune/update',
method: 'post',
data: data
......@@ -381,16 +379,16 @@ export function updatePayoutAmount(data){
}
// 同步预计来佣
export function syncExpectedCommission(data){
return request({
export function syncExpectedCommission(data) {
return request({
url: '/csf/api/commission/addToExpected',
method: 'post',
data: data
})
}
// 更新出账记录
export function updatePayRecord(data){
return request({
export function updatePayRecord(data) {
return request({
url: '/csf/api/expectedFortune/update',
method: 'post',
data: data
......@@ -406,10 +404,10 @@ export function exportPayRecord(data) {
})
}
// 入账检核重新比对
export function compareCommissionEntry(data){
return request({
export function compareCommissionEntry(data) {
return request({
url: '/csf/api/commission/compare?commissionBizId=' + data,
method: 'get',
method: 'get'
})
}
......@@ -418,7 +416,7 @@ export function payableReport(data) {
return request({
url: '/csf/api/expectedFortune/payable_report',
method: 'post',
data: data,
data: data
})
}
......@@ -429,4 +427,75 @@ export function receivableReport(data) {
method: 'post',
data: data
})
}
\ No newline at end of file
}
// 薪资拆分应发信息汇总列表
export function salarySummary(data) {
return request({
url: 'csf/api/salarySplit/summary/page',
method: 'post',
data: data
})
}
// 薪资拆分应发信息汇总列表下载---待提供
export function exportPayRoll(data) {
return request({
url: 'csf/api/salarySplit/export/summary/list',
method: 'post',
data: data
})
}
// 拆分出账列表
export function salarySplitList(data) {
return request({
url: 'csf/api/salarySplit/page',
method: 'post',
data: data
})
}
// 拆分出账查询-原币种剩余总金额和原币种
export function billSplitRemaining(data) {
return request({
url: 'csf/api/salarySplit/query/remaining',
method: 'post',
data: data
})
}
// 获取转介人详情
export function borkerDetail(data) {
return request({
url: '/insurance/base/api/userSaleExpand/detail?clientUserBizId=' + data,
method: 'get'
})
}
// 拆分出账查询-原币种和原币种金额——>目标币种即时汇率和目标币种金额
export function billSplitRate(data) {
return request({
url: 'csf/api/salarySplit/query/rate',
method: 'post',
data: data
})
}
// 拆分出账查询-批量保存-薪资拆分应发信息列表
export function billBatchSave(data) {
return request({
url: 'csf/api/salarySplit/batch/save',
method: 'post',
data: data
})
}
// 拆分出账查询-计算目标金额
export function billCalculateToAmount(data) {
return request({
url: 'csf/api/salarySplit/calculate/toAmount',
method: 'post',
data: data
})
}
......@@ -82,14 +82,28 @@
v-model="localModel[item.prop]"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:start-placeholder="item.startPlaceholder || '开始日期'"
:end-placeholder="item.endPlaceholder || '结束日期'"
:value-format="item.valueFormat || 'YYYY-MM-DD'"
:disabled="item.disabled"
:disabled-date="getDisabledDateFn(item)"
style="width: 100%"
@change="val => handleModelChange(val, item)"
/>
<!-- Monthrange (新增) -->
<el-date-picker
v-else-if="item.type === 'monthrange'"
v-model="localModel[item.prop]"
type="monthrange"
range-separator="至"
:start-placeholder="item.startPlaceholder || '开始月份'"
:end-placeholder="item.endPlaceholder || '结束月份'"
:value-format="item.valueFormat || 'YYYY-MM'"
:disabled="item.disabled"
:disabled-date="getDisabledDateFn(item)"
style="width: 100%"
@change="val => handleModelChange(val, item)"
/>
<!-- Checkbox Group -->
<el-checkbox-group
......@@ -359,7 +373,7 @@ watch(
// 优先用父传值,否则用默认值
if (props.modelValue?.[key] !== undefined) {
initialModel[key] = props.modelValue[key]
} else if (item.multiple || ['checkbox-group', 'daterange'].includes(item.type)) {
} else if (item.multiple || ['checkbox-group', 'daterange','monthrange'].includes(item.type)) {
initialModel[key] = item.defaultValue ?? []
} else {
initialModel[key] = item.defaultValue ?? ''
......@@ -396,7 +410,7 @@ function syncModelFromProps(newModelValue, newConfig) {
const key = item.prop
if (newModelValue.hasOwnProperty(key)) {
synced[key] = newModelValue[key]
} else if (item.multiple || ['checkbox-group', 'daterange'].includes(item.type)) {
} else if (item.multiple || ['checkbox-group', 'daterange','monthrange'].includes(item.type)) {
synced[key] = item.defaultValue ?? []
} else {
synced[key] = item.defaultValue ?? ''
......@@ -571,7 +585,7 @@ onMounted(async () => {
if (localModel.value[key] == null) {
if (item.multiple) {
initialData[key] = item.defaultValue ?? []
} else if (['checkbox-group', 'daterange'].includes(item.type)) {
} else if (['checkbox-group', 'daterange','monthrange'].includes(item.type)) {
initialData[key] = item.defaultValue ?? []
} else {
initialData[key] = item.defaultValue ?? ''
......@@ -885,7 +899,7 @@ defineExpose({
const resetData = {}
internalConfig.value.forEach(item => {
const key = item.prop
if (['checkbox-group', 'daterange'].includes(item.type) || item.multiple) {
if (['checkbox-group', 'daterange','monthrange'].includes(item.type) || item.multiple) {
resetData[key] = item.defaultValue ?? []
} else if (item.type === 'upload') {
resetData[key] = item.defaultValue ?? [] // upload 也是数组
......
......@@ -75,3 +75,7 @@ export function processUserName(users) {
}
})
}
export function generateId() {
return `${Date.now()}_${Math.random().toString(36).substr(2, 8)}`
}
// 格式化金额为货币格式
export function formatCurrency(value, currency = '',fixedDigits = 2) {
export function formatCurrency(value, currency = '', fixedDigits = 2) {
if (value === undefined || value === null) return currency + '0.00'
return currency + value.toFixed(fixedDigits).replace(/\d(?=(\d{3})+\.)/g, '$&,')
}
......@@ -198,9 +198,19 @@ export function formatThousandsSimple(value) {
return result
}
export function inputThousands(value) {
if (value === undefined || value === null || value === '') {
return ''
}
const parts = String(value).split('.')
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',')
return parts.join('.')
}
export default {
formatCurrency,
numberFormat,
formatThousands,
formatThousandsSimple
formatThousandsSimple,
inputThousands
}
......@@ -16,7 +16,7 @@ const service = axios.create({
// axios中请求配置有baseURL选项,表示请求URL公共部分
baseURL: import.meta.env.VITE_APP_BASE_API,
// 超时
timeout: 10000
timeout: 30000
})
// request拦截器
......
import { ref } from 'vue'
export function usePositiveDecimal(defaultPlaces = 2) {
// 实时过滤(返回过滤后的字符串)
const filterInput = (value, decimalPlaces = defaultPlaces) => {
if (value === undefined || value === null) return ''
let str = String(value)
// 1. 只保留数字和小数点
str = str.replace(/[^\d.]/g, '')
// 2. 限制只有一个小数点
const parts = str.split('.')
if (parts.length > 2) {
str = parts[0] + '.' + parts.slice(1).join('')
}
// 3. 限制小数位数
if (parts.length === 2 && parts[1].length > decimalPlaces) {
str = parts[0] + '.' + parts[1].slice(0, decimalPlaces)
}
return str
}
// 失焦时格式化(补零 / 截断)
const formatBlur = (value, decimalPlaces = defaultPlaces) => {
if (value === '' || value === null || value === undefined) {
return ''
}
let num = parseFloat(value)
if (isNaN(num) || num < 0) {
return ''
}
return num.toFixed(decimalPlaces)
}
return { filterInput, formatBlur }
}
......@@ -203,7 +203,7 @@ import {
getPolicyFortuneList,
addCheckRecordaddBatch,
updatePayoutAmount,
downloadPolicyFortuneAccount
downloadPolicyFortuneAccount,
} from '@/api/financial/commission'
import useUserStore from '@/store/modules/user'
......@@ -378,11 +378,13 @@ const addCheckRecordConfig = [
requestParams: { pageNo: 1, pageSize: 20 },
placeholder: '输入转介人名称搜索',
debounceWait: 500, // 自定义防抖时间
valueKey: 'userSaleBizId',
valueKey: 'clientUserBizId',
labelKey: 'realName',
onChangeExtraFields: {
broker: 'realName', // 自动同步 raw.name 到 reconciliationCompany
reconciliationCompanyCode: 'code'
reconciliationCompanyCode: 'code',
team:'deptName',
teamBizId:'deptBizId',
},
transform: res => {
return res?.data.records || []
......
<template>
<div class='app-container'>
<CommonPage :operationBtnList='operationBtnList' :visibleDefaultButtons='visibleDefaultButtons'
:showSearchForm='true' :show-pagination='true' :total='pageTotal' :current-page='currentPage'
:page-size='pageSize' @size-change='handleSizeChange' @current-change='handleCurrentChange'>
<div class="app-container">
<CommonPage
:operationBtnList="operationBtnList"
:visibleDefaultButtons="visibleDefaultButtons"
:showSearchForm="true"
:show-pagination="true"
:total="pageTotal"
:current-page="currentPage"
:page-size="pageSize"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
<!-- 搜索区域 -->
<template #searchForm>
<SearchForm ref="searchFormRef" :config="searchConfig" />
......@@ -13,21 +21,32 @@
<div class="statistics-container">
<el-row :gutter="16">
<el-col :xs="24" :sm="12" :md="6" class="text-center mb-4">
<el-statistic title="总金额" :value="statisticInfo.totalAmount" />
<el-statistic
title="总金额"
:value="statisticInfo.totalAmount"
:formatter="value => formatCurrency(value, '', 4)"
/>
</el-col>
<el-col :xs="24" :sm="12" :md="6" class="text-center mb-4">
<el-statistic title="总人数" :value="statisticInfo.brokerCount" />
</el-col>
</el-row>
</div>
<el-table :data="tableData" @selection-change="handleSelectionChange" v-loading="loading" ref="tableRef"
row-key="fortuneAccountBizId" :reserve-selection="true" :border="true">
<el-table
:data="tableData"
@selection-change="handleSelectionChange"
v-loading="loading"
ref="tableRef"
row-key="fortuneAccountBizId"
:reserve-selection="true"
:border="true"
>
<el-table-column type="selection" width="55" :reserve-selection="true" />
<el-table-column prop="broker" label="转介人" min-width="120" sortable />
<el-table-column prop="team" label="所属团队" min-width="120" sortable />
<el-table-column prop="hkdAmount" label="出账金额" width="120" sortable>
<template #default="scope">
{{ formatCurrency(scope.row.hkdAmount) }}
{{ formatCurrency(scope.row.hkdAmount, '', 4) }}
</template>
</el-table-column>
<el-table-column prop="currency" label="出账币种" width="120" sortable>
......@@ -42,14 +61,212 @@
</el-tag>
</template>
</el-table-column>
<el-table-column prop="fortuneAccountDate" label="出账日" min-width="150" show-overflow-tooltip />
<el-table-column
prop="fortuneAccountDate"
label="出账日"
min-width="150"
show-overflow-tooltip
/>
<el-table-column prop="remark" label="备注" min-width="150" show-overflow-tooltip />
<el-table-column fixed="right" label="操作" min-width="120">
<template #default="{ row }">
<el-popover placement="right" :width="200" trigger="click">
<template #reference>
<el-icon>
<MoreFilled />
</el-icon>
</template>
<el-menu @select="handleSelect($event, row)" popper-class="custom-menu">
<el-menu-item
:index="item.value"
v-for="item in dropdownItems"
:key="item.value"
>{{ item.label }}</el-menu-item
>
</el-menu>
</el-popover>
</template>
</el-table-column>
</el-table>
</template>
</CommonPage>
<!-- 拆分出账 -->
<CommonDialog
dialogTitle="拆分出账"
dialogWidth="90%"
confirmText="批量保存"
:openDialog="showBillingFlag"
:showAction="true"
:showClose="true"
@close="showBillingFlag = false"
@confirm="handleBillConfirm"
>
<!-- 统计数据 -->
<div class="statistics-container">
<el-row :gutter="16">
<el-col :xs="24" :sm="12" :md="6" class="text-center mb-4">
<el-statistic
title="原币种总金额"
:value="currentRow.hkdAmount"
:formatter="value => formatCurrency(value, '', 4)"
/>
</el-col>
<el-col :xs="24" :sm="12" :md="6" class="text-center mb-4">
<el-statistic
title="剩余原币种总金额"
:value="billStatistic.beSplitAmount"
:formatter="value => formatCurrency(value, '', 4)"
/>
</el-col>
</el-row>
</div>
<el-button
style="margin: 10px 0"
@click="handleAddBill"
:loading="addBillLoading"
type="primary"
:icon="Plus"
>新增拆分</el-button
>
<el-table
v-loading="billLoading"
:data="billTableList"
border
ref="billTableRef"
height="450px"
>
<el-table-column
label="序号 "
width="55"
align="center"
type="index"
fixed="left"
></el-table-column>
<el-table-column label="发放编号" prop="salarySplitNo" width="150" fixed="left">
<template #default="scope">
<el-input
v-model="scope.row.salarySplitNo"
placeholder="请输入"
clearable
:disabled="true"
/>
</template>
</el-table-column>
<el-table-column label="转介人" prop="brokerName" width="150">
<template #default="scope">
<el-input
v-model="scope.row.brokerName"
placeholder="请输入"
clearable
:disabled="true"
/>
</template>
</el-table-column>
<el-table-column label="转介人内部编号" prop="internalNumber" width="150">
<template #default="scope">
<el-input
v-model="scope.row.internalNumber"
placeholder="请输入"
clearable
:disabled="true"
/>
</template>
</el-table-column>
<el-table-column label="出账机构" prop="billOrg" width="150">
<template #default="scope">
<el-input v-model="scope.row.billOrg" placeholder="请输入" clearable />
</template>
</el-table-column>
<el-table-column label="原币种金额" prop="fromAmount" width="150">
<template #default="scope">
<!--等生产没问题再删除 @input="val => (scope.row.fromAmount = amountInput.filterInput(val, 4))"
@blur="billInputBlur('fromAmount', scope.row)" -->
<el-input
v-model="scope.row.fromAmount"
placeholder="请输入"
clearable
@clear="clearInput('fromAmount', scope.row)"
@input="val => handleFromAmountInput(val, scope.row)"
@blur="handleFromAmountBlur(scope.row)"
:formatter="value => inputThousands(value)"
:parser="value => value.replace(/\$\s?|(,*)/g, '')"
/>
</template>
</el-table-column>
<el-table-column label="目标币种" prop="toCurrency" width="150">
<template #default="scope">
<el-select
v-model="scope.row.toCurrency"
style="width: 100%"
placeholder="请选择"
clearable
@clear="clearInput('toCurrency', scope.row)"
@change="changeToCurrency(scope.row)"
>
<el-option
v-for="item in bx_currency_type"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
<!--等生产没问题再删除 @blur="billInputBlur('exchangeRate', scope.row)"
@input="val => (scope.row.exchangeRate = amountInput.filterInput(val, 4))" -->
<el-table-column label="汇率" prop="exchangeRate" width="150">
<template #default="scope">
<el-input
v-model="scope.row.exchangeRate"
placeholder="请输入"
clearable
@clear="clearInput('exchangeRate', scope.row)"
@input="val => handleExchangeRateInput(val, scope.row)"
@blur="handleExchangeRateBlur(scope.row)"
/>
</template>
</el-table-column>
<el-table-column label="目标金额" prop="toAmount" width="150">
<template #default="scope">
<el-input
v-model="scope.row.toAmount"
placeholder="请输入"
clearable
:disabled="true"
@input="val => (scope.row.toAmount = amountInput.filterInput(val, 4))"
:formatter="value => inputThousands(value)"
:parser="value => value.replace(/\$\s?|(,*)/g, '')"
/>
</template>
</el-table-column>
<el-table-column label="备注" prop="remark" width="150">
<template #default="scope">
<el-input v-model="scope.row.remark" type="textarea" placeholder="请输入" />
</template>
</el-table-column>
<el-table-column label="操作" width="150" align="center" fixed="right">
<template #default="scope">
<div class="btnCon">
<el-button
size="small"
type="danger"
@click="handleDeleteBill(scope.row, scope.$index)"
>删除</el-button
>
</div>
</template>
</el-table-column>
</el-table>
</CommonDialog>
<!-- 弹窗-->
<CommonDialog dialogTitle='出账完成' dialogWidth='80%' :openDialog=billingCompleteDialogVisible :showAction='false'
:showClose='true' @close='billingCompleteDialogVisible = false'>
<CommonDialog
dialogTitle="出账完成"
dialogWidth="80%"
:openDialog="billingCompleteDialogVisible"
:showAction="false"
:showClose="true"
@close="billingCompleteDialogVisible = false"
>
<div style="text-align: center">
<el-icon size="48" color="#67C23A">
<SuccessFilled />
......@@ -57,8 +274,14 @@
<p style="margin-top: 16px; font-size: 16px">出账操作已完成!</p>
</div>
</CommonDialog>
<CommonDialog dialogTitle='修订记录' dialogWidth='80%' :openDialog=showReviseRecord :showAction='false'
:showClose='true' @close='showReviseRecord = false'>
<CommonDialog
dialogTitle="修订记录"
dialogWidth="80%"
:openDialog="showReviseRecord"
:showAction="false"
:showClose="true"
@close="showReviseRecord = false"
>
<el-table :data="reviseList" border>
<el-table-column prop="createTime" label="修订时间" align="center" width="180">
<template #default="scope">
......@@ -78,13 +301,27 @@
import { ref, reactive } from 'vue'
import CommonPage from '@/components/commonPage'
import CommonDialog from '@/components/commonDialog'
import { Plus } from '@element-plus/icons-vue'
import {
getReferrerFortuneList,
salaryStatistics,
salarySplitList,
billSplitRemaining,
borkerDetail,
billSplitRate,
billBatchSave,
billCalculateToAmount
} from '@/api/financial/commission'
import { formatCurrency } from '@/utils/number'
import { formatCurrency, inputThousands } from '@/utils/number'
import { generateId } from '@/utils/common'
import { ElMessageBox, ElMessage } from 'element-plus'
import SearchForm from '@/components/SearchForm/SearchForm.vue'
import { usePositiveDecimal } from '@/utils/usePositiveDecimal'
import { debounce } from 'lodash-es'
const amountInput = usePositiveDecimal(4) // 默认2位小数
const { proxy } = getCurrentInstance()
const { bx_currency_type } = proxy.useDict('bx_currency_type')
const searchFormRef = ref(null)
const searchParams = ref({})
const searchConfig = ref([
......@@ -100,7 +337,7 @@ const searchConfig = ref([
valueKey: 'clientUserBizId',
labelKey: 'realName',
multiple: true,
transform: (res) => {
transform: res => {
return res?.data.records || []
}
},
......@@ -117,7 +354,7 @@ const searchConfig = ref([
label: '出账状态',
dictType: 'csf_expected_fortune_status',
multiple: true,
defaultValue: ['6'],//默认查询待出账,已检核的数据
defaultValue: ['6'] //默认查询待出账,已检核的数据
}
])
// 添加表格引用
......@@ -144,14 +381,295 @@ const billingCompleteDialogVisible = ref(false)
const currentPage = ref(1)
const pageSize = ref(10)
const pageTotal = ref(0)
let showBillingFlag = ref(false)
let currentRow = ref(null)
let billTableList = ref([{ salarySplitNo: '1' }])
let billLoading = ref(false)
let billPageTotal = ref(0)
let billCurrentPage = ref(1)
let billPageSize = ref(999)
let billStatistic = ref({ beSplitAmount: 0, beSplitCurrency: 0 })
let saleInfo = ref({})
let addBillLoading = ref(false)
let submitBillLoading = ref(false)
// 存储每行的防抖函数(原币种金额)
const debounceChangeRateMap = new WeakMap()
// 存储每行的防抖函数(汇率)
const debounceChangeToAmountMap = new WeakMap()
// 表格操作菜单
const dropdownItems = [
{ label: '拆分出账', value: 'splitBilling' }
// { label: '更新', value: 'editRecord' },
// { label: '查看记录', value: 'viewRecord' }
]
//=============拆分出账开始================
const clearInput = (key, row) => {
if (key == 'toCurrency') {
row.exchangeRate = '0.00'
row.toAmount = '0.00'
} else if (key == 'exchangeRate') {
row.toAmount = '0.00'
} else if (key == 'fromAmount') {
row.toAmount = '0.00'
}
}
const getDebouncedChangeRate = row => {
if (!debounceChangeRateMap.has(row)) {
const debounced = debounce(r => {
changeRate(r)
}, 500)
debounceChangeRateMap.set(row, debounced)
}
return debounceChangeRateMap.get(row)
}
const getDebouncedChangeToAmount = row => {
if (!debounceChangeToAmountMap.has(row)) {
const debounced = debounce(r => {
changeToAmount(r)
}, 500)
debounceChangeToAmountMap.set(row, debounced)
}
return debounceChangeToAmountMap.get(row)
}
// 原币种金额输入处理
const handleFromAmountInput = (val, row) => {
row.fromAmount = amountInput.filterInput(val, 4)
getDebouncedChangeRate(row)(row)
}
// 原币种金额失焦处理
const handleFromAmountBlur = row => {
const debounced = debounceChangeRateMap.get(row)
if (debounced) debounced.cancel()
changeRate(row)
}
// 汇率输入处理
const handleExchangeRateInput = (val, row) => {
row.exchangeRate = amountInput.filterInput(val, 4)
getDebouncedChangeToAmount(row)(row)
}
// 汇率失焦处理
const handleExchangeRateBlur = row => {
const debounced = debounceChangeToAmountMap.get(row)
if (debounced) debounced.cancel()
changeToAmount(row)
}
const billInputBlur = (type, row) => {
if (type == 'fromAmount') {
if (row.fromAmount) {
changeRate(row)
}
} else if (type == 'exchangeRate') {
if (row.exchangeRate) {
changeToAmount(row)
}
}
}
// 改变汇率
const changeRate = async (row, type) => {
try {
if (row.toCurrency) {
const params = {
fortuneAccountBizId: currentRow.value.fortuneAccountBizId, //出账记录业务id(关联出账记录表)
fromCurrency: currentRow.value.currency, //原币种
fromAmount: row.fromAmount || '0.00', //原币种金额
toCurrency: row.toCurrency //目标币种
}
const response = await billSplitRate(params)
if (response.data) {
if (type == 'toCurrency') {
row.exchangeRate = response.data.exchangeRate ? response.data.exchangeRate.toFixed(4) : ''
}
if (response.data.convertedAmount > 0) {
row.toAmount = Number(response.data.convertedAmount).toFixed(4)
} else {
row.toAmount = '0.00'
}
}
} else {
}
} catch (error) {
ElMessage.error('获取汇率失败')
}
}
//改变目标金额
const changeToAmount = async row => {
try {
if (row.exchangeRate && row.fromAmount) {
const params = {
fromAmount: row.fromAmount, //原币种金额
exchangeRate: row.exchangeRate //汇率
}
const response = await billCalculateToAmount(params)
if (response.data) {
row.toAmount = Number(response.data.toAmount).toFixed(4)
}
}
} catch (error) {
ElMessage.error('获取目标金额失败')
}
}
const handleBillConfirm = async () => {
submitBillLoading.value = true
billTableList.value = billTableList.value.map(item => {
item.brokerBizId = currentRow.value.brokerBizId
return item
})
try {
const params = {
fortuneAccountBizId: currentRow.value.fortuneAccountBizId,
apiSalarySplitBatchSaveDtoList: billTableList.value
}
const response = await billBatchSave(params)
if (response.code == 200) {
ElMessage.success('拆分出账新增保存成功')
showBillingFlag.value = false
submitBillLoading.value = false
}
} catch (error) {
submitBillLoading.value = false
ElMessage.error('拆分出账新增保存失败')
}
}
const changeToCurrency = row => {
if (row.toCurrency) {
changeRate(row, 'toCurrency')
} else {
row.exchangeRate = ''
row.toAmount = ''
}
}
const handleBillSizeChange = val => {
billPageSize.value = val
getSplitTableList()
}
const handleBillCurrentChange = val => {
billCurrentPage.value = val
getSplitTableList()
}
// 新增拆分出账
const handleAddBill = async () => {
addBillLoading.value = true
try {
const params = {
fortuneAccountBizId: currentRow.value.fortuneAccountBizId, //出账记录业务id(关联出账记录表)
fromAmountList: billTableList.value.map(item => {
return item.fromAmount
})
}
const response = await billSplitRemaining(params)
console.log('====================================')
console.log('新增拆分', response)
console.log('====================================')
if (response.data) {
if (response.data.fromAmount > 0) {
billTableList.value.push({
brokerName: currentRow.value.broker,
fromAmount: Number(response.data.fromAmount).toFixed(4),
internalNumber: saleInfo.value.internalNumber ? saleInfo.value.internalNumber : '',
id: generateId()
})
addBillLoading.value = false
billPageTotal.value = billTableList.value.length
} else {
addBillLoading.value = false
ElMessage.error('剩余金额不足,不能新增拆分出账')
}
}
} catch (error) {
addBillLoading.value = false
ElMessage.error('获取剩余金额失败')
}
}
// 删除拆分出账
const handleDeleteBill = (row, index) => {
console.log('====================================')
console.log('删除拆分', row)
console.log('====================================')
ElMessageBox.confirm('确定删除此行?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
billTableList.value.splice(index, 1)
})
.catch(() => {})
}
// 获取数据列表
const getSplitTableList = async (searchParams = {}) => {
billLoading.value = true
try {
const params = {
...searchParams,
pageNo: billCurrentPage.value,
pageSize: billPageSize.value,
fortuneAccountBizId: currentRow.value.fortuneAccountBizId
}
const userSale = await borkerDetail(currentRow.value.brokerBizId)
if (userSale.data) {
saleInfo.value = userSale.data
}
const response = await salarySplitList(params)
if (response.data.page) {
billTableList.value = response.data.page.records
if (billTableList.value.length == 0) {
billTableList.value = [
{
brokerName: currentRow.value.broker,
fromAmount: Number(currentRow.value.hkdAmount).toFixed(4),
internalNumber: userSale.data ? userSale.data.internalNumber : '',
id: generateId(),
exchangeRate: '0.00',
toAmount: '0.00'
}
]
billPageTotal.value = billTableList.value.length
} else {
billTableList.value = billTableList.value.map(item => {
item.brokerName = currentRow.value.broker
item.internalNumber = userSale.data ? userSale.data.internalNumber : ''
return item
})
billPageTotal.value = response.data.page.total
}
billLoading.value = false
showBillingFlag.value = true
}
if (response.data.statisticsDto) {
billStatistic.value = response.data.statisticsDto
}
} catch (error) {
billLoading.value = false
// ElMessage.error('获取数据失败')
}
}
//=============拆分出账结束================
const handleSelect = (e, row) => {
console.log('选中行:', e, row)
currentRow.value = row
if (e === 'splitBilling') {
billPageSize.value = 10
billCurrentPage.value = 1
billTableList.value = []
getSplitTableList()
}
}
// 分页事件
const handleSizeChange = (val) => {
const handleSizeChange = val => {
pageSize.value = val
getList()
}
const handleCurrentChange = (val) => {
const handleCurrentChange = val => {
currentPage.value = val
getList()
}
......@@ -219,7 +737,6 @@ const clearAllSelection = () => {
}
}
// 获取数据列表
const getList = async (searchParams = {}) => {
loading.value = true
......@@ -228,7 +745,7 @@ const getList = async (searchParams = {}) => {
...searchParams,
accountDateStart: searchParams.payoutDate?.[0] || undefined,
accountDateEnd: searchParams.payoutDate?.[1] || undefined,
payoutDate:undefined,
payoutDate: undefined,
pageNo: currentPage.value,
pageSize: pageSize.value
}
......@@ -242,6 +759,7 @@ const getList = async (searchParams = {}) => {
if (response.data.statisticsVO) {
statisticInfo.value = response.data.statisticsVO
}
// 数据加载完成后,设置当前页的选中状态
nextTick(() => {
setCurrentPageSelection()
......@@ -250,6 +768,7 @@ const getList = async (searchParams = {}) => {
loading.value = false
// ElMessage.error('获取数据失败')
}
// tableData.value = [{}]
}
getList()
......@@ -286,8 +805,6 @@ const handleSelectionChange = selection => {
updateAllSelectedRows()
}
// 完成出账
const completeBilling = async () => {
if (selectedRows.value.length === 0) {
......@@ -370,10 +887,9 @@ const fetchCompletePolicyFortune = async row => {
} else {
ElMessage.error(res.msg)
}
} catch (error) { }
} catch (error) {}
}
const visibleDefaultButtons = ref(['reset', 'query'])
// 按钮配置
const operationBtnList = ref([
......@@ -398,6 +914,31 @@ const operationBtnList = ref([
}
])
const formatAmount = value => {
if (value === null || value === undefined || value === '') {
return ''
}
// 转换为数字
let num = typeof value === 'number' ? value : parseFloat(value)
if (isNaN(num)) {
return '' // 无效值返回空字符串
}
// 保留两位小数
let fixed = num.toFixed(2)
// 拆分整数和小数部分
let parts = fixed.split('.')
// 整数部分添加千位分隔符
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',')
return parts.join('.')
}
// 解析器(配合 formatter,保持数据一致性)
const parseAmount = value => {
if (!value) return null
// 移除千位分隔符
const cleaned = value.replace(/,/g, '')
const num = parseFloat(cleaned)
return isNaN(num) ? null : num
}
</script>
<style scoped></style>
\ No newline at end of file
<style scoped></style>
......@@ -122,7 +122,7 @@
<script setup name="Payables">
import CommonPage from '@/components/commonPage'
import { ref, reactive } from 'vue'
import { ref, reactive,nextTick } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { formatCurrency } from '@/utils/number'
import { expectedFortuneList, payRecordList, addPayRecord, updatePayRecord, exportPayRecord, payableReport } from '@/api/financial/commission'
......@@ -161,7 +161,7 @@ const payableReportListTableColumns = ref([
{ prop: 'broker', label: '转介人', sortable: true, width: '120', formatter: (row) => row.broker || '-' },
{ prop: 'fortuneName', label: '出账项目', sortable: true, width: '120', formatter: (row) => row.fortuneName || '-' },
{ prop: 'status', label: '出账状态', sortable: true, width: '120', formatter: (row) => getDictLabel('csf_expected_fortune_status', row.status) || '-' },
{ prop: 'currency', label: '出账币种', sortable: true, width: '100', formatter: (row) => row.currency || '-' },
{ prop: 'currencyName', label: '出账币种', sortable: true, width: '100', formatter: (row) => row.currencyName || '-' },
{ prop: 'fortunePeriod', label: '出账期数', sortable: true, width: '100', formatter: (row) => row.fortunePeriod || '-' },
{ prop: 'fortuneTotalPeriod', label: '出账总期数', sortable: true, width: '100', formatter: (row) => row.fortuneTotalPeriod || '-' },
{ prop: 'payoutDate', label: '出账日(估)', sortable: true, width: '120', formatter: (row) => row.payoutDate || '-' },
......@@ -387,7 +387,7 @@ const addPayRecordFormConfig = [
requestParams: { pageNo: 1, pageSize: 20 },
placeholder: '输入转介人名称搜索',
debounceWait: 500, // 自定义防抖时间
valueKey: 'userSaleBizId',
valueKey: 'clientUserBizId',
labelKey: 'realName',
onChangeExtraFields: {
broker: 'realName',// 自动同步 raw.name 到 reconciliationCompany
......@@ -480,12 +480,13 @@ const handleSelect = async (e, row) => {
} else if (e === 'updateData') {
editStatus.value = 'edit'
addPayRecordDialogVisible.value = true
if (addPayRecordFormRef.value) {
addPayRecordFormModel.value = {
...selectedRow.value
}
}
// 2. 使用 nextTick 等待 DOM 更新
nextTick(() => {
// 3. 此时 addRecordRef.value 一定存在了
if (addPayRecordFormRef.value && selectedRow.value) {
addPayRecordFormModel.value = { ...selectedRow.value };
}
});
console.log(addPayRecordFormModel.value)
}
......
<template>
<div class='app-container'>
<CommonPage :operationBtnList='operationBtnList' :visibleDefaultButtons='visibleDefaultButtons'
:showSearchForm='true' :show-pagination='true' :total='pageTotal' :current-page='currentPage'
:page-size='pageSize' @size-change='handleSizeChange' @current-change='handleCurrentChange'>
<!-- 搜索区域 -->
<template #searchForm>
<SearchForm ref="searchFormRef" :config="searchConfig" />
</template>
<!-- 列表区域 -->
<template #table>
<el-table :data="tableData" v-loading="loading" ref="tableRef"
row-key="salarySplitNo" :reserve-selection="true" :border="true">
<el-table-column v-for="(column, index) in tableColumns" :key="index" :fixed="column.fixed"
:prop="column.prop" :label="column.label" :width="column.width" :sortable="column.sortable"
:formatter="column.formatter" />
</el-table>
</template>
</CommonPage>
</div>
</template>
<script setup>
import { ref, reactive } from 'vue'
import CommonPage from '@/components/commonPage'
import {salarySummary,exportPayRoll} from '@/api/financial/commission'
import { ElMessageBox, ElMessage } from 'element-plus'
import SearchForm from '@/components/SearchForm/SearchForm.vue'
const searchFormRef = ref(null)
const searchParams = ref({})
const searchConfig = ref([
{
type: 'select',
prop: 'brokerBizIdList',
label: '转介人',
api: '/insurance/base/api/userSaleExpand/page',
keywordField: 'realName',
requestParams: { pageNo: 1, pageSize: 20 },
placeholder: '输入转介人名称搜索',
debounceWait: 500, // 自定义防抖时间
valueKey: 'clientUserBizId',
labelKey: 'realName',
multiple: true,
transform: (res) => {
return res?.data.records || []
}
},
{
type: 'monthrange',
prop: 'payoutMonth',
label: '出账年月(实)',
startPlaceholder: '开始年月',
endPlaceholder: '结束年月'
},
{
type: 'input',
prop: 'billOrg',
label: '出账机构',
}
])
const tableColumns = ref([
{ prop: 'salarySplitNo', label: '发放编号', sortable: true, width: '150',fixed:'left'},
{ prop: 'brokerName', label: '转介人', sortable: true, width: '150',fixed:'left'},
{ prop: 'internalNumber', label: '内部编号', sortable: true, width: '150'},
{ prop: 'team', label: '所属团队', sortable: true, width: '150'},
{ prop: 'fromAmount', label: '原币种金额', sortable: true, width: '150'},
{ prop: 'currency', label: '原币种', sortable: true, width: '150'},
{ prop: 'exchangeRate', label: '汇率(原币种->目标币种)', sortable: true, width: '150'},
{ prop: 'toAmount', label: '目标金额', sortable: true, width: '150'},
{ prop: 'toCurrency', label: '目标币种', sortable: true, width: '150'},
{ prop: 'fortuneAccountMonth', label: '出账月(实)', sortable: true, width: '150'},
{ prop: 'billOrg', label: '出账机构', sortable: true, width: '150'},
{ prop: 'hkdAmount', label: '本期总出账金额(原币种)', sortable: true, width: '150'},
{ prop: 'fortuneAccountBizId', label: '出账记录业务id', sortable: true, width: '150'},
])
// 添加表格引用
const tableRef = ref()
// 表格数据
const tableData = ref([])
const loading = ref(false)
// 分页相关
const currentPage = ref(1)
const pageSize = ref(10)
const pageTotal = ref(0)
// 分页事件
const handleSizeChange = (val) => {
pageSize.value = val
getList()
}
const handleCurrentChange = (val) => {
currentPage.value = val
getList()
}
// 获取数据列表
const getList = async (searchParams = {}) => {
loading.value = true
try {
const params = {
...searchParams,
startMonth:searchParams.payoutMonth ? searchParams.payoutMonth[0] : '',
endMonth:searchParams.payoutMonth ? searchParams.payoutMonth[1] :'',
payoutMonth:undefined,
pageNo: currentPage.value,
pageSize: pageSize.value
}
const response = await salarySummary(params)
if (response.data.page) {
tableData.value = response.data.page.records
pageTotal.value = response.data.page.total
loading.value = false
}
} catch (error) {
loading.value = false
// ElMessage.error('获取数据失败')
}
}
getList()
// 查询
const handleQuery = () => {
const params = searchFormRef.value.getFormData()
console.log('父组件发起查询:', params)
getList(params)
}
// 重置查询
const handleReset = () => {
// 重置搜索表单
searchFormRef.value.resetForm()
searchParams.value = {}
console.log('表单已重置')
getList(searchParams.value)
}
const handleExport = async () => {
// 获取搜索参数
let params = searchFormRef.value?.getFormData()
params = {
...params,
startMonth:params.payoutMonth ? params.payoutMonth[0] : '',
endMonth:params.payoutMonth ? params.payoutMonth[1] :'',
payoutMonth:undefined,
}
const response = await exportPayRoll(params)
if(response.data && response.data.url){
window.open(response.data.url)
}else{
ElMessage.error('导出失败')
}
}
const visibleDefaultButtons = ref(['export','reset', 'query'])
// 按钮配置
const operationBtnList = ref([
{
key: 'reset',
direction: 'right',
click: handleReset
},
{
key: 'query',
direction: 'right',
click: handleQuery
},
{
key: 'export',
direction: 'right',
click: handleExport
}
])
</script>
<style scoped></style>
\ No newline at end of file
......@@ -196,7 +196,7 @@
<script setup name="Receivables">
import CommonPage from '@/components/commonPage'
import CommonDialog from '@/components/commonDialog'
import { ref, reactive, onMounted, computed } from 'vue'
import { ref, reactive, onMounted, computed,nextTick } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { MoreFilled } from '@element-plus/icons-vue'
import {
......@@ -696,11 +696,14 @@ const handleSelect = async (e, row) => {
} else if (e === 'updateData') {
editStatus.value = 'update'
addReceivablesDialogVisible.value = true
if (addRecordRef.value) {
addReceivablesFormModel.value = {
...selectedRow.value
// 2. 使用 nextTick 等待 DOM 更新
nextTick(() => {
// 3. 此时 addRecordRef.value 一定存在了
if (addRecordRef.value && selectedRow.value) {
addReceivablesFormModel.value = { ...selectedRow.value };
console.log('赋值成功:', addReceivablesFormModel.value);
}
}
});
console.log('更新数据', selectedRow.value)
}
}
......
......@@ -582,9 +582,11 @@ const confirmAffirm = async () => {
currentRow.value = {}
}
} catch (error) {
console.log('error', error)
settingAffirmLoading.value = false
console.error('加载数据失败:', error)
ElMessage.error('必填项不能为空' || '认定失败')
if (error.message && error.message.includes('Validation')) {
ElMessage.error('必填项不能为空')
}
}
}
// ==============设置认定结果结束============
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment