list.vue 19 KB

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