Commit 1d9c426b by yuzhenWang

Merge branch 'wyz' into 'test'

Wyz

See merge request !140
parents 5fb8d958 feb487f6
...@@ -120,6 +120,13 @@ ...@@ -120,6 +120,13 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="commissionRatio"
label="保单本期来佣率"
width="120"
:formatter="formatRatio"
>
</el-table-column>
<el-table-column
prop="currentCommissionRatio" prop="currentCommissionRatio"
label="本次实佣率" label="本次实佣率"
width="130" width="130"
...@@ -161,7 +168,7 @@ ...@@ -161,7 +168,7 @@
/> />
<el-table-column prop="policyCurrency" label="保单币种" width="120" sortable /> <el-table-column prop="policyCurrency" label="保单币种" width="120" sortable />
<el-table-column prop="productName" label="产品名称" width="120" /> <el-table-column prop="productName" label="产品名称" width="120" />
<el-table-column prop="commissionRatio" label="保单本期来佣率" width="120" />
<el-table-column prop="policyHolder" label="投保人" width="120" /> <el-table-column prop="policyHolder" label="投保人" width="120" />
<el-table-column prop="policyHolderEn" label="投保人(英文)" width="120" /> <el-table-column prop="policyHolderEn" label="投保人(英文)" width="120" />
<el-table-column prop="broker" label="转介人" width="120" /> <el-table-column prop="broker" label="转介人" width="120" />
...@@ -263,7 +270,7 @@ ...@@ -263,7 +270,7 @@
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :xs="24" :sm="24" :md="24" :lg="24"> <el-col :xs="24" :sm="24" :md="24" :lg="24">
<el-table :data="checkRecordTableData" style="width: 100%" height="400"> <el-table :data="checkRecordTableData" style="width: 100%" height="400">
<el-table-column prop="commissionBizType" label="应收款类型" width="120"> <el-table-column prop="commissionBizType" label="应收款类型" width="150">
<template #default="{ row }"> <template #default="{ row }">
{{ getCommissionBizTypeLabel(row.commissionBizType) }} {{ getCommissionBizTypeLabel(row.commissionBizType) }}
</template> </template>
...@@ -277,8 +284,12 @@ ...@@ -277,8 +284,12 @@
</el-table-column> </el-table-column>
<el-table-column prop="commissionPeriod" label="佣金期数" width="120" /> <el-table-column prop="commissionPeriod" label="佣金期数" width="120" />
<el-table-column prop="totalPeriod" label="总期数" width="120" /> <el-table-column prop="totalPeriod" label="总期数" width="120" />
<el-table-column prop="commissionDate" label="入账日(实)" width="120" /> <el-table-column prop="commissionDate" label="入账年月(实)" width="120" />
<el-table-column prop="amount" label="入账金额" width="120" /> <el-table-column prop="amount" label="入账金额" width="120">
<template #default="{ row }">
{{ formatCurrency(row.amount) }}
</template>
</el-table-column>
<el-table-column prop="currency" label="入账币种" width="120" /> <el-table-column prop="currency" label="入账币种" width="120" />
<el-table-column prop="exchangeRate" label="结算汇率" width="120" /> <el-table-column prop="exchangeRate" label="结算汇率" width="120" />
<el-table-column prop="commissionName" label="入账项目" width="120" /> <el-table-column prop="commissionName" label="入账项目" width="120" />
...@@ -327,7 +338,7 @@ ...@@ -327,7 +338,7 @@
</CommonDialog> </CommonDialog>
<!-- 新增检核记录弹窗 --> <!-- 新增检核记录弹窗 -->
<CommonDialog <CommonDialog
:dialogTitle="editStatus.value == 'add' ? '新增检核记录' : '修改检核记录'" :dialogTitle="editStatus == 'add' ? '新增检核记录' : '修改检核记录'"
dialogWidth="80%" dialogWidth="80%"
:openDialog="addCheckRecordDialogFlag" :openDialog="addCheckRecordDialogFlag"
:showAction="true" :showAction="true"
...@@ -335,6 +346,7 @@ ...@@ -335,6 +346,7 @@
@close="closeDialog()" @close="closeDialog()"
@confirm="handleAddCheckRecord()" @confirm="handleAddCheckRecord()"
> >
{{}}
<el-row> <el-row>
<el-col :xs="24" :sm="24" :md="24" :lg="24"> <el-col :xs="24" :sm="24" :md="24" :lg="24">
<SearchForm <SearchForm
...@@ -449,7 +461,7 @@ ...@@ -449,7 +461,7 @@
</template> </template>
<script setup> <script setup>
import { ref, reactive, onMounted } from 'vue' import { ref, reactive, onMounted, watch } from 'vue'
import CommonPage from '@/components/commonPage' import CommonPage from '@/components/commonPage'
import CommonDialog from '@/components/commonDialog' import CommonDialog from '@/components/commonDialog'
import SearchForm from '@/components/SearchForm/SearchForm.vue' import SearchForm from '@/components/SearchForm/SearchForm.vue'
...@@ -657,6 +669,7 @@ const checkRecordEdit = row => { ...@@ -657,6 +669,7 @@ const checkRecordEdit = row => {
selectedRowCheck.value = { ...row } selectedRowCheck.value = { ...row }
editStatus.value = 'edit' editStatus.value = 'edit'
addReceivablesFormModel.value = { ...row } addReceivablesFormModel.value = { ...row }
// addReceivablesFormModel.value.currency = 'HKD'
addCheckRecordDialogFlag.value = true addCheckRecordDialogFlag.value = true
console.log('父组件赋值', addReceivablesFormModel.value) console.log('父组件赋值', addReceivablesFormModel.value)
} }
...@@ -799,13 +812,22 @@ const addCheckRecordConfig = ref([ ...@@ -799,13 +812,22 @@ const addCheckRecordConfig = ref([
prop: 'currency', prop: 'currency',
label: '入账币种', label: '入账币种',
dictType: 'bx_currency_type', dictType: 'bx_currency_type',
rules: [{ required: true, message: '请选择入账币种', trigger: 'blur' }] defaultValue: 'HKD',
disabled: true,
rules: [
{
required: true,
message: '请选择入账币种',
trigger: 'blur'
}
]
}, },
{ {
type: 'select', type: 'select',
prop: 'commissionType', prop: 'commissionType',
label: '入账项目', label: '入账项目',
dictType: 'csf_commission_type', dictType: 'csf_commission_type',
defaultValue: '1',
rules: [{ required: true, message: '请选择入账项目', trigger: 'blur' }], rules: [{ required: true, message: '请选择入账项目', trigger: 'blur' }],
onChangeExtraFields: { onChangeExtraFields: {
commissionName: 'itemLabel' commissionName: 'itemLabel'
...@@ -846,7 +868,7 @@ const addCheckRecordConfig = ref([ ...@@ -846,7 +868,7 @@ const addCheckRecordConfig = ref([
}, },
{ {
type: 'input', type: 'input',
prop: 'remark', prop: 'manualRemark',
label: '备注' label: '备注'
} }
]) ])
...@@ -1102,6 +1124,16 @@ const handleSelect = (e, row) => { ...@@ -1102,6 +1124,16 @@ const handleSelect = (e, row) => {
} }
const handleAddCheckList = () => { const handleAddCheckList = () => {
editStatus.value = 'add' editStatus.value = 'add'
// addCheckRecordConfig.value = addCheckRecordConfig.value
// addCheckRecordConfig.value = addCheckRecordConfig.value.map(item => {
// if (item.prop == 'currency') {
// item.defaultValue = 'HKD'
// item.disabled = true
// } else if (item.prop == 'commissionType') {
// item.defaultValue = '1'
// }
// return item
// })
addReceivablesFormModel.value = { ...selectedRow.value } addReceivablesFormModel.value = { ...selectedRow.value }
addCheckRecordDialogFlag.value = true addCheckRecordDialogFlag.value = true
clearForm('addReceivablesFormModel') clearForm('addReceivablesFormModel')
......
...@@ -220,6 +220,25 @@ ...@@ -220,6 +220,25 @@
@inputChange="(prop, value, item) => handleInputChange('addPayRecord', prop, value, item)" @inputChange="(prop, value, item) => handleInputChange('addPayRecord', prop, value, item)"
/> />
</CommonDialog> </CommonDialog>
<!-- 修改出账记录 -->
<CommonDialog
dialogTitle="修改出账记录"
dialogWidth="80%"
:openDialog="updatePayRecordDialogVisible"
:showAction="true"
:showClose="true"
@close="updatePayRecordDialogVisible = false"
@confirm="handleConfirmUpdatePayRecord"
>
<SearchForm
ref="updatePayRecordFormRef"
:config="updatePayRecordFormConfig"
v-model="updatePayRecordFormModel"
@inputChange="
(prop, value, item) => handleInputChange('updatePayRecord', prop, value, item)
"
/>
</CommonDialog>
<!-- 设置出账状态 --> <!-- 设置出账状态 -->
<CommonDialog <CommonDialog
dialogTitle="设置出账状态" dialogTitle="设置出账状态"
...@@ -239,7 +258,7 @@ ...@@ -239,7 +258,7 @@
import CommonPage from '@/components/commonPage' import CommonPage from '@/components/commonPage'
import { ref, reactive, nextTick } from 'vue' import { ref, reactive, nextTick } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import { formatCurrency } from '@/utils/number' import { formatCurrency, calculateAmount } from '@/utils/number'
import { import {
expectedFortuneList, expectedFortuneList,
payRecordList, payRecordList,
...@@ -254,7 +273,9 @@ import CommonDialog from '@/components/commonDialog' ...@@ -254,7 +273,9 @@ import CommonDialog from '@/components/commonDialog'
import { loadDicts, getDictLabel } from '@/utils/useDict' import { loadDicts, getDictLabel } from '@/utils/useDict'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import { safeDownload } from '@/utils/safeDownload' import { safeDownload } from '@/utils/safeDownload'
const updatePayRecordFormModel = ref({})
const updatePayRecordFormRef = ref(null)
const updatePayRecordDialogVisible = ref(false)
const payableReportTableData = ref([]) const payableReportTableData = ref([])
const payableReportTableColumns = ref([ const payableReportTableColumns = ref([
{ {
...@@ -726,10 +747,235 @@ const searchConfig = ref([ ...@@ -726,10 +747,235 @@ const searchConfig = ref([
const payRecordDialogTableVisible = ref(false) const payRecordDialogTableVisible = ref(false)
// 新增出账记录 // 新增出账记录
const addPayRecordFormModel = ref({ const addPayRecordFormModel = ref({
fortuneBizType: 'R', fortuneBizType: 'R'
}) })
const addPayRecordDialogVisible = ref(false) const addPayRecordDialogVisible = ref(false)
const addPayRecordFormRef = ref() const addPayRecordFormRef = ref()
const updatePayRecordFormConfig = [
{
type: 'select',
prop: 'fortuneBizType',
label: '应付单类型',
options: [
{ value: 'R', label: '关联保单应付单' },
{ value: 'U', label: '非关联保单应付单' }
]
},
{
type: 'input',
prop: 'policyNo',
label: '关联保单号',
visible: formData => formData.fortuneBizType === 'R',
rules: [{ required: true, message: '关联保单号必填', trigger: 'blur' }]
},
{
type: 'month',
prop: 'payoutDate',
label: '出账月(估)',
placeholder: '请选择'
},
{
type: 'month',
prop: 'actualPayoutDate',
label: '出账月(实)',
placeholder: '请选择',
maxDate: 'today'
},
{
type: 'input',
prop: 'fortuneName',
label: '出账项目'
},
{
type: 'select',
prop: 'fortuneType',
label: '出账项目类型',
dictType: 'csf_fortune_type'
},
{
type: 'input',
prop: 'fortunePeriod',
label: '佣金期数',
inputType: 'decimal',
visible: formData => formData.fortuneBizType === 'R',
rules: [{ pattern: /^\d+$/, message: '只能输入正整数', trigger: 'blur' }]
},
{
type: 'input',
prop: 'fortuneTotalPeriod',
label: '总期数',
inputType: 'decimal',
visible: formData => formData.fortuneBizType === 'R',
rules: [{ pattern: /^\d+$/, message: '只能输入正整数', trigger: 'blur' }]
},
{
type: 'select',
prop: 'currency',
label: '出账币种',
dictType: 'bx_currency_type',
defaultValue: 'HKD'
},
{
type: 'select',
prop: 'brokerBizId',
label: '转介人',
api: '/insurance/base/api/userSaleExpand/page',
keywordField: 'realName',
requestParams: { pageNo: 1, pageSize: 200 },
placeholder: '输入转介人名称搜索',
debounceWait: 500, // 自定义防抖时间
valueKey: 'clientUserBizId',
labelKey: 'realName',
onChangeExtraFields: {
broker: 'realName', // 自动同步 raw.name 到 reconciliationCompany
reconciliationCompanyCode: 'code'
},
transform: res => {
return res?.data.records || []
}
},
{
type: 'select',
prop: 'teamBizId',
label: '所属团队',
api: '/csf/api/team/page',
keywordField: 'teamName',
requestParams: { pageNo: 1, pageSize: 200 },
placeholder: '输入所属团队名称搜索',
debounceWait: 500, // 自定义防抖时间
valueKey: 'teamBizId',
labelKey: 'teamName',
onChangeExtraFields: {
// broker: 'realName', // 自动同步 raw.name 到 reconciliationCompany
// reconciliationCompanyCode: 'code',
team: 'teamName',
teamBizId: 'teamBizId'
},
transform: res => {
return res?.data.records || []
},
rules: [{ required: true, message: '所属团队必填', trigger: 'blur' }]
},
{
type: 'select',
prop: 'ruleCurrency',
label: '保单币种',
dictType: 'bx_currency_type',
rules: [{ required: true, message: '保单币种必填', trigger: 'blur' }]
},
{
type: 'select',
prop: 'originalCurrency',
label: '原币种',
dictType: 'bx_currency_type',
rules: [{ required: true, message: '原币种必填', trigger: 'blur' }]
},
{
type: 'select',
prop: 'payoutCurrency',
label: '发放币种',
dictType: 'bx_currency_type',
rules: [{ required: true, message: '发放币种必填', trigger: 'blur' }]
},
{
type: 'input',
prop: 'originalAmount',
label: '原币种金额',
inputType: 'decimal',
rules: [{ required: true, message: '只能输入正整数和小数', trigger: 'blur' }]
},
{
type: 'input',
prop: 'originalToHkdRate',
label: '汇率3(原币种->港币)',
inputType: 'decimal',
rules: [{ required: true, message: '只能输入正整数和小数', trigger: 'blur' }]
// defaultValue: 1
},
{
type: 'input',
prop: 'hkdAmount',
label: '港币金额',
inputType: 'decimal',
rules: [{ required: true, message: '只能输入正整数和小数', trigger: 'blur' }]
},
{
type: 'input',
prop: 'hkdToPayoutRate',
label: '汇率1(港币->发放币种)',
inputType: 'decimal',
rules: [{ required: true, message: '只能输入正整数和小数', trigger: 'blur' }]
// defaultValue: 1
},
{
type: 'input',
prop: 'payoutAmount',
label: '实际发放金额',
inputType: 'decimal',
rules: [{ required: true, message: '只能输入正整数和小数', trigger: 'blur' }]
},
{
type: 'input',
prop: 'exchangeRate',
label: '汇率2(保单币种->港币)入账检核汇率',
inputType: 'decimal',
rules: [{ required: true, message: '只能输入正整数和小数', trigger: 'blur' }]
// defaultValue: 1
},
{
type: 'input',
prop: 'ruleAmount',
label: '保单币种金额',
inputType: 'decimal',
rules: [{ required: true, message: '只能输入正整数和小数', trigger: 'blur' }]
},
{
type: 'input',
prop: 'remark',
label: '备注'
}
// {
// type: 'input',
// prop: 'hkdAmount',
// label: '出账金额',
// rules: [
// { required: true, message: '请输入', trigger: 'blur' },
// { pattern: /^-?\d+(\.\d{1,2})?$/, message: '小数(最多两位)', trigger: 'blur' }
// ]
// },
// {
// type: 'input',
// prop: 'defaultExchangeRate',
// label: '结算汇率(入账检核时的汇率)',
// rules: [
// { required: true, message: '请输入', trigger: 'blur' },
// { pattern: /^-?\d+(\.\d{1,6})?$/, message: '小数(最多6位)', trigger: 'blur' }
// ]
// },
// {
// type: 'select',
// prop: 'status',
// label: '出账状态',
// dictType: 'csf_expected_fortune_status'
// },
// {
// type: 'input',
// prop: 'exchangeRate',
// label: '结算汇率',
// inputType: 'decimal',
// rules: [{ required: true, message: '只能输入正整数和小数', trigger: 'blur' }]
// // defaultValue: 1
// },
// {
// type: 'input',
// prop: 'remark',
// label: '备注'
// }
]
const addPayRecordFormConfig = [ const addPayRecordFormConfig = [
{ {
type: 'select', type: 'select',
...@@ -780,17 +1026,18 @@ const addPayRecordFormConfig = [ ...@@ -780,17 +1026,18 @@ const addPayRecordFormConfig = [
prop: 'hkdAmount', prop: 'hkdAmount',
label: '出账金额', label: '出账金额',
rules: [ rules: [
{ required: true, message: '请输入', trigger: 'blur' }, { required: true, message: '请输入', trigger: 'blur' },
{ pattern: /^-?\d+(\.\d{1,2})?$/, message: '小数(最多两位)', trigger: 'blur' } { pattern: /^-?\d+(\.\d{1,2})?$/, message: '小数(最多两位)', trigger: 'blur' }
] ]
}, { },
{
type: 'select', type: 'select',
prop: 'currency', prop: 'currency',
label: '出账币种', label: '出账币种',
dictType: 'bx_currency_type', dictType: 'bx_currency_type',
defaultValue:'HKD' defaultValue: 'HKD'
}, },
{ {
type: 'input', type: 'input',
prop: 'defaultExchangeRate', prop: 'defaultExchangeRate',
label: '结算汇率(入账检核时的汇率)', label: '结算汇率(入账检核时的汇率)',
...@@ -798,7 +1045,8 @@ const addPayRecordFormConfig = [ ...@@ -798,7 +1045,8 @@ const addPayRecordFormConfig = [
{ required: true, message: '请输入', trigger: 'blur' }, { required: true, message: '请输入', trigger: 'blur' },
{ pattern: /^-?\d+(\.\d{1,6})?$/, message: '小数(最多6位)', trigger: 'blur' } { pattern: /^-?\d+(\.\d{1,6})?$/, message: '小数(最多6位)', trigger: 'blur' }
] ]
},{ },
{
type: 'select', type: 'select',
prop: 'fortuneType', prop: 'fortuneType',
label: '出账项目', label: '出账项目',
...@@ -843,6 +1091,7 @@ const addPayRecordFormConfig = [ ...@@ -843,6 +1091,7 @@ const addPayRecordFormConfig = [
label: '备注' label: '备注'
} }
] ]
//是否实收 //是否实收
const typeOptions = [ const typeOptions = [
{ value: 1, label: '预计' }, { value: 1, label: '预计' },
...@@ -877,6 +1126,179 @@ const handleInputChange = async (formType, prop, value, item) => { ...@@ -877,6 +1126,179 @@ const handleInputChange = async (formType, prop, value, item) => {
ElMessage.error('查询结算汇率失败') ElMessage.error('查询结算汇率失败')
} }
} }
// 1.计算港币金额
if (prop === 'originalToHkdRate' && value && addPayRecordFormModel.value.originalAmount) {
// 计算港币金额 原币种金额*原币种->港币
const originalAmount = addPayRecordFormModel.value.originalAmount
const originalToHkdRate = value
const hkdAmount = calculateAmount(originalAmount, originalToHkdRate, 2)
await nextTick()
addPayRecordFormModel.value.hkdAmount = hkdAmount
const hkdToPayoutRate = addPayRecordFormModel.value.hkdToPayoutRate
if (hkdToPayoutRate) {
const payoutAmount = calculateAmount(hkdAmount, hkdToPayoutRate, 2)
await nextTick()
addPayRecordFormModel.value.payoutAmount = payoutAmount
}
const exchangeRate = addPayRecordFormModel.value.exchangeRate
if (exchangeRate) {
const ruleAmount = calculateAmount(hkdAmount, exchangeRate, 2, 'Divided')
await nextTick()
addPayRecordFormModel.value.ruleAmount = ruleAmount
}
} else if (
prop === 'originalAmount' &&
value &&
addPayRecordFormModel.value.originalToHkdRate
) {
// 计算港币金额
const originalAmount = value
const originalToHkdRate = addPayRecordFormModel.value.originalToHkdRate
const hkdAmount = calculateAmount(originalAmount, originalToHkdRate, 2)
console.log('新增', hkdAmount)
await nextTick()
addPayRecordFormModel.value.hkdAmount = hkdAmount
const hkdToPayoutRate = addPayRecordFormModel.value.hkdToPayoutRate
if (hkdToPayoutRate) {
const payoutAmount = calculateAmount(hkdAmount, hkdToPayoutRate, 2)
await nextTick()
addPayRecordFormModel.value.payoutAmount = payoutAmount
}
const exchangeRate = addPayRecordFormModel.value.exchangeRate
if (exchangeRate) {
const ruleAmount = calculateAmount(hkdAmount, exchangeRate, 2, 'Divided')
await nextTick()
addPayRecordFormModel.value.ruleAmount = ruleAmount
}
}
//2.计算实际发放金额 港币金额*港币->发放币种汇率
if (prop == 'hkdAmount' && value && addPayRecordFormModel.value.hkdToPayoutRate) {
// 计算实际发放金额
const hkdToPayoutRate = addPayRecordFormModel.value.hkdToPayoutRate
const hkdAmount = value
const payoutAmount = calculateAmount(hkdAmount, hkdToPayoutRate, 2)
await nextTick()
addPayRecordFormModel.value.payoutAmount = payoutAmount
} else if (prop == 'hkdToPayoutRate' && value && addPayRecordFormModel.value.hkdAmount) {
// 计算实际发放金额
const hkdToPayoutRate = value
const hkdAmount = addPayRecordFormModel.value.hkdAmount
const payoutAmount = calculateAmount(hkdAmount, hkdToPayoutRate, 2)
await nextTick()
addPayRecordFormModel.value.payoutAmount = payoutAmount
}
//3.计算保单币种金额 港币金额*保单币种->港币汇率
if (prop == 'hkdAmount' && value && addPayRecordFormModel.value.exchangeRate) {
// 计算保单币种金额
const exchangeRate = addPayRecordFormModel.value.exchangeRate
const hkdAmount = value
const ruleAmount = calculateAmount(hkdAmount, exchangeRate, 2, 'Divided')
await nextTick()
addPayRecordFormModel.value.ruleAmount = ruleAmount
} else if (prop == 'exchangeRate' && value && addPayRecordFormModel.value.hkdAmount) {
// 计算保单币种金额
const exchangeRate = value
const hkdAmount = addPayRecordFormModel.value.hkdAmount
const ruleAmount = calculateAmount(hkdAmount, exchangeRate, 2, 'Divided')
await nextTick()
addPayRecordFormModel.value.ruleAmount = ruleAmount
}
} else if (formType == 'updatePayRecord') {
await nextTick()
let policyNo = updatePayRecordFormModel.value.policyNo
let fortunePeriod = updatePayRecordFormModel.value.fortunePeriod
if ((prop == 'policyNo' || prop == 'fortunePeriod') && fortunePeriod && policyNo) {
const res = await commissionExchangeRateApi({
policyNo: policyNo,
commissionPeriod: fortunePeriod
})
if (res.code == 200) {
updatePayRecordFormModel.value.exchangeRate = res.data
} else {
ElMessage.error('查询结算汇率失败')
}
}
// 1.计算港币金额
if (prop === 'originalToHkdRate' && value && updatePayRecordFormModel.value.originalAmount) {
// 计算港币金额 原币种金额*原币种->港币
const originalAmount = updatePayRecordFormModel.value.originalAmount
const originalToHkdRate = value
const hkdAmount = calculateAmount(originalAmount, originalToHkdRate, 2)
await nextTick()
updatePayRecordFormModel.value.hkdAmount = hkdAmount
const hkdToPayoutRate = updatePayRecordFormModel.value.hkdToPayoutRate
if (hkdToPayoutRate) {
const payoutAmount = calculateAmount(hkdAmount, hkdToPayoutRate, 2)
await nextTick()
updatePayRecordFormModel.value.payoutAmount = payoutAmount
}
const exchangeRate = updatePayRecordFormModel.value.exchangeRate
if (exchangeRate) {
const ruleAmount = calculateAmount(hkdAmount, exchangeRate, 2, 'Divided')
await nextTick()
updatePayRecordFormModel.value.ruleAmount = ruleAmount
}
} else if (
prop === 'originalAmount' &&
value &&
updatePayRecordFormModel.value.originalToHkdRate
) {
// 计算港币金额
const originalAmount = value
const originalToHkdRate = updatePayRecordFormModel.value.originalToHkdRate
const hkdAmount = calculateAmount(originalAmount, originalToHkdRate, 2)
console.log('新增', hkdAmount)
await nextTick()
updatePayRecordFormModel.value.hkdAmount = hkdAmount
const hkdToPayoutRate = updatePayRecordFormModel.value.hkdToPayoutRate
if (hkdToPayoutRate) {
const payoutAmount = calculateAmount(hkdAmount, hkdToPayoutRate, 2)
await nextTick()
updatePayRecordFormModel.value.payoutAmount = payoutAmount
}
const exchangeRate = updatePayRecordFormModel.value.exchangeRate
if (exchangeRate) {
const ruleAmount = calculateAmount(hkdAmount, exchangeRate, 2, 'Divided')
await nextTick()
updatePayRecordFormModel.value.ruleAmount = ruleAmount
}
}
//2.计算实际发放金额 港币金额*港币->发放币种汇率
if (prop == 'hkdAmount' && value && updatePayRecordFormModel.value.hkdToPayoutRate) {
// 计算实际发放金额
const hkdToPayoutRate = updatePayRecordFormModel.value.hkdToPayoutRate
const hkdAmount = value
const payoutAmount = calculateAmount(hkdAmount, hkdToPayoutRate, 2)
await nextTick()
updatePayRecordFormModel.value.payoutAmount = payoutAmount
} else if (prop == 'hkdToPayoutRate' && value && updatePayRecordFormModel.value.hkdAmount) {
// 计算实际发放金额
const hkdToPayoutRate = value
const hkdAmount = updatePayRecordFormModel.value.hkdAmount
const payoutAmount = calculateAmount(hkdAmount, hkdToPayoutRate, 2)
await nextTick()
updatePayRecordFormModel.value.payoutAmount = payoutAmount
}
//3.计算保单币种金额 港币金额*保单币种->港币汇率
if (prop == 'hkdAmount' && value && updatePayRecordFormModel.value.exchangeRate) {
// 计算保单币种金额
const exchangeRate = updatePayRecordFormModel.value.exchangeRate
const hkdAmount = value
const ruleAmount = calculateAmount(hkdAmount, exchangeRate, 2, 'Divided')
await nextTick()
updatePayRecordFormModel.value.ruleAmount = ruleAmount
} else if (prop == 'exchangeRate' && value && updatePayRecordFormModel.value.hkdAmount) {
// 计算保单币种金额
const exchangeRate = value
const hkdAmount = updatePayRecordFormModel.value.hkdAmount
const ruleAmount = calculateAmount(hkdAmount, exchangeRate, 2, 'Divided')
await nextTick()
updatePayRecordFormModel.value.ruleAmount = ruleAmount
}
} }
} }
const handleConfirmAddPayRecord = async () => { const handleConfirmAddPayRecord = async () => {
...@@ -899,9 +1321,28 @@ const handleConfirmAddPayRecord = async () => { ...@@ -899,9 +1321,28 @@ const handleConfirmAddPayRecord = async () => {
} }
await updatePayRecord(params) await updatePayRecord(params)
ElMessage.success('更新出账记录成功') ElMessage.success('更新出账记录成功')
addPayRecordDialogVisible.value = false updatePayRecordDialogVisible.value = false
addPayRecordFormRef.value.resetForm() updatePayRecordFormRef.value.resetForm()
editStatus.value = 'add' loadPayRecordTableData(selectedRow.value.expectedFortuneBizId)
expectedFortuneListData()
} catch (error) {
ElMessage.error(error.message)
}
}
}
const handleConfirmUpdatePayRecord = async () => {
if (selectedRow.value.type == '1') {
try {
const formData = updatePayRecordFormRef.value.getFormData()
const params = {
...formData,
expectedFortuneBizId: selectedRow.value.expectedFortuneBizId
}
await updatePayRecord(params)
ElMessage.success('更新出账记录成功')
updatePayRecordDialogVisible.value = false
updatePayRecordFormRef.value.resetForm()
loadPayRecordTableData(selectedRow.value.expectedFortuneBizId) loadPayRecordTableData(selectedRow.value.expectedFortuneBizId)
expectedFortuneListData() expectedFortuneListData()
} catch (error) { } catch (error) {
...@@ -970,13 +1411,12 @@ const handleSelect = async (e, row) => { ...@@ -970,13 +1411,12 @@ const handleSelect = async (e, row) => {
} }
] ]
} else if (e === 'updateData') { } else if (e === 'updateData') {
editStatus.value = 'edit' updatePayRecordDialogVisible.value = true
addPayRecordDialogVisible.value = true
// 2. 使用 nextTick 等待 DOM 更新 // 2. 使用 nextTick 等待 DOM 更新
nextTick(() => { nextTick(() => {
// 3. 此时 addRecordRef.value 一定存在了 // 3. 此时 addRecordRef.value 一定存在了
if (addPayRecordFormRef.value && selectedRow.value) { if (updatePayRecordFormRef.value && selectedRow.value) {
addPayRecordFormModel.value = { ...selectedRow.value } updatePayRecordFormModel.value = { ...selectedRow.value }
} }
}) })
console.log(addPayRecordFormModel.value) console.log(addPayRecordFormModel.value)
......
...@@ -1103,7 +1103,7 @@ const receivableReportTableColumns = ref([ ...@@ -1103,7 +1103,7 @@ const receivableReportTableColumns = ref([
sortable: true, sortable: true,
width: '120', width: '120',
formatter: row => row.policyCurrency || '-' formatter: row => row.policyCurrency || '-'
}, }
// { // {
// prop: 'unpaidAmount', // prop: 'unpaidAmount',
// label: '待入账金额HKD', // label: '待入账金额HKD',
...@@ -1111,12 +1111,12 @@ const receivableReportTableColumns = ref([ ...@@ -1111,12 +1111,12 @@ const receivableReportTableColumns = ref([
// width: '120', // width: '120',
// formatter: row => formatCurrency(row.unpaidAmount || 0) // formatter: row => formatCurrency(row.unpaidAmount || 0)
// }, // },
{ // {
prop: 'remark', // prop: 'manualRemark',
label: '备注', // label: '备注',
width: '150', // width: '150',
formatter: row => row.remark || '-' // formatter: row => row.manualRemark || '-'
} // }
]) ])
// 应收明细 // 应收明细
const receivableReportItemTableColumns = ref([ const receivableReportItemTableColumns = ref([
...@@ -1138,7 +1138,7 @@ const receivableReportItemTableColumns = ref([ ...@@ -1138,7 +1138,7 @@ const receivableReportItemTableColumns = ref([
prop: 'no', prop: 'no',
label: '应收单编号', label: '应收单编号',
sortable: true, sortable: true,
width: '150', width: '180',
formatter: row => row.no || '-' formatter: row => row.no || '-'
}, },
// { // {
...@@ -1159,7 +1159,7 @@ const receivableReportItemTableColumns = ref([ ...@@ -1159,7 +1159,7 @@ const receivableReportItemTableColumns = ref([
prop: 'reconciliationCompany', prop: 'reconciliationCompany',
label: '对账公司', label: '对账公司',
sortable: true, sortable: true,
width: '150', width: '100',
formatter: row => row.reconciliationCompany || '-' formatter: row => row.reconciliationCompany || '-'
}, },
{ {
...@@ -1214,7 +1214,7 @@ const receivableReportItemTableColumns = ref([ ...@@ -1214,7 +1214,7 @@ const receivableReportItemTableColumns = ref([
{ {
prop: 'commissionRatio', prop: 'commissionRatio',
label: '产品对应来佣率', label: '保单对应来佣率',
sortable: true, sortable: true,
width: '120', width: '120',
formatter: row => (row.commissionRatio || 0) + '%' || '-' formatter: row => (row.commissionRatio || 0) + '%' || '-'
...@@ -1259,7 +1259,7 @@ const receivableReportItemTableColumns = ref([ ...@@ -1259,7 +1259,7 @@ const receivableReportItemTableColumns = ref([
label: '本次入账比例', label: '本次入账比例',
sortable: true, sortable: true,
width: '120', width: '120',
formatter: row => (row.revenueRatio || 0) + '%' || '-' formatter: row => (row.revenueRatio ? row.revenueRatio + '%' : '-')
}, },
{ {
prop: 'pendingAmount', prop: 'pendingAmount',
......
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