index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  1. <template>
  2. <view>
  3. <view class="navbar-tit">{{title}}</view>
  4. <view class="statisticsData" >
  5. <view class="statisticsData-item">
  6. <h3 style="font-size: 20px;">{{info.merchantAccountName}}</h3>
  7. </view>
  8. <view class="statisticsDataMain">
  9. <view class="statisticsData-item">
  10. <view class="statisticsData-head" @click="gotoUrl('pagesFinance/detailed/index')">
  11. <p>今日充电流水</p>
  12. <u-icon name="arrow-right-s-line" custom-prefix="custom-icon" color="#637AA2" size="36"></u-icon>
  13. </view>
  14. <view class="statisticsData-main">
  15. <h2>{{indexData.todayAmount}}元</h2>
  16. </view>
  17. <view class="statisticsData-foot">
  18. <p>昨日流水</p>
  19. <h2 style="margin-left: 10px;">{{indexData.yesterdayAmount}}元</h2>
  20. </view>
  21. </view>
  22. <view class="statisticsData-item">
  23. <view >
  24. <h3>&nbsp;</h3>
  25. </view>
  26. <view class="statisticsData-head">
  27. <p>今日充电笔数</p>
  28. </view>
  29. <view class="statisticsData-main">
  30. <h2>{{indexData.todayEQNum}}笔</h2>
  31. </view>
  32. <view class="statisticsData-foot">
  33. <p>本月流水</p>
  34. <h2 style="margin-left: 10px;">{{indexData.thisMonthAmount}}元</h2>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. <u-popup v-model="popupShow" mode="top" height="80%">
  40. <view class="popup-screen">
  41. <view class="screen">
  42. <view class="screen-item">
  43. <view class="screen-head">查询日期</view>
  44. <view class="screen-main2">
  45. <u-calendar v-model="showdate" mode="range" @change="changedate"></u-calendar>
  46. <u-input :value="startTime?startTime+'至'+endTime:'选择时间筛选'" :type="type" :border="border" @click="showdate = true" />
  47. <!--
  48. <u-action-sheet :list="actionSheetList" v-model="show" @click="actionSheetCallback"></u-action-sheet>
  49. --></view>
  50. </view>
  51. <view class="screen-item">
  52. <view class="screen-head">充电桩类型</view>
  53. <view class="screen-main">
  54. <view
  55. :class="{
  56. active:selecttype==''
  57. }" @click="selecttype=''"
  58. class="screen-entry ">全部</view>
  59. <view
  60. :class="{
  61. active:selecttype=='0'
  62. }" @click="selecttype='0'"
  63. class="screen-entry type1">自行车充电</view>
  64. <view
  65. :class="{
  66. active:selecttype=='2'
  67. }" @click="selecttype='2'"
  68. class="screen-entry type3">交流慢充</view>
  69. <view
  70. :class="{
  71. active:selecttype=='1'
  72. }" @click="selecttype='1'"
  73. class="screen-entry type2">直流快充</view>
  74. </view>
  75. </view>
  76. <view class="screen-item">
  77. <view class="screen-head">站点</view>
  78. <view class="screen-main">
  79. <view class="screen-entry "
  80. :class="{
  81. active:selectstationId==''
  82. }"
  83. @click="selectstationId=''"
  84. >全部</view>
  85. <view
  86. v-for="(item,i) in stationList" :key="i"
  87. :class="{
  88. active:selectstationId==item.id
  89. }"
  90. @click="selectstationId=item.id,selectdeviceNo=''"
  91. class="screen-entry" >{{item.name}}</view>
  92. </view>
  93. </view>
  94. <view
  95. class="screen-item">
  96. <view class="screen-head">桩号</view>
  97. <view class="screen-main">
  98. <view class="screen-entry "
  99. :class="{
  100. active:selectdeviceNo==''
  101. }"
  102. @click="selectdeviceNo=''"
  103. >全部</view>
  104. <view
  105. v-for="(item,i) in stationListSon" :key="i"
  106. v-show="selectstationId?(selectstationId==item.stationId):true"
  107. :class="{
  108. active:selectdeviceNo==item.deviceNo
  109. }"
  110. @click="selectdeviceNo=item.deviceNo"
  111. class="screen-entry" >{{item.name}}</view>
  112. </view>
  113. </view>
  114. </view>
  115. <view class="screen-foot">
  116. <view class="screen-btn-l"
  117. @click="resetBtn" >重置</view>
  118. <view class="screen-btn-r" @click="okbtn" >确定</view>
  119. </view>
  120. </view>
  121. </u-popup>
  122. <u-calendar v-model="showdate2" mode="range" @change="changedate2"></u-calendar>
  123. <u-popup v-model="popupShow2" mode="top" height="50%">
  124. <view class="popup-screen">
  125. <view class="screen">
  126. <view class="screen-item">
  127. <view class="screen-head">查询日期</view>
  128. <view class="screen-main2">
  129. <u-input :value="startTime2?startTime2+'至'+endTime2:'选择时间筛选'" :type="type" :border="border" @click="showdate2 = true,popupShow2=false" />
  130. <!--
  131. <u-action-sheet :list="actionSheetList" v-model="show" @click="actionSheetCallback"></u-action-sheet>
  132. --></view>
  133. </view>
  134. <view class="screen-item">
  135. <view class="screen-head">站点</view>
  136. <view class="screen-main">
  137. <view class="screen-entry "
  138. :class="{
  139. active:selectstationId2==''
  140. }"
  141. @click="selectstationId2=''"
  142. >全部</view>
  143. <view
  144. v-for="(item,i) in stationList" :key="i"
  145. :class="{
  146. active:selectstationId2==item.id
  147. }"
  148. @click="selectstationId2=item.id,selectdeviceNo=''"
  149. class="screen-entry" >{{item.name}}</view>
  150. </view>
  151. </view>
  152. </view>
  153. <view class="screen-foot">
  154. <view class="screen-btn-l"
  155. @click="resetBtn2" >重置</view>
  156. <view class="screen-btn-r" @click="okbtn2" >确定</view>
  157. </view>
  158. </view>
  159. </u-popup>
  160. <view class="statisticsChart">
  161. <view class="statisticsChart-head">
  162. <h4 >流水占比</h4>
  163. <view class="navbar-screen" @click="popupShow = true"><span>筛选</span><u-icon name="filter-2-fill" custom-prefix="custom-icon" color="#b0b8c8" size="32"></u-icon></view>
  164. </view>
  165. <view class="statisticsChart-main" >
  166. <!-- <u-calendar v-model="showdate" mode="range" @change="changedate"></u-calendar>
  167. -->
  168. <view class="statisticsChart-time" style="
  169. text-align: center; margin-bottom: 5px;
  170. ">
  171. <p >{{startTime}} 至 {{endTime}} </p>
  172. </view>
  173. <u-subsection :list="subsection" @change="changesub" :current="current" button-color="#2E7Dff"
  174. active-color="#fff"></u-subsection>
  175. <cover-view id="pieEcharts" style="min-height:250px;">
  176. </cover-view>
  177. </view>
  178. <view class="statisticsChart-head" style="margin-top: 20px;">
  179. <h4 >收益统计</h4>
  180. <!-- <view class="navbar-screen" >
  181. {{startTime}}至{{endTime}}
  182. </view> -->
  183. <view class="navbar-screen" @click="popupShow2 = true"><span>筛选</span><u-icon name="filter-2-fill" custom-prefix="custom-icon" color="#b0b8c8" size="32"></u-icon></view>
  184. </view>
  185. <view class="details" v-if="indexData2.incomeMap" >
  186. <p style="text-align: center; margin-bottom: 5px;" >{{startTime2}}至{{endTime2}} </p>
  187. <view class="details-row" >
  188. <p>投资人收入</p>
  189. <span>{{indexData2.incomeMap.incomeAmount}}元</span>
  190. </view>
  191. <view class="details-row" >
  192. <p>用电度数</p>
  193. <span>{{indexData2.incomeMap.electricQuantity/10000}}度</span>
  194. </view>
  195. <view class="details-row" >
  196. <p>电费</p>
  197. <span>{{indexData2.incomeMap.costAmount}}元</span>
  198. </view>
  199. <view class="details-row" >
  200. <p>服务费收益</p>
  201. <span><b>{{indexData2.incomeMap.serviceAmount}}元</b></span>
  202. </view>
  203. </view>
  204. </view>
  205. <Tabbar :current="0" ref="tabbarMain" ></Tabbar>
  206. <!-- <u-tabbar v-model="current" :list="tabbarList" active-color="#185ac6"></u-tabbar>
  207. --> </view>
  208. </template>
  209. <script>
  210. import Tabbar from '@/components/TabbarFinance.vue'
  211. import * as API from '@/apis/finance.js'
  212. import * as echarts from "echarts";
  213. //require("@/apis/echarts-5-3.min.js")
  214. //import * as echarts from "@/apis/echarts-5-3.min.js";
  215. import {
  216. beforeTimeStamp,
  217. currentTimeStamp,
  218. parseUnixTime
  219. } from '@/utils'
  220. export default {
  221. data() {
  222. return {
  223. isinit:true,
  224. form:{},
  225. form2:{},
  226. selecttype:"",
  227. selectstationId:"",
  228. selectdeviceNo:"",
  229. popupShow2:false,
  230. popupShow:false,
  231. selectstationId2:"",
  232. info:{},
  233. title:"",
  234. showdate: false,
  235. showdate2: false,
  236. startTime: "",
  237. indexData:{},
  238. endTime: "",
  239. startTime2: "",
  240. indexData2:{},
  241. endTime2: "",
  242. myChart: null,
  243. subsection: [{
  244. name: '金额'
  245. },
  246. {
  247. name: '笔数'
  248. }
  249. ],
  250. stationList:[],
  251. stationListSon:[],
  252. tabbarList: [{
  253. iconPath: "bar-chart-box-fill",
  254. selectedIconPath: "bar-chart-box-fill",
  255. text: '统计',
  256. count: 0,
  257. isDot: true,
  258. customIcon: true,
  259. },
  260. {
  261. iconPath: "article-fill",
  262. selectedIconPath: "article-fill",
  263. text: '明细',
  264. midButton: true,
  265. customIcon: true,
  266. },
  267. {
  268. iconPath: "account-pin-box-fill",
  269. selectedIconPath: "account-pin-box-fill",
  270. text: '我的',
  271. count: 0,
  272. isDot: false,
  273. customIcon: true,
  274. },
  275. ],
  276. current: 0,
  277. background: {
  278. background: 'none'
  279. },
  280. value: '',
  281. type: 'select',
  282. show: false,
  283. border: true,
  284. }
  285. },
  286. onShow(){
  287. if(this.$refs.tabbarMain){
  288. this.$refs.tabbarMain.setcount(0);
  289. }
  290. },
  291. onLoad() {
  292. this.title="收益统计"
  293. this.info=this.carhelp.getPersonInfo("merchantUser")
  294. },
  295. components: {
  296. Tabbar
  297. },
  298. onReady() {
  299. this.startTime = parseUnixTime(beforeTimeStamp(7), '{y}-{m}-{d}')
  300. this.endTime = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}')
  301. this.startTime2 = parseUnixTime(beforeTimeStamp(7), '{y}-{m}-{d}')
  302. this.endTime2 = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}')
  303. this.getData()
  304. this.getStation()
  305. },
  306. methods: {
  307. getStation(bl) {
  308. API.stationList().then((res) => {
  309. this.stationList = res.data.stationList
  310. this.stationListSon=res.data.deviceList
  311. }).catch(error => {
  312. uni.showToast({
  313. title: error
  314. })
  315. })
  316. },
  317. resetBtn(){
  318. this.startTime = parseUnixTime(beforeTimeStamp(7), '{y}-{m}-{d}')
  319. this.endTime = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}')
  320. this.selecttype=""
  321. this.selectstationId=""
  322. this.selectdeviceNo=""
  323. this.form = {
  324. type:this.selecttype,
  325. stationId:this.selectstationId,
  326. deviceNo:this.selectdeviceNo,
  327. };
  328. this.popupShow=false;
  329. this.list = [];
  330. this.getData()
  331. },
  332. okbtn(){
  333. this.popupShow=false;
  334. this.form = {
  335. type:this.selecttype,
  336. stationId:this.selectstationId,
  337. deviceNo:this.selectdeviceNo,
  338. };
  339. this.list = [];
  340. this.getData()
  341. },
  342. resetBtn2(){
  343. this.startTime2 = parseUnixTime(beforeTimeStamp(7), '{y}-{m}-{d}')
  344. this.endTime2 = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}')
  345. this.selectstationId2=""
  346. this.form2 = {
  347. stationId:this.selectstationId2,
  348. };
  349. this.popupShow2=false;
  350. this.getData2()
  351. },
  352. okbtn2(){
  353. this.popupShow2=false;
  354. this.form2 = {
  355. stationId:this.selectstationId2,
  356. };
  357. this.getData2()
  358. },
  359. getData(){
  360. uni.showLoading({
  361. title: "加载中",
  362. mask: true,
  363. })
  364. this.form.startDate=this.startTime,
  365. this.form.endDate=this.endTime
  366. API.spIncomeStatistics(this.form).then((res) => {
  367. this.indexData = res.data
  368. if(this.isinit){
  369. this.isinit=false;
  370. this.indexData2=res.data
  371. }
  372. this.getPie()
  373. uni.hideLoading()
  374. }).catch(error => {
  375. uni.showToast({
  376. title: error
  377. })
  378. })
  379. },
  380. getData2(){
  381. uni.showLoading({
  382. title: "加载中",
  383. mask: true,
  384. })
  385. this.form2.startDate=this.startTime2,
  386. this.form2.endDate=this.endTime2
  387. API.spIncomeStatistics(this.form2).then((res) => {
  388. this.indexData2=res.data
  389. uni.hideLoading()
  390. }).catch(error => {
  391. uni.showToast({
  392. title: error
  393. })
  394. })
  395. },
  396. changesub(e){
  397. console.log(e)
  398. this.current=e
  399. this.getPie()
  400. },
  401. changedate(e) {
  402. this.startTime = e.startDate
  403. this.endTime = e.endDate
  404. },
  405. changedate2(e) {
  406. this.startTime2 = e.startDate
  407. this.endTime2= e.endDate
  408. this.popupShow2=true
  409. },
  410. getPie() {
  411. var list=this.indexData.pieChart;
  412. var getData=[];
  413. var unit=this.current?'笔':'元'
  414. list.forEach(item=>{
  415. var value=this.current?item.eqNum:item.amount
  416. if(value){
  417. getData.push({
  418. value: value,
  419. name: item.deviceName
  420. })
  421. }
  422. })
  423. if (!this.myChart) {
  424. this.myChart = echarts.init(document.getElementById('pieEcharts'));
  425. }
  426. // 指定图表的配置项和数据
  427. var option = {
  428. tooltip: {
  429. trigger: 'item',
  430. formatter: '{b} <br/> {c}'+unit,
  431. position:function(point,params,dom,rect,size){
  432. return ['10%','0%']
  433. }
  434. },
  435. series: [{
  436. //name: 'Access From',
  437. type: 'pie',
  438. radius: '40%',
  439. data: getData,
  440. emphasis: {
  441. itemStyle: {
  442. shadowBlur: 10,
  443. shadowOffsetX: 0,
  444. shadowColor: 'rgba(0, 0, 0, 0.5)'
  445. }
  446. },
  447. label:{
  448. fontWeight:"bold",
  449. fontSize:14,
  450. }
  451. }]
  452. };
  453. // 使用刚指定的配置项和数据显示图表。
  454. this.myChart.setOption(option);
  455. }
  456. }
  457. }
  458. </script>
  459. <style>
  460. page {
  461. background: url(../../assets/img/index_header_bg.png) no-repeat top center #f7f7f7;
  462. background-size: 100%;
  463. }
  464. </style>
  465. <style lang="scss" scoped>
  466. .details{
  467. margin-top: 16px;
  468. padding: 20px;
  469. background-color: #fff;
  470. border-radius: 8px;
  471. }
  472. .details-title{
  473. margin-bottom: 16px;
  474. h4{
  475. font-weight: normal;
  476. font-size: 16px;
  477. position: relative;
  478. padding-left:10px;
  479. &::after{
  480. content: '';
  481. position: absolute;
  482. height: 12px;
  483. width: 4px;
  484. background-color: #27B148;
  485. left: 0;
  486. top:5px;
  487. }
  488. }
  489. }
  490. .details-row{
  491. display: flex;
  492. justify-content: space-between;
  493. align-items: center;
  494. margin-top: 15px;
  495. p{
  496. color: #37393c;
  497. font-weight: bold;
  498. }
  499. }
  500. .popup-screen{
  501. padding: 20px;
  502. position: relative;
  503. .screen{
  504. padding-bottom: 30px;
  505. }
  506. .screen-item{
  507. margin-bottom: 20px;
  508. .screen-head{
  509. margin-bottom: 8px;
  510. font-size: 16px;
  511. }
  512. .screen-main{
  513. display: flex;
  514. // display: -webkit-box;
  515. flex-wrap: wrap;
  516. }
  517. .screen-entry{
  518. width: 29%;
  519. padding:6px 0;
  520. display: flex;
  521. align-items: center;
  522. justify-content: center;
  523. background-color: #F2F5FA ;
  524. text-align: center;
  525. margin-bottom: 10px;
  526. border-radius: 3px;
  527. margin-right: 6px;
  528. }
  529. .screen-entry.active{
  530. background-color: #185AC6;
  531. color:#fff;
  532. }
  533. }
  534. .screen-foot{
  535. position: fixed;
  536. left: 0;
  537. right: 0;
  538. bottom: 0;
  539. display: flex;
  540. height:50px;
  541. border-top: 1px solid #ededed;
  542. .screen-btn-l{
  543. background-color: #fff;
  544. flex: 0.2;
  545. text-align: center;
  546. line-height: 50px;
  547. }
  548. .screen-btn-r{
  549. flex: 0.8;
  550. text-align: center;
  551. line-height: 50px;
  552. background-color: #185AC6;
  553. color:#fff;
  554. }
  555. }
  556. }
  557. .navbar-tit {
  558. color: #fff;
  559. font-size: 24px;
  560. padding-left: 15px;
  561. padding-top: 10px;
  562. }
  563. .statisticsData {
  564. background-color: #fff;
  565. margin: 12px;
  566. padding: 12px;
  567. border-radius: 8px;
  568. margin-top: 60px;
  569. }
  570. .statisticsDataMain {
  571. display: flex;
  572. }
  573. .statisticsData-item {
  574. flex: 1;
  575. .statisticsData-head {
  576. display: flex;
  577. align-items: center;
  578. p {
  579. color: #637AA2;
  580. font-size: 12px;
  581. }
  582. }
  583. .statisticsData-main {
  584. margin-top: 4px;
  585. font-size: 20px;
  586. }
  587. .statisticsData-foot {
  588. display: flex;
  589. align-items: center;
  590. margin-top: 16px;
  591. p {
  592. color: #637AA2;
  593. }
  594. h4 {
  595. margin-left: 8px;
  596. }
  597. }
  598. }
  599. .statisticsChart {
  600. margin: 16px;
  601. .statisticsChart-head {
  602. margin-bottom: 5px;
  603. display: flex;
  604. justify-content: space-between;
  605. align-items: center;
  606. h4 {
  607. font-weight: normal;
  608. font-size: 16px;
  609. position: relative;
  610. padding-left: 10px;
  611. &::after {
  612. content: '';
  613. position: absolute;
  614. height: 12px;
  615. width: 4px;
  616. background-color: #4E8DF6;
  617. left: 0;
  618. top: 5px;
  619. }
  620. }
  621. .statisticsChart-time {
  622. display: flex;
  623. align-items: center;
  624. p {
  625. color: #666;
  626. }
  627. }
  628. }
  629. .statisticsChart-main {
  630. background-color: #fff;
  631. padding:10px 16px 16px 16px;
  632. border-radius: 8px;
  633. }
  634. }
  635. </style>