[update] 缴费凭证

This commit is contained in:
zhaoxiao
2021-12-17 18:45:42 +08:00
parent c0c8f62621
commit 80c9de0ee6
2 changed files with 37 additions and 3 deletions
+32
View File
@@ -631,3 +631,35 @@ export function addZero(e) {
} }
} }
} }
//将数字(整数)转为汉字
export function convertToChinaNum(num) {
let arr1 = new Array('零', '一', '二', '三', '四', '五', '六', '七', '八', '九')
let arr2 = new Array('', '十', '百', '千', '万', '十', '百', '千', '亿', '十', '百', '千', '万', '十', '百', '千', '亿')//可继续追加更高位转换值
if (!num || isNaN(num)) {
return '零'
}
let english = num.toString().split('')
let result = ''
for (let i = 0; i < english.length; i++) {
let des_i = english.length - 1 - i//倒序排列设值
result = arr2[i] + result
let arr1_index = english[des_i]
result = arr1[arr1_index] + result
}
//将【零千、零百】换成【零】 【十零】换成【十】
result = result.replace(/零(千|百|十)/g, '零').replace(/十零/g, '十')
//合并中间多个零为一个零
result = result.replace(/零+/g, '零')
//将【零亿】换成【亿】【零万】换成【万】
result = result.replace(/零亿/g, '亿').replace(/零万/g, '万')
//将【亿万】换成【亿】
result = result.replace(/亿万/g, '亿')
//移除末尾的零
result = result.replace(/零+$/, '')
//将【零一十】换成【零十】
//result = result.replace(/零一十/g, '零十');//貌似正规读法是零一十
//将【一十】换成【十】
result = result.replace(/^一十/g, '十')
return result
}
+5 -3
View File
@@ -66,7 +66,7 @@
</div> </div>
<!-- 表格区域end--> <!-- 表格区域end-->
<!-- 添加阶段按钮--> <!-- 添加阶段按钮-->
<a-button type="primary" icon="plus" class="add-stage-btn" @click="addStage" :disabled="editDisabled">添加阶段 <a-button type="primary" icon="plus" class="add-stage-btn" @click="addStage" :disabled="editDisabled || Number(receivableAmount) === 0">添加阶段
</a-button> </a-button>
<!-- 审核记录--> <!-- 审核记录-->
@@ -162,6 +162,7 @@ import { getAction, postAction } from '@api/manage'
import PreviewImgModal from '@views/MessagePage/modules/PreviewImgModal' import PreviewImgModal from '@views/MessagePage/modules/PreviewImgModal'
import ProofInfoModal from '@views/MessagePage/modules/ProofInfoModal' import ProofInfoModal from '@views/MessagePage/modules/ProofInfoModal'
import { getAuditProofRecords } from '@api/incomePaymentsApi' import { getAuditProofRecords } from '@api/incomePaymentsApi'
import { convertToChinaNum } from '@/utils/util'
const columns = [ const columns = [
{ {
@@ -171,7 +172,7 @@ const columns = [
width: 120, width: 120,
align: 'center', align: 'center',
customRender: function (t, r, index) { customRender: function (t, r, index) {
return r.paymentStatus === 'completed' ? `${ parseInt(index) + 1 }阶段` : '' return r.paymentStatus === 'completed' ? `${ convertToChinaNum(parseInt(index) + 1) }阶段` : ''
} }
}, { }, {
title: '缴费金额', title: '缴费金额',
@@ -359,7 +360,8 @@ export default {
}).finally(() => { }).finally(() => {
this.proofLoading = false this.proofLoading = false
}) })
} },
} }
} }
</script> </script>