当前位置:网站首页>Display Chinese characters according to numbers
Display Chinese characters according to numbers
2022-07-04 08:15:00 【Э Time walker to me】
Display Chinese characters according to numbers
<div class="money">
<div class="left">
<span> total </span>
<br>
<span> amount of money </span>
</div>
<div class="nums">
<span class="unit">{
{payDetail.moneyArr[0]}} Thousand </span>
<span class="unit">{
{payDetail.moneyArr[1]}} Bai </span>
<span class="unit">{
{payDetail.moneyArr[2]}} Ten </span>
<span class="unit">{
{payDetail.moneyArr[3]}} ten thousand </span>
<span class="unit">{
{payDetail.moneyArr[4]}} Thousand </span>
<span class="unit">{
{payDetail.moneyArr[5]}} Bai </span>
<span class="unit">{
{payDetail.moneyArr[6]}} Ten </span>
<span class="unit">{
{payDetail.moneyArr[7]}} element </span>
<span class="unit">{
{payDetail.moneyArr[8]}} horn </span>
<span class="unit">{
{payDetail.moneyArr[9]}} branch </span>
</div>
<div class="right">
¥<span class="underline">{
{Number(payDetail.payAmount||0).toFixed(2)}}</span> element
</div>
</div>
data() {
return {
modalShow: false,
id: '',
payDetail: {
paymentOrderNo: '', // Payment request No
payAmount: '', // Amount due
accountName: '', // title of account
bank: '', // Bank of deposit
accountNumber: '', // Bank account
billDateStart: '', // Bill start time
billDateEnd: '', // Bill end time
applyTime: '', // Application time
applicant: '', // Applicant
settlementType: '', // Settlement method
remarks: '', // 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)) // This is the value we use
} catch (error) {
console.log(error)
this.$Message.error(' Network anomalies ')
} finally {
this.$Spin.hide()
}
},
convertCurrency(money) {
console.log(this.payDetail.payAmount) // egg:123456 Numeric type
// The number of Chinese characters
var cnNums = [' zero ', ' one ', ' Ii. ', ' 3 ', ' boss ', ' wu ', ' lu ', ' Retailer, ', ' ', ' nine ']
// Maximum processed number
var maxNum = 99999999999999.99
// Array used after separating amounts , predefined
if (!money) {
return '' }
money = parseFloat(money)
if (money >= maxNum) {
// Maximum processing number exceeded
return ''
}
// Convert to string
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(' zero ')
}
}
console.log(arr) // This one can print out the Chinese numerical value
return arr
},
// Print
doPrint() {
window.print()
}
}
边栏推荐
- DM8 database recovery based on point in time
- [performance test] read JMeter
- Laravel page load problem connection reset - PHP
- 力扣今日题-1200. 最小绝对差
- ZABBIX monitoring system custom monitoring content
- Devops Practice Guide - reading notes (long text alarm)
- Linear algebra 1.1
- Do you know about autorl in intensive learning? A summary of articles written by more than ten scholars including Oxford University and Google
- Figure guessing game
- Common components of flask
猜你喜欢
L2-013 red alarm (C language) and relevant knowledge of parallel search
Google's official response: we have not given up tensorflow and will develop side by side with Jax in the future
zabbix监控系统邮件报警配置
论文学习——基于极值点特征的时间序列相似性查询方法
[test de performance] lire jmeter
DM8 database recovery based on point in time
Flask 常用组件
Go h*ck yourself:online reconnaissance (online reconnaissance)
Fault analysis | MySQL: unique key constraint failure
Do you know about autorl in intensive learning? A summary of articles written by more than ten scholars including Oxford University and Google
随机推荐
L1-023 output gplt (20 points)
zabbix 5.0监控客户端
Moher College phpmailer remote command execution vulnerability tracing
Scanf read in data type symbol table
Ecole bio rushes to the scientific innovation board: the annual revenue is 330million. Honghui fund and Temasek are shareholders
如何用MOS管来实现电源防反接电路
Technology sharing | MySQL parallel DDL
Oracle stored procedures and functions
Laravel page load problem connection reset - PHP
string. Format without decimal places will generate unexpected rounding - C #
L1-025 positive integer a+b (15 points)
Application of isnull in database query
一文了解数据异常值检测方法
Famous blackmail software stops operation and releases decryption keys. Most hospital IOT devices have security vulnerabilities | global network security hotspot on February 14
OKR vs. KPI figure out these two concepts at once!
Easy to understand: understand the time series database incluxdb
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
zabbix监控系统邮件报警配置
Figure guessing game
Azure ad domain service (II) configure azure file share disk sharing for machines in the domain service