当前位置:网站首页>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()
}
}
边栏推荐
- Is l1-029 too fat (5 points)
- 真空介电常数和真空磁导率究竟是由什么决定的?为何会存在这两个物理量?
- Preliminary study on temporal database incluxdb 2.2
- [gurobi] establishment of simple model
- Sports [running 01] a programmer's half horse challenge: preparation before running + adjustment during running + recovery after running (experience sharing)
- 团体程序设计天梯赛-练习集 L1-006 连续因子
- ES6 summary
- Leetcode(215)——数组中的第K个最大元素
- Chrome is set to pure black
- Conversion of yolov5 XML dataset to VOC dataset
猜你喜欢
Go h*ck yourself:online reconnaissance (online reconnaissance)
DM8 command line installation and database creation
What does range mean in PHP
Google's official response: we have not given up tensorflow and will develop side by side with Jax in the future
Flask 常用组件
snipaste 方便的截图软件,可以复制在屏幕上
A method for detecting outliers of data
【性能测试】一文读懂Jmeter
墨者学院-phpMyAdmin后台文件包含分析溯源
一文了解数据异常值检测方法
随机推荐
墨者学院-PHPMailer远程命令执行漏洞溯源
2022 examination questions for safety managers of metal and nonmetal mines (underground mines) and examination papers for safety managers of metal and nonmetal mines (underground mines)
Chrome is set to pure black
OKR vs. KPI 一次搞清楚这两大概念!
1. Kalman filter - the best linear filter
Leetcode(215)——数组中的第K个最大元素
Moher College phpmailer remote command execution vulnerability tracing
Unity write word
Leetcode 146. LRU cache
DM database password policy and login restriction settings
Need help resetting PHP counters - PHP
deno debugger
Application of isnull in database query
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
How to use MOS tube to realize the anti reverse connection circuit of power supply
Unity-Text上标平方表示形式+text判断文本是否为空
The second session of the question swiping and punching activity -- solving the switching problem with recursion as the background (I)
[gurobi] establishment of simple model
Easy to understand: understand the time series database incluxdb
论文学习——基于极值点特征的时间序列相似性查询方法