index.vue 35 KB

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