index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  1. <template>
  2. <view>
  3. <u-navbar :is-back="false">
  4. <view class="navbar">
  5. <view class="navbar-tit" >充电明细</view>
  6. <view class="navbar-screen" v-show="current==0" @click="popupShow = true"><span>筛选</span>
  7. <u-icon name="filter-2-fill" custom-prefix="custom-icon" color="#b0b8c8" size="32"></u-icon>
  8. </view>
  9. </view>
  10. </u-navbar>
  11. <u-popup v-model="popupShow" mode="top" height="80%" >
  12. <view class="popup-screen">
  13. <view class="screen">
  14. <view class="screen-item">
  15. <view class="screen-head">查询日期</view>
  16. <view class="screen-main2">
  17. <u-calendar v-model="showdate" mode="range" @change="changedate"></u-calendar>
  18. <u-input :value="startTime?startTime+'至'+endTime:'选择时间筛选'" :type="type" :border="border" @click="showdate = true" />
  19. <!--
  20. <u-action-sheet :list="actionSheetList" v-model="show" @click="actionSheetCallback"></u-action-sheet>
  21. --></view>
  22. </view>
  23. <view class="screen-item">
  24. <view class="screen-head">充电桩类型</view>
  25. <view class="screen-main">
  26. <view
  27. :class="{
  28. active:selecttype==''
  29. }" @click="selecttype=''"
  30. class="screen-entry ">全部</view>
  31. <view
  32. :class="{
  33. active:selecttype=='0'
  34. }" @click="selecttype='0'"
  35. class="screen-entry type1">自行车充电</view>
  36. <view
  37. :class="{
  38. active:selecttype=='2'
  39. }" @click="selecttype='2'"
  40. class="screen-entry type3">交流慢充</view>
  41. <view
  42. :class="{
  43. active:selecttype=='1'
  44. }" @click="selecttype='1'"
  45. class="screen-entry type2">直流快充</view>
  46. </view>
  47. </view>
  48. <view class="screen-item">
  49. <view class="screen-head">站点</view>
  50. <view class="screen-main">
  51. <view class="screen-entry "
  52. :class="{
  53. active:selectstationId==''
  54. }"
  55. @click="selectstationId=''"
  56. >全部</view>
  57. <view
  58. v-for="(item,i) in stationList" :key="i"
  59. :class="{
  60. active:selectstationId==item.id
  61. }"
  62. @click="selectstationId=item.id,selectdeviceNo=''"
  63. class="screen-entry" >{{item.name}}</view>
  64. </view>
  65. </view>
  66. <view
  67. class="screen-item">
  68. <view class="screen-head">桩号</view>
  69. <view class="screen-main">
  70. <view class="screen-entry "
  71. :class="{
  72. active:selectdeviceNo==''
  73. }"
  74. @click="selectdeviceNo=''"
  75. >全部</view>
  76. <view
  77. v-for="(item,i) in stationListSon" :key="i"
  78. v-show="selectstationId?(selectstationId==item.stationId):true"
  79. :class="{
  80. active:selectdeviceNo==item.deviceNo
  81. }"
  82. @click="selectdeviceNo=item.deviceNo"
  83. class="screen-entry" >{{item.name}}</view>
  84. </view>
  85. </view>
  86. </view>
  87. <view class="screen-foot">
  88. <view class="screen-btn-l" @click="resetBtn" >重置</view>
  89. <view class="screen-btn-r" @click="okbtn" >确定</view>
  90. </view>
  91. </view>
  92. </u-popup>
  93. <u-tabs
  94. :bar-width="100"
  95. :list="tabList" :is-scroll="false" :current="current" @change="change" inactive-color="#acb2af"
  96. active-color="#101010"></u-tabs>
  97. <view class="detailed" v-show="current==0" >
  98. <view style="text-align: center;margin-top: 100px" v-if="!list.length">
  99. <img src="@/assets/img/blankpage.png">
  100. <view>查询为空</view>
  101. </view>
  102. <view class="detailed-list" v-for="(item ,index) in list"
  103. @click="gotoUrl('pagesFinance/detailed/details?id='+item.id)"
  104. :key="index">
  105. <view class="detailed-time" v-if="item.show">
  106. <p>{{item.showtime}}</p>
  107. <p v-if="showMap">共收{{showMap.get(item.showtime).num}}笔,{{showMap.get(item.showtime).amount.toFixed(2)}}元</p>
  108. </view>
  109. <view class="detailed-item">
  110. <view class="detailed-item-name" style="
  111. width: 70%;
  112. ">
  113. <h2 class="showName">{{item.stationName}}/{{item.deviceName}}</h2>
  114. <!-- <p>{{item.flowNo?item.flowNo:'无充电单号'}}</p> -->
  115. <span
  116. :style="{
  117. color:colorList[item.platform%3]
  118. }">{{item.platformText}}</span>
  119. <span v-if="item.userCardId" style="color:#FF8B00 ;margin-left: 10px;">月卡订单</span>
  120. </view>
  121. <view class="detailed-item-name" style="
  122. min-width: 60px;
  123. width: 30%;
  124. ">
  125. <h2 style=" text-align: end;">{{item.actualFee?item.actualFee.toFixed(2):0}}元</h2>
  126. <p style=" text-align: end;" >{{item.endTime?item.endTime.slice(11):''}}</p>
  127. </view>
  128. <view class="sign" v-if="false">
  129. <!-- //<img src="../../assets/img/tixian.png" alt=""> -->
  130. <!-- 月卡 -->
  131. <view class="product_tip" >
  132. <view class="product_tip_bg"></view>
  133. <p>月卡</p>
  134. </view>
  135. </view>
  136. </view>
  137. </view>
  138. <u-divider v-if="list.length&&list.length == recordsTotal" color="#B6BDC3" style="margin-top:20px;" bg-color="#f7f7f7">已经到底了</u-divider>
  139. </view>
  140. <!-- 包月卡 -->
  141. <view class="detailed"
  142. style=" padding-bottom: 20px;"
  143. v-show="current==1">
  144. <view style="text-align: center;margin-top: 100px" v-if="!list2.length">
  145. <img src="@/assets/img/blankpage.png">
  146. <view>查询为空</view>
  147. </view>
  148. <view class="detailed-list" v-for="(item ,index) in list2"
  149. @click="gotoUrl('pagesFinance/detailed/monthlyCardDetails?id='+item.id)"
  150. :key="index" >
  151. <view class="detailed-time" v-if="item.show" >
  152. <p>{{item.showtime}}</p>
  153. <p v-if="showMap2">共收{{showMap2.get(item.showtime).num}}笔,{{showMap2.get(item.showtime).amount.toFixed(2)}}元</p>
  154. </view>
  155. <view class="detailed-item">
  156. <view class="detailed-item-name" style="
  157. width: 70%;
  158. ">
  159. <h2 class="showName">{{item.monthlyRentName}}</h2>
  160. <p>{{item.payTime?item.payTime.slice(11):''}}</p>
  161. </view>
  162. <view class="detailed-item-name" style="
  163. min-width: 60px;
  164. width: 30%;
  165. font-size: 16px;
  166. text-align: right;
  167. ">
  168. <h2>{{item.payFee.toFixed(2)}}<span style="font-size: 12px;">元</span></h2>
  169. </view>
  170. <!-- <view class="sign">
  171. <img src="../../assets/img/tixian.png" alt="">
  172. </view> -->
  173. </view>
  174. </view>
  175. <u-divider v-if="list2.length&&list2.length == recordsTotal2" color="#B6BDC3" style="margin-top:20px;" bg-color="#f7f7f7">已经到底了</u-divider>
  176. </view>
  177. <Tabbar :current="1" ref="tabbarMain"></Tabbar>
  178. </view>
  179. </template>
  180. <script>
  181. import Tabbar from '@/components/TabbarFinance.vue'
  182. import * as API from '@/apis/finance.js'
  183. // import {
  184. // beforeTimeStamp,
  185. // currentTimeStamp,
  186. // parseUnixTime
  187. // } from '@/utils'
  188. export default {
  189. data() {
  190. return {
  191. showdate: false,
  192. startTime: "",
  193. colorList:["#00B962","#1677FF","#eb372a"],
  194. endTime: "",
  195. selecttype:"",
  196. selectstationId:"",
  197. selectdeviceNo:"",
  198. title:"",
  199. form:{
  200. },
  201. // current: 0,
  202. tabList: [{
  203. name: '充电订单'
  204. }, {
  205. name: '月卡订单'
  206. }],
  207. pageIndex: 1,
  208. recordsTotal: 0,
  209. list: [],
  210. pageIndex2: 1,
  211. recordsTotal2: 0,
  212. list2: [],
  213. popupShow: false,
  214. tabbarList: [{
  215. iconPath: "bar-chart-box-fill",
  216. selectedIconPath: "bar-chart-box-fill",
  217. text: '统计',
  218. count: 0,
  219. isDot: true,
  220. customIcon: true,
  221. },
  222. {
  223. iconPath: "article-fill",
  224. selectedIconPath: "article-fill",
  225. text: '明细',
  226. midButton: true,
  227. customIcon: true,
  228. },
  229. {
  230. iconPath: "account-pin-box-fill",
  231. selectedIconPath: "account-pin-box-fill",
  232. text: '我的',
  233. count: 0,
  234. isDot: false,
  235. customIcon: true,
  236. },
  237. ],
  238. showMap:null,
  239. showMap2:null,
  240. current: 0,
  241. value: '',
  242. type: 'select',
  243. show: false,
  244. border: true,
  245. stationList:[],
  246. stationListSon:[],
  247. actionSheetList: [
  248. {
  249. text: '男'
  250. },
  251. {
  252. text: '女'
  253. },
  254. {
  255. text: '保密'
  256. }
  257. ],
  258. }
  259. },
  260. components: {
  261. Tabbar
  262. },
  263. onReachBottom() {
  264. this.myLoadmore();
  265. },
  266. onShow() {
  267. if(this.$refs.tabbarMain){
  268. this.$refs.tabbarMain.setcount(1);
  269. }
  270. },
  271. onLoad() {
  272. },
  273. onReady() {
  274. this.getList()
  275. this.getList2()
  276. this.getStation()
  277. },
  278. methods: {
  279. change(index) {
  280. this.current = index;
  281. },
  282. changedate(e) {
  283. this.startTime = e.startDate
  284. this.endTime = e.endDate
  285. },
  286. resetBtn(){
  287. this.startTime=""
  288. this.endTime=""
  289. this.selecttype=""
  290. this.selectstationId=""
  291. this.selectdeviceNo=""
  292. this.pageIndex = 1;
  293. this.form = {
  294. startDate:"",
  295. endDate:"",
  296. pageIndex: this.pageIndex,
  297. type:this.selecttype,
  298. stationId:this.selectstationId,
  299. deviceNo:this.selectdeviceNo,
  300. };
  301. this.popupShow=false;
  302. this.list = [];
  303. this.getList()
  304. },
  305. okbtn(){
  306. this.popupShow=false;
  307. this.pageIndex = 1;
  308. this.form = {
  309. startDate:this.startTime,
  310. endDate:this.endTime,
  311. pageIndex: this.pageIndex,
  312. type:this.selecttype,
  313. stationId:this.selectstationId,
  314. deviceNo:this.selectdeviceNo,
  315. };
  316. this.list = [];
  317. this.getList()
  318. },
  319. getList() {
  320. uni.showLoading({
  321. title: "加载中",
  322. mask: true,
  323. })
  324. this.form.pageIndex=this.pageIndex
  325. this.form.pageSize=20
  326. API.incomeList(this.form).then((res) => {
  327. var showMap=new Map()
  328. this.list = [
  329. ...this.list,
  330. ...res.data.data
  331. ];
  332. this.list.forEach(item=>{
  333. if(item.endTime){
  334. var ktime=item.endTime.split(" ")[0]
  335. if(showMap.has(ktime)){
  336. item.show=false;
  337. }else{
  338. var Amount=item.totalAmount
  339. var num=item.totalNum
  340. showMap.set(ktime,{
  341. amount:Amount,
  342. num:num
  343. })
  344. item.show=true;
  345. item.showtime=ktime;
  346. }
  347. }
  348. })
  349. this.showMap=showMap;
  350. this.recordsTotal = res.data.recordsTotal
  351. uni.hideLoading()
  352. }).catch(error => {
  353. uni.showToast({
  354. title: error
  355. })
  356. })
  357. },
  358. getList2() {
  359. uni.showLoading({
  360. title: "加载中",
  361. mask: true,
  362. })
  363. API.buyCardList({
  364. pageIndex:this.pageIndex2,
  365. pageSize:20
  366. }).then((res) => {
  367. var showMap=new Map()
  368. this.showMap2=showMap;
  369. this.list2 = [
  370. ...this.list2,
  371. ...res.data.data
  372. ];
  373. this.list2.forEach(item=>{
  374. if(item.createTime){
  375. var ktime=item.createTime.split(" ")[0]
  376. if(showMap.has(ktime)){
  377. item.show=false;
  378. }else{
  379. var Amount=item.totalAmount
  380. var num=item.totalNum
  381. showMap.set(ktime,{
  382. amount:Amount,
  383. num:num
  384. })
  385. item.show=true;
  386. item.showtime=ktime;
  387. }
  388. }
  389. })
  390. this.showMap2=showMap;
  391. this.recordsTotal2 = res.data.recordsTotal
  392. uni.hideLoading()
  393. }).catch(error => {
  394. uni.showToast({
  395. title: error
  396. })
  397. })
  398. },
  399. getStation(bl) {
  400. API.stationList().then((res) => {
  401. this.stationList = res.data.stationList
  402. this.stationListSon=res.data.deviceList
  403. }).catch(error => {
  404. uni.showToast({
  405. title: error
  406. })
  407. })
  408. },
  409. myLoadmore() {
  410. if(this.current==0){
  411. if (this.list.length < this.recordsTotal) {
  412. this.pageIndex += 1;
  413. this.getList()
  414. }
  415. }else{
  416. if (this.list2.length < this.recordsTotal2) {
  417. this.pageIndex2 += 1;
  418. this.getList2()
  419. }
  420. }
  421. },
  422. // 点击actionSheet回调
  423. actionSheetCallback(index) {
  424. this.value = this.actionSheetList[index].text;
  425. }
  426. }
  427. }
  428. </script>
  429. <style>
  430. page{
  431. background-color: #F7F7F7;
  432. }
  433. </style>
  434. <style lang="scss" scoped>
  435. .product_tip{
  436. position: absolute;
  437. top: 0;
  438. right: 0;
  439. width: 26px;
  440. height: 26px;
  441. text-align: right;
  442. p{
  443. font-size: 24rpx;
  444. color: #ffffff;
  445. transform: rotate(45deg);
  446. position: relative;
  447. top: 0rpx;
  448. right: 0rpx;
  449. }
  450. .product_tip_bg{
  451. width: 0;
  452. height: 0;
  453. border-bottom: 48rpx solid #FD662A;
  454. border-right: 48rpx solid transparent;
  455. border-left: 48rpx solid transparent;
  456. transform: rotate(45deg);
  457. position: absolute;
  458. top: -7rpx;
  459. right: -29rpx;
  460. }
  461. }
  462. .popup-screen{
  463. padding: 20px;
  464. position: relative;
  465. .screen{
  466. padding-bottom: 30px;
  467. }
  468. .screen-item{
  469. margin-bottom: 20px;
  470. .screen-head{
  471. margin-bottom: 8px;
  472. font-size: 16px;
  473. }
  474. .screen-main{
  475. display: flex;
  476. // display: -webkit-box;
  477. flex-wrap: wrap;
  478. }
  479. .screen-entry{
  480. width: 29%;
  481. padding:6px 0;
  482. display: flex;
  483. align-items: center;
  484. justify-content: center;
  485. background-color: #F2F5FA ;
  486. text-align: center;
  487. margin-bottom: 10px;
  488. border-radius: 3px;
  489. margin-right: 6px;
  490. }
  491. .screen-entry.active{
  492. background-color: #185AC6;
  493. color:#fff;
  494. }
  495. }
  496. .screen-foot{
  497. position: fixed;
  498. left: 0;
  499. right: 0;
  500. bottom: 0;
  501. display: flex;
  502. height:50px;
  503. border-top: 1px solid #ededed;
  504. .screen-btn-l{
  505. background-color: #fff;
  506. flex: 0.2;
  507. text-align: center;
  508. line-height: 50px;
  509. }
  510. .screen-btn-r{
  511. flex: 0.8;
  512. text-align: center;
  513. line-height: 50px;
  514. background-color: #185AC6;
  515. color:#fff;
  516. }
  517. }
  518. }
  519. .navbar{
  520. display: flex;
  521. justify-content: space-between;
  522. flex: 1;
  523. padding: 0 15px;
  524. }
  525. .navbar-tit{
  526. font-size: 20px;
  527. }
  528. .navbar-screen{
  529. display: flex;
  530. align-items: center;
  531. span{
  532. margin-right: 2px;
  533. color:#999;
  534. }
  535. }
  536. .detailed-time{
  537. display: flex;
  538. justify-content: space-between;
  539. align-items: center;
  540. padding: 10px 20px;
  541. font-size: 16px;
  542. p{
  543. color:#666;
  544. }
  545. }
  546. .detailed-item{
  547. background-color: #fff;
  548. display: flex;
  549. justify-content: space-between;
  550. padding: 10px 20px;
  551. border-bottom: 1px solid #ededed;
  552. position: relative;
  553. .sign{
  554. width: 32px;
  555. height: 32px;
  556. position: absolute;
  557. top: 0;
  558. right: 0;
  559. img{
  560. width: 100%;
  561. }
  562. }
  563. .detailed-item-name{
  564. h4{
  565. font-weight: normal;
  566. }
  567. span{
  568. font-size: 15px;
  569. }
  570. p{
  571. font-size: 15px;
  572. margin-top: 4px;
  573. color:#A2A9B5;
  574. }
  575. }
  576. .detailed-item-num{
  577. display: flex;
  578. align-items: center;
  579. h2{
  580. margin-right: 4px;
  581. }
  582. }
  583. }
  584. .showName{
  585. font-weight: unset;
  586. font-weight: unset;
  587. overflow: hidden;
  588. text-overflow: ellipsis;
  589. white-space: nowrap;
  590. font-size: 16px;
  591. }
  592. .u-tabs{
  593. /deep/.uni-scroll-view-content {
  594. width: 56.2% !important;
  595. margin: auto;
  596. }
  597. }
  598. /deep/.u-tab-bar {
  599. background-color: #0076FF !important;
  600. }
  601. </style>