当前位置:网站首页>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()
}
}
边栏推荐
- Scanf read in data type symbol table
- es6总结
- Ecole bio rushes to the scientific innovation board: the annual revenue is 330million. Honghui fund and Temasek are shareholders
- R language uses cforest function in Party package to build random forest based on conditional inference trees, uses varimp function to check feature importance, and uses table function to calculate co
- 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
- DM8 command line installation and database creation
- 【Go基础】1 - Go Go Go
- Group programming ladder race - exercise set l1-006 continuity factor
- L2-013 red alarm (C language) and relevant knowledge of parallel search
- 21 examples of strategic goals to promote the rapid development of your company
猜你喜欢

What does range mean in PHP

Unity-Text上标平方表示形式+text判断文本是否为空

SSRF vulnerability exploitation - attack redis

PCIE知识点-010:PCIE 热插拔资料从哪获取

ZABBIX 5.0 monitoring client

JVM -- class loading process and runtime data area

How to use MOS tube to realize the anti reverse connection circuit of power supply

弈柯莱生物冲刺科创板:年营收3.3亿 弘晖基金与淡马锡是股东

线性代数1.1

运动【跑步 01】一个程序员的半马挑战:跑前准备+跑中调整+跑后恢复(经验分享)
随机推荐
Leetcode 146. LRU cache
Group programming ladder race - exercise set l1-006 continuity factor
Do you know about autorl in intensive learning? A summary of articles written by more than ten scholars including Oxford University and Google
WordPress get_ Users() returns all users with comparison queries - PHP
力扣今日题-1200. 最小绝对差
Is l1-029 too fat (5 points)
Mouse over to change the transparency of web page image
团体程序设计天梯赛-练习集 L1-006 连续因子
Email alarm configuration of ZABBIX monitoring system
Application of isnull in database query
[CV] Wu Enda machine learning course notes | Chapter 9
Li Kou today's question -1200 Minimum absolute difference
Leetcode(215)——数组中的第K个最大元素
Google's official response: we have not given up tensorflow and will develop side by side with Jax in the future
Collections in Scala
L1-021 important words three times (5 points)
DM database password policy and login restriction settings
The right way to capture assertion failures in NUnit - C #
Scanf read in data type symbol table
Put a lantern on the website during the Lantern Festival