From 0cac71783bbdf90c8f4dba424b3b2f52c6419a6f Mon Sep 17 00:00:00 2001 From: cclu <1106109051@qq.com> Date: Mon, 29 Jan 2024 21:41:54 +0800 Subject: [PATCH] update --- common/utils.js | 23 +- package-lock.json | 15 +- package.json | 2 +- pages.json | 7 + pages/index/index.vue | 11 +- .../components/entryCarNumber.vue | 5 +- .../js_sdk/u-charts/config-echarts.js | 1 + .../js_sdk/u-charts/config-ucharts.js | 89 +- pages/nationalPage/components/yearRevenue.vue | 9 +- pages/nationalPage/index.vue | 334 ++++++-- pages/nationalPage/springTravel.vue | 801 ++++++++++++++++++ .../{noticeIcon.svg => noticeIcon2.svg} | 0 12 files changed, 1180 insertions(+), 117 deletions(-) create mode 100644 pages/nationalPage/springTravel.vue rename static/images/newIndex/{noticeIcon.svg => noticeIcon2.svg} (100%) diff --git a/common/utils.js b/common/utils.js index f77d694..57370bc 100644 --- a/common/utils.js +++ b/common/utils.js @@ -120,6 +120,7 @@ const fmoney = (s, n) => { // 没有小数点的金额格式化 function noDecimal(s){ + console.log('s',s) let fuhao = ''; //如果数字小于零则值为- if (s < 0) { s = Math.abs(s); @@ -492,7 +493,7 @@ function getMoney(money){ let num = parseFloat(money + '') + ''; num = parseInt(money * 100 + '') / 100 + '' - let reg = /(-?\d+)(\d{4})/; + let reg = /(-?\d+)(\d{3})/; while (reg.test(num)) { num = num.replace(reg, "$1,$2"); } @@ -511,6 +512,25 @@ function getMoney(money){ return num; } +function getMoneyNoDecimal(money){ + if (!money || isNaN(money)) return "0"; + let num = parseFloat(money + '') + ''; + num = parseInt(money * 100 + '') / 100 + '' + let reg = /(-?\d+)(\d{3})/; + while (reg.test(num)) { + num = num.replace(reg, "$1,$2"); + } + let idx = num.indexOf('.') + if (idx === -1) { + num = num + } + if (idx > 0) { + let num_per = num.substring(0, idx) + let num_next = num.substring(idx + 1) + num = num_per + } + return num; +} @@ -535,6 +555,7 @@ export default { // bMapToQQMap, playVideo, getMoney, + getMoneyNoDecimal, getThisMonthDateList, handleReduceAMonth } diff --git a/package-lock.json b/package-lock.json index 10a3fa3..c3f119e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "": { "dependencies": { "chinese-lunar-calendar": "^1.0.1", - "moment": "^2.25.3", + "moment": "^2.30.1", "sass": "^1.45.1", "sass-loader": "^10.3.1", "vuex-persistedstate": "^4.1.0" @@ -760,9 +760,9 @@ } }, "node_modules/moment": { - "version": "2.29.4", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", - "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==", + "version": "2.30.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", + "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==", "engines": { "node": "*" } @@ -1115,6 +1115,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/vuex-persistedstate/-/vuex-persistedstate-4.1.0.tgz", "integrity": "sha512-3SkEj4NqwM69ikJdFVw6gObeB0NHyspRYMYkR/EbhR0hbvAKyR5gksVhtAfY1UYuWUOCCA0QNGwv9pOwdj+XUQ==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", "dependencies": { "deepmerge": "^4.2.2", "shvl": "^2.0.3" @@ -1792,9 +1793,9 @@ } }, "moment": { - "version": "2.29.4", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", - "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==" + "version": "2.30.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", + "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==" }, "neo-async": { "version": "2.6.2", diff --git a/package.json b/package.json index 5599f61..15a50cc 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "dependencies": { "chinese-lunar-calendar": "^1.0.1", - "moment": "^2.25.3", + "moment": "^2.30.1", "sass": "^1.45.1", "sass-loader": "^10.3.1", "vuex-persistedstate": "^4.1.0" diff --git a/pages.json b/pages.json index dd6af1d..b21be31 100644 --- a/pages.json +++ b/pages.json @@ -131,6 +131,13 @@ "navigationBarTitleText": "", "navigationStyle": "custom" } + }, + { + "path": "springTravel", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } } ] }, diff --git a/pages/index/index.vue b/pages/index/index.vue index 1cc9c1c..06ad03f 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -819,6 +819,8 @@ + + @@ -858,17 +860,18 @@ 财务报表 - - + - 节日特刊 + + 2024春运 + @@ -4735,7 +4738,7 @@ $iphoneHeight: env(safe-area-inset-bottom); .funIconBox{ width: 88rpx; height: 88rpx; - border-radius: 50%; + //border-radius: 50%; overflow: hidden; margin-bottom: 16rpx; .funIcon{ diff --git a/pages/nationalPage/components/entryCarNumber.vue b/pages/nationalPage/components/entryCarNumber.vue index 91a5f2f..344729f 100644 --- a/pages/nationalPage/components/entryCarNumber.vue +++ b/pages/nationalPage/components/entryCarNumber.vue @@ -145,8 +145,9 @@ export default { // this.drawCharts('entryCarNumber', res,config) }, getSplitNumber(value){ - if (value === 0){ - return 5 + if (value === 0 || value<5){ + let num = Math.ceil(Number(value)) + return num }else{ let sum = Number(value) + Number(value) *0.2 return Number((Math.ceil(sum / 1000)).toFixed(0)) * 1000 diff --git a/pages/nationalPage/components/qiun-data-charts/js_sdk/u-charts/config-echarts.js b/pages/nationalPage/components/qiun-data-charts/js_sdk/u-charts/config-echarts.js index b31cb45..fec21f9 100644 --- a/pages/nationalPage/components/qiun-data-charts/js_sdk/u-charts/config-echarts.js +++ b/pages/nationalPage/components/qiun-data-charts/js_sdk/u-charts/config-echarts.js @@ -86,6 +86,7 @@ const cfe = { return res.name + '年' + res.value + '元'; }, entryCarNumber:function (item, category, index, opts){ + console.log('entryCarNumber',1111) if (item.data){ return item.name + ":" + this.$util.fmoney(item.data.value,2) + '万元'; }else{ diff --git a/pages/nationalPage/components/qiun-data-charts/js_sdk/u-charts/config-ucharts.js b/pages/nationalPage/components/qiun-data-charts/js_sdk/u-charts/config-ucharts.js index bf32f95..352c6e3 100644 --- a/pages/nationalPage/components/qiun-data-charts/js_sdk/u-charts/config-ucharts.js +++ b/pages/nationalPage/components/qiun-data-charts/js_sdk/u-charts/config-ucharts.js @@ -60,6 +60,54 @@ const noDecimal = (s) =>{ return fuhao + [...t].reverse().join("") } +const getMoney = (money)=>{ + if (!money || isNaN(money)) return "0.00"; + let num = parseFloat(money + '') + ''; + num = parseInt(money * 100 + '') / 100 + '' + + let reg = /(-?\d+)(\d{3})/; + while (reg.test(num)) { + num = num.replace(reg, "$1,$2"); + } + + let idx = num.indexOf('.') + if (idx === -1) { + num = num + '.00' + } + + if (idx > 0) { + let num_per = num.substring(0, idx) + '.' + let num_next = num.substring(idx + 1).padEnd(2, '0') + num = num_per + num_next + } + + return num; +} + +const getMoneyNoDecimal = (money)=>{ + if (!money || isNaN(money)) return "0"; + let num = parseFloat(money + '') + ''; + num = parseInt(money * 100 + '') / 100 + '' + + let reg = /(-?\d+)(\d{3})/; + while (reg.test(num)) { + num = num.replace(reg, "$1,$2"); + } + + let idx = num.indexOf('.') + if (idx === -1) { + num = num + } + + if (idx > 0) { + let num_per = num.substring(0, idx) + let num_next = num.substring(idx + 1).padEnd(2, '0') + num = num_per + } + + return num; +} + //事件转换函数,主要用作格式化x轴为时间轴,根据需求自行修改 const formatDateTime = (timeStamp, returnType)=>{ var date = new Date(); @@ -114,12 +162,33 @@ const cfu = { }, "entryCarNumber":function (item, category, index, opts){ console.log('item',item) - return item.name - // if (item.data){ - // return item.name + ":" + this.$util.fmoney(item.data.value,2) + '万元'; - // }else{ - // return item.name + ":" + 0 + '万元'; - // } + console.log('category',category) + console.log('index',index) + console.log('opts',opts) + // return item.name + let data = opts.series.filter(subItem=> subItem.name === item.name)[0].real[index] + let day = opts.series.filter(subItem=> subItem.name === item.name)[0].howDayNumber + console.log('data',data) + console.log('day',day) + + if (data){ + if (item.name==='2024年'){ + let howWeek = Math.floor(day / 7) + let howDay = day % 7 + if (howWeek === index){ + return item.name + ":" + getMoney(data / 10000,2) + '万元' + `(第${day}天)`; + }else if (howWeek subItem.name === item.name)[0].real[index] + console.log('data',data) + if (data){ + return item.name + ":" + getMoneyNoDecimal(data)+ '辆'; }else{ - return item.name + ":" + 0 + '辆'; + return item.name + ":" + 0 + '辆'; } } }, diff --git a/pages/nationalPage/components/yearRevenue.vue b/pages/nationalPage/components/yearRevenue.vue index 19fdcf4..ad3d0ca 100644 --- a/pages/nationalPage/components/yearRevenue.vue +++ b/pages/nationalPage/components/yearRevenue.vue @@ -32,7 +32,7 @@ export default { dataList: { type: Object, default: () => {} - } + }, }, watch: { dataList: { @@ -62,6 +62,7 @@ export default { // 处理传入的数据 handleCarData(value) { let res = value + console.log('value',value) // let res = { // categories: ["9.28","9.29","9.30","10.1","10.2","10.3","10.4","10.5","10.6","10.7"], // series: [ @@ -78,6 +79,7 @@ export default { let config = { max:this.getSplitNumber(value.max) } + console.log('config',config) this.res = value this.opts = { categories: res.categories, @@ -121,8 +123,9 @@ export default { // this.drawCharts('yearRevenue', res,config) }, getSplitNumber(value){ - if (value === 0){ - return 5 + if (value === 0 || value<5){ + let num = Math.ceil(Number(value)) + return num }else{ let sum = Number(value) + Number(value) *0.2 if((sum / 10000)<1){ diff --git a/pages/nationalPage/index.vue b/pages/nationalPage/index.vue index 641f42c..0f95673 100644 --- a/pages/nationalPage/index.vue +++ b/pages/nationalPage/index.vue @@ -1,9 +1,9 @@ + diff --git a/static/images/newIndex/noticeIcon.svg b/static/images/newIndex/noticeIcon2.svg similarity index 100% rename from static/images/newIndex/noticeIcon.svg rename to static/images/newIndex/noticeIcon2.svg