list.vue 13 KB

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