当前位置:网站首页>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()
}
}
边栏推荐
- Set and modify the page address bar icon favicon ico
- Preliminary study on temporal database incluxdb 2.2
- Leetcode 146. LRU cache
- What sparks can applet container technology collide with IOT
- Div hidden in IE 67 shows blank problem IE 8 is normal
- SQL statement view SQL Server 2005 version number
- Comprendre la méthode de détection des valeurs aberrantes des données
- Mouse over to change the transparency of web page image
- ZABBIX monitoring system deployment
- 2022 electrician (intermediate) examination question bank and electrician (intermediate) examination questions and analysis
猜你喜欢
Sports [running 01] a programmer's half horse challenge: preparation before running + adjustment during running + recovery after running (experience sharing)
[test de performance] lire jmeter
DM8 uses different databases to archive and recover after multiple failures
[performance test] read JMeter
Redis sentinel mechanism
[go basics] 2 - go basic sentences
Oracle stored procedures and functions
Linear algebra 1.1
Fault analysis | MySQL: unique key constraint failure
PCIE知识点-010:PCIE 热插拔资料从哪获取
随机推荐
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
[go basics] 2 - go basic sentences
Unity write word
21个战略性目标实例,推动你的公司快速发展
Li Kou today's question -1200 Minimum absolute difference
SQL注入测试工具之Sqli-labs下载安装重置数据库报错解决办法之一(#0{main}thrown in D:\Software\phpstudy_pro\WWW\sqli-labs-……)
Wechat has new functions, and the test is started again
Parallel shift does not provide any acceleration - C #
团体程序设计天梯赛-练习集 L2-002 链表去重
一文了解數據异常值檢測方法
Azure ad domain service (II) configure azure file share disk sharing for machines in the domain service
ZABBIX monitoring system custom monitoring content
PCIe knowledge points -010: where to get PCIe hot plug data
Azure ad domain service (II) configure azure file share disk sharing for machines in the domain service
Convert datetime string to datetime - C in the original time zone
zabbix监控系统部署
Collections in Scala
@Role of pathvariable annotation
zabbix 5.0监控客户端
OKR vs. KPI figure out these two concepts at once!