index.vue 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285
  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.toFixed(2)}}元</span>
  201. </view>
  202. <view class="details-row">
  203. <p>预估用电度数</p>
  204. <span>{{(indexData2.incomeMap.electricQuantity/10000).toFixed(1)}}度</span>
  205. </view>
  206. <view class="details-row">
  207. <p>预估电费</p>
  208. <span>{{indexData2.incomeMap.costAmount.toFixed(2)}}元</span>
  209. </view>
  210. <view class="details-row">
  211. <p>服务费预估收益</p>
  212. <span>{{indexData2.incomeMap.serviceAmount.toFixed(2)}}元</span>
  213. </view>
  214. <view class="details-row">
  215. <p>月卡收益</p>
  216. <span>{{indexData2.incomeMap.cardIncomeAmount.toFixed(2)}}元</span>
  217. </view>
  218. <view class="details-row">
  219. <p>预估总利润</p>
  220. <span>{{(indexData2.incomeMap.serviceAmount+indexData2.incomeMap.cardIncomeAmount).toFixed(2)}}元</span>
  221. </view>
  222. </view>
  223. </view>
  224. <Tabbar :current="0" ref="tabbarMain"></Tabbar>
  225. <!-- <u-tabbar v-model="current" :list="tabbarList" active-color="#185ac6"></u-tabbar>
  226. -->
  227. </view>
  228. </template>
  229. <script>
  230. import Tabbar from '@/components/TabbarFinance.vue'
  231. import * as API from '@/apis/finance.js'
  232. import * as echarts from "echarts";
  233. //require("@/apis/echarts-5-3.min.js")
  234. //import * as echarts from "@/apis/echarts-5-3.min.js";
  235. import {
  236. daysDistance,
  237. beforeTimeStamp,
  238. currentTimeStamp,
  239. parseUnixTime
  240. } from '@/utils'
  241. export default {
  242. data() {
  243. return {
  244. popupShow3: false,
  245. params: {
  246. year: true,
  247. month: true,
  248. day: false,
  249. hour: false,
  250. minute: false,
  251. second: false
  252. },
  253. headitemby:"",
  254. isinit: true,
  255. form: {},
  256. form2: {},
  257. selecttype: "",
  258. selectstationId: "",
  259. selectdeviceNo: "",
  260. popupShow2: false,
  261. popupShow: false,
  262. popupShow4: false,
  263. nowTime: 0,
  264. selectstationId2: "",
  265. selectstationIndex: 0,
  266. selectstationName: "",
  267. info: {},
  268. title: "",
  269. showdate: false,
  270. showdate2: false,
  271. queryTime: "",
  272. queryTime2: "",
  273. indexData: {},
  274. indexData3: null,
  275. indexData2: null,
  276. type_head: '1',
  277. startDate_head: '',
  278. changeitemBl: false,
  279. myChart: null,
  280. myChartReady: false,
  281. myChartTime: false,
  282. subsection: [{
  283. name: '金额'
  284. },
  285. {
  286. name: '笔数'
  287. }
  288. ],
  289. stationFlowList: [],
  290. serviceMoneySum: 0,
  291. allMoneySum: 0,
  292. stationList: [],
  293. stationListSon: [],
  294. tabbarList: [{
  295. iconPath: "bar-chart-box-fill",
  296. selectedIconPath: "bar-chart-box-fill",
  297. text: '统计',
  298. count: 0,
  299. isDot: true,
  300. customIcon: true,
  301. },
  302. {
  303. iconPath: "article-fill",
  304. selectedIconPath: "article-fill",
  305. text: '明细',
  306. midButton: true,
  307. customIcon: true,
  308. },
  309. {
  310. iconPath: "account-pin-box-fill",
  311. selectedIconPath: "account-pin-box-fill",
  312. text: '我的',
  313. count: 0,
  314. isDot: false,
  315. customIcon: true,
  316. },
  317. ],
  318. endTime: '',
  319. endTime2: '',
  320. current: 1,
  321. background: {
  322. background: 'none'
  323. },
  324. value: '',
  325. type: 'select',
  326. show: false,
  327. border: true,
  328. step: 0,
  329. stepname: '',
  330. startTime: '',
  331. stepid: 0,
  332. }
  333. },
  334. onShow() {
  335. if (this.$refs.tabbarMain) {
  336. this.$refs.tabbarMain.setcount(0);
  337. }
  338. },
  339. onLoad() {
  340. this.info = this.carhelp.getPersonInfo("merchantUser")
  341. this.title = this.info.merchantAccountName
  342. },
  343. components: {
  344. Tabbar
  345. },
  346. onReady() {
  347. var date = new Date();
  348. this.nowTime = 7
  349. this.queryTime = parseUnixTime(currentTimeStamp(), '{y}-{m}');
  350. this.queryTime2 = parseUnixTime(currentTimeStamp(), '{y}-{m}'),
  351. this.startDate_head = parseUnixTime(beforeTimeStamp(30), '{y}-{m}-{d}')
  352. this.startTime = parseUnixTime(beforeTimeStamp(7), '{y}-{m}-{d}')
  353. this.endTime = parseUnixTime(beforeTimeStamp(1), '{y}-{m}-{d}')
  354. //this.startTime2 = parseUnixTime(beforeTimeStamp(6), '{y}-{m}-{d}')
  355. this.endTime2 = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}')
  356. this.getStation()
  357. },
  358. computed: {
  359. // startTime(){
  360. // return this.queryTime+'-1'
  361. // },
  362. startTime2() {
  363. return this.queryTime2 + '-1'
  364. },
  365. },
  366. methods: {
  367. changeitem(e) {
  368. if (this.stationFlowList.length > 1 && e.index == this.stationFlowList.length - 1 && e.show) {
  369. this.changeitemBl = true;
  370. } else {
  371. this.changeitemBl = false;
  372. }
  373. },
  374. showTime(name) {
  375. if (!name) {
  376. return ''
  377. }
  378. return name.replace('-', '年') + '月';
  379. },
  380. getStation(bl) {
  381. API.stationList().then((res) => {
  382. this.stationList = res.data.stationList
  383. this.stationList.unshift({
  384. id: '',
  385. name: "全部站点"
  386. })
  387. this.selectstationName = "全部站点"
  388. this.stationListSon = res.data.deviceList
  389. this.getDataHome2()
  390. this.getData()
  391. this.getData2()
  392. }).catch(error => {
  393. uni.showToast({
  394. title: error
  395. })
  396. })
  397. },
  398. resetBtn() {
  399. this.nowTime = 7
  400. this.startTime = parseUnixTime(beforeTimeStamp(6), '{y}-{m}-{d}')
  401. this.endTime = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}')
  402. this.selecttype = ""
  403. this.selectstationId = ""
  404. this.selectdeviceNo = ""
  405. this.form = {
  406. type: this.selecttype,
  407. stationId: this.selectstationId,
  408. deviceNo: this.selectdeviceNo,
  409. };
  410. this.popupShow = false;
  411. this.list = [];
  412. this.getData()
  413. },
  414. okbtn() {
  415. this.popupShow = false;
  416. this.form = {
  417. type: this.selecttype,
  418. stationId: this.selectstationId,
  419. deviceNo: this.selectdeviceNo,
  420. };
  421. this.list = [];
  422. this.getData()
  423. },
  424. resetBtn2() {
  425. this.startTime2 = parseUnixTime(beforeTimeStamp(6), '{y}-{m}-{d}')
  426. this.endTime2 = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}')
  427. this.selectstationId2 = ""
  428. this.form2 = {
  429. stationId: this.selectstationId2,
  430. };
  431. this.popupShow2 = false;
  432. this.getData2()
  433. },
  434. okbtn2() {
  435. this.popupShow2 = false;
  436. this.form2 = {
  437. stationId: this.selectstationId2,
  438. };
  439. this.getData2()
  440. },
  441. getDataHome2() {
  442. var endtime = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}')
  443. API.homeHeadChargingStatistics({
  444. type: this.type_head,
  445. startDate: this.startDate_head,
  446. endDate: endtime
  447. }).then((res) => {
  448. this.indexData3 = res.data;
  449. this.getPie()
  450. }).catch(error => {
  451. uni.showToast({
  452. title: error
  453. })
  454. })
  455. },
  456. getDataHome() {
  457. API.homeHeadStatistics().then((res) => {
  458. this.indexData = res.data;
  459. }).catch(error => {
  460. uni.showToast({
  461. title: error
  462. })
  463. })
  464. },
  465. getData() {
  466. this.form.startDate = this.startTime,
  467. this.form.endDate = this.endTime
  468. API.homeFlowStatistics(this.form).then((res) => {
  469. this.stationFlowList = res.data.stationFlowList;
  470. this.nowTime = daysDistance(this.startTime, this.endTime) + 1;
  471. this.serviceMoneySum = 0;
  472. this.allMoneySum = 0;
  473. for (var i in this.stationFlowList) {
  474. var item = this.stationFlowList[i];
  475. this.allMoneySum += item.actualMoney
  476. this.serviceMoneySum += item.serviceMoney
  477. this.serviceMoneySum += item.cardMoney
  478. }
  479. }).catch(error => {
  480. uni.showToast({
  481. title: error
  482. })
  483. })
  484. },
  485. getData2() {
  486. uni.showLoading({
  487. title: "加载中",
  488. mask: true,
  489. })
  490. this.form2.startDate = this.startTime2,
  491. this.form2.endDate = this.endTime2
  492. API.homeIncomeStatistics(this.form2).then((res) => {
  493. this.indexData2 = res.data
  494. uni.hideLoading()
  495. }).catch(error => {
  496. uni.showToast({
  497. title: error
  498. })
  499. })
  500. },
  501. changesub(e) {
  502. this.current = e
  503. this.type_head = e;
  504. if (e == 1) {
  505. this.startDate_head = parseUnixTime(beforeTimeStamp(30), '{y}-{m}-{d}')
  506. } else {
  507. this.startDate_head = parseUnixTime(beforeTimeStamp(365), '{y}-{m}-01')
  508. }
  509. // this.getPie()
  510. this.getDataHome2()
  511. },
  512. changedate4(e) {
  513. this.startTime = e.startDate
  514. this.endTime = e.endDate
  515. this.okbtn()
  516. },
  517. changedate3(e) {
  518. var index = e[0];
  519. var obj = this.stationList[index];
  520. this.selectstationId2 = obj.id;
  521. this.selectstationIndex = index;
  522. this.selectstationName = obj.name;
  523. this.okbtn2()
  524. },
  525. changedate(e) {
  526. this.queryTime = e.year + '-' + e.month;
  527. this.startTime = e.year + '-' + e.month + '-1';
  528. if (e.month == '12') {
  529. this.endTime = (e.year) + "/12/31"
  530. } else {
  531. var b = e.year + '/' + (parseInt(e.month) + 1) + '/1';
  532. var a = beforeTimeStamp(1, b);
  533. this.endTime = parseUnixTime(a, '{y}-{m}-{d}')
  534. }
  535. this.okbtn()
  536. },
  537. changedate2(e) {
  538. this.queryTime2 = e.year + '-' + e.month;
  539. if (e.month == '12') {
  540. this.endTime2 = (e.year) + "/12/31"
  541. } else {
  542. var b = e.year + '/' + (parseInt(e.month) + 1) + '/1';
  543. var a = beforeTimeStamp(1, b);
  544. this.endTime2 = parseUnixTime(a, '{y}-{m}-{d}')
  545. }
  546. this.okbtn2()
  547. },
  548. getPie() {
  549. var dataInterval =null;
  550. if (this.type_head == 1) {
  551. dataInterval= [0,50,100,150,200,300,400,500,800,1000,1500,
  552. 2000,2500,3000,3500,4000, 4500,5000,6000,7000,8000,9000, 10000, 20000, 30000, 40000, 60000,999999];
  553. }else{
  554. dataInterval= [0,500,1000,2000,5000, 10000, 20000, 30000, 40000,50000, 60000, 80000, 100000, 120000, 150000, 200000, 250000,300000, 400000, 500000,999999];
  555. }
  556. this.headitemby="";
  557. var showkey = "";
  558. var getData = this.indexData3.graphMap;
  559. //var unit = this.current ? '笔' : '元'
  560. var colorName = "#333"
  561. this.showlist1 = ['收入', '利润', '次数'];
  562. var sz2 = ['todayAmount', 'todayProfit', 'todayEQNum'];
  563. if (!this.myChart) {
  564. this.myChart = echarts.init(document.getElementById('pieEcharts'));
  565. this.myChart.on("dataZoom", (res) => {
  566. showkey = "";
  567. this.headitemby ="";
  568. });
  569. }
  570. this.myChart.clear();
  571. //
  572. var timelist = []
  573. for (var i in getData) {
  574. if (this.type_head == 1) {
  575. timelist.push(i.substring(5))
  576. } else {
  577. timelist.push(i)
  578. }
  579. }
  580. var list = [];
  581. for (var j in this.showlist1) {
  582. var ap = {
  583. name: this.showlist1[j],
  584. type: 'line',
  585. // label: {
  586. // show: true,
  587. // position: 'top'
  588. // },
  589. data: []
  590. }
  591. if (this.type_head == 1) {
  592. ap.symbolSize = 3;
  593. }
  594. for (var i in getData) {
  595. //var time=this.queryDate.replace("-","/").replace("-","/")
  596. //time+' '+i
  597. var obj = getData[i][sz2[j]];
  598. //**********
  599. if(true){
  600. const min_v = Math.max(...dataInterval.filter((v) => v <= obj));
  601. // 2.寻找在数据间隔里大于amount的最小值
  602. const max_v = Math.min(...dataInterval.filter((v) => v > obj));
  603. // 3.寻找 min_v 所在的下标
  604. const index = dataInterval.findIndex((v) => v === min_v);
  605. // 4.计算该amount在y轴上应该展示的位置
  606. const y_value = ((obj - min_v) / (max_v - min_v)) * 10 + index * 10;
  607. obj = y_value;
  608. }
  609. //**********
  610. //'todayAmount', 'todayProfit', 'todayEQNum'
  611. if (getData[i].todayAmount == 0 && getData[i].todayProfit == 0 ) {
  612. //&& &&getData[i].todayEQNum == 0
  613. continue;
  614. }
  615. var time = i
  616. if (this.type_head == 1) {
  617. //time = i.substring(5)
  618. } else {
  619. }
  620. ap.data.push([time, obj]);
  621. }
  622. list.push(ap)
  623. }
  624. var yshow=0;
  625. // 指定图表的配置项和数据
  626. var option = {
  627. tooltip: {
  628. formatter: (value) => {
  629. var name = value[0].data[0];
  630. var info = getData[name];
  631. var style = "float: right;margin-left: 3px;"
  632. var text1 = ""
  633. for (var i in value) {
  634. var u = "元"
  635. var num=info[sz2[value[i].seriesIndex]];
  636. if (value[i].seriesName == '次数') {
  637. u = '次'
  638. }else{
  639. num=num.toFixed(2)
  640. }
  641. text1 += "<p>" + value[i].marker + value[i].seriesName + '<span style="' + style +
  642. '">' + num + u + '</span></p>';
  643. }
  644. return `<p>${name}</p>` + text1
  645. },
  646. trigger: 'axis',
  647. borderColor: "#F0F0F0",
  648. borderWidth: 1,
  649. backgroundColor: "#ffffff",
  650. textStyle: {
  651. color: "#333"
  652. }
  653. },
  654. legend: {
  655. data: this.showlist1,
  656. textStyle: {
  657. color: "#333"
  658. }
  659. },
  660. grid: {
  661. top: '13%',
  662. left: '3%',
  663. right: '8%',
  664. bottom: '18%',
  665. containLabel: true
  666. },
  667. xAxis: {
  668. //type: 'value',
  669. type: 'category',
  670. splitNumber: 4,
  671. boundaryGap: false,
  672. axisLabel: {
  673. formatter: (value) => {
  674. if(this.headitemby==""){
  675. this.headitemby=value
  676. }
  677. var i = 5
  678. // if (this.type_head == 1) {
  679. // i = 3;
  680. // } else {
  681. // i = 5;
  682. // }
  683. var showvalue = "";
  684. var key = value.substring(0,8);
  685. if (showkey == ""||value==this.headitemby) {
  686. showkey = key
  687. showvalue = value
  688. showvalue = value.substring(5)
  689. } else {
  690. if (key != showkey) {
  691. showkey = key
  692. showvalue = value
  693. showvalue = value.substring(5)
  694. } else {
  695. showvalue = value.substring(8)
  696. }
  697. }
  698. return showvalue.replace("-",".");
  699. },
  700. textStyle: {
  701. color: "#333"
  702. }
  703. },
  704. axisLine: {
  705. show: true,
  706. lineStyle: {
  707. color: "#333"
  708. }
  709. },
  710. },
  711. yAxis: {
  712. type: 'value',
  713. // name: '单位('+this.typeN+')',
  714. axisLabel: {
  715. formatter:(v,i)=>{
  716. //console.log(v,i)
  717. if(i==0){
  718. yshow=0
  719. return 0
  720. }
  721. if(yshow!=parseInt(v/10)){
  722. yshow=parseInt(v/10);
  723. return dataInterval[parseInt(v/10)]
  724. }else{
  725. return ''
  726. }
  727. },
  728. textStyle: {
  729. color: "#333"
  730. }
  731. },
  732. axisLine: {
  733. show: true,
  734. lineStyle: {
  735. color: "#333"
  736. }
  737. },
  738. },
  739. series: list
  740. };
  741. option.dataZoom = [{
  742. type: 'inside',
  743. start: 0,
  744. end: 100
  745. },
  746. {
  747. start: 0,
  748. end: 100
  749. }
  750. ]
  751. if (this.type_head == 1) {
  752. } else {
  753. //timelist.push(i)
  754. }
  755. // 使用刚指定的配置项和数据显示图表。
  756. this.myChart.setOption(option);
  757. }
  758. }
  759. }
  760. </script>
  761. <style>
  762. page {
  763. background: url(../../assets/img/index_header_bg.png) no-repeat top center #f7f7f7;
  764. background-size: 100%;
  765. }
  766. </style>
  767. <style lang="scss" scoped>
  768. .headbotton1:after {
  769. border-radius: 15px 0 0 15px;
  770. }
  771. .headbotton2:after {
  772. border-radius: 0 15px 15px 0;
  773. }
  774. .detailstable {
  775. padding: 40rpx 30rpx !important;
  776. }
  777. .detailstableHead {
  778. .span1 {
  779. font-size: 32rpx !important;
  780. }
  781. .details-row-head-1 {}
  782. .details-row-head-2 {}
  783. .details-row-head-3 {
  784. width: 30% !important;
  785. max-width: 150rpx;
  786. .span {}
  787. }
  788. .span2 {
  789. font-size: 44rpx !important;
  790. font-weight: bold;
  791. width: 100%;
  792. color: #101010;
  793. span {
  794. font-size: 24rpx !important;
  795. }
  796. }
  797. }
  798. .detailslineHead {
  799. border-top: 1px solid #ededed;
  800. ;
  801. .details-row {
  802. padding-left: 8rpx !important;
  803. }
  804. font-size: 30rpx !important;
  805. .span1 span {
  806. font-size: 28rpx;
  807. }
  808. }
  809. .detailstable,
  810. .detailstableHead {
  811. font-size: 16px;
  812. p {
  813. font-size: 14px;
  814. }
  815. .details-row-main {
  816. border-bottom: 1px solid #ededed;
  817. padding: 10px 0;
  818. }
  819. .detailsline {
  820. border-bottom: 1px solid #ededed;
  821. }
  822. .detailsline,
  823. .detailsline—bottom {
  824. display: flex;
  825. .details-row {
  826. width: 50%;
  827. display: flex;
  828. justify-content: space-between;
  829. flex-direction: column;
  830. padding-left: 16rpx;
  831. margin-bottom: 20rpx;
  832. .span1 {
  833. color: rgba(136, 136, 136, 100);
  834. font-size: 28rpx;
  835. width: 100%;
  836. }
  837. .span2 {
  838. font-size: 36rpx;
  839. width: 100%;
  840. color: #101010;
  841. span {
  842. font-size: 24rpx;
  843. }
  844. }
  845. }
  846. }
  847. .details-row-1 {
  848. width: 47%;
  849. padding-left: 0px !important;
  850. border-right: 1px solid #ededed;
  851. }
  852. }
  853. .details {
  854. padding: 20px;
  855. background-color: #fff;
  856. border-radius: 8px;
  857. }
  858. .details-title {
  859. margin-bottom: 16px;
  860. h4 {
  861. font-weight: normal;
  862. font-size: 16px;
  863. position: relative;
  864. padding-left: 10px;
  865. &::after {
  866. content: '';
  867. position: absolute;
  868. height: 12px;
  869. width: 4px;
  870. background-color: #27B148;
  871. left: 0;
  872. top: 5px;
  873. }
  874. }
  875. }
  876. .details-row {
  877. display: flex;
  878. justify-content: space-between;
  879. align-items: center;
  880. margin-top: 15px;
  881. p {
  882. color: #37393c;
  883. font-weight: bold;
  884. }
  885. }
  886. .details-row2 {
  887. display: flex;
  888. justify-content: space-between;
  889. align-items: center;
  890. // margin-top: 15px;
  891. p {
  892. // color: #37393c;
  893. // font-weight: bold;
  894. }
  895. }
  896. .popup-screen {
  897. padding: 20px;
  898. position: relative;
  899. .screen {
  900. padding-bottom: 30px;
  901. }
  902. .screen-item {
  903. margin-bottom: 20px;
  904. .screen-head {
  905. margin-bottom: 8px;
  906. font-size: 16px;
  907. }
  908. .screen-main {
  909. display: flex;
  910. // display: -webkit-box;
  911. flex-wrap: wrap;
  912. }
  913. .screen-entry {
  914. width: 29%;
  915. padding: 6px 0;
  916. display: flex;
  917. align-items: center;
  918. justify-content: center;
  919. background-color: #F2F5FA;
  920. text-align: center;
  921. margin-bottom: 10px;
  922. border-radius: 3px;
  923. margin-right: 6px;
  924. }
  925. .screen-entry.active {
  926. background-color: #185AC6;
  927. color: #fff;
  928. }
  929. }
  930. .screen-foot {
  931. position: fixed;
  932. left: 0;
  933. right: 0;
  934. bottom: 0;
  935. display: flex;
  936. height: 50px;
  937. border-top: 1px solid #ededed;
  938. .screen-btn-l {
  939. background-color: #fff;
  940. flex: 0.2;
  941. text-align: center;
  942. line-height: 50px;
  943. }
  944. .screen-btn-r {
  945. flex: 0.8;
  946. text-align: center;
  947. line-height: 50px;
  948. background-color: #185AC6;
  949. color: #fff;
  950. }
  951. }
  952. }
  953. .navbar-tit {
  954. color: #fff;
  955. font-size: 24px;
  956. padding-left: 15px;
  957. padding-top: 10px;
  958. }
  959. .statisticsData {
  960. background-color: #fff;
  961. margin: 0px 24rpx 24rpx;
  962. //padding:0px 24rpx 24rpx;
  963. border-radius: 8px;
  964. }
  965. .statisticsDataMain {
  966. flex-wrap: wrap;
  967. display: flex;
  968. }
  969. .statisticsData-item {
  970. flex: 1;
  971. width: 40%;
  972. .statisticsData-head {
  973. display: flex;
  974. align-items: center;
  975. p {
  976. color: #637AA2;
  977. font-size: 12px;
  978. }
  979. }
  980. .statisticsData-main {
  981. margin-top: 4px;
  982. font-size: 18px;
  983. }
  984. .statisticsData-foot {
  985. display: flex;
  986. align-items: center;
  987. margin-top: 16px;
  988. p {
  989. color: #637AA2;
  990. }
  991. h4 {
  992. margin-left: 8px;
  993. }
  994. }
  995. }
  996. .statisticsChart {
  997. margin: 16px;
  998. .statisticsChart-head {
  999. margin-bottom: 5px;
  1000. display: flex;
  1001. justify-content: space-between;
  1002. align-items: center;
  1003. h4 {
  1004. font-weight: normal;
  1005. font-size: 16px;
  1006. position: relative;
  1007. padding-left: 10px;
  1008. &::after {
  1009. content: '';
  1010. position: absolute;
  1011. height: 12px;
  1012. width: 4px;
  1013. background-color: #4E8DF6;
  1014. left: 0;
  1015. top: 5px;
  1016. }
  1017. }
  1018. .statisticsChart-time {
  1019. display: flex;
  1020. align-items: center;
  1021. p {
  1022. color: #666;
  1023. }
  1024. }
  1025. }
  1026. .statisticsChart-main {
  1027. background-color: #fff;
  1028. padding: 10px 16px 16px 16px;
  1029. border-radius: 8px;
  1030. }
  1031. }
  1032. </style>