index.vue 27 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160
  1. <template>
  2. <view>
  3. <view class="navbar-tit">{{title}}运管中心</view>
  4. <view class="statisticsChart" style="margin-top: 120rpx;margin-bottom: 0px">
  5. <view class="statisticsChart-head" >
  6. <h4>充电统计</h4>
  7. </view>
  8. </view>
  9. <view class="statisticsData">
  10. <view class="detailstableHead" v-if="indexData">
  11. <view class="detailsline" >
  12. <view class="details-row details-row-head-1 ">
  13. <view class="span1">今日收入</view>
  14. <view class="span2">{{indexData.todayAmount?indexData.todayAmount.toFixed(2):0}}<span >元</span></view>
  15. </view>
  16. <view class="details-row details-row-head-2" >
  17. <view class="span1">今日利润</view>
  18. <view class="span2">{{indexData.todayProfit?indexData.todayProfit.toFixed(2):0}}<span >元</span></view>
  19. </view>
  20. <view class="details-row details-row-head-3" >
  21. <view class="span1">今日笔数</view>
  22. <view class="span2">{{indexData.todayEQNum?indexData.todayEQNum:0}}<span >笔</span></view>
  23. </view>
  24. </view>
  25. <view class="detailsline" >
  26. <view class="details-row details-row-head-1 ">
  27. <view class="span1">昨日收入</view>
  28. <view class="span2">{{indexData.yesterdayAmount?indexData.yesterdayAmount.toFixed(2):0}}<span>元</span></view>
  29. </view>
  30. <view class="details-row details-row-head-2" >
  31. <view class="span1">昨日利润</view>
  32. <view class="span2">{{indexData.yesterdayProfit?indexData.yesterdayProfit.toFixed(2):0}}<span >元</span></view>
  33. </view>
  34. <view class="details-row details-row-head-3" >
  35. <view class="span1">昨日笔数</view>
  36. <view class="span2">{{indexData.yesterdayEQNum?indexData.yesterdayEQNum:0}}<span >笔</span></view>
  37. </view>
  38. </view>
  39. <view class="detailsline—bottom" >
  40. <view class="details-row details-row-head-1">
  41. <view class="span1">本月收入</view>
  42. <view class="span2">{{indexData.thisMonthAmount?indexData.thisMonthAmount.toFixed(2):0}}<span >元</span></view>
  43. </view>
  44. <view class="details-row details-row-head-2" >
  45. <view class="span1">本月利润</view>
  46. <view class="span2">{{indexData.thisMonthProfit?indexData.thisMonthProfit.toFixed(2):0}}<span >元</span></view>
  47. </view>
  48. <view class="details-row details-row-head-3" >
  49. <view class="span1">本月笔数</view>
  50. <view class="span2">{{indexData.thisMonthEQNum?indexData.thisMonthEQNum:0}}<span >笔</span></view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <u-picker mode="time" v-model="popupShow" @confirm="changedate" :default-time="queryTime" :params="params"></u-picker>
  56. <u-picker mode="time" v-model="popupShow2" @confirm="changedate2" :default-time="queryTime2+'-1'" :params="params"></u-picker>
  57. <u-picker mode="selector" v-model="popupShow3" @confirm="changedate3" :range="stationList" range-key="name" :default-selector="[selectstationIndex]"></u-picker>
  58. <view class="statisticsChart">
  59. <view class="statisticsChart-head" style="margin-top: 20px;">
  60. <h4>流水统计</h4>
  61. <!-- <view class="navbar-screen" >
  62. {{startTime}}至{{endTime}}
  63. </view> -->
  64. <view class="navbar-screen" @click="popupShow = true" v-if="false">
  65. <span>{{showTime(queryTime)}}</span>
  66. <u-icon name="arrow-down" color="#b0b8c8" size="32" v-show="!popupShow"></u-icon>
  67. <u-icon name="arrow-up" color="#b0b8c8" size="32" v-show="popupShow"></u-icon>
  68. </view>
  69. </view>
  70. <u-calendar v-model="popupShow4" mode="range" @change="changedate4"></u-calendar>
  71. <view class="details detailstable">
  72. <p style="text-align: center; margin-bottom: 5px;" @click="popupShow4 = true">
  73. <img src="@/assets/img/riLine-calendar-todo-line.svg" align="absmiddle" style="height:40rpx;width: 40rpx ;" >
  74. {{startTime}}至{{endTime}}
  75. <u-icon name="arrow-down" color="#b0b8c8" size="32" v-show="!popupShow4"></u-icon>
  76. <u-icon name="arrow-up" color="#b0b8c8" size="32" v-show="popupShow4"></u-icon>
  77. </p>
  78. <view class="detailsline detailslineHead" v-if="stationFlowList.length>1" >
  79. <view class="details-row ">
  80. <view class="span1">总收入</view>
  81. <view class="span2">{{(allMoneySum).toFixed(2)}}<span>元</span></view>
  82. </view>
  83. <view class="details-row">
  84. <view class="span1">总利润<span>(服务费+月卡)</span></view>
  85. <view class="span2">{{(serviceMoneySum).toFixed(2)}}<span>元</span></view>
  86. </view>
  87. </view>
  88. <u-collapse
  89. :headStyle="{
  90. color:'#101010',
  91. fontWeight: 'bold',
  92. padding:'24rpx 0',
  93. borderBottom: '1px solid #ededed'
  94. }"
  95. v-if="stationFlowList.length">
  96. <u-collapse-item @change="changeitem"
  97. v-for="(item, index) in stationFlowList" :index="index" :key="index">
  98. <view slot="title" class="u-collapse-title u-line-1" style="width: 100%;">
  99. {{item.stationName}} <span style="float:right;"><span style="font-size: 24rpx;margin-right: 8rpx;font-weight: normal;">总收入</span>{{item.actualMoney.toFixed(2)}}元</span>
  100. </view>
  101. <!-- -->
  102. <view class="detailsline">
  103. <view class="details-row details-row-1">
  104. <view class="span1">电费</view>
  105. <view class="span2">{{item.elecMoney.toFixed(2)}}<span>元</span></view>
  106. </view>
  107. <view class="details-row">
  108. <view class="span1">服务费</view>
  109. <view class="span2">{{item.serviceMoney.toFixed(2)}}<span>元</span></view>
  110. </view>
  111. </view>
  112. <view class="detailsline">
  113. <view class="details-row details-row-1">
  114. <view class="span1">总用电量</view>
  115. <view class="span2">{{(item.eq/10000).toFixed(1)}}<span>度</span></view>
  116. </view>
  117. <view class="details-row">
  118. <view class="span1">充电枪数量</view>
  119. <view class="span2">快充{{item.fastNum}}/慢充{{item.slowNum}}</view>
  120. </view>
  121. </view>
  122. <view class="detailsline" v-if="item.fastNum&&item.slowNum">
  123. <view class="details-row details-row-1">
  124. <view class="span1">快充枪平均充电量</view>
  125. <view class="span2" v-if="item.fastNum">{{(item.averageFast/10000).toFixed(1)}}<span>度/枪/天</span></view>
  126. <view class="span2" v-else>0<span>度/枪/天</span></view>
  127. </view>
  128. <view class="details-row">
  129. <view class="span1">慢充枪平均充电量</view>
  130. <view class="span2" v-if="item.slowNum" >{{(item.averageSlow/10000).toFixed(1)}}<span>度/枪/天</span></view>
  131. <view class="span2" v-else>0<span>度/枪/天</span></view>
  132. </view>
  133. </view>
  134. <view class="detailsline" v-if="item.fastNum&&item.slowNum" >
  135. <view class="details-row details-row-1">
  136. <view class="span1">月卡收益</view>
  137. <view class="span2" >{{(item.cardMoney).toFixed(2)}}<span>元</span></view>
  138. </view>
  139. <view class="details-row">
  140. </view>
  141. </view>
  142. <view v-if="item.fastNum&&item.slowNum" :style="item.slowDayNum==nowTime?'color: #ffffff;':'border-bottom: 1px solid #ededed;'"
  143. >查询范围内实际订单天数{{item.slowDayNum}}</view>
  144. </u-collapse-item>
  145. </u-collapse>
  146. </view>
  147. <view class="statisticsChart-head" style="margin-top: 20px;">
  148. <h4>投资人收益统计</h4>
  149. <!-- <view class="navbar-screen" >
  150. {{startTime}}至{{endTime}}
  151. </view> -->
  152. <!-- <view class="navbar-screen" @click="popupShow2 = true"><span>筛选</span>
  153. <u-icon name="filter-2-fill" custom-prefix="custom-icon" color="#b0b8c8" size="32"></u-icon>
  154. </view> -->
  155. </view>
  156. <view class="details"
  157. v-if="indexData2&&indexData2.incomeMap">
  158. <view class="details-row2">
  159. <p @click="popupShow3 = true">{{selectstationName}}
  160. <u-icon name="arrow-down" color="#b0b8c8" size="32" v-show="!popupShow3"></u-icon>
  161. <u-icon name="arrow-up" color="#b0b8c8" size="32" v-show="popupShow3"></u-icon>
  162. </p>
  163. <p @click="popupShow2 = true">
  164. {{showTime(queryTime2)}}
  165. <u-icon name="arrow-down" color="#b0b8c8" size="32" v-show="!popupShow2"></u-icon>
  166. <u-icon name="arrow-up" color="#b0b8c8" size="32" v-show="popupShow2"></u-icon>
  167. </p>
  168. </view>
  169. <view class="details-row">
  170. <p>投资人收入</p>
  171. <span>{{indexData2.incomeMap.incomeAmount.toFixed(2)}}元</span>
  172. </view>
  173. <view class="details-row" >
  174. <p>预估用电度数</p>
  175. <span>{{(indexData2.incomeMap.electricQuantity/10000).toFixed(1)}}度</span>
  176. </view>
  177. <view class="details-row">
  178. <p>预估电费</p>
  179. <span>{{indexData2.incomeMap.costAmount.toFixed(2)}}元</span>
  180. </view>
  181. <view class="details-row">
  182. <p>服务费预估收益</p>
  183. <span>{{indexData2.incomeMap.serviceAmount.toFixed(2)}}元</span>
  184. </view>
  185. <view class="details-row">
  186. <p>月卡收益</p>
  187. <span>{{indexData2.incomeMap.cardIncomeAmount.toFixed(2)}}元</span>
  188. </view>
  189. <view class="details-row">
  190. <p>预估总利润</p>
  191. <span>{{(indexData2.incomeMap.serviceAmount+indexData2.incomeMap.cardIncomeAmount).toFixed(2)}}元</span>
  192. </view>
  193. </view>
  194. </view>
  195. <Tabbar :current="0" ref="tabbarMain"></Tabbar>
  196. <!-- <u-tabbar v-model="current" :list="tabbarList" active-color="#185ac6"></u-tabbar>
  197. -->
  198. </view>
  199. </template>
  200. <script>
  201. import Tabbar from '@/components/TabbarFinance.vue'
  202. import * as API from '@/apis/finance.js'
  203. import * as echarts from "echarts";
  204. //require("@/apis/echarts-5-3.min.js")
  205. //import * as echarts from "@/apis/echarts-5-3.min.js";
  206. import {
  207. daysDistance,
  208. beforeTimeStamp,
  209. currentTimeStamp,
  210. parseUnixTime
  211. } from '@/utils'
  212. export default {
  213. data() {
  214. return {
  215. popupShow3:false,
  216. params: {
  217. year: true,
  218. month: true,
  219. day: false,
  220. hour: false,
  221. minute: false,
  222. second: false
  223. },
  224. isinit: true,
  225. form: {},
  226. form2: {},
  227. selecttype: "",
  228. selectstationId: "",
  229. selectdeviceNo: "",
  230. popupShow2: false,
  231. popupShow: false,
  232. popupShow4:false,
  233. nowTime:0,
  234. selectstationId2: "",
  235. selectstationIndex:0,
  236. selectstationName: "",
  237. info: {},
  238. title: "",
  239. showdate: false,
  240. showdate2: false,
  241. queryTime:"",
  242. queryTime2:"",
  243. indexData: {},
  244. indexData2: null,
  245. changeitemBl:false,
  246. myChart: null,
  247. myChartReady: false,
  248. myChartTime: false,
  249. subsection: [{
  250. name: '金额'
  251. },
  252. {
  253. name: '笔数'
  254. }
  255. ],
  256. stationFlowList: [],
  257. serviceMoneySum:0,
  258. allMoneySum:0,
  259. stationList: [],
  260. stationListSon: [],
  261. tabbarList: [{
  262. iconPath: "bar-chart-box-fill",
  263. selectedIconPath: "bar-chart-box-fill",
  264. text: '统计',
  265. count: 0,
  266. isDot: true,
  267. customIcon: true,
  268. },
  269. {
  270. iconPath: "article-fill",
  271. selectedIconPath: "article-fill",
  272. text: '明细',
  273. midButton: true,
  274. customIcon: true,
  275. },
  276. {
  277. iconPath: "account-pin-box-fill",
  278. selectedIconPath: "account-pin-box-fill",
  279. text: '我的',
  280. count: 0,
  281. isDot: false,
  282. customIcon: true,
  283. },
  284. ],
  285. endTime:'',
  286. endTime2:'',
  287. current: 0,
  288. background: {
  289. background: 'none'
  290. },
  291. value: '',
  292. type: 'select',
  293. show: false,
  294. border: true,
  295. step: 0,
  296. stepname: '',
  297. startTime:'',
  298. stepid: 0,
  299. }
  300. },
  301. onShow() {
  302. if (this.$refs.tabbarMain) {
  303. this.$refs.tabbarMain.setcount(0);
  304. }
  305. },
  306. onLoad() {
  307. this.info = this.carhelp.getPersonInfo("merchantUser")
  308. this.title = this.info.merchantAccountName
  309. },
  310. components: {
  311. Tabbar
  312. },
  313. onReady() {
  314. var date=new Date();
  315. this.nowTime=7
  316. this.queryTime=parseUnixTime(currentTimeStamp(), '{y}-{m}');
  317. this.queryTime2=parseUnixTime(currentTimeStamp(), '{y}-{m}'),
  318. console.log(this.queryTime);
  319. this.startTime = parseUnixTime(beforeTimeStamp(7), '{y}-{m}-{d}')
  320. this.endTime = parseUnixTime(beforeTimeStamp(1), '{y}-{m}-{d}')
  321. //this.startTime2 = parseUnixTime(beforeTimeStamp(6), '{y}-{m}-{d}')
  322. this.endTime2 = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}')
  323. this.getStation()
  324. },computed:{
  325. // startTime(){
  326. // return this.queryTime+'-1'
  327. // },
  328. startTime2(){
  329. return this.queryTime2+'-1'
  330. },
  331. },
  332. methods: {
  333. changeitem(e){
  334. if(this.stationFlowList.length>1&&e.index==this.stationFlowList.length-1&&e.show){
  335. this.changeitemBl=true;
  336. }else{
  337. this.changeitemBl=false;
  338. }
  339. },
  340. showTime(name){
  341. if(!name){
  342. return ''
  343. }
  344. return name.replace('-','年')+'月';
  345. },
  346. getStation(bl) {
  347. API.stationList().then((res) => {
  348. this.stationList = res.data.stationList
  349. this.stationList.unshift({
  350. id:'',name:"全部站点"
  351. })
  352. this.selectstationName="全部站点"
  353. this.stationListSon = res.data.deviceList
  354. this.getDataHome()
  355. this.getData()
  356. this.getData2()
  357. }).catch(error => {
  358. uni.showToast({
  359. title: error
  360. })
  361. })
  362. },
  363. resetBtn() {
  364. this.nowTime=7
  365. this.startTime = parseUnixTime(beforeTimeStamp(6), '{y}-{m}-{d}')
  366. this.endTime = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}')
  367. this.selecttype = ""
  368. this.selectstationId = ""
  369. this.selectdeviceNo = ""
  370. this.form = {
  371. type: this.selecttype,
  372. stationId: this.selectstationId,
  373. deviceNo: this.selectdeviceNo,
  374. };
  375. this.popupShow = false;
  376. this.list = [];
  377. this.getData()
  378. },
  379. okbtn() {
  380. this.popupShow = false;
  381. this.form = {
  382. type: this.selecttype,
  383. stationId: this.selectstationId,
  384. deviceNo: this.selectdeviceNo,
  385. };
  386. this.list = [];
  387. this.getData()
  388. },
  389. resetBtn2() {
  390. this.startTime2 = parseUnixTime(beforeTimeStamp(6), '{y}-{m}-{d}')
  391. this.endTime2 = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}')
  392. this.selectstationId2 = ""
  393. this.form2 = {
  394. stationId: this.selectstationId2,
  395. };
  396. this.popupShow2 = false;
  397. this.getData2()
  398. },
  399. okbtn2() {
  400. this.popupShow2 = false;
  401. this.form2 = {
  402. stationId: this.selectstationId2,
  403. };
  404. this.getData2()
  405. },
  406. getDataHome() {
  407. API.homeHeadStatistics().then((res) => {
  408. this.indexData = res.data;
  409. }).catch(error => {
  410. uni.showToast({
  411. title: error
  412. })
  413. })
  414. },
  415. getData() {
  416. this.form.startDate = this.startTime,
  417. this.form.endDate = this.endTime
  418. API.homeFlowStatistics(this.form).then((res) => {
  419. this.stationFlowList = res.data.stationFlowList;
  420. this.nowTime=daysDistance(this.startTime, this.endTime)+1;
  421. this.serviceMoneySum=0;
  422. this.allMoneySum=0;
  423. for(var i in this.stationFlowList ){
  424. var item=this.stationFlowList[i];
  425. this.allMoneySum+=item.actualMoney
  426. this.serviceMoneySum+=item.serviceMoney
  427. this.serviceMoneySum+=item.cardMoney
  428. }
  429. console.log(this.nowTime)
  430. }).catch(error => {
  431. uni.showToast({
  432. title: error
  433. })
  434. })
  435. },
  436. getData2() {
  437. uni.showLoading({
  438. title: "加载中",
  439. mask: true,
  440. })
  441. this.form2.startDate = this.startTime2,
  442. this.form2.endDate = this.endTime2
  443. API.homeIncomeStatistics(this.form2).then((res) => {
  444. this.indexData2 = res.data
  445. uni.hideLoading()
  446. }).catch(error => {
  447. uni.showToast({
  448. title: error
  449. })
  450. })
  451. },
  452. changesub(e) {
  453. this.current = e
  454. this.getPie()
  455. },
  456. changedate4(e) {
  457. this.startTime = e.startDate
  458. this.endTime = e.endDate
  459. this.okbtn()
  460. },
  461. changedate3(e) {
  462. console.log(e)
  463. var index=e[0];
  464. var obj=this.stationList[index];
  465. this.selectstationId2=obj.id;
  466. this.selectstationIndex=index;
  467. this.selectstationName=obj.name;
  468. this.okbtn2()
  469. },
  470. changedate(e) {
  471. console.log(e)
  472. this.queryTime=e.year+'-'+e.month;
  473. this.startTime=e.year+'-'+e.month+'-1';
  474. if(e.month=='12'){
  475. this.endTime=(e.year)+"/12/31"
  476. }else{
  477. var b=e.year+'/'+(parseInt(e.month)+1)+'/1';
  478. var a=beforeTimeStamp(1,b);
  479. this.endTime= parseUnixTime(a, '{y}-{m}-{d}')
  480. }
  481. this.okbtn()
  482. },
  483. changedate2(e) {
  484. console.log(e)
  485. this.queryTime2=e.year+'-'+e.month;
  486. if(e.month=='12'){
  487. this.endTime2=(e.year)+"/12/31"
  488. }else{
  489. var b=e.year+'/'+(parseInt(e.month)+1)+'/1';
  490. var a=beforeTimeStamp(1,b);
  491. this.endTime2= parseUnixTime(a, '{y}-{m}-{d}')
  492. }
  493. this.okbtn2()
  494. },
  495. getPie1(list) {
  496. var getData = [];
  497. var map = new Map()
  498. var stationNum = 0;
  499. list.forEach(item => {
  500. var value = this.current ? item.eqNum : item.amount
  501. if (value) {
  502. var stationName = ""
  503. var obj = this.stationListSon.find(item2 => {
  504. return item2.deviceNo == item.deviceNo
  505. })
  506. if (obj && obj.stationId) {
  507. var obj2 = this.stationList.find(item3 => {
  508. return item3.id == obj.stationId
  509. })
  510. if (obj2 && obj2.name) {
  511. stationName = obj2.name;
  512. }
  513. if (!map.has(obj.stationId)) {
  514. map.set(obj.stationId, {
  515. id: obj.stationId,
  516. value: value,
  517. name: stationName,
  518. })
  519. this.stepid = obj.stationId;
  520. stationNum++;
  521. } else {
  522. var omap = map.get(obj.stationId)
  523. var addvalue = (omap.value * 100 + value * 100) / 100
  524. map.set(obj.stationId, {
  525. id: obj.stationId,
  526. value: addvalue,
  527. name: stationName,
  528. })
  529. }
  530. }
  531. }
  532. })
  533. map.forEach((item, i) => {
  534. getData.push(item)
  535. })
  536. if (stationNum == 1) {
  537. this.step = 2; //只有一个站, 就不拆分了
  538. } else {
  539. this.stepid = 0;
  540. }
  541. return getData;
  542. },
  543. getPie2(list) {
  544. var getData = [];
  545. var sz = ['自行车充电桩', '直流汽车充电桩', '交流汽车充电桩']
  546. list.forEach(item => {
  547. var value = this.current ? item.eqNum : item.amount
  548. if (value) {
  549. var typeName = "";
  550. var stationName = ""
  551. var obj = this.stationListSon.find(item2 => {
  552. return item2.deviceNo == item.deviceNo
  553. })
  554. if (this.stepid != obj.stationId) {
  555. return
  556. }
  557. if (obj && obj.stationId) {
  558. var obj2 = this.stationList.find(item3 => {
  559. return item3.id == obj.stationId
  560. })
  561. if (obj2 && obj2.name) {
  562. stationName = obj2.name;
  563. }
  564. }
  565. if (obj && obj.type) {
  566. typeName = sz[obj.type]
  567. }
  568. getData.push({
  569. id: item.id,
  570. value: value,
  571. name: item.deviceName,
  572. typeName: typeName,
  573. stationName: stationName
  574. })
  575. }
  576. })
  577. return getData;
  578. },
  579. getPie() {
  580. var list = this.indexData.pieChart;
  581. var unit = this.current ? '笔' : '元'
  582. var getData = [];
  583. if (this.step == 0) {
  584. getData = this.getPie1(list)
  585. }
  586. if (this.step == 1 || this.step == 2) {
  587. getData = this.getPie2(list)
  588. }
  589. if (!this.myChart) {
  590. this.myChart = echarts.init(document.getElementById('pieEcharts'));
  591. }
  592. // 指定图表的配置项和数据
  593. var option = {
  594. tooltip: {
  595. trigger: 'item',
  596. formatter: (value) => {
  597. var info = value.data;
  598. var showvalue = info.value;
  599. if (!this.current) {
  600. showvalue = info.value.toFixed(2)
  601. }
  602. if (this.step == 0) {
  603. if (!info) {
  604. return ""
  605. }
  606. return info.name + ' <br/> ' + showvalue + unit
  607. }
  608. if (this.step == 1 || this.step == 2) {
  609. return info.stationName + ' <br/> ' + info.name + ' <br/> ' + showvalue + unit +
  610. ' <br/> ' + info.typeName
  611. }
  612. },
  613. position: function(point, params, dom, rect, size) {
  614. return ['10%', '0%']
  615. }
  616. },
  617. series: [{
  618. //name: 'Access From',
  619. type: 'pie',
  620. radius: '40%',
  621. data: getData,
  622. emphasis: {
  623. itemStyle: {
  624. shadowBlur: 10,
  625. shadowOffsetX: 0,
  626. shadowColor: 'rgba(0, 0, 0, 0.5)'
  627. }
  628. },
  629. label: {
  630. fontWeight: "bold",
  631. fontSize: 14,
  632. }
  633. }]
  634. };
  635. // 使用刚指定的配置项和数据显示图表。
  636. this.myChart.setOption(option);
  637. var _this = this;
  638. if (!this.myChartReady) {
  639. this.myChartReady = true;
  640. //双击事件不能生效 , 改为多次点击
  641. this.myChart.on('click', function(params) {
  642. var tid = _this.stepid; //上一次
  643. _this.stepid = params.data.id
  644. if (!_this.myChartTime || tid != _this.stepid) {
  645. _this.stepid = params.data.id
  646. _this.myChartTime = true;
  647. setTimeout(function() {
  648. console.log("setTimeout")
  649. _this.myChartTime = false;
  650. }, 500)
  651. return
  652. }
  653. if (_this.step == 0) {
  654. _this.step = 1
  655. _this.stepname = params.data.name
  656. _this.myChart.clear()
  657. _this.getPie()
  658. } else if (_this.step == 1) {
  659. //_this.step=0
  660. }
  661. // window.open('https://www.baidu.com/s?wd=' + encodeURIComponent(params.name));
  662. });
  663. }
  664. }
  665. }
  666. }
  667. </script>
  668. <style>
  669. page {
  670. background: url(../../assets/img/index_header_bg.png) no-repeat top center #f7f7f7;
  671. background-size: 100%;
  672. }
  673. </style>
  674. <style lang="scss" scoped>
  675. .detailstable{
  676. padding: 40rpx 30rpx !important;
  677. }
  678. .detailstableHead{
  679. .span1{
  680. font-size: 32rpx!important;
  681. }
  682. .details-row-head-1{
  683. }
  684. .details-row-head-2{
  685. }
  686. .details-row-head-3{
  687. width: 30% !important;
  688. max-width: 150rpx;
  689. .span{
  690. }
  691. }
  692. .span2{
  693. font-size: 44rpx !important;
  694. font-weight: bold;
  695. width: 100%;
  696. color: #101010;
  697. span{
  698. font-size: 24rpx !important;
  699. }
  700. }
  701. }
  702. .detailslineHead{
  703. border-top: 1px solid #ededed;;
  704. .details-row{
  705. padding-left: 8rpx!important;
  706. }
  707. font-size: 30rpx!important;
  708. .span1 span{
  709. font-size: 28rpx;
  710. }
  711. }
  712. .detailstable,.detailstableHead {
  713. font-size: 16px;
  714. p{
  715. font-size: 14px;
  716. }
  717. .details-row-main{
  718. border-bottom: 1px solid #ededed;
  719. padding: 10px 0;
  720. }
  721. .detailsline{
  722. border-bottom: 1px solid #ededed;
  723. }
  724. .detailsline,.detailsline—bottom {
  725. display: flex;
  726. .details-row {
  727. width: 50%;
  728. display: flex;
  729. justify-content: space-between;
  730. flex-direction: column;
  731. padding-left: 16rpx;
  732. margin-bottom: 20rpx;
  733. .span1 {
  734. color: rgba(136, 136, 136, 100);
  735. font-size:28rpx;
  736. width: 100%;
  737. }
  738. .span2{
  739. font-size: 36rpx;
  740. width: 100%;
  741. color: #101010;
  742. span{
  743. font-size: 24rpx;
  744. }
  745. }
  746. }
  747. }
  748. .details-row-1 {
  749. width: 47%;
  750. padding-left: 0px !important;
  751. border-right: 1px solid #ededed;
  752. }
  753. }
  754. .details {
  755. padding: 20px;
  756. background-color: #fff;
  757. border-radius: 8px;
  758. }
  759. .details-title {
  760. margin-bottom: 16px;
  761. h4 {
  762. font-weight: normal;
  763. font-size: 16px;
  764. position: relative;
  765. padding-left: 10px;
  766. &::after {
  767. content: '';
  768. position: absolute;
  769. height: 12px;
  770. width: 4px;
  771. background-color: #27B148;
  772. left: 0;
  773. top: 5px;
  774. }
  775. }
  776. }
  777. .details-row {
  778. display: flex;
  779. justify-content: space-between;
  780. align-items: center;
  781. margin-top: 15px;
  782. p {
  783. color: #37393c;
  784. font-weight: bold;
  785. }
  786. }
  787. .details-row2 {
  788. display: flex;
  789. justify-content: space-between;
  790. align-items: center;
  791. // margin-top: 15px;
  792. p {
  793. // color: #37393c;
  794. // font-weight: bold;
  795. }
  796. }
  797. .popup-screen {
  798. padding: 20px;
  799. position: relative;
  800. .screen {
  801. padding-bottom: 30px;
  802. }
  803. .screen-item {
  804. margin-bottom: 20px;
  805. .screen-head {
  806. margin-bottom: 8px;
  807. font-size: 16px;
  808. }
  809. .screen-main {
  810. display: flex;
  811. // display: -webkit-box;
  812. flex-wrap: wrap;
  813. }
  814. .screen-entry {
  815. width: 29%;
  816. padding: 6px 0;
  817. display: flex;
  818. align-items: center;
  819. justify-content: center;
  820. background-color: #F2F5FA;
  821. text-align: center;
  822. margin-bottom: 10px;
  823. border-radius: 3px;
  824. margin-right: 6px;
  825. }
  826. .screen-entry.active {
  827. background-color: #185AC6;
  828. color: #fff;
  829. }
  830. }
  831. .screen-foot {
  832. position: fixed;
  833. left: 0;
  834. right: 0;
  835. bottom: 0;
  836. display: flex;
  837. height: 50px;
  838. border-top: 1px solid #ededed;
  839. .screen-btn-l {
  840. background-color: #fff;
  841. flex: 0.2;
  842. text-align: center;
  843. line-height: 50px;
  844. }
  845. .screen-btn-r {
  846. flex: 0.8;
  847. text-align: center;
  848. line-height: 50px;
  849. background-color: #185AC6;
  850. color: #fff;
  851. }
  852. }
  853. }
  854. .navbar-tit {
  855. color: #fff;
  856. font-size: 24px;
  857. padding-left: 15px;
  858. padding-top: 10px;
  859. }
  860. .statisticsData {
  861. background-color: #fff;
  862. margin:0px 24rpx 24rpx;
  863. padding:0px 24rpx 24rpx;
  864. border-radius: 8px;
  865. }
  866. .statisticsDataMain {
  867. flex-wrap: wrap;
  868. display: flex;
  869. }
  870. .statisticsData-item {
  871. flex: 1;
  872. width: 40%;
  873. .statisticsData-head {
  874. display: flex;
  875. align-items: center;
  876. p {
  877. color: #637AA2;
  878. font-size: 12px;
  879. }
  880. }
  881. .statisticsData-main {
  882. margin-top: 4px;
  883. font-size: 18px;
  884. }
  885. .statisticsData-foot {
  886. display: flex;
  887. align-items: center;
  888. margin-top: 16px;
  889. p {
  890. color: #637AA2;
  891. }
  892. h4 {
  893. margin-left: 8px;
  894. }
  895. }
  896. }
  897. .statisticsChart {
  898. margin: 16px;
  899. .statisticsChart-head {
  900. margin-bottom: 5px;
  901. display: flex;
  902. justify-content: space-between;
  903. align-items: center;
  904. h4 {
  905. font-weight: normal;
  906. font-size: 16px;
  907. position: relative;
  908. padding-left: 10px;
  909. &::after {
  910. content: '';
  911. position: absolute;
  912. height: 12px;
  913. width: 4px;
  914. background-color: #4E8DF6;
  915. left: 0;
  916. top: 5px;
  917. }
  918. }
  919. .statisticsChart-time {
  920. display: flex;
  921. align-items: center;
  922. p {
  923. color: #666;
  924. }
  925. }
  926. }
  927. .statisticsChart-main {
  928. background-color: #fff;
  929. padding: 10px 16px 16px 16px;
  930. border-radius: 8px;
  931. }
  932. }
  933. </style>