当前位置:网站首页>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()
}
}
边栏推荐
- Li Kou today's question -1200 Minimum absolute difference
- Leetcode 23. Merge K ascending linked lists
- 墨者学院-Webmin未经身份验证的远程代码执行
- Example analysis of C # read / write lock
- 21 examples of strategic goals to promote the rapid development of your company
- 广和通高性能4G/5G无线模组解决方案全面推动高效、低碳智能电网
- Moher College webmin unauthenticated remote code execution
- 【Go基础】2 - Go基本语句
- 学习Nuxt.js
- [performance test] read JMeter
猜你喜欢
1. Getting started with QT
[Gurobi] 简单模型的建立
谷歌官方回应:我们没有放弃TensorFlow,未来与JAX并肩发展
SSRF vulnerability exploitation - attack redis
Devops Practice Guide - reading notes (long text alarm)
C#,数值计算(Numerical Recipes in C#),线性代数方程的求解,Gauss-Jordan消去法,源代码
zabbix监控系统邮件报警配置
AcWing 244. Enigmatic cow (tree array + binary search)
SQL注入测试工具之Sqli-labs下载安装重置数据库报错解决办法之一(#0{main}thrown in D:\Software\phpstudy_pro\WWW\sqli-labs-……)
The second session of the question swiping and punching activity -- solving the switching problem with recursion as the background (I)
随机推荐
Activiti常见操作数据表关系
运动【跑步 01】一个程序员的半马挑战:跑前准备+跑中调整+跑后恢复(经验分享)
The right way to capture assertion failures in NUnit - C #
Conversion of yolov5 XML dataset to VOC dataset
1. Getting started with QT
Go h*ck yourself:online reconnaissance (online reconnaissance)
21 examples of strategic goals to promote the rapid development of your company
Example analysis of C # read / write lock
@Role of requestparam annotation
Cannot click button when method is running - C #
Put a lantern on the website during the Lantern Festival
@Role of pathvariable annotation
L1-021 important words three times (5 points)
How to write a summary of the work to promote the implementation of OKR?
How to improve your system architecture?
Famous blackmail software stops operation and releases decryption keys. Most hospital IOT devices have security vulnerabilities | global network security hotspot on February 14
Activiti常見操作數據錶關系
Fault analysis | MySQL: unique key constraint failure
如何用MOS管来实现电源防反接电路
C # implements a queue in which everything can be sorted