From 67393e3a366b5e034ea11eaafe9a6d700b8e31e1 Mon Sep 17 00:00:00 2001 From: "luoJunYong.123" Date: Tue, 12 Apr 2022 18:24:58 +0800 Subject: [PATCH] update --- src/components/checkPhoto/index.vue | 160 ++++++++++++++++++++++------ src/layouts/header/index.vue | 19 +++- src/pages/counter/list/index.vue | 39 +++---- src/plugins/drag/index.js | 2 - src/store/modules/system.js | 1 + 5 files changed, 167 insertions(+), 54 deletions(-) diff --git a/src/components/checkPhoto/index.vue b/src/components/checkPhoto/index.vue index c410114..27afac1 100644 --- a/src/components/checkPhoto/index.vue +++ b/src/components/checkPhoto/index.vue @@ -4,32 +4,55 @@ + + @@ -70,16 +93,23 @@ export default { // } // } }, - mounted() { - // new Sortable(this.$refs.showPage, { - // animation: 150, - // group: { - // name:'shared', - // pull:'clone',// 是否可以被移出或克隆 - // put:false// 禁止拖入 - // }, - // }) - console.log(this.$refs.showPage) + data() { + return { + nowDate: '' + } + + }, + created() { + // dataFlow.getMoney 表示要从钱箱中取出多少钱 + this.nowDate = (() => { + const date = new Date() + var y = date.getFullYear(); + var m = date.getMonth() + 1; + m = m < 10 ? '0' + m : m; + var d = date.getDate(); + d = d < 10 ? ('0' + d) : d; + return y + '-' + m + '-' + d; + })() }, watch: { showImg: { @@ -100,14 +130,82 @@ export default { computed: { ...mapGetters({ dataFlow: 'system/dataFlow' - }) + }), + getNowYear() { + return (index) => { + return this.nowDate.split('-')[index] + } + }, + transMoney() { + return (str) => { + var num = parseFloat(str); + + var strOutput = "", + + strUnit = '仟佰拾亿仟佰拾万仟佰拾元角分'; + + num += "00"; + + var intPos = num.indexOf('.');  + + if (intPos >= 0){ + + num = num.substring(0, intPos) + num.substr(intPos + 1, 2); + } + + strUnit = strUnit.substr(strUnit.length - num.length); + + for (var i=0; i < num.length; i++){ + + strOutput += '零壹贰叁肆伍陆柒捌玖'.substr(num.substr(i,1),1) + strUnit.substr(i,1); + + } + return strOutput.replace(/零角零分$/, '整').replace(/零[仟佰拾]/g, '零').replace(/零{2,}/g, '零').replace(/零([亿|万])/g, '$1').replace(/零+元/, '元').replace(/亿零{0,3}万/, '亿').replace(/^元/, "零元") + + } + }, + mapNumber() { + const myMap = new Map([ + ['0', '零'], + ['1', '壹'], + ['2', '贰'], + ['3', '叁'], + ['4', '肆'], + ['5', '伍'], + ['6', '陆'], + ['7', '柒'], + ['8', '捌'], + ['9', '玖'] + ]) + return (str) => { + let myStr = str + '' + let strEnd = '' + if(str.length === 4) { + for(const val of myStr) { + strEnd += myMap.get(val) + } + }else { + if(str.indexOf('0' === 0)) { + strEnd = myMap.get(str.charAt(1)) + }else { + strEnd = myMap.get(str.charAt(0)) + '拾' + + } + } + + return strEnd + } + } } }