list.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808
  1. <template>
  2. <view>
  3. <ujp-navbar title="站点流水统计">
  4. <view class="navbar" @click="downloadCk()">
  5. <view class="navbar-screen" ><span>导出</span>
  6. <u-icon name="download" color="#b0b8c8" size="32"></u-icon>
  7. </view>
  8. </view>
  9. </ujp-navbar>
  10. <view class="statisticsChart">
  11. <u-picker mode="selector" v-model="popupShow3" @confirm="changedate3" :range="valueList" range-key="name"
  12. :default-selector="[selectValue]"></u-picker>
  13. <u-calendar v-model="popupShow4" mode="range" @change="changedate4"></u-calendar>
  14. <view class="details detailstable">
  15. <view class="detailsline detailsline " style="padding: 12rpx 0;" >
  16. <view v-if="false" class="details-row-where " style=" font-size: 28rpx; padding-left: 0px !important;" >
  17. <p @click="popupShow3 = true" style="font-size: 28rpx">{{selectName}}
  18. <u-icon name="arrow-drop-down-fill" custom-prefix="custom-icon" v-show="!popupShow3" size="36"></u-icon>
  19. <u-icon name="arrow-drop-up-fill" custom-prefix="custom-icon" v-show="popupShow3" color="#b0b8c8" size="36"></u-icon>
  20. </p>
  21. </view>
  22. <view class="details-row-where" style="font-size: 28rpx" @click="popupShow4 = true" >
  23. {{showTime(startTime)}}-{{showTime(endTime)}}
  24. <u-icon name="arrow-drop-down-fill" custom-prefix="custom-icon" v-show="!popupShow4" size="36"></u-icon>
  25. <u-icon name="arrow-drop-up-fill" custom-prefix="custom-icon" v-show="popupShow4" size="36"></u-icon>
  26. </view>
  27. </view>
  28. <view class="detailsline detailsline0 " v-if="stationFlowList.length>1">
  29. <view class="details-row " style=" padding-left: 0px !important;" >
  30. <view class="span1">总收入</view>
  31. <view class="span2">{{(allMoneySum).toFixed(2)}}<span>元</span></view>
  32. </view>
  33. <view class="details-row">
  34. <view class="span1">总利润<span>(服务费+折扣卡)</span></view>
  35. <view class="span2">{{(serviceMoneySum).toFixed(2)}}<span>元</span></view>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="details detailstable"
  40. >
  41. <u-collapse :headStyle="{
  42. color:'#101010',
  43. fontWeight: 'bold',
  44. fontSize:'32rpx',
  45. padding:'36rpx 0 36rpx 32rpx',
  46. }">
  47. <template v-for="(item, index) in stationFlowList" >
  48. <view style=" background-color: #f3f4f7;color: #f3f4f7; line-height: 8px;"
  49. v-show="!getItem(item)"
  50. :key="'a_'+index" >-</view>
  51. <u-collapse-item
  52. :key="'b_'+index"
  53. v-show="!getItem(item)"
  54. >
  55. <view slot="title" class="u-collapse-title u-line-1" style="width: 100%;">
  56. <view style=" display: flex;
  57. justify-content: space-between; flex-wrap: wrap;">
  58. <view style=" margin-top: 3px;">{{item.station.stationNo?item.station.stationNo.substring(0,1):""}}-{{item.stationName}}</view>
  59. <view style="float:right; margin-top: 3px;"><span
  60. style="font-size: 24rpx;margin-right: 8rpx;font-weight: normal;">总收入</span>{{item.actualMoney.toFixed(2)}}元</view>
  61. </view>
  62. <view style=" margin-top: 10px;" v-if="item.station.stationNo&&item.station.stationNo.indexOf('D')!=0" >
  63. <span style="font-size: 24rpx; font-weight: normal;">平均充电量(度/枪/天)</span>
  64. <span style="float:right;">
  65. <span style="font-size: 24rpx;margin-right: 8rpx;font-weight: normal;" v-if="item.fastNum" >快充枪:</span>{{item.fastNum?(item.averageFast).toFixed(1):''}}
  66. <span style="font-size: 24rpx;margin:0 8rpx;font-weight: normal;" v-if="item.fastNum&&item.slowNum">|</span>
  67. <span style="font-size: 24rpx;margin-right: 8rpx;font-weight: normal;" v-if="item.slowNum" >慢充枪:</span>{{item.slowNum?(item.averageSlow).toFixed(1):''}}
  68. </span>
  69. </view>
  70. <view style=" margin-top: 10px;" v-if="item.station.stationNo&&item.station.stationNo.indexOf('D')!=0" >
  71. <span style="font-size: 24rpx; font-weight: normal;">充电使用率(枪/天)</span>
  72. <span style="float:right;">
  73. <span style="font-size: 24rpx;margin-right: 8rpx;font-weight: normal;" v-if="item.fastNum" >快充枪:</span>{{item.fastNum?(item.fastUsageRate)+'%':''}}
  74. <span style="font-size: 24rpx;margin:0 8rpx;font-weight: normal;" v-if="item.fastNum&&item.slowNum">|</span>
  75. <span style="font-size: 24rpx;margin-right: 8rpx;font-weight: normal;" v-if="item.slowNum" >慢充枪:</span>{{item.slowNum?(item.slowUsageRate)+'%':''}}
  76. </span>
  77. </view>
  78. </view>
  79. <!-- -->
  80. <view class="detailsline">
  81. <view class="details-row details-row-1">
  82. <view class="span1">电费</view>
  83. <view class="span2">{{item.elecMoney.toFixed(2)}}<span>元</span></view>
  84. </view>
  85. <view class="details-row">
  86. <view class="span1">服务费</view>
  87. <view class="span2">{{item.serviceMoney.toFixed(2)}}<span>元</span></view>
  88. </view>
  89. </view>
  90. <view class="detailsline">
  91. <view class="details-row details-row-1">
  92. <view class="span1">总用电量</view>
  93. <view class="span2">{{(item.eq).toFixed(1)}}<span>度</span></view>
  94. </view>
  95. <view class="details-row" v-if="item.station.stationNo&&item.station.stationNo.indexOf('D')!=0" >
  96. <view class="span1">充电枪数量</view>
  97. <view class="span2">快充{{item.fastNum}}/慢充{{item.slowNum}}</view>
  98. </view>
  99. <view class="details-row " v-else >
  100. <view class="span1">总收入</view>
  101. <view class="span2">{{item.actualMoney.toFixed(2)}}<span>元</span></view>
  102. </view>
  103. </view>
  104. <view class="detailsline" v-if="item.station.stationNo&&item.station.stationNo.indexOf('D')!=0" >
  105. <view class="details-row "
  106. :class="{
  107. 'details-row-1':item.slowNum,
  108. 'details-row-2':!item.slowNum
  109. }"
  110. v-if="item.fastNum" >
  111. <view class="span1">快充枪平均充电量</view>
  112. <view class="span2" v-if="item.fastNum">
  113. {{(item.averageFast).toFixed(1)}}<span>度/枪/天</span>
  114. </view>
  115. <view class="span2" v-else>0<span>度/枪/天</span></view>
  116. </view>
  117. <view class="details-row "
  118. :class="{
  119. 'details-row-2':!item.fastNum
  120. }"
  121. v-if="item.slowNum" >
  122. <view class="span1">慢充枪平均充电量</view>
  123. <view class="span2" v-if="item.slowNum">
  124. {{(item.averageSlow).toFixed(1)}}<span>度/枪/天</span>
  125. </view>
  126. <view class="span2" v-else>0<span>度/枪/天</span></view>
  127. </view>
  128. </view>
  129. <view class="detailsline" v-if="item.station.stationNo&&item.station.stationNo.indexOf('D')!=0" >
  130. <view class="details-row details-row-1">
  131. <view class="span1">总收入</view>
  132. <view class="span2">{{item.actualMoney.toFixed(2)}}<span>元</span></view>
  133. </view>
  134. <view class="details-row " >
  135. <view class="span1">折扣卡收益</view>
  136. <view class="span2">{{(item.cardMoney).toFixed(2)}}<span>元</span></view>
  137. </view>
  138. </view>
  139. <view class="detailsline" v-if="item.station.stationNo&&item.station.stationNo.indexOf('D')!=0" >
  140. <view class="details-row "
  141. :class="{
  142. 'details-row-1':item.slowNum,
  143. 'details-row-2':!item.slowNum
  144. }"
  145. v-if="item.fastNum" >
  146. <view class="span1">快充枪充电使用率</view>
  147. <view class="span2" v-if="item.fastNum">
  148. {{(item.fastUsageRate)}}%<span>枪/天</span>
  149. </view>
  150. <view class="span2" v-else>0%<span>枪/天</span></view>
  151. </view>
  152. <view class="details-row "
  153. :class="{
  154. 'details-row-2':!item.fastNum
  155. }"
  156. v-if="item.slowNum" >
  157. <view class="span1">慢充枪充电使用率</view>
  158. <view class="span2" v-if="item.slowNum">
  159. {{(item.slowUsageRate)}}%<span>枪/天</span>
  160. </view>
  161. <view class="span2" v-else>0%<span>枪/天</span></view>
  162. </view>
  163. </view>
  164. <!--
  165. <view v-if="item.fastNum&&item.slowNum"
  166. :style="item.slowDayNum==nowTime?'color: #ffffff;':'border-bottom: 1px solid #ededed;'">
  167. 查询范围内实际订单天数{{item.slowDayNum}}</view> -->
  168. </u-collapse-item>
  169. </template>
  170. </u-collapse>
  171. <u-divider color="#B6BDC3" style="margin-top:20px;" bg-color="#f7f7f7">已经到底了</u-divider>
  172. </view>
  173. </view>
  174. </view>
  175. </template>
  176. <script>
  177. import * as API from '@/apis/finance.js'
  178. import {
  179. daysDistance,
  180. beforeTimeStamp,
  181. currentTimeStamp,
  182. parseUnixTime
  183. } from '@/utils'
  184. export default {
  185. data() {
  186. return {
  187. form: {},
  188. selectName:"全部充电站",
  189. selectValue: 0,
  190. valueList: [{
  191. name: '全部充电站',
  192. value:'0'
  193. },
  194. {
  195. name: '汽车充电站',
  196. value:'1'
  197. },
  198. {
  199. name: '单车充电站',
  200. value:'2'
  201. }
  202. ],
  203. popupShow3:false,
  204. popupShow4: false,
  205. nowTime: 0,
  206. stationFlowList: [],
  207. serviceMoneySum: 0,
  208. allMoneySum: 0,
  209. endTime: '',
  210. startTime: '',
  211. }
  212. },
  213. onShow() {
  214. },
  215. onLoad() {
  216. },
  217. components: {
  218. },
  219. onReady() {
  220. this.nowTime = 7
  221. this.startTime = parseUnixTime(beforeTimeStamp(6), '{y}-{m}-{d}')
  222. this.endTime = parseUnixTime(beforeTimeStamp(0), '{y}-{m}-{d}')
  223. this.getData()
  224. },
  225. computed: {
  226. // serviceMoneySum(){
  227. // var serviceMoneySum = 0;
  228. // //this.allMoneySum = 0;
  229. // for (var i in this.stationFlowList) {
  230. // var item = this.stationFlowList[i];
  231. // if(this.getItem(item)){
  232. // continue
  233. // }
  234. // //this.allMoneySum += item.actualMoney
  235. // serviceMoneySum += item.serviceMoney
  236. // serviceMoneySum += item.cardMoney
  237. // }
  238. // return serviceMoneySum
  239. // },
  240. // allMoneySum(){
  241. // var allMoneySum = 0;
  242. // //this.allMoneySum = 0;
  243. // for (var i in this.stationFlowList) {
  244. // var item = this.stationFlowList[i];
  245. // if(this.getItem(item)){
  246. // continue
  247. // }
  248. // allMoneySum += item.actualMoney
  249. // }
  250. // return allMoneySum
  251. // }
  252. },
  253. methods: {
  254. downloadCk(){
  255. uni.showLoading({
  256. title: "加载中",
  257. mask: true,
  258. })
  259. this.form.startDate = this.startTime,
  260. this.form.endDate = this.endTime
  261. API.homeFlowStatisticsExport(this.form).then((res2) => {
  262. //console.log(res2)
  263. window.location.href=res2.data.exportUrl
  264. uni.hideLoading()
  265. }).catch(error => {
  266. uni.showToast({
  267. title: error
  268. })
  269. })
  270. },
  271. getItem(item){
  272. if(this.selectValue==0){
  273. }else if(this.selectValue==1){
  274. if(item.fastNum==0&&item.slowNum==0){
  275. return true;
  276. }
  277. }else if(this.selectValue==2){
  278. if(item.fastNum||item.slowNum){
  279. return true;
  280. }
  281. }
  282. return false
  283. },
  284. showTime(name) {
  285. if (!name) {
  286. return ''
  287. }
  288. return name.replace('-', '.').replace('-', '.') ;
  289. },
  290. changedate3(e) {
  291. var index = e[0];
  292. this.selectValue=index
  293. this.selectName=this.valueList[index].name
  294. },
  295. getData() {
  296. uni.showLoading({
  297. title: "加载中",
  298. mask: true,
  299. })
  300. this.form.startDate = this.startTime,
  301. this.form.endDate = this.endTime
  302. API.homeFlowStatistics(this.form).then((res) => {
  303. this.serviceMoneySum=res.data.allProfit;
  304. this.allMoneySum=res.data.allAmount;
  305. this.stationFlowList = res.data.stationFlowList;
  306. this.nowTime = daysDistance(this.startTime, this.endTime) + 1;
  307. uni.hideLoading()
  308. }).catch(error => {
  309. uni.showToast({
  310. title: error
  311. })
  312. })
  313. },
  314. changedate4(e) {
  315. this.startTime = e.startDate
  316. this.endTime = e.endDate
  317. this.getData()
  318. },
  319. }
  320. }
  321. </script>
  322. <style>
  323. page {
  324. background: #f3f4f7;
  325. background-size: 100%;
  326. }
  327. </style>
  328. <style lang="scss" scoped>
  329. .headbotton1:after {
  330. border-radius: 15px 0 0 15px;
  331. }
  332. .headbotton2:after {
  333. border-radius: 0 15px 15px 0;
  334. }
  335. .detailstable {
  336. //padding: 40rpx 30rpx !important;
  337. }
  338. .detailstableHead {
  339. .span1 {
  340. font-size: 32rpx !important;
  341. }
  342. .details-row-head-1 {}
  343. .details-row-head-2 {}
  344. .details-row-head-3 {
  345. width: 30% !important;
  346. max-width: 150rpx;
  347. .span {}
  348. }
  349. .span2 {
  350. font-size: 44rpx !important;
  351. font-weight: bold;
  352. width: 100%;
  353. color: #101010;
  354. span {
  355. font-size: 24rpx !important;
  356. }
  357. }
  358. }
  359. .detailslineHead {
  360. border-top: 1px solid #ededed;
  361. ;
  362. .details-row {
  363. padding-left: 8rpx !important;
  364. }
  365. font-size: 30rpx !important;
  366. .span1 span {
  367. font-size: 28rpx;
  368. }
  369. }
  370. .detailstable,
  371. .detailstableHead {
  372. font-size: 16px;
  373. p {
  374. font-size: 14px;
  375. }
  376. .details-row-main {
  377. border-bottom: 1px solid #ededed;
  378. padding: 10px 0;
  379. }
  380. .detailsline0 {
  381. border-bottom: 0px !important;
  382. background : linear-gradient(90deg, rgba(27,126,242,1) 0%,rgba(0,90,217,1) 100%);
  383. color: #FFFFFF;
  384. padding: 0 16px;
  385. .span1,.span2,.span{
  386. color: #FFFFFF !important;
  387. }
  388. }
  389. .detailsline {
  390. border-top: 1px solid #ededed;
  391. padding: 0px 16px;
  392. }
  393. .detailsline,
  394. .detailsline—bottom {
  395. //justify-content: center;
  396. display: flex;
  397. .details-row-where{
  398. width: 50%;
  399. text-align: center;
  400. }
  401. .details-row {
  402. width: 50%;
  403. display: flex;
  404. justify-content: space-between;
  405. flex-direction: column;
  406. padding-left: 16rpx;
  407. margin-bottom: 20rpx;
  408. .span1 {
  409. color: rgba(136, 136, 136, 100);
  410. font-size: 28rpx;
  411. width: 100%;
  412. }
  413. .span2 {
  414. font-size: 36rpx;
  415. width: 100%;
  416. color: #101010;
  417. span {
  418. font-size: 24rpx;
  419. }
  420. }
  421. }
  422. }
  423. .details-row-1 {
  424. width: 47%;
  425. padding-left: 0px !important;
  426. border-right: 1px solid #ededed;
  427. }
  428. .details-row-2 {
  429. width: 47%;
  430. padding-left: 0px !important;
  431. //border-right: 1px solid #ededed;
  432. }
  433. }
  434. .details {
  435. //padding-top: 16rpx;
  436. background-color: #fff;
  437. //border-radius: 8px;
  438. }
  439. .details-title {
  440. margin-bottom: 16px;
  441. h4 {
  442. font-weight: normal;
  443. font-size: 16px;
  444. position: relative;
  445. padding-left: 10px;
  446. &::after {
  447. content: '';
  448. position: absolute;
  449. height: 12px;
  450. width: 4px;
  451. background-color: #27B148;
  452. left: 0;
  453. top: 5px;
  454. }
  455. }
  456. }
  457. .details-row {
  458. display: flex;
  459. justify-content: space-between;
  460. align-items: center;
  461. margin-top: 10px;
  462. p {
  463. color: #37393c;
  464. font-weight: bold;
  465. }
  466. }
  467. .details-row2 {
  468. display: flex;
  469. justify-content: space-between;
  470. align-items: center;
  471. // margin-top: 15px;
  472. p {
  473. // color: #37393c;
  474. // font-weight: bold;
  475. }
  476. }
  477. .popup-screen {
  478. padding: 20px;
  479. position: relative;
  480. .screen {
  481. padding-bottom: 30px;
  482. }
  483. .screen-item {
  484. margin-bottom: 20px;
  485. .screen-head {
  486. margin-bottom: 8px;
  487. font-size: 16px;
  488. }
  489. .screen-main {
  490. display: flex;
  491. // display: -webkit-box;
  492. flex-wrap: wrap;
  493. }
  494. .screen-entry {
  495. width: 29%;
  496. padding: 6px 0;
  497. display: flex;
  498. align-items: center;
  499. justify-content: center;
  500. background-color: #F2F5FA;
  501. text-align: center;
  502. margin-bottom: 10px;
  503. border-radius: 3px;
  504. margin-right: 6px;
  505. }
  506. .screen-entry.active {
  507. background-color: #185AC6;
  508. color: #fff;
  509. }
  510. }
  511. .screen-foot {
  512. position: fixed;
  513. left: 0;
  514. right: 0;
  515. bottom: 0;
  516. display: flex;
  517. height: 50px;
  518. border-top: 1px solid #ededed;
  519. .screen-btn-l {
  520. background-color: #fff;
  521. flex: 0.2;
  522. text-align: center;
  523. line-height: 50px;
  524. }
  525. .screen-btn-r {
  526. flex: 0.8;
  527. text-align: center;
  528. line-height: 50px;
  529. background-color: #185AC6;
  530. color: #fff;
  531. }
  532. }
  533. }
  534. .statisticsData {
  535. background-color: #fff;
  536. margin: 0px 24rpx 24rpx;
  537. //padding:0px 24rpx 24rpx;
  538. border-radius: 8px;
  539. }
  540. .statisticsDataMain {
  541. flex-wrap: wrap;
  542. display: flex;
  543. }
  544. .statisticsData-item {
  545. flex: 1;
  546. width: 40%;
  547. .statisticsData-head {
  548. display: flex;
  549. align-items: center;
  550. p {
  551. color: #637AA2;
  552. font-size: 12px;
  553. }
  554. }
  555. .statisticsData-main {
  556. margin-top: 4px;
  557. font-size: 18px;
  558. }
  559. .statisticsData-foot {
  560. display: flex;
  561. align-items: center;
  562. margin-top: 16px;
  563. p {
  564. color: #637AA2;
  565. }
  566. h4 {
  567. margin-left: 8px;
  568. }
  569. }
  570. }
  571. .statisticsChart {
  572. //margin: 16px;
  573. .statisticsChart-head {
  574. //margin-bottom: 5px;
  575. display: flex;
  576. justify-content: space-between;
  577. align-items: center;
  578. h4 {
  579. font-weight: normal;
  580. font-size: 16px;
  581. position: relative;
  582. padding-left: 10px;
  583. &::after {
  584. content: '';
  585. position: absolute;
  586. height: 12px;
  587. width: 4px;
  588. background-color: #4E8DF6;
  589. left: 0;
  590. top: 5px;
  591. }
  592. }
  593. .statisticsChart-time {
  594. display: flex;
  595. align-items: center;
  596. p {
  597. color: #666;
  598. }
  599. }
  600. }
  601. .statisticsChart-main {
  602. background-color: #fff;
  603. padding: 10px 16px 16px 16px;
  604. border-radius: 8px;
  605. }
  606. }
  607. .navbar {
  608. justify-content: flex-end;
  609. display: flex;
  610. //justify-content: space-between;
  611. flex: 1;
  612. padding: 0 15px;
  613. }
  614. .navbar-tit {
  615. font-size: 20px;
  616. }
  617. .navbar-tit {
  618. color: #fff;
  619. font-size: 24px;
  620. padding-left: 15px;
  621. padding-top: 10px;
  622. }
  623. .navbar-screen {
  624. display: flex;
  625. align-items: center;
  626. span {
  627. margin-right: 2px;
  628. color: #999;
  629. }
  630. }
  631. </style>