index.vue 13 KB

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