From 189045fd98bee2dace5f26851ac775c0f17b3382 Mon Sep 17 00:00:00 2001 From: ylj20011123 Date: Tue, 25 Nov 2025 16:03:27 +0800 Subject: [PATCH] update --- pages/index/index.vue | 273 ++++++++++++++++++++++++++---------------- 1 file changed, 169 insertions(+), 104 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index c63e325..cde6c8f 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -101,7 +101,7 @@ {{ (Math.floor(index / 12) + 2024).toString().slice(2, 4) - }}年累计对客销售/亿元 + }}年累计对客销售/亿元 {{ @@ -169,22 +169,35 @@ {{ currentMoney }} + + + + + {{ currentTotal }} {{ currentTotal ? '万笔' : '' }} {{ $util.handleGetMonthDay(nowDay) }}/{{ howDay }} - - - - - + + + + + {{ subItem.label || "" }} + + {{ subItem.value || "" }} /{{ subItem.unit || "" }} + + {{ subItem.totalCount || "" }} + {{ + subItem.totalCountUnit ? `/${subItem.totalCountUnit}` : "" }} + @@ -252,6 +265,7 @@ export default { profitSharingList: [],// 顶部圆环图右边的数据 howDay: "", // 星期几 currentMoney: "",// 实时营收 + currentTotal: "",// 实时营收了多少笔订单 page: "/pages/index/index", otherRealData: [],// 其他的实时数据 single: "", @@ -572,6 +586,14 @@ export default { } this.$util.toNextRoute("navigateTo", "/pages/map/index?type=index"); }, + // 处理一下数据 保留两位小数 + handleProcessNumber(number) { + if (number) { + return number.toFixed(2) + } else { + return '' + } + }, // 拿到云南 油水电等数据 async handleGetYNRealData() { try { @@ -588,7 +610,7 @@ export default { label: '油品', icon: 'https://eshangtech.com/cyy_DIB/oilIcon.png', valueKey: 'totalCount', - unitKey: 'totalCountUnit' + unitKey: 'totalCountUnit', }, 3000: { label: '加水', @@ -605,24 +627,88 @@ export default { 5000: { label: '充电', icon: 'https://eshangtech.com/cyy_DIB/chargeIcon.png', - valueKey: 'totalTicket', - unitKey: 'totalTicketUnit' + valueKey: 'totalAmount', + unitKey: 'totalAmountUnit', + totalKey: "totalTicket", + totalKeyUnit: "totalTicketUnit", } }; + console.log('listlistlistlist', list); + // 去拿油品、加水、尿素的数据 + const OilData = await request.$apiPost("CommercialApi/BigData/GetEnergyRevenueInfo", { + DataType: 2000, + StatisticsDate: this.nowDay, + ShowWY: true, + ShowLargeUnit: true, + type: "encryption" + }); + if (OilData.Result_Data) { + result.push({ + label: '油品', + value: this.handleProcessNumber(Number(OilData.Result_Data.value)), + unit: '万元', + icon: 'https://eshangtech.com/cyy_DIB/oilIcon.png', + totalCount: this.handleProcessNumber(Number(OilData.Result_Data.data)), + totalCountUnit: '吨', + }); + } + + const addWaterData = await request.$apiPost("CommercialApi/BigData/GetEnergyRevenueInfo", { + DataType: 3000, + StatisticsDate: this.nowDay, + ShowWY: true, + ShowLargeUnit: true, + type: "encryption" + }); + if (addWaterData.Result_Data) { + result.push({ + label: '加水', + value: this.handleProcessNumber(Number(addWaterData.Result_Data.value)), + unit: '万元', + icon: 'https://eshangtech.com/cyy_DIB/addWaterIcon.png', + totalCount: this.handleProcessNumber(Number(addWaterData.Result_Data.data)), + totalCountUnit: '吨', + }); + } + + const UreaData = await request.$apiPost("CommercialApi/BigData/GetEnergyRevenueInfo", { + DataType: 4000, + StatisticsDate: this.nowDay, + ShowWY: true, + ShowLargeUnit: true, + type: "encryption" + }); + if (UreaData.Result_Data) { + result.push({ + label: '尿素', + value: this.handleProcessNumber(Number(UreaData.Result_Data.value)), + unit: '万元', + icon: 'https://eshangtech.com/cyy_DIB/chargeIcon.png', + totalCount: this.handleProcessNumber(Number(UreaData.Result_Data.data)), + totalCountUnit: '吨', + }); + } if (list && list.length > 0) { list.forEach((item) => { - const config = dataTypeMap[item.dataType]; - if (config) { - result.push({ - label: config.label, - value: this.$util.fmoney(item[config.valueKey]), - unit: item[config.unitKey], - icon: config.icon - }); + if (item.dataType === 5000) { + const config = dataTypeMap[item.dataType]; + if (config) { + result.push({ + label: config.label, + value: this.$util.fmoney(item[config.valueKey]), + unit: item[config.unitKey], + icon: config.icon, + totalCount: this.$util.fmoney(item[config.totalKey]), + totalCountUnit: item[config.totalKeyUnit], + }); + } + } else if (item.dataType === 1000) { + this.currentTotal = this.handleProcessNumber(Number(item.totalTicket)) } }); } + console.log('resultresultresult', result); this.otherRealData = result; } catch (error) { console.error('获取实时数据失败:', error); @@ -930,6 +1016,7 @@ export default { background-image: url("https://eshangtech.com/minTestImg/pageBg.png"); background-size: 100% 100%; background-repeat: no-repeat; + overflow-y: auto; .topBox { width: 100%; @@ -1318,62 +1405,6 @@ export default { color: #999; } } - - .data-grid { - display: grid; - grid-template-columns: repeat(2, 1fr); - gap: 16rpx; - margin-bottom: 24rpx; - - .data-item { - background: #fff; - padding: 24rpx; - border-radius: 16rpx; - box-shadow: @shadow; - display: flex; - align-items: center; - - .data-icon { - width: 64rpx; - height: 64rpx; - background: linear-gradient(135deg, #DCE6FF, #EEF3FF); - border-radius: 50%; - display: flex; - align-items: center; - justify-content: center; - margin-right: 16rpx; - - .icon { - width: 32rpx; - height: 32rpx; - } - } - - .data-info { - flex: 1; - - .data-label { - font-size: 24rpx; - color: @muted; - margin-bottom: 8rpx; - } - - .data-value { - .value { - font-size: 28rpx; - font-weight: 600; - color: #160002; - } - - .unit { - font-size: 20rpx; - color: #A69E9F; - margin-left: 4rpx; - } - } - } - } - } } .thingBox { @@ -1381,46 +1412,70 @@ export default { box-sizing: border-box; padding: 0 32rpx; margin-top: 24rpx; + margin-bottom: 24rpx; .data-grid { - display: grid; - grid-template-columns: repeat(2, 1fr); - gap: 16rpx; + // display: grid; + // grid-template-columns: repeat(2, 1fr); + // gap: 16rpx; + width: 100%; + display: flex; + align-items: center; + justify-content: space-between; + flex-wrap: wrap; .data-item { + width: calc(50% - 8rpx); background: #fff; - padding: 24rpx; + padding: 18rpx 18rpx 18rpx 18rpx; border-radius: 16rpx; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); - display: flex; - align-items: center; + box-sizing: border-box; + // display: flex; + // align-items: center; + // align-items: flex-start; - .data-icon { - width: 64rpx; - height: 64rpx; - background: linear-gradient(135deg, #DCE6FF, #EEF3FF); - border-radius: 50%; + .data-item-top { + width: 100%; display: flex; align-items: center; - justify-content: center; - margin-right: 16rpx; - .icon { - width: 32rpx; - height: 32rpx; + .data-icon { + width: 50rpx; + height: 50rpx; + background: linear-gradient(135deg, #DCE6FF, #EEF3FF); + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + margin-right: 16rpx; + + .icon { + width: 32rpx; + height: 32rpx; + } + } + + .data-label { + font-size: 28rpx; + color: #160002; + font-weight: 600; + // margin-bottom: 8rpx; } } - .data-info { - flex: 1; - - .data-label { - font-size: 24rpx; - color: #666; - margin-bottom: 8rpx; - } + .data-item-data { + margin-top: 8rpx; + // display: flex; + // align-items: center; + // justify-content: space-between; .data-value { + // width: 50%; + width: 100%; + display: flex; + justify-content: space-between; + .value { font-size: 28rpx; font-weight: 600; @@ -1428,9 +1483,16 @@ export default { } .unit { - font-size: 20rpx; - color: #A69E9F; + font-size: 24rpx; + color: #160002; margin-left: 4rpx; + font-weight: 600; + white-space: nowrap; + } + + .total { + font-size: 24rpx; + color: #A69E9F; } } } @@ -1615,18 +1677,21 @@ export default { .funBox { width: calc(100% - 64rpx); margin-left: 32rpx; - margin-bottom: calc(100rpx + env(safe-area-inset-bottom)); + margin-bottom: calc(80px + env(safe-area-inset-bottom)); background: #ffffff; border-radius: 16rpx; box-sizing: border-box; - padding: 32rpx 24rpx; - display: grid; - grid-template-columns: repeat(4, 1fr); - gap: 24rpx; + padding: 32rpx 0; + display: flex; + // display: grid; + // grid-template-columns: repeat(4, 1fr); + // gap: 24rpx; box-shadow: @shadow; .funItem { + width: 25%; display: flex; + align-items: center; justify-content: center; .funItemContent {