当前位置:网站首页>根据数字显示中文汉字
根据数字显示中文汉字
2022-07-04 08:13:00 【Э时间行者于我】
根据数字显示中文汉字

<div class="money">
<div class="left">
<span>合计</span>
<br>
<span>金额</span>
</div>
<div class="nums">
<span class="unit">{
{payDetail.moneyArr[0]}} 仟</span>
<span class="unit">{
{payDetail.moneyArr[1]}} 佰</span>
<span class="unit">{
{payDetail.moneyArr[2]}} 拾</span>
<span class="unit">{
{payDetail.moneyArr[3]}} 万</span>
<span class="unit">{
{payDetail.moneyArr[4]}} 仟</span>
<span class="unit">{
{payDetail.moneyArr[5]}} 佰</span>
<span class="unit">{
{payDetail.moneyArr[6]}} 拾</span>
<span class="unit">{
{payDetail.moneyArr[7]}} 元</span>
<span class="unit">{
{payDetail.moneyArr[8]}} 角</span>
<span class="unit">{
{payDetail.moneyArr[9]}} 分</span>
</div>
<div class="right">
¥<span class="underline">{
{Number(payDetail.payAmount||0).toFixed(2)}}</span>元
</div>
</div>
data() {
return {
modalShow: false,
id: '',
payDetail: {
paymentOrderNo: '', // 请款单号
payAmount: '', // 应付金额
accountName: '', // 账户名称
bank: '', // 开户银行
accountNumber: '', // 银行账户
billDateStart: '', // 账单开始时间
billDateEnd: '', // 账单结束时间
applyTime: '', // 申请时间
applicant: '', // 申请人
settlementType: '', // 结算方式
remarks: '', // 备注
moneyArr: []
}
}
},
created() {
console.log(this.$route.query)
this.init()
},
methods: {
async init() {
let id = this.$route.query.id
if (!id) return
this.$Spin.show()
try {
let res = await getPaymentOrder({
id })
this.payDetail = res.data.result || {
}
this.payDetail.moneyArr = this.convertCurrency(Number(this.payDetail.payAmount)) // 就是这个数值是我们用到的
} catch (error) {
console.log(error)
this.$Message.error('网络异常')
} finally {
this.$Spin.hide()
}
},
convertCurrency(money) {
console.log(this.payDetail.payAmount) // egg:123456 数字类型
// 汉字的数字
var cnNums = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖']
// 最大处理的数字
var maxNum = 99999999999999.99
// 分离金额后用的数组,预定义
if (!money) {
return '' }
money = parseFloat(money)
if (money >= maxNum) {
// 超出最大处理数字
return ''
}
// 转换为字符串
money = Number(money).toFixed(2)
let arr = Array.from(money).filter(item => item !== '.').map(item => cnNums[item])
console.log(arr)
let len = arr.length
if (len < 10) {
for (let i = 0; i < 10 - len; i++) {
arr.unshift('零')
}
}
console.log(arr) // 这块就可以打印出中文数值
return arr
},
// 打印
doPrint() {
window.print()
}
}
边栏推荐
- The second session of the question swiping and punching activity -- solving the switching problem with recursion as the background (I)
- DM database password policy and login restriction settings
- zabbix 5.0监控客户端
- Collections in Scala
- 团体程序设计天梯赛-练习集 L2-002 链表去重
- 学习Nuxt.js
- Leetcode 146. LRU 缓存
- DM8 uses different databases to archive and recover after multiple failures
- This article is enough for learning advanced mysql
- C # implements a queue in which everything can be sorted
猜你喜欢
![[test de performance] lire jmeter](/img/c9/25a0df681c7ecb4a0a737259c882b3.png)
[test de performance] lire jmeter

Oracle stored procedures and functions

This monitoring system can monitor the turnover intention and fishing all, and the product page has 404 after the dispute appears
![[Gurobi] 简单模型的建立](/img/3f/d637406bca3888b939bead40b24337.png)
[Gurobi] 简单模型的建立

BUUCTF(4)

Heap concept in JVM

【Go基础】1 - Go Go Go

Azure ad domain service (II) configure azure file share disk sharing for machines in the domain service

Azure ad domain service (II) configure azure file share disk sharing for machines in the domain service

如何用MOS管来实现电源防反接电路
随机推荐
[CV] Wu Enda machine learning course notes | Chapter 9
运动【跑步 01】一个程序员的半马挑战:跑前准备+跑中调整+跑后恢复(经验分享)
Use preg_ Match extracts the string into the array between: & | people PHP
L1-028 judging prime number (10 points)
L1-022 odd even split (10 points)
[go basics] 2 - go basic sentences
Take you to master the formatter of visual studio code
一文了解數據异常值檢測方法
Go h*ck yourself:online reconnaissance (online reconnaissance)
【性能測試】一文讀懂Jmeter
墨者学院-Webmin未经身份验证的远程代码执行
Div hidden in IE 67 shows blank problem IE 8 is normal
Sort by item from the list within the list - C #
L2-013 red alarm (C language) and relevant knowledge of parallel search
R language ggplot2 visualization: ggplot2 visualization grouping box diagram, place the legend and title of the visualization image on the top left of the image and align them to the left, in which th
1. Qt入门
真空介电常数和真空磁导率究竟是由什么决定的?为何会存在这两个物理量?
Example analysis of C # read / write lock
@Role of requestparam annotation
Using the rate package for data mining