Commit 64281c76 by yuzhenWang

Merge branch 'feature-20260407wyz-增加拆分出帐' into 'test'

Feature 20260407wyz 增加拆分出帐

See merge request !104
parents 74677502 43a80971
...@@ -45,7 +45,7 @@ RUN ls -la node_modules/esbuild/bin && \ ...@@ -45,7 +45,7 @@ RUN ls -la node_modules/esbuild/bin && \
# 复制源码并构建 # 复制源码并构建
COPY . . COPY . .
RUN npm run build:dev RUN npm run build:prod
# 生产阶段 # 生产阶段
FROM docker.m.daocloud.io/library/nginx:alpine FROM docker.m.daocloud.io/library/nginx:alpine
...@@ -60,5 +60,5 @@ RUN echo "https://mirrors.aliyun.com/alpine/v3.22/main/" > /etc/apk/repositories ...@@ -60,5 +60,5 @@ RUN echo "https://mirrors.aliyun.com/alpine/v3.22/main/" > /etc/apk/repositories
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone echo "Asia/Shanghai" > /etc/timezone
EXPOSE 6688 EXPOSE 2669
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]
\ No newline at end of file
# 定义网关服务的负载均衡组
upstream gateway_load_balance {
server 139.224.150.79:9010; # 管理节点服务器上的网关实例
server 139.224.149.150:9011; # 工作节点服务器上的网关实例
}
server { server {
listen 6688; listen 2669;
server_name 139.224.145.34; server_name _;
# 处理前端静态资源(Vue应用) root /usr/share/nginx/html;
location / { index index.html;
root /usr/share/nginx/html;
index index.html; # 静态资源处理 - 必须放在最前面
try_files $uri $uri/ /index.html; # 处理Vue路由history模式 location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|map)$ {
if ($request_method = OPTIONS) { # ✅ 关键:添加 try_files 指令
try_files $uri =404;
# 确保静态资源有正确的过期时间和缓存头
expires 1y;
add_header Cache-Control "public, immutable";
# 为静态资源添加CORS头
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization' always;
# 处理OPTIONS请求(CORS预检)
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS'; add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
add_header 'Access-Control-Max-Age' 1728000; add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0; add_header 'Content-Length' 0;
add_header 'Content-Type' 'text/plain; charset=UTF-8';
return 204; return 204;
} }
limit_except GET POST PUT DELETE OPTIONS {
deny all;
}
} }
# 代理后端API请求 - 使用更具体的路径 # 健康检查接口
location /api/ { location /health {
proxy_buffer_size 1024k; #设置代理服务器(nginx)保存用户头信息的缓冲区大小 access_log off;
proxy_buffers 16 1024k; #proxy_buffers缓冲区,网页平均在32k以下的设置 return 200 "healthy\n";
proxy_busy_buffers_size 2048k; #高负荷下缓冲大小(proxy_buffers*2) add_header Content-Type text/plain;
proxy_temp_file_write_size 2048k; #设定缓存文件夹大小,大于这个值,将从upstream服务器传
proxy_pass http://139.224.145.34:9002/;
} }
# 可能需要代理其他后端服务 # 前端路由处理 - 放在最后,作为兜底规则
# location /other-service/ { location / {
# proxy_pass http://other-service:port/; try_files $uri $uri/ /index.html; # 处理Vue路由history模式
# }
} # 为页面添加CORS头
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization' always;
}
}
\ No newline at end of file
...@@ -9,7 +9,6 @@ export function getPolicyCommissionList(data) { ...@@ -9,7 +9,6 @@ export function getPolicyCommissionList(data) {
}) })
} }
// 生成可出账记录 // 生成可出账记录
export function generateCommissionRecord(data) { export function generateCommissionRecord(data) {
return request({ return request({
...@@ -55,7 +54,7 @@ export function downloadPolicyFortuneAccount(data) { ...@@ -55,7 +54,7 @@ export function downloadPolicyFortuneAccount(data) {
return request({ return request({
url: '/csf/api/fortune/download/account', url: '/csf/api/fortune/download/account',
method: 'post', method: 'post',
data: data, data: data
}) })
} }
...@@ -257,7 +256,6 @@ export function commissionEntryEditRecords(data) { ...@@ -257,7 +256,6 @@ export function commissionEntryEditRecords(data) {
}) })
} }
// 获取保单发佣列表 // 获取保单发佣列表
export function policyNoCommissionPayRecord(data) { export function policyNoCommissionPayRecord(data) {
return request({ return request({
...@@ -303,8 +301,8 @@ export function updateCommissionExpected(data) { ...@@ -303,8 +301,8 @@ export function updateCommissionExpected(data) {
} }
// 修改出账状态 // 修改出账状态
export function updataPayrollStatus(data){ export function updataPayrollStatus(data) {
return request({ return request({
url: '/csf/api/fortune/update/status', url: '/csf/api/fortune/update/status',
method: 'post', method: 'post',
data: data data: data
...@@ -312,8 +310,8 @@ export function updataPayrollStatus(data){ ...@@ -312,8 +310,8 @@ export function updataPayrollStatus(data){
} }
// 批量新增检核记录 // 批量新增检核记录
export function addPayrollCheckRecord(data){ export function addPayrollCheckRecord(data) {
return request({ return request({
url: '/csf/api/commission/addBatch', url: '/csf/api/commission/addBatch',
method: 'post', method: 'post',
data: data data: data
...@@ -321,8 +319,8 @@ export function addPayrollCheckRecord(data){ ...@@ -321,8 +319,8 @@ export function addPayrollCheckRecord(data){
} }
// 新增应收款 // 新增应收款
export function addReceivedFortune(data){ export function addReceivedFortune(data) {
return request({ return request({
url: '/csf/api/CommissionExpected/add', url: '/csf/api/CommissionExpected/add',
method: 'post', method: 'post',
data: data data: data
...@@ -330,23 +328,23 @@ export function addReceivedFortune(data){ ...@@ -330,23 +328,23 @@ export function addReceivedFortune(data){
} }
// 新增出账记录 // 新增出账记录
export function addPayRecord(data){ export function addPayRecord(data) {
return request({ return request({
url: '/csf/api/expectedFortune/add', url: '/csf/api/expectedFortune/add',
method: 'post', method: 'post',
data: data data: data
}) })
} }
// 获取销售员详情 // 获取销售员详情
export function userSaleExpandDetail(data){ export function userSaleExpandDetail(data) {
return request({ return request({
url: '/insurance/base/api/userSaleExpand/detail?userSaleBizId=' + data, url: '/insurance/base/api/userSaleExpand/detail?userSaleBizId=' + data,
method: 'get', method: 'get'
}) })
} }
// 更新比对状态 // 更新比对状态
export function updateCompareStatus(data){ export function updateCompareStatus(data) {
return request({ return request({
url: '/csf/api/commission/updateCompareStatus', url: '/csf/api/commission/updateCompareStatus',
method: 'post', method: 'post',
data: data data: data
...@@ -354,8 +352,8 @@ export function updateCompareStatus(data){ ...@@ -354,8 +352,8 @@ export function updateCompareStatus(data){
} }
// 更新数据 // 更新数据
export function updateCommissionRecord(data){ export function updateCommissionRecord(data) {
return request({ return request({
url: '/csf/api/commission/update', url: '/csf/api/commission/update',
method: 'post', method: 'post',
data: data data: data
...@@ -363,8 +361,8 @@ export function updateCommissionRecord(data){ ...@@ -363,8 +361,8 @@ export function updateCommissionRecord(data){
} }
// 新增出账检核记录 // 新增出账检核记录
export function addCheckRecordaddBatch(data){ export function addCheckRecordaddBatch(data) {
return request({ return request({
url: '/csf/api/fortune/addBatch', url: '/csf/api/fortune/addBatch',
method: 'post', method: 'post',
data: data data: data
...@@ -372,8 +370,8 @@ export function addCheckRecordaddBatch(data){ ...@@ -372,8 +370,8 @@ export function addCheckRecordaddBatch(data){
} }
// 设置本期出账金额 // 设置本期出账金额
export function updatePayoutAmount(data){ export function updatePayoutAmount(data) {
return request({ return request({
url: '/csf/api/fortune/update', url: '/csf/api/fortune/update',
method: 'post', method: 'post',
data: data data: data
...@@ -381,16 +379,16 @@ export function updatePayoutAmount(data){ ...@@ -381,16 +379,16 @@ export function updatePayoutAmount(data){
} }
// 同步预计来佣 // 同步预计来佣
export function syncExpectedCommission(data){ export function syncExpectedCommission(data) {
return request({ return request({
url: '/csf/api/commission/addToExpected', url: '/csf/api/commission/addToExpected',
method: 'post', method: 'post',
data: data data: data
}) })
} }
// 更新出账记录 // 更新出账记录
export function updatePayRecord(data){ export function updatePayRecord(data) {
return request({ return request({
url: '/csf/api/expectedFortune/update', url: '/csf/api/expectedFortune/update',
method: 'post', method: 'post',
data: data data: data
...@@ -406,10 +404,10 @@ export function exportPayRecord(data) { ...@@ -406,10 +404,10 @@ export function exportPayRecord(data) {
}) })
} }
// 入账检核重新比对 // 入账检核重新比对
export function compareCommissionEntry(data){ export function compareCommissionEntry(data) {
return request({ return request({
url: '/csf/api/commission/compare?commissionBizId=' + data, url: '/csf/api/commission/compare?commissionBizId=' + data,
method: 'get', method: 'get'
}) })
} }
...@@ -418,7 +416,7 @@ export function payableReport(data) { ...@@ -418,7 +416,7 @@ export function payableReport(data) {
return request({ return request({
url: '/csf/api/expectedFortune/payable_report', url: '/csf/api/expectedFortune/payable_report',
method: 'post', method: 'post',
data: data, data: data
}) })
} }
...@@ -434,8 +432,8 @@ export function receivableReport(data) { ...@@ -434,8 +432,8 @@ export function receivableReport(data) {
// 薪资拆分应发信息汇总列表 // 薪资拆分应发信息汇总列表
export function salarySummary(data) { export function salarySummary(data) {
return request({ return request({
url:'csf/api/salarySplit/summary/page', url: 'csf/api/salarySplit/summary/page',
method: 'post', method: 'post',
data: data data: data
}) })
} }
...@@ -443,8 +441,61 @@ export function salarySummary(data) { ...@@ -443,8 +441,61 @@ export function salarySummary(data) {
// 薪资拆分应发信息汇总列表下载---待提供 // 薪资拆分应发信息汇总列表下载---待提供
export function exportPayRoll(data) { export function exportPayRoll(data) {
return request({ return request({
url:'csf/api/salarySplit/export/summary/list', url: 'csf/api/salarySplit/export/summary/list',
method: 'post', method: 'post',
data: data, data: data
}) })
} }
\ No newline at end of file
// 拆分出账列表
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
})
}
...@@ -75,3 +75,7 @@ export function processUserName(users) { ...@@ -75,3 +75,7 @@ export function processUserName(users) {
} }
}) })
} }
export function generateId() {
return `${Date.now()}_${Math.random().toString(36).substr(2, 8)}`
}
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 }
}
<template> <template>
<div class='app-container'> <div class="app-container">
<CommonPage :operationBtnList='operationBtnList' :visibleDefaultButtons='visibleDefaultButtons' <CommonPage
:showSearchForm='true' :show-pagination='true' :total='pageTotal' :current-page='currentPage' :operationBtnList="operationBtnList"
:page-size='pageSize' @size-change='handleSizeChange' @current-change='handleCurrentChange'> :visibleDefaultButtons="visibleDefaultButtons"
:showSearchForm="true"
:show-pagination="true"
:total="pageTotal"
:current-page="currentPage"
:page-size="pageSize"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
<!-- 搜索区域 --> <!-- 搜索区域 -->
<template #searchForm> <template #searchForm>
<SearchForm ref="searchFormRef" :config="searchConfig" /> <SearchForm ref="searchFormRef" :config="searchConfig" />
...@@ -13,21 +21,32 @@ ...@@ -13,21 +21,32 @@
<div class="statistics-container"> <div class="statistics-container">
<el-row :gutter="16"> <el-row :gutter="16">
<el-col :xs="24" :sm="12" :md="6" class="text-center mb-4"> <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>
<el-col :xs="24" :sm="12" :md="6" class="text-center mb-4"> <el-col :xs="24" :sm="12" :md="6" class="text-center mb-4">
<el-statistic title="总人数" :value="statisticInfo.brokerCount" /> <el-statistic title="总人数" :value="statisticInfo.brokerCount" />
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
<el-table :data="tableData" @selection-change="handleSelectionChange" v-loading="loading" ref="tableRef" <el-table
row-key="fortuneAccountBizId" :reserve-selection="true" :border="true"> :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 type="selection" width="55" :reserve-selection="true" />
<el-table-column prop="broker" label="转介人" min-width="120" sortable /> <el-table-column prop="broker" label="转介人" min-width="120" sortable />
<el-table-column prop="team" label="所属团队" min-width="120" sortable /> <el-table-column prop="team" label="所属团队" min-width="120" sortable />
<el-table-column prop="hkdAmount" label="出账金额" width="120" sortable> <el-table-column prop="hkdAmount" label="出账金额" width="120" sortable>
<template #default="scope"> <template #default="scope">
{{ formatCurrency(scope.row.hkdAmount) }} {{ formatCurrency(scope.row.hkdAmount, '', 4) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="currency" label="出账币种" width="120" sortable> <el-table-column prop="currency" label="出账币种" width="120" sortable>
...@@ -42,14 +61,202 @@ ...@@ -42,14 +61,202 @@
</el-tag> </el-tag>
</template> </template>
</el-table-column> </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 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> </el-table>
</template> </template>
</CommonPage> </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 />
</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">
<el-input
v-model="scope.row.fromAmount"
placeholder="请输入"
clearable
@clear="clearInput('fromAmount', scope.row)"
@input="val => (scope.row.fromAmount = amountInput.filterInput(val, 4))"
@blur="billInputBlur('fromAmount', scope.row)"
:formatter="value => `${value}`.replace(/\d(?=(\d{3})+\.)/g, '$&,')"
: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>
<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)"
@blur="billInputBlur('exchangeRate', scope.row)"
@input="val => (scope.row.exchangeRate = amountInput.filterInput(val, 4))"
/>
</template>
</el-table-column>
<el-table-column label="目标金额" prop="toAmount" width="150">
<template #default="scope">
<el-input
v-model="scope.row.toAmount"
placeholder="请输入"
clearable
@input="val => (scope.row.toAmount = amountInput.filterInput(val, 4))"
:formatter="value => `${value}`.replace(/\d(?=(\d{3})+\.)/g, '$&,')"
: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' <CommonDialog
:showClose='true' @close='billingCompleteDialogVisible = false'> dialogTitle="出账完成"
dialogWidth="80%"
:openDialog="billingCompleteDialogVisible"
:showAction="false"
:showClose="true"
@close="billingCompleteDialogVisible = false"
>
<div style="text-align: center"> <div style="text-align: center">
<el-icon size="48" color="#67C23A"> <el-icon size="48" color="#67C23A">
<SuccessFilled /> <SuccessFilled />
...@@ -57,8 +264,14 @@ ...@@ -57,8 +264,14 @@
<p style="margin-top: 16px; font-size: 16px">出账操作已完成!</p> <p style="margin-top: 16px; font-size: 16px">出账操作已完成!</p>
</div> </div>
</CommonDialog> </CommonDialog>
<CommonDialog dialogTitle='修订记录' dialogWidth='80%' :openDialog=showReviseRecord :showAction='false' <CommonDialog
:showClose='true' @close='showReviseRecord = false'> dialogTitle="修订记录"
dialogWidth="80%"
:openDialog="showReviseRecord"
:showAction="false"
:showClose="true"
@close="showReviseRecord = false"
>
<el-table :data="reviseList" border> <el-table :data="reviseList" border>
<el-table-column prop="createTime" label="修订时间" align="center" width="180"> <el-table-column prop="createTime" label="修订时间" align="center" width="180">
<template #default="scope"> <template #default="scope">
...@@ -78,13 +291,26 @@ ...@@ -78,13 +291,26 @@
import { ref, reactive } from 'vue' import { ref, reactive } from 'vue'
import CommonPage from '@/components/commonPage' import CommonPage from '@/components/commonPage'
import CommonDialog from '@/components/commonDialog' import CommonDialog from '@/components/commonDialog'
import { Plus } from '@element-plus/icons-vue'
import { import {
getReferrerFortuneList, getReferrerFortuneList,
salaryStatistics, salaryStatistics,
salarySplitList,
billSplitRemaining,
borkerDetail,
billSplitRate,
billBatchSave,
billCalculateToAmount
} from '@/api/financial/commission' } from '@/api/financial/commission'
import { formatCurrency } from '@/utils/number' import { formatCurrency, formatThousands } from '@/utils/number'
import { generateId } from '@/utils/common'
import { ElMessageBox, ElMessage } from 'element-plus' import { ElMessageBox, ElMessage } from 'element-plus'
import SearchForm from '@/components/SearchForm/SearchForm.vue' import SearchForm from '@/components/SearchForm/SearchForm.vue'
import { usePositiveDecimal } from '@/utils/usePositiveDecimal'
const amountInput = usePositiveDecimal(4) // 默认2位小数
const { proxy } = getCurrentInstance()
const { bx_currency_type } = proxy.useDict('bx_currency_type')
const searchFormRef = ref(null) const searchFormRef = ref(null)
const searchParams = ref({}) const searchParams = ref({})
const searchConfig = ref([ const searchConfig = ref([
...@@ -100,7 +326,7 @@ const searchConfig = ref([ ...@@ -100,7 +326,7 @@ const searchConfig = ref([
valueKey: 'clientUserBizId', valueKey: 'clientUserBizId',
labelKey: 'realName', labelKey: 'realName',
multiple: true, multiple: true,
transform: (res) => { transform: res => {
return res?.data.records || [] return res?.data.records || []
} }
}, },
...@@ -117,7 +343,7 @@ const searchConfig = ref([ ...@@ -117,7 +343,7 @@ const searchConfig = ref([
label: '出账状态', label: '出账状态',
dictType: 'csf_expected_fortune_status', dictType: 'csf_expected_fortune_status',
multiple: true, multiple: true,
defaultValue: ['6'],//默认查询待出账,已检核的数据 defaultValue: ['6'] //默认查询待出账,已检核的数据
} }
]) ])
// 添加表格引用 // 添加表格引用
...@@ -144,14 +370,237 @@ const billingCompleteDialogVisible = ref(false) ...@@ -144,14 +370,237 @@ const billingCompleteDialogVisible = ref(false)
const currentPage = ref(1) const currentPage = ref(1)
const pageSize = ref(10) const pageSize = ref(10)
const pageTotal = ref(0) 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 dropdownItems = [
{ label: '拆分出账', value: 'splitBilling' }
// { label: '更新', value: 'editRecord' },
// { label: '查看记录', value: 'viewRecord' }
]
//=============拆分出账开始================
const clearInput = (key, row) => {
if (key == 'fromAmount' || key == 'toCurrency') {
row.exchangeRate = '0.00'
row.toAmount = '0.00'
} else if (key == 'exchangeRate') {
row.toAmount = '0.00'
}
}
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 => {
try {
if (row.toCurrency && row.fromAmount) {
const params = {
fortuneAccountBizId: currentRow.value.fortuneAccountBizId, //出账记录业务id(关联出账记录表)
fromCurrency: currentRow.value.currency, //原币种
fromAmount: row.fromAmount, //原币种金额
toCurrency: row.toCurrency //目标币种
}
const response = await billSplitRate(params)
if (response.data) {
row.exchangeRate = response.data.exchangeRate
? (response.data.exchangeRate * 100).toFixed(4)
: ''
row.toAmount = Number(response.data.convertedAmount).toFixed(4)
}
} 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
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)
} 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 pageSize.value = val
getList() getList()
} }
const handleCurrentChange = (val) => { const handleCurrentChange = val => {
currentPage.value = val currentPage.value = val
getList() getList()
} }
...@@ -219,7 +668,6 @@ const clearAllSelection = () => { ...@@ -219,7 +668,6 @@ const clearAllSelection = () => {
} }
} }
// 获取数据列表 // 获取数据列表
const getList = async (searchParams = {}) => { const getList = async (searchParams = {}) => {
loading.value = true loading.value = true
...@@ -228,7 +676,7 @@ const getList = async (searchParams = {}) => { ...@@ -228,7 +676,7 @@ const getList = async (searchParams = {}) => {
...searchParams, ...searchParams,
accountDateStart: searchParams.payoutDate?.[0] || undefined, accountDateStart: searchParams.payoutDate?.[0] || undefined,
accountDateEnd: searchParams.payoutDate?.[1] || undefined, accountDateEnd: searchParams.payoutDate?.[1] || undefined,
payoutDate:undefined, payoutDate: undefined,
pageNo: currentPage.value, pageNo: currentPage.value,
pageSize: pageSize.value pageSize: pageSize.value
} }
...@@ -242,6 +690,7 @@ const getList = async (searchParams = {}) => { ...@@ -242,6 +690,7 @@ const getList = async (searchParams = {}) => {
if (response.data.statisticsVO) { if (response.data.statisticsVO) {
statisticInfo.value = response.data.statisticsVO statisticInfo.value = response.data.statisticsVO
} }
// 数据加载完成后,设置当前页的选中状态 // 数据加载完成后,设置当前页的选中状态
nextTick(() => { nextTick(() => {
setCurrentPageSelection() setCurrentPageSelection()
...@@ -250,6 +699,7 @@ const getList = async (searchParams = {}) => { ...@@ -250,6 +699,7 @@ const getList = async (searchParams = {}) => {
loading.value = false loading.value = false
// ElMessage.error('获取数据失败') // ElMessage.error('获取数据失败')
} }
// tableData.value = [{}]
} }
getList() getList()
...@@ -286,8 +736,6 @@ const handleSelectionChange = selection => { ...@@ -286,8 +736,6 @@ const handleSelectionChange = selection => {
updateAllSelectedRows() updateAllSelectedRows()
} }
// 完成出账 // 完成出账
const completeBilling = async () => { const completeBilling = async () => {
if (selectedRows.value.length === 0) { if (selectedRows.value.length === 0) {
...@@ -370,10 +818,9 @@ const fetchCompletePolicyFortune = async row => { ...@@ -370,10 +818,9 @@ const fetchCompletePolicyFortune = async row => {
} else { } else {
ElMessage.error(res.msg) ElMessage.error(res.msg)
} }
} catch (error) { } } catch (error) {}
} }
const visibleDefaultButtons = ref(['reset', 'query']) const visibleDefaultButtons = ref(['reset', 'query'])
// 按钮配置 // 按钮配置
const operationBtnList = ref([ const operationBtnList = ref([
...@@ -398,6 +845,31 @@ const operationBtnList = ref([ ...@@ -398,6 +845,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> </script>
<style scoped></style> <style scoped></style>
\ No newline at end of file
...@@ -582,9 +582,11 @@ const confirmAffirm = async () => { ...@@ -582,9 +582,11 @@ const confirmAffirm = async () => {
currentRow.value = {} currentRow.value = {}
} }
} catch (error) { } catch (error) {
console.log('error', error)
settingAffirmLoading.value = false settingAffirmLoading.value = false
console.error('加载数据失败:', error) if (error.message && error.message.includes('Validation')) {
ElMessage.error('必填项不能为空' || '认定失败') 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