index.vue 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549
  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 class="navbar-screen ">
  8. <u-button text="月落" size="mini" class="headbotton1" style="border-radius: 10px 0 0 10px;"
  9. :type="current==1?'primary':'info'" @click="changesub(1)">按天</u-button>
  10. <u-button text="月落" size="mini" class="headbotton2" style="border-radius: 0 10px 10px 0;"
  11. :type="current==2?'primary':'info'" @click="changesub(2)">按月</u-button>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="statisticsData">
  16. <view class="detailstableHead" style="
  17. padding-top: 1px;
  18. ">
  19. <view id="pieEcharts" style="min-height:250px;margin-top: 20px">
  20. </view>
  21. </view>
  22. <view class="detailstableHead" v-if="indexData&&false">
  23. <view class="detailsline">
  24. <view class="details-row details-row-head-1 ">
  25. <view class="span1">今日收入</view>
  26. <view class="span2">{{indexData.todayAmount?indexData.todayAmount.toFixed(2):0}}<span>元</span>
  27. </view>
  28. </view>
  29. <view class="details-row details-row-head-2">
  30. <view class="span1">今日利润</view>
  31. <view class="span2">{{indexData.todayProfit?indexData.todayProfit.toFixed(2):0}}<span>元</span>
  32. </view>
  33. </view>
  34. <view class="details-row details-row-head-3">
  35. <view class="span1">今日笔数</view>
  36. <view class="span2">{{indexData.todayEQNum?indexData.todayEQNum:0}}<span>笔</span></view>
  37. </view>
  38. </view>
  39. <view class="detailsline">
  40. <view class="details-row details-row-head-1 ">
  41. <view class="span1">昨日收入</view>
  42. <view class="span2">
  43. {{indexData.yesterdayAmount?indexData.yesterdayAmount.toFixed(2):0}}<span>元</span>
  44. </view>
  45. </view>
  46. <view class="details-row details-row-head-2">
  47. <view class="span1">昨日利润</view>
  48. <view class="span2">
  49. {{indexData.yesterdayProfit?indexData.yesterdayProfit.toFixed(2):0}}<span>元</span>
  50. </view>
  51. </view>
  52. <view class="details-row details-row-head-3">
  53. <view class="span1">昨日笔数</view>
  54. <view class="span2">{{indexData.yesterdayEQNum?indexData.yesterdayEQNum:0}}<span>笔</span></view>
  55. </view>
  56. </view>
  57. <view class="detailsline—bottom">
  58. <view class="details-row details-row-head-1">
  59. <view class="span1">本月收入</view>
  60. <view class="span2">
  61. {{indexData.thisMonthAmount?indexData.thisMonthAmount.toFixed(2):0}}<span>元</span>
  62. </view>
  63. </view>
  64. <view class="details-row details-row-head-2">
  65. <view class="span1">本月利润</view>
  66. <view class="span2">
  67. {{indexData.thisMonthProfit?indexData.thisMonthProfit.toFixed(2):0}}<span>元</span>
  68. </view>
  69. </view>
  70. <view class="details-row details-row-head-3">
  71. <view class="span1">本月笔数</view>
  72. <view class="span2">{{indexData.thisMonthEQNum?indexData.thisMonthEQNum:0}}<span>笔</span></view>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. <u-picker mode="time" v-model="popupShow" @confirm="changedate" :default-time="queryTime" :params="params">
  78. </u-picker>
  79. <u-picker mode="time" v-model="popupShow2" @confirm="changedate2" :default-time="queryTime2+'-1'"
  80. :params="params"></u-picker>
  81. <u-picker mode="selector" v-model="popupShow3" @confirm="changedate3" :range="stationList" range-key="name"
  82. :default-selector="[selectstationIndex]"></u-picker>
  83. <view class="statisticsChart">
  84. <view class="statisticsChart-head" style="margin-top: 20px;">
  85. <h4>流水统计</h4>
  86. <!-- <view class="navbar-screen" >
  87. {{startTime}}至{{endTime}}
  88. </view> -->
  89. <view class="navbar-screen" @click="popupShow = true" v-if="false">
  90. <span>{{showTime(queryTime)}}</span>
  91. <u-icon name="arrow-down" color="#b0b8c8" size="32" v-show="!popupShow"></u-icon>
  92. <u-icon name="arrow-up" color="#b0b8c8" size="32" v-show="popupShow"></u-icon>
  93. </view>
  94. </view>
  95. <u-calendar v-model="popupShow4" mode="range" @change="changedate4"></u-calendar>
  96. <view class="details detailstable">
  97. <p style="text-align: center; margin-bottom: 5px;" @click="popupShow4 = true">
  98. <img src="@/assets/img/riLine-calendar-todo-line.svg" align="absmiddle"
  99. style="height:40rpx;width: 40rpx ;">
  100. {{startTime}}至{{endTime}}
  101. <u-icon name="arrow-down" color="#b0b8c8" size="32" v-show="!popupShow4"></u-icon>
  102. <u-icon name="arrow-up" color="#b0b8c8" size="32" v-show="popupShow4"></u-icon>
  103. </p>
  104. <view class="detailsline detailslineHead" v-if="stationFlowList.length>1">
  105. <view class="details-row ">
  106. <view class="span1">总收入</view>
  107. <view class="span2">{{(allMoneySum).toFixed(2)}}<span>元</span></view>
  108. </view>
  109. <view class="details-row">
  110. <view class="span1">总利润<span>(服务费+月卡)</span></view>
  111. <view class="span2">{{(serviceMoneySum).toFixed(2)}}<span>元</span></view>
  112. </view>
  113. </view>
  114. <u-collapse :headStyle="{
  115. color:'#101010',
  116. fontWeight: 'bold',
  117. padding:'24rpx 0',
  118. borderBottom: '1px solid #ededed'
  119. }" v-if="stationFlowList.length">
  120. <u-collapse-item @change="changeitem" v-for="(item, index) in stationFlowList" :index="index"
  121. :key="index">
  122. <view slot="title" class="u-collapse-title u-line-1" style="width: 100%;">
  123. {{item.stationName}} <span style="float:right;"><span
  124. style="font-size: 24rpx;margin-right: 8rpx;font-weight: normal;">总收入</span>{{item.actualMoney.toFixed(2)}}元</span>
  125. </view>
  126. <!-- -->
  127. <view class="detailsline">
  128. <view class="details-row details-row-1">
  129. <view class="span1">电费</view>
  130. <view class="span2">{{item.elecMoney.toFixed(2)}}<span>元</span></view>
  131. </view>
  132. <view class="details-row">
  133. <view class="span1">服务费</view>
  134. <view class="span2">{{item.serviceMoney.toFixed(2)}}<span>元</span></view>
  135. </view>
  136. </view>
  137. <view class="detailsline">
  138. <view class="details-row details-row-1">
  139. <view class="span1">总用电量</view>
  140. <view class="span2">{{(item.eq/10000).toFixed(1)}}<span>度</span></view>
  141. </view>
  142. <view class="details-row">
  143. <view class="span1">充电枪数量</view>
  144. <view class="span2">快充{{item.fastNum}}/慢充{{item.slowNum}}</view>
  145. </view>
  146. </view>
  147. <view class="detailsline" v-if="item.fastNum&&item.slowNum">
  148. <view class="details-row details-row-1">
  149. <view class="span1">快充枪平均充电量</view>
  150. <view class="span2" v-if="item.fastNum">
  151. {{(item.averageFast/10000).toFixed(1)}}<span>度/枪/天</span>
  152. </view>
  153. <view class="span2" v-else>0<span>度/枪/天</span></view>
  154. </view>
  155. <view class="details-row">
  156. <view class="span1">慢充枪平均充电量</view>
  157. <view class="span2" v-if="item.slowNum">
  158. {{(item.averageSlow/10000).toFixed(1)}}<span>度/枪/天</span>
  159. </view>
  160. <view class="span2" v-else>0<span>度/枪/天</span></view>
  161. </view>
  162. </view>
  163. <view class="detailsline" v-if="item.fastNum&&item.slowNum">
  164. <view class="details-row details-row-1">
  165. <view class="span1">月卡收益</view>
  166. <view class="span2">{{(item.cardMoney).toFixed(2)}}<span>元</span></view>
  167. </view>
  168. <view class="details-row">
  169. </view>
  170. </view>
  171. <view v-if="item.fastNum&&item.slowNum"
  172. :style="item.slowDayNum==nowTime?'color: #ffffff;':'border-bottom: 1px solid #ededed;'">
  173. 查询范围内实际订单天数{{item.slowDayNum}}</view>
  174. </u-collapse-item>
  175. </u-collapse>
  176. </view>
  177. <view class="statisticsChart-head" style="margin-top: 20px;">
  178. <h4>站主/桩主收益统计</h4>
  179. <!-- <view class="navbar-screen" >
  180. {{startTime}}至{{endTime}}
  181. </view> -->
  182. <!-- <view class="navbar-screen" @click="popupShow2 = true"><span>筛选</span>
  183. <u-icon name="filter-2-fill" custom-prefix="custom-icon" color="#b0b8c8" size="32"></u-icon>
  184. </view> -->
  185. </view>
  186. <view class="details" v-if="indexData2&&indexData2.incomeMap">
  187. <view class="details-row2">
  188. <p @click="popupShow3 = true">{{selectstationName}}
  189. <u-icon name="arrow-down" color="#b0b8c8" size="32" v-show="!popupShow3"></u-icon>
  190. <u-icon name="arrow-up" color="#b0b8c8" size="32" v-show="popupShow3"></u-icon>
  191. </p>
  192. <p @click="popupShow2 = true">
  193. {{showTime(queryTime2)}}
  194. <u-icon name="arrow-down" color="#b0b8c8" size="32" v-show="!popupShow2"></u-icon>
  195. <u-icon name="arrow-up" color="#b0b8c8" size="32" v-show="popupShow2"></u-icon>
  196. </p>
  197. </view>
  198. <view class="details-row">
  199. <p>充电总收入</p>
  200. <span>{{(indexData2.incomeMap.incomeAmount+indexData2.incomeMap.cardIncomeAmount).toFixed(2)}}元</span>
  201. </view>
  202. <view class="details-row">
  203. <p>站主/桩主收入</p>
  204. <span>{{indexData2.incomeMap.incomeAmount.toFixed(2)}}元</span>
  205. </view>
  206. <view class="details-row">
  207. <p>预估用电度数</p>
  208. <span>{{(indexData2.incomeMap.electricQuantity/10000).toFixed(1)}}度</span>
  209. </view>
  210. <view class="details-row">
  211. <p>预估电费</p>
  212. <span>{{indexData2.incomeMap.costAmount.toFixed(2)}}元</span>
  213. </view>
  214. <view class="details-row">
  215. <p>服务费预估收益</p>
  216. <span>{{indexData2.incomeMap.serviceAmount.toFixed(2)}}元</span>
  217. </view>
  218. <view class="details-row">
  219. <p>月卡收益</p>
  220. <span>{{indexData2.incomeMap.cardIncomeAmount.toFixed(2)}}元</span>
  221. </view>
  222. <view class="details-row">
  223. <p>预估总利润</p>
  224. <span>{{(indexData2.incomeMap.serviceAmount+indexData2.incomeMap.cardIncomeAmount).toFixed(2)}}元</span>
  225. </view>
  226. </view>
  227. </view>
  228. <Tabbar :current="0" ref="tabbarMain"></Tabbar>
  229. <!-- <u-tabbar v-model="current" :list="tabbarList" active-color="#185ac6"></u-tabbar>
  230. -->
  231. </view>
  232. </template>
  233. <script>
  234. import Tabbar from '@/components/TabbarFinance.vue'
  235. import * as API from '@/apis/finance.js'
  236. import * as echarts from "echarts";
  237. //require("@/apis/echarts-5-3.min.js")
  238. //import * as echarts from "@/apis/echarts-5-3.min.js";
  239. import {
  240. daysDistance,
  241. beforeTimeStamp,
  242. currentTimeStamp,
  243. parseUnixTime
  244. } from '@/utils'
  245. export default {
  246. data() {
  247. return {
  248. popupShow3: false,
  249. params: {
  250. year: true,
  251. month: true,
  252. day: false,
  253. hour: false,
  254. minute: false,
  255. second: false
  256. },
  257. headitemby:"",
  258. isinit: true,
  259. form: {},
  260. form2: {},
  261. selecttype: "",
  262. selectstationId: "",
  263. selectdeviceNo: "",
  264. popupShow2: false,
  265. popupShow: false,
  266. popupShow4: false,
  267. nowTime: 0,
  268. selectstationId2: "",
  269. selectstationIndex: 0,
  270. selectstationName: "",
  271. info: {},
  272. title: "",
  273. showdate: false,
  274. showdate2: false,
  275. queryTime: "",
  276. queryTime2: "",
  277. indexData: {},
  278. indexData3: null,
  279. indexData2: null,
  280. type_head: '1',
  281. startDate_head: '',
  282. changeitemBl: false,
  283. myChart: null,
  284. myChartReady: false,
  285. myChartTime: false,
  286. subsection: [{
  287. name: '金额'
  288. },
  289. {
  290. name: '笔数'
  291. }
  292. ],
  293. stationFlowList: [],
  294. serviceMoneySum: 0,
  295. allMoneySum: 0,
  296. stationList: [],
  297. stationListSon: [],
  298. tabbarList: [{
  299. iconPath: "bar-chart-box-fill",
  300. selectedIconPath: "bar-chart-box-fill",
  301. text: '统计',
  302. count: 0,
  303. isDot: true,
  304. customIcon: true,
  305. },
  306. {
  307. iconPath: "article-fill",
  308. selectedIconPath: "article-fill",
  309. text: '明细',
  310. midButton: true,
  311. customIcon: true,
  312. },
  313. {
  314. iconPath: "account-pin-box-fill",
  315. selectedIconPath: "account-pin-box-fill",
  316. text: '我的',
  317. count: 0,
  318. isDot: false,
  319. customIcon: true,
  320. },
  321. ],
  322. endTime: '',
  323. endTime2: '',
  324. current: 1,
  325. background: {
  326. background: 'none'
  327. },
  328. value: '',
  329. type: 'select',
  330. show: false,
  331. border: true,
  332. step: 0,
  333. stepname: '',
  334. startTime: '',
  335. stepid: 0,
  336. }
  337. },
  338. onShow() {
  339. if (this.$refs.tabbarMain) {
  340. this.$refs.tabbarMain.setcount(0);
  341. }
  342. },
  343. onLoad() {
  344. this.info = this.carhelp.getPersonInfo("merchantUser")
  345. this.title = this.info.merchantAccountName
  346. },
  347. components: {
  348. Tabbar
  349. },
  350. onReady() {
  351. var date = new Date();
  352. this.nowTime = 7
  353. this.queryTime = parseUnixTime(currentTimeStamp(), '{y}-{m}');
  354. this.queryTime2 = parseUnixTime(currentTimeStamp(), '{y}-{m}'),
  355. this.startDate_head = parseUnixTime(beforeTimeStamp(30), '{y}-{m}-{d}')
  356. this.startTime = parseUnixTime(beforeTimeStamp(6), '{y}-{m}-{d}')
  357. this.endTime = parseUnixTime(beforeTimeStamp(0), '{y}-{m}-{d}')
  358. //this.startTime2 = parseUnixTime(beforeTimeStamp(6), '{y}-{m}-{d}')
  359. this.endTime2 = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}')
  360. this.getStation()
  361. },
  362. computed: {
  363. // startTime(){
  364. // return this.queryTime+'-1'
  365. // },
  366. startTime2() {
  367. return this.queryTime2 + '-1'
  368. },
  369. },
  370. methods: {
  371. changeitem(e) {
  372. if (this.stationFlowList.length > 1 && e.index == this.stationFlowList.length - 1 && e.show) {
  373. this.changeitemBl = true;
  374. } else {
  375. this.changeitemBl = false;
  376. }
  377. },
  378. showTime(name) {
  379. if (!name) {
  380. return ''
  381. }
  382. return name.replace('-', '年') + '月';
  383. },
  384. getStation(bl) {
  385. API.stationList().then((res) => {
  386. this.stationList = res.data.stationList
  387. this.stationList.unshift({
  388. id: '',
  389. name: "全部站点"
  390. })
  391. this.selectstationName = "全部站点"
  392. this.stationListSon = res.data.deviceList
  393. this.getDataHome2()
  394. this.getData()
  395. this.getData2()
  396. }).catch(error => {
  397. uni.showToast({
  398. title: error
  399. })
  400. })
  401. },
  402. resetBtn() {
  403. this.nowTime = 7
  404. this.startTime = parseUnixTime(beforeTimeStamp(6), '{y}-{m}-{d}')
  405. this.endTime = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}')
  406. this.selecttype = ""
  407. this.selectstationId = ""
  408. this.selectdeviceNo = ""
  409. this.form = {
  410. type: this.selecttype,
  411. stationId: this.selectstationId,
  412. deviceNo: this.selectdeviceNo,
  413. };
  414. this.popupShow = false;
  415. this.list = [];
  416. this.getData()
  417. },
  418. okbtn() {
  419. this.popupShow = false;
  420. this.form = {
  421. type: this.selecttype,
  422. stationId: this.selectstationId,
  423. deviceNo: this.selectdeviceNo,
  424. };
  425. this.list = [];
  426. this.getData()
  427. },
  428. resetBtn2() {
  429. this.startTime2 = parseUnixTime(beforeTimeStamp(6), '{y}-{m}-{d}')
  430. this.endTime2 = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}')
  431. this.selectstationId2 = ""
  432. this.form2 = {
  433. stationId: this.selectstationId2,
  434. };
  435. this.popupShow2 = false;
  436. this.getData2()
  437. },
  438. okbtn2() {
  439. this.popupShow2 = false;
  440. this.form2 = {
  441. stationId: this.selectstationId2,
  442. };
  443. this.getData2()
  444. },
  445. getDataHome2() {
  446. var endtime = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}')
  447. API.homeHeadChargingStatistics({
  448. type: this.type_head,
  449. startDate: this.startDate_head,
  450. endDate: endtime
  451. }).then((res) => {
  452. this.indexData3 = res.data;
  453. if( this.info.accountType==3){
  454. this.getPie2()
  455. }else{
  456. this.getPie()
  457. }
  458. }).catch(error => {
  459. uni.showToast({
  460. title: error
  461. })
  462. })
  463. },
  464. getDataHome() {
  465. API.homeHeadStatistics().then((res) => {
  466. this.indexData = res.data;
  467. }).catch(error => {
  468. uni.showToast({
  469. title: error
  470. })
  471. })
  472. },
  473. getData() {
  474. this.form.startDate = this.startTime,
  475. this.form.endDate = this.endTime
  476. API.homeFlowStatistics(this.form).then((res) => {
  477. this.stationFlowList = res.data.stationFlowList;
  478. this.nowTime = daysDistance(this.startTime, this.endTime) + 1;
  479. this.serviceMoneySum = 0;
  480. this.allMoneySum = 0;
  481. for (var i in this.stationFlowList) {
  482. var item = this.stationFlowList[i];
  483. this.allMoneySum += item.actualMoney
  484. this.serviceMoneySum += item.serviceMoney
  485. this.serviceMoneySum += item.cardMoney
  486. }
  487. }).catch(error => {
  488. uni.showToast({
  489. title: error
  490. })
  491. })
  492. },
  493. getData2() {
  494. uni.showLoading({
  495. title: "加载中",
  496. mask: true,
  497. })
  498. this.form2.startDate = this.startTime2,
  499. this.form2.endDate = this.endTime2
  500. API.homeIncomeStatistics(this.form2).then((res) => {
  501. this.indexData2 = res.data
  502. uni.hideLoading()
  503. }).catch(error => {
  504. uni.showToast({
  505. title: error
  506. })
  507. })
  508. },
  509. changesub(e) {
  510. this.current = e
  511. this.type_head = e;
  512. if (e == 1) {
  513. this.startDate_head = parseUnixTime(beforeTimeStamp(30), '{y}-{m}-{d}')
  514. } else {
  515. this.startDate_head = parseUnixTime(beforeTimeStamp(365), '{y}-{m}-01')
  516. }
  517. // this.getPie()
  518. this.getDataHome2()
  519. },
  520. changedate4(e) {
  521. this.startTime = e.startDate
  522. this.endTime = e.endDate
  523. this.okbtn()
  524. },
  525. changedate3(e) {
  526. var index = e[0];
  527. var obj = this.stationList[index];
  528. this.selectstationId2 = obj.id;
  529. this.selectstationIndex = index;
  530. this.selectstationName = obj.name;
  531. this.okbtn2()
  532. },
  533. changedate(e) {
  534. this.queryTime = e.year + '-' + e.month;
  535. this.startTime = e.year + '-' + e.month + '-1';
  536. if (e.month == '12') {
  537. this.endTime = (e.year) + "/12/31"
  538. } else {
  539. var b = e.year + '/' + (parseInt(e.month) + 1) + '/1';
  540. var a = beforeTimeStamp(1, b);
  541. this.endTime = parseUnixTime(a, '{y}-{m}-{d}')
  542. }
  543. this.okbtn()
  544. },
  545. changedate2(e) {
  546. this.queryTime2 = e.year + '-' + e.month;
  547. if (e.month == '12') {
  548. this.endTime2 = (e.year) + "/12/31"
  549. } else {
  550. var b = e.year + '/' + (parseInt(e.month) + 1) + '/1';
  551. var a = beforeTimeStamp(1, b);
  552. this.endTime2 = parseUnixTime(a, '{y}-{m}-{d}')
  553. }
  554. this.okbtn2()
  555. },
  556. getPie2(){
  557. this.headitemby="";
  558. var showkey = "";
  559. var getData = this.indexData3.graphMap;
  560. //var unit = this.current ? '笔' : '元'
  561. var colorName = "#333"
  562. this.showlist1 = ['收入', '利润', '次数'];
  563. var sz2 = ['todayAmount', 'todayProfit', 'todayEQNum'];
  564. if (!this.myChart) {
  565. this.myChart = echarts.init(document.getElementById('pieEcharts'));
  566. this.myChart.on("dataZoom", (res) => {
  567. showkey = "";
  568. this.headitemby ="";
  569. });
  570. }
  571. this.myChart.clear();
  572. //
  573. var timelist = []
  574. for (var i in getData) {
  575. if (this.type_head == 1) {
  576. timelist.push(i.substring(5))
  577. } else {
  578. timelist.push(i)
  579. }
  580. }
  581. var list = [];
  582. for (var j in this.showlist1) {
  583. var ap = {
  584. name: this.showlist1[j],
  585. type: 'line',
  586. // label: {
  587. // show: true,
  588. // position: 'top'
  589. // },
  590. data: []
  591. }
  592. if (this.type_head == 1) {
  593. ap.symbolSize = 3;
  594. }
  595. var bl=true;
  596. for (var i in getData) {
  597. //var time=this.queryDate.replace("-","/").replace("-","/")
  598. //time+' '+i
  599. var obj = getData[i][sz2[j]];
  600. //'todayAmount', 'todayProfit', 'todayEQNum'
  601. if (bl&&getData[i].todayAmount == 0 && getData[i].todayProfit == 0 && getData[i].todayEQNum == 0 ) {
  602. //&& &&getData[i].todayEQNum == 0
  603. continue;
  604. }
  605. bl=false;
  606. var time = i
  607. if (this.type_head == 1) {
  608. time = i.substring(5)
  609. } else {
  610. }
  611. if(j!=2){
  612. obj=obj.toFixed(2)
  613. }
  614. ap.data.push([time, obj]);
  615. }
  616. if(bl){
  617. ap.data=[];
  618. for (var i in getData) {
  619. //var time=this.queryDate.replace("-","/").replace("-","/")
  620. //time+' '+i
  621. var obj = getData[i][sz2[j]];
  622. var time = i
  623. if (this.type_head == 1) {
  624. time = i.substring(5)
  625. } else {
  626. }
  627. if(j!=2){
  628. obj=obj.toFixed(2)
  629. }
  630. ap.data.push([time, obj]);
  631. }
  632. }
  633. list.push(ap)
  634. }
  635. // 指定图表的配置项和数据
  636. var option = {
  637. tooltip: {
  638. formatter: (value) => {
  639. var info = value;
  640. var name = value[0].data[0];
  641. var style = "float: right;margin-left: 3px;"
  642. var text1 = ""
  643. for (var i in value) {
  644. var u = "元"
  645. if (value[i].seriesName == '次数') {
  646. u = '次'
  647. }
  648. text1 += "<p>" + value[i].marker + value[i].seriesName + '<span style="' + style +
  649. '">' + value[i].data[1] + u + '</span></p>';
  650. }
  651. return `<p>${name}</p>` + text1
  652. },
  653. trigger: 'axis',
  654. borderColor: "#F0F0F0",
  655. borderWidth: 1,
  656. backgroundColor: "#ffffff",
  657. textStyle: {
  658. color: "#333"
  659. }
  660. },
  661. legend: {
  662. data: this.showlist1,
  663. textStyle: {
  664. color: "#333"
  665. }
  666. },
  667. grid: {
  668. top: '13%',
  669. left: '3%',
  670. right: '8%',
  671. bottom: '18%',
  672. containLabel: true
  673. },
  674. xAxis: {
  675. //type: 'value',
  676. type: 'category',
  677. splitNumber: 4,
  678. boundaryGap: false,
  679. axisLabel: {
  680. formatter: (value) => {
  681. if(this.headitemby==""){
  682. this.headitemby=value
  683. }
  684. var i = 0
  685. if (this.type_head == 1) {
  686. i = 3;
  687. } else {
  688. i = 5;
  689. }
  690. var showvalue = "";
  691. var key = value.substring(0, i);
  692. if (showkey == ""||value==this.headitemby) {
  693. showkey = key
  694. showvalue = value
  695. } else {
  696. if (key != showkey) {
  697. showkey = key
  698. showvalue = value
  699. } else {
  700. showvalue = value.substring(i)
  701. }
  702. }
  703. return showvalue.replace("-",".");
  704. },
  705. textStyle: {
  706. color: "#333"
  707. }
  708. },
  709. axisLine: {
  710. show: true,
  711. lineStyle: {
  712. color: "#333"
  713. }
  714. },
  715. },
  716. yAxis: {
  717. //type: 'log',
  718. // name: '单位('+this.typeN+')',
  719. axisLabel: {
  720. textStyle: {
  721. color: "#333"
  722. }
  723. },
  724. axisLine: {
  725. show: true,
  726. lineStyle: {
  727. color: "#333"
  728. }
  729. },
  730. },
  731. series: list
  732. };
  733. option.dataZoom = [{
  734. type: 'inside',
  735. start: 0,
  736. end: 100
  737. },
  738. {
  739. start: 0,
  740. end: 100
  741. }
  742. ]
  743. if (this.type_head == 1) {
  744. } else {
  745. //timelist.push(i)
  746. }
  747. // 使用刚指定的配置项和数据显示图表。
  748. this.myChart.setOption(option);
  749. },
  750. getPie() {
  751. var dataInterval =null;
  752. if (this.type_head == 1) {
  753. dataInterval= [0,25,50,75,100,
  754. 125,150,200,250,300,400,500,
  755. 600,800,1000,1200,1400,1600,1800,
  756. 2000,2300,2600,2800,
  757. 3000,3400,3800,4200,
  758. 4800,5200,5600,6000,6500,7000,7500,8000,9000, 10000,12000,14000, 16000, 20000, 30000,999999];
  759. }else{
  760. dataInterval= [0,500,1000,2000,5000, 10000, 20000, 30000, 40000,50000, 60000,70000, 80000,90000, 100000, 120000, 140000, 160000, 180000, 200000, 250000,300000, 400000, 500000,999999];
  761. }
  762. this.headitemby="";
  763. var showkey = "";
  764. var getData = this.indexData3.graphMap;
  765. //var unit = this.current ? '笔' : '元'
  766. var colorName = "#333"
  767. this.showlist1 = ['收入', '利润', '次数'];
  768. var sz2 = ['todayAmount', 'todayProfit', 'todayEQNum'];
  769. if (!this.myChart) {
  770. this.myChart = echarts.init(document.getElementById('pieEcharts'));
  771. this.myChart.on("dataZoom", (res) => {
  772. showkey = "";
  773. this.headitemby ="";
  774. });
  775. }
  776. this.myChart.clear();
  777. //
  778. var timelist = []
  779. for (var i in getData) {
  780. if (this.type_head == 1) {
  781. timelist.push(i.substring(5))
  782. } else {
  783. timelist.push(i)
  784. }
  785. }
  786. var list = [];
  787. for (var j in this.showlist1) {
  788. var ap = {
  789. name: this.showlist1[j],
  790. type: 'line',
  791. // label: {
  792. // show: true,
  793. // position: 'top'
  794. // },
  795. data: []
  796. }
  797. if (this.type_head == 1) {
  798. ap.symbolSize = 3;
  799. }
  800. var bl=true;
  801. for (var i in getData) {
  802. //var time=this.queryDate.replace("-","/").replace("-","/")
  803. //time+' '+i
  804. var obj = getData[i][sz2[j]];
  805. //**********
  806. if(true){
  807. const min_v = Math.max(...dataInterval.filter((v) => v <= obj));
  808. // 2.寻找在数据间隔里大于amount的最小值
  809. const max_v = Math.min(...dataInterval.filter((v) => v > obj));
  810. // 3.寻找 min_v 所在的下标
  811. const index = dataInterval.findIndex((v) => v === min_v);
  812. // 4.计算该amount在y轴上应该展示的位置
  813. const y_value = ((obj - min_v) / (max_v - min_v)) * 10 + index * 10;
  814. obj = y_value;
  815. }
  816. //**********
  817. //'todayAmount', 'todayProfit', 'todayEQNum'
  818. if (bl&&getData[i].todayAmount == 0 && getData[i].todayProfit == 0 &&getData[i].todayEQNum == 0) {
  819. //&& &&getData[i].todayEQNum == 0
  820. continue;
  821. }
  822. bl=false;
  823. var time = i
  824. if (this.type_head == 1) {
  825. //time = i.substring(5)
  826. } else {
  827. }
  828. ap.data.push([time, obj]);
  829. }
  830. if(bl){
  831. ap.data=[];
  832. for (var i in getData) {
  833. //var time=this.queryDate.replace("-","/").replace("-","/")
  834. //time+' '+i
  835. var obj = getData[i][sz2[j]];
  836. var time = i
  837. if (this.type_head == 1) {
  838. time = i.substring(5)
  839. } else {
  840. }
  841. if(j!=2){
  842. obj=obj.toFixed(2)
  843. }
  844. ap.data.push([time, obj]);
  845. }
  846. }
  847. list.push(ap)
  848. }
  849. var yshow=0;
  850. // 指定图表的配置项和数据
  851. var option = {
  852. tooltip: {
  853. formatter: (value) => {
  854. var name = value[0].data[0];
  855. var info = getData[name];
  856. var style = "float: right;margin-left: 3px;"
  857. var text1 = ""
  858. for (var i in value) {
  859. var u = "元"
  860. var num=info[sz2[value[i].seriesIndex]];
  861. if (value[i].seriesName == '次数') {
  862. u = '次'
  863. }else{
  864. num=num.toFixed(2)
  865. }
  866. text1 += "<p>" + value[i].marker + value[i].seriesName + '<span style="' + style +
  867. '">' + num + u + '</span></p>';
  868. }
  869. return `<p>${name}</p>` + text1
  870. },
  871. trigger: 'axis',
  872. borderColor: "#F0F0F0",
  873. borderWidth: 1,
  874. backgroundColor: "#ffffff",
  875. textStyle: {
  876. color: "#333"
  877. }
  878. },
  879. legend: {
  880. data: this.showlist1,
  881. textStyle: {
  882. color: "#333"
  883. }
  884. },
  885. grid: {
  886. top: '13%',
  887. left: '3%',
  888. right: '8%',
  889. bottom: '18%',
  890. containLabel: true
  891. },
  892. xAxis: {
  893. //type: 'value',
  894. type: 'category',
  895. splitNumber: 4,
  896. boundaryGap: false,
  897. axisLabel: {
  898. formatter: (value) => {
  899. if(this.headitemby==""){
  900. this.headitemby=value
  901. }
  902. var i = 0
  903. if (this.type_head == 1) {
  904. i = 0;
  905. } else {
  906. i = 3;
  907. }
  908. var showvalue = "";
  909. var key = value.substring(0,8-i);
  910. if (showkey == ""||value==this.headitemby) {
  911. showkey = key
  912. showvalue = value
  913. showvalue = value.substring(5-i)
  914. } else {
  915. if (key != showkey) {
  916. showkey = key
  917. showvalue = value
  918. showvalue = value.substring(5-i)
  919. } else {
  920. showvalue = value.substring(8-i)
  921. }
  922. }
  923. return showvalue.replace("-",".");
  924. },
  925. textStyle: {
  926. color: "#333"
  927. }
  928. },
  929. axisLine: {
  930. show: true,
  931. lineStyle: {
  932. color: "#333"
  933. }
  934. },
  935. },
  936. yAxis: {
  937. type: 'value',
  938. // name: '单位('+this.typeN+')',
  939. axisLabel: {
  940. formatter:(v,i)=>{
  941. //console.log(v,i)
  942. if(i==0){
  943. yshow=0
  944. return 0
  945. }
  946. if(yshow!=parseInt(v/10)){
  947. yshow=parseInt(v/10);
  948. return dataInterval[parseInt(v/10)]
  949. }else{
  950. return ''
  951. }
  952. },
  953. textStyle: {
  954. color: "#333"
  955. }
  956. },
  957. axisLine: {
  958. show: true,
  959. lineStyle: {
  960. color: "#333"
  961. }
  962. },
  963. },
  964. series: list
  965. };
  966. option.dataZoom = [{
  967. type: 'inside',
  968. start: 0,
  969. end: 100
  970. },
  971. {
  972. start: 0,
  973. end: 100
  974. }
  975. ]
  976. if (this.type_head == 1) {
  977. } else {
  978. //timelist.push(i)
  979. }
  980. // 使用刚指定的配置项和数据显示图表。
  981. this.myChart.setOption(option);
  982. }
  983. }
  984. }
  985. </script>
  986. <style>
  987. page {
  988. background: url(../../assets/img/index_header_bg.png) no-repeat top center #f7f7f7;
  989. background-size: 100%;
  990. }
  991. </style>
  992. <style lang="scss" scoped>
  993. .headbotton1:after {
  994. border-radius: 15px 0 0 15px;
  995. }
  996. .headbotton2:after {
  997. border-radius: 0 15px 15px 0;
  998. }
  999. .detailstable {
  1000. padding: 40rpx 30rpx !important;
  1001. }
  1002. .detailstableHead {
  1003. .span1 {
  1004. font-size: 32rpx !important;
  1005. }
  1006. .details-row-head-1 {}
  1007. .details-row-head-2 {}
  1008. .details-row-head-3 {
  1009. width: 30% !important;
  1010. max-width: 150rpx;
  1011. .span {}
  1012. }
  1013. .span2 {
  1014. font-size: 44rpx !important;
  1015. font-weight: bold;
  1016. width: 100%;
  1017. color: #101010;
  1018. span {
  1019. font-size: 24rpx !important;
  1020. }
  1021. }
  1022. }
  1023. .detailslineHead {
  1024. border-top: 1px solid #ededed;
  1025. ;
  1026. .details-row {
  1027. padding-left: 8rpx !important;
  1028. }
  1029. font-size: 30rpx !important;
  1030. .span1 span {
  1031. font-size: 28rpx;
  1032. }
  1033. }
  1034. .detailstable,
  1035. .detailstableHead {
  1036. font-size: 16px;
  1037. p {
  1038. font-size: 14px;
  1039. }
  1040. .details-row-main {
  1041. border-bottom: 1px solid #ededed;
  1042. padding: 10px 0;
  1043. }
  1044. .detailsline {
  1045. border-bottom: 1px solid #ededed;
  1046. }
  1047. .detailsline,
  1048. .detailsline—bottom {
  1049. display: flex;
  1050. .details-row {
  1051. width: 50%;
  1052. display: flex;
  1053. justify-content: space-between;
  1054. flex-direction: column;
  1055. padding-left: 16rpx;
  1056. margin-bottom: 20rpx;
  1057. .span1 {
  1058. color: rgba(136, 136, 136, 100);
  1059. font-size: 28rpx;
  1060. width: 100%;
  1061. }
  1062. .span2 {
  1063. font-size: 36rpx;
  1064. width: 100%;
  1065. color: #101010;
  1066. span {
  1067. font-size: 24rpx;
  1068. }
  1069. }
  1070. }
  1071. }
  1072. .details-row-1 {
  1073. width: 47%;
  1074. padding-left: 0px !important;
  1075. border-right: 1px solid #ededed;
  1076. }
  1077. }
  1078. .details {
  1079. padding: 20px;
  1080. background-color: #fff;
  1081. border-radius: 8px;
  1082. }
  1083. .details-title {
  1084. margin-bottom: 16px;
  1085. h4 {
  1086. font-weight: normal;
  1087. font-size: 16px;
  1088. position: relative;
  1089. padding-left: 10px;
  1090. &::after {
  1091. content: '';
  1092. position: absolute;
  1093. height: 12px;
  1094. width: 4px;
  1095. background-color: #27B148;
  1096. left: 0;
  1097. top: 5px;
  1098. }
  1099. }
  1100. }
  1101. .details-row {
  1102. display: flex;
  1103. justify-content: space-between;
  1104. align-items: center;
  1105. margin-top: 15px;
  1106. p {
  1107. color: #37393c;
  1108. font-weight: bold;
  1109. }
  1110. }
  1111. .details-row2 {
  1112. display: flex;
  1113. justify-content: space-between;
  1114. align-items: center;
  1115. // margin-top: 15px;
  1116. p {
  1117. // color: #37393c;
  1118. // font-weight: bold;
  1119. }
  1120. }
  1121. .popup-screen {
  1122. padding: 20px;
  1123. position: relative;
  1124. .screen {
  1125. padding-bottom: 30px;
  1126. }
  1127. .screen-item {
  1128. margin-bottom: 20px;
  1129. .screen-head {
  1130. margin-bottom: 8px;
  1131. font-size: 16px;
  1132. }
  1133. .screen-main {
  1134. display: flex;
  1135. // display: -webkit-box;
  1136. flex-wrap: wrap;
  1137. }
  1138. .screen-entry {
  1139. width: 29%;
  1140. padding: 6px 0;
  1141. display: flex;
  1142. align-items: center;
  1143. justify-content: center;
  1144. background-color: #F2F5FA;
  1145. text-align: center;
  1146. margin-bottom: 10px;
  1147. border-radius: 3px;
  1148. margin-right: 6px;
  1149. }
  1150. .screen-entry.active {
  1151. background-color: #185AC6;
  1152. color: #fff;
  1153. }
  1154. }
  1155. .screen-foot {
  1156. position: fixed;
  1157. left: 0;
  1158. right: 0;
  1159. bottom: 0;
  1160. display: flex;
  1161. height: 50px;
  1162. border-top: 1px solid #ededed;
  1163. .screen-btn-l {
  1164. background-color: #fff;
  1165. flex: 0.2;
  1166. text-align: center;
  1167. line-height: 50px;
  1168. }
  1169. .screen-btn-r {
  1170. flex: 0.8;
  1171. text-align: center;
  1172. line-height: 50px;
  1173. background-color: #185AC6;
  1174. color: #fff;
  1175. }
  1176. }
  1177. }
  1178. .navbar-tit {
  1179. color: #fff;
  1180. font-size: 24px;
  1181. padding-left: 15px;
  1182. padding-top: 10px;
  1183. }
  1184. .statisticsData {
  1185. background-color: #fff;
  1186. margin: 0px 24rpx 24rpx;
  1187. //padding:0px 24rpx 24rpx;
  1188. border-radius: 8px;
  1189. }
  1190. .statisticsDataMain {
  1191. flex-wrap: wrap;
  1192. display: flex;
  1193. }
  1194. .statisticsData-item {
  1195. flex: 1;
  1196. width: 40%;
  1197. .statisticsData-head {
  1198. display: flex;
  1199. align-items: center;
  1200. p {
  1201. color: #637AA2;
  1202. font-size: 12px;
  1203. }
  1204. }
  1205. .statisticsData-main {
  1206. margin-top: 4px;
  1207. font-size: 18px;
  1208. }
  1209. .statisticsData-foot {
  1210. display: flex;
  1211. align-items: center;
  1212. margin-top: 16px;
  1213. p {
  1214. color: #637AA2;
  1215. }
  1216. h4 {
  1217. margin-left: 8px;
  1218. }
  1219. }
  1220. }
  1221. .statisticsChart {
  1222. margin: 16px;
  1223. .statisticsChart-head {
  1224. margin-bottom: 5px;
  1225. display: flex;
  1226. justify-content: space-between;
  1227. align-items: center;
  1228. h4 {
  1229. font-weight: normal;
  1230. font-size: 16px;
  1231. position: relative;
  1232. padding-left: 10px;
  1233. &::after {
  1234. content: '';
  1235. position: absolute;
  1236. height: 12px;
  1237. width: 4px;
  1238. background-color: #4E8DF6;
  1239. left: 0;
  1240. top: 5px;
  1241. }
  1242. }
  1243. .statisticsChart-time {
  1244. display: flex;
  1245. align-items: center;
  1246. p {
  1247. color: #666;
  1248. }
  1249. }
  1250. }
  1251. .statisticsChart-main {
  1252. background-color: #fff;
  1253. padding: 10px 16px 16px 16px;
  1254. border-radius: 8px;
  1255. }
  1256. }
  1257. </style>