Commit 37bec7c7 by chenwq

fix(financeManage): 修复系统对账单编辑逻辑和验证规则

- 恢复系统对账按钮显示
- 修正金额验证逻辑,使用绝对值比较
- 优化字段编辑权限判断逻辑
- 调整批量编辑字段配置
1 parent 6a002f18
...@@ -503,9 +503,9 @@ export default { ...@@ -503,9 +503,9 @@ export default {
const totalPaymentObj = this.tmplFieldsList.find(item => item.fieldCode == 'totalPaymentAmount') const totalPaymentObj = this.tmplFieldsList.find(item => item.fieldCode == 'totalPaymentAmount')
var errorTxt = '' var errorTxt = ''
const min = 0 const min = 0
const max = this.tableList[rowIndex][totalPaymentObj.extInfo.source].totalPaymentAmount || '0' const max = Math.abs(this.tableList[rowIndex][totalPaymentObj.extInfo.source].totalPaymentAmount || 0)
if (value > max || value < min) { if (value > max || value < min) {
errorTxt = `请输入大于${min}且小于${max}的数字` errorTxt = `请输入小于${min}且大于${max}的数字`
} else if (value !== null && value !== undefined && value !== '') { } else if (value !== null && value !== undefined && value !== '') {
const decimalPart = String(value).split('.')[1] const decimalPart = String(value).split('.')[1]
if (decimalPart && decimalPart.length > 2) { if (decimalPart && decimalPart.length > 2) {
...@@ -527,9 +527,10 @@ export default { ...@@ -527,9 +527,10 @@ export default {
orderList.forEach(item => { orderList.forEach(item => {
max = max + item[totalPaymentObj.extInfo.source].totalPaymentAmount max = max + item[totalPaymentObj.extInfo.source].totalPaymentAmount
}) })
max = Math.abs(max)
min = parseFloat((max * -1).toFixed(2)) min = parseFloat((max * -1).toFixed(2))
if (value > max || value < min) { if (value > max || value < min) {
errorTxt = `请输入大于${min}且小于${max}的数字` errorTxt = `请输入小于${min}且大于${max}的数字`
} else if (value !== null && value !== undefined && value !== '') { } else if (value !== null && value !== undefined && value !== '') {
const decimalPart = String(value).split('.')[1] const decimalPart = String(value).split('.')[1]
if (decimalPart && decimalPart.length > 2) { if (decimalPart && decimalPart.length > 2) {
...@@ -1153,6 +1154,10 @@ export default { ...@@ -1153,6 +1154,10 @@ export default {
if (this.judgeDisable(rowIndex, source, fieldConfig)) { if (this.judgeDisable(rowIndex, source, fieldConfig)) {
return true return true
} }
console.log(fieldConfig)
if (['remark'].includes(fieldConfig.fieldCode)) {
return true
}
if (fieldConfig?.editType === 'selectInput') { if (fieldConfig?.editType === 'selectInput') {
const obj = this.tableList[rowIndex][source] const obj = this.tableList[rowIndex][source]
const selectVal = obj[fieldConfig.editObj.selectField] const selectVal = obj[fieldConfig.editObj.selectField]
...@@ -1197,10 +1202,9 @@ export default { ...@@ -1197,10 +1202,9 @@ export default {
Object.keys(row).forEach(source => { Object.keys(row).forEach(source => {
Object.keys(row[source]).forEach(field => { Object.keys(row[source]).forEach(field => {
const fieldConfig = this.getFieldConfig(field, source) const fieldConfig = this.getFieldConfig(field, source)
let headObj = this.tmplFieldsList.find(i => i.fieldCode == field) // let headObj = this.tmplFieldsList.find(i => i.fieldCode == field)
if (!noValidList.includes(field) && fieldConfig && this.isEditableField(fieldConfig, field)) { if (!noValidList.includes(field) && fieldConfig && this.isEditableField(fieldConfig, field)) {
if (!this.validateField(rowIndex, source, field, fieldConfig)) { if (!this.validateField(rowIndex, source, field, fieldConfig)) {
console.log(rowIndex, source, field, fieldConfig, '===')
isValid = false isValid = false
} }
} }
...@@ -1514,46 +1518,39 @@ export default { ...@@ -1514,46 +1518,39 @@ export default {
} }
/** /**
* 流量方 - traffic;服务商 - service * 流量方 - traffic;服务商 - service
* 对账单类型为服务商时,支付方式不能编辑
* */
if (this.billTypeStr == 'service') {
if (['ORDERpayType'].includes(source + fieldConfig.fieldCode)) {
isDisable = true
}
}
/**
* sourceType:1-订单;2-退款 * sourceType:1-订单;2-退款
* 订单是退款单时,流量方总金额,服务商品类比例,按新政策标准,备注的字段可以编辑 * 流量方 && 退款:流量方品类比例不能编辑
*/ * */
if (value.ORDER.sourceType != 1) { if (this.billTypeStr == 'traffic' && value.ORDER.sourceType != 1) {
if (!['ORDERshopDivisionMoney', 'SUB_ORDERpartnerFeeCalculateType,partnerFeeCalculateValue', 'SUB_ORDERpartnerFeeCalculateType', 'SUB_ORDERpartnerFeeCalculateValue', 'SUB_ORDERpartnerFeeCalculateCoefficient', 'SUB_ORDERsecondPartnerFee', 'ORDERremark'].includes(source + fieldConfig.fieldCode)) { if (['SUB_ORDERtrafficFeeCalculateType,trafficFeeCalculateValue'].includes(source + fieldConfig.fieldCode)) {
isDisable = true isDisable = true
} }
} }
/** /**
* 流量方 - traffic;服务商 - service
* sourceType:1-订单;2-退款 * sourceType:1-订单;2-退款
* 订单是退款单时,服务商2的金额可以编辑 * 服务商 && 退款:服务商品类比例、按新政策标准不能编辑
*/ * */
if (value.ORDER.sourceType == 1) { if (this.billTypeStr == 'service' && value.ORDER.sourceType != 1) {
if (['SUB_ORDERsecondPartnerFee'].includes(source + fieldConfig.fieldCode)) { if (['SUB_ORDERpartnerFeeCalculateType,partnerFeeCalculateValue', 'SUB_ORDERpartnerFeeCalculateCoefficient'].includes(source + fieldConfig.fieldCode)) {
isDisable = true isDisable = true
} }
} }
/** editable为false,平台方和支付方式不能编辑 */ /** editable为false,平台方和支付方式不能编辑 */
if (value.ORDER.editable == false) { // if (value.ORDER.editable == false) {
if (['ORDERplatformMerchantId', 'ORDERpayType'].includes(source + fieldConfig.fieldCode)) { // if (['ORDERplatformMerchantId', 'ORDERpayType'].includes(source + fieldConfig.fieldCode)) {
isDisable = true // isDisable = true
} // }
} // }
return isDisable return isDisable
}, },
// 判断表头字段是否可以批量编辑 // 判断表头字段是否可以批量编辑
judgeImgShow(obj) { judgeImgShow(obj) {
const list = deepClone(this[this.billTypeStr + 'SourceEditList']) const list = deepClone(this[this.billTypeStr + 'SourceEditList'])
const editList = [] const editList = []
const noBatchEditAtttrList = ['ORDERpayType', 'ORDERremark'] const batchEditAtttrList = ['ORDERplatformMerchantId', 'SUB_ORDERtrafficFeeCalculateType,trafficFeeCalculateValue', 'SUB_ORDERpartnerFeeCalculateType,partnerFeeCalculateValue', 'SUB_ORDERpartnerFeeCalculateCoefficient']
list.forEach(item => { list.forEach(item => {
if (!noBatchEditAtttrList.includes(item)) { if (batchEditAtttrList.includes(item)) {
editList.push(item) editList.push(item)
} }
}) })
......
<!-- 下载对账单 --> <!-- 下载对账单 -->
<template> <template>
<d2-dialog title="下载对账单" :is-visible="accountVisible" class="accountDailog" width="688px" btn-ok-label="下载" @closeDialog="handleClose" @confirmDialog="handleAddConfirm"> <d2-dialog title="下载对账单" :is-visible="accountVisible" class="accountDailog" width="688px" btn-ok-label="下载" @closeDialog="handleClose" @confirmDialog="handleAddConfirm">
<!-- <el-button v-if="isTmpl" slot="btn-start" type="primary" @click="handleSystemBill">系统对账</el-button> --> <el-button v-if="isTmpl" slot="btn-start" type="primary" @click="handleSystemBill">系统对账</el-button>
<el-form ref="accountForm" :model="infoForm" :rules="formRules" label-width="120px" v-loading="loading"> <el-form ref="accountForm" :model="infoForm" :rules="formRules" label-width="120px" v-loading="loading">
<el-form-item label="商户类型:" prop="merchantType"> <el-form-item label="商户类型:" prop="merchantType">
<el-radio-group v-model="infoForm.merchantType" @change="changeType"> <el-radio-group v-model="infoForm.merchantType" @change="changeType">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!