list.vue 13 KB

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