index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  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 :list="tabList" :is-scroll="false" :current="current" @change="change" inactive-color="#acb2af"
  94. active-color="#101010"></u-tabs>
  95. <view class="detailed" v-show="current==0" >
  96. <view style="text-align: center;margin-top: 100px" v-if="!list.length">
  97. <img src="@/assets/img/blankpage.png">
  98. <view>查询为空</view>
  99. </view>
  100. <view class="detailed-list" v-for="(item ,index) in list"
  101. @click="gotoUrl('pagesFinance/detailed/details?id='+item.id)"
  102. :key="index">
  103. <view class="detailed-time" v-if="item.show">
  104. <p>{{item.showtime}}</p>
  105. <p v-if="showMap">共收{{showMap.get(item.showtime).num}}笔,{{showMap.get(item.showtime).amount}}元</p>
  106. </view>
  107. <view class="detailed-item">
  108. <view class="detailed-item-name" style="
  109. width: 70%;
  110. ">
  111. <h2 class="showName">{{item.stationName}}/{{item.deviceName}}</h2>
  112. <p>{{item.flowNo?item.flowNo:'无充电单号'}}</p>
  113. </view>
  114. <view class="detailed-item-name" style="
  115. min-width: 60px;
  116. width: 30%;
  117. ">
  118. <h2 style=" text-align: end;">{{item.actualFee?item.actualFee:0}}元</h2>
  119. <p style=" text-align: end;" >{{item.endTime?item.endTime.slice(11):''}}</p>
  120. </view>
  121. </view>
  122. </view>
  123. <u-divider v-if="list.length&&list.length == recordsTotal" color="#B6BDC3" style="margin-top:20px;" bg-color="#f4f0f0">已经到底了</u-divider>
  124. </view>
  125. <!-- 包月卡 -->
  126. <view class="" v-show="current==1">
  127. <view class="detailed-list" v-for="(item ,index) in list2"
  128. @click="gotoUrl('pagesFinance/detailed/monthlyCardDetails?id='+item.id)"
  129. :key="index" >
  130. <view class="detailed-time" v-if="item.show" >
  131. <p>{{item.showtime}}</p>
  132. <p v-if="showMap2">今日办卡{{showMap2.get(item.showtime).amount}}元,{{showMap2.get(item.showtime).num}}笔</p>
  133. </view>
  134. <view class="detailed-item">
  135. <view class="detailed-item-name" style="
  136. width: 70%;
  137. ">
  138. <h2 class="showName">{{item.monthlyRentName}}</h2>
  139. <p>{{item.payTime?item.payTime.slice(11):''}}</p>
  140. </view>
  141. <view class="detailed-item-name" style="
  142. min-width: 60px;
  143. width: 30%;
  144. font-size: 16px;
  145. text-align: right;
  146. ">
  147. <h2>{{item.payFee}}元</h2>
  148. </view>
  149. <!-- <view class="sign">
  150. <img src="../../assets/img/tixian.png" alt="">
  151. </view> -->
  152. </view>
  153. </view>
  154. </view>
  155. <Tabbar :current="1" ref="tabbarMain"></Tabbar>
  156. </view>
  157. </template>
  158. <script>
  159. import Tabbar from '@/components/TabbarFinance.vue'
  160. import * as API from '@/apis/finance.js'
  161. // import {
  162. // beforeTimeStamp,
  163. // currentTimeStamp,
  164. // parseUnixTime
  165. // } from '@/utils'
  166. export default {
  167. data() {
  168. return {
  169. showdate: false,
  170. startTime: "",
  171. endTime: "",
  172. selecttype:"",
  173. selectstationId:"",
  174. selectdeviceNo:"",
  175. title:"",
  176. form:{
  177. },
  178. // current: 0,
  179. tabList: [{
  180. name: '充电订单'
  181. }, {
  182. name: '月卡订单'
  183. }],
  184. pageIndex: 1,
  185. recordsTotal: 0,
  186. list: [],
  187. pageIndex2: 1,
  188. recordsTotal2: 0,
  189. list2: [],
  190. popupShow: false,
  191. tabbarList: [{
  192. iconPath: "bar-chart-box-fill",
  193. selectedIconPath: "bar-chart-box-fill",
  194. text: '统计',
  195. count: 0,
  196. isDot: true,
  197. customIcon: true,
  198. },
  199. {
  200. iconPath: "article-fill",
  201. selectedIconPath: "article-fill",
  202. text: '明细',
  203. midButton: true,
  204. customIcon: true,
  205. },
  206. {
  207. iconPath: "account-pin-box-fill",
  208. selectedIconPath: "account-pin-box-fill",
  209. text: '我的',
  210. count: 0,
  211. isDot: false,
  212. customIcon: true,
  213. },
  214. ],
  215. showMap:null,
  216. showMap2:null,
  217. current: 0,
  218. value: '',
  219. type: 'select',
  220. show: false,
  221. border: true,
  222. stationList:[],
  223. stationListSon:[],
  224. actionSheetList: [
  225. {
  226. text: '男'
  227. },
  228. {
  229. text: '女'
  230. },
  231. {
  232. text: '保密'
  233. }
  234. ],
  235. }
  236. },
  237. components: {
  238. Tabbar
  239. },
  240. onReachBottom() {
  241. if (this.list.length < this.recordsTotal) {
  242. this.myLoadmore();
  243. }
  244. },
  245. onShow() {
  246. if(this.$refs.tabbarMain){
  247. this.$refs.tabbarMain.setcount(1);
  248. }
  249. },
  250. onLoad() {
  251. },
  252. onReady() {
  253. this.getList()
  254. this.getList2()
  255. this.getStation()
  256. },
  257. methods: {
  258. change(index) {
  259. this.current = index;
  260. },
  261. changedate(e) {
  262. this.startTime = e.startDate
  263. this.endTime = e.endDate
  264. },
  265. resetBtn(){
  266. this.startTime=""
  267. this.endTime=""
  268. this.selecttype=""
  269. this.selectstationId=""
  270. this.selectdeviceNo=""
  271. this.pageIndex = 1;
  272. this.form = {
  273. startDate:"",
  274. endDate:"",
  275. pageIndex: this.pageIndex,
  276. type:this.selecttype,
  277. stationId:this.selectstationId,
  278. deviceNo:this.selectdeviceNo,
  279. };
  280. this.popupShow=false;
  281. this.list = [];
  282. this.getList()
  283. },
  284. okbtn(){
  285. this.popupShow=false;
  286. this.pageIndex = 1;
  287. this.form = {
  288. startDate:this.startTime,
  289. endDate:this.endTime,
  290. pageIndex: this.pageIndex,
  291. type:this.selecttype,
  292. stationId:this.selectstationId,
  293. deviceNo:this.selectdeviceNo,
  294. };
  295. this.list = [];
  296. this.getList()
  297. },
  298. getList() {
  299. uni.showLoading({
  300. title: "加载中",
  301. mask: true,
  302. })
  303. this.form.pageIndex=this.pageIndex
  304. this.form.pageSize=20
  305. API.incomeList(this.form).then((res) => {
  306. var showMap=new Map()
  307. this.list = [
  308. ...this.list,
  309. ...res.data.data
  310. ];
  311. this.list.forEach(item=>{
  312. if(item.endTime){
  313. var ktime=item.endTime.split(" ")[0]
  314. if(showMap.has(ktime)){
  315. item.show=false;
  316. }else{
  317. var Amount=item.totalAmount
  318. var num=item.totalNum
  319. showMap.set(ktime,{
  320. amount:Amount,
  321. num:num
  322. })
  323. item.show=true;
  324. item.showtime=ktime;
  325. }
  326. }
  327. })
  328. this.showMap=showMap;
  329. this.recordsTotal = res.data.recordsTotal
  330. uni.hideLoading()
  331. }).catch(error => {
  332. uni.showToast({
  333. title: error
  334. })
  335. })
  336. },
  337. getList2() {
  338. uni.showLoading({
  339. title: "加载中",
  340. mask: true,
  341. })
  342. API.buyCardList({
  343. pageIndex:this.pageIndex2,
  344. pageSize:20
  345. }).then((res) => {
  346. var showMap=new Map()
  347. this.showMap2=showMap;
  348. this.list2 = [
  349. ...this.list2,
  350. ...res.data.data
  351. ];
  352. this.list2.forEach(item=>{
  353. if(item.createTime){
  354. var ktime=item.createTime.split(" ")[0]
  355. if(showMap.has(ktime)){
  356. item.show=false;
  357. }else{
  358. var Amount=item.totalAmount
  359. var num=item.totalNum
  360. showMap.set(ktime,{
  361. amount:Amount,
  362. num:num
  363. })
  364. item.show=true;
  365. item.showtime=ktime;
  366. }
  367. }
  368. })
  369. this.showMap2=showMap;
  370. this.recordsTotal2 = res.data.recordsTotal
  371. uni.hideLoading()
  372. }).catch(error => {
  373. uni.showToast({
  374. title: error
  375. })
  376. })
  377. },
  378. getStation(bl) {
  379. API.stationList().then((res) => {
  380. this.stationList = res.data.stationList
  381. this.stationListSon=res.data.deviceList
  382. }).catch(error => {
  383. uni.showToast({
  384. title: error
  385. })
  386. })
  387. },
  388. myLoadmore() {
  389. this.pageIndex += 1;
  390. this.getList()
  391. },
  392. // 点击actionSheet回调
  393. actionSheetCallback(index) {
  394. this.value = this.actionSheetList[index].text;
  395. }
  396. }
  397. }
  398. </script>
  399. <style>
  400. page{
  401. background-color: #F7F7F7;
  402. }
  403. </style>
  404. <style lang="scss" scoped>
  405. .popup-screen{
  406. padding: 20px;
  407. position: relative;
  408. .screen{
  409. padding-bottom: 30px;
  410. }
  411. .screen-item{
  412. margin-bottom: 20px;
  413. .screen-head{
  414. margin-bottom: 8px;
  415. font-size: 16px;
  416. }
  417. .screen-main{
  418. display: flex;
  419. // display: -webkit-box;
  420. flex-wrap: wrap;
  421. }
  422. .screen-entry{
  423. width: 29%;
  424. padding:6px 0;
  425. display: flex;
  426. align-items: center;
  427. justify-content: center;
  428. background-color: #F2F5FA ;
  429. text-align: center;
  430. margin-bottom: 10px;
  431. border-radius: 3px;
  432. margin-right: 6px;
  433. }
  434. .screen-entry.active{
  435. background-color: #185AC6;
  436. color:#fff;
  437. }
  438. }
  439. .screen-foot{
  440. position: fixed;
  441. left: 0;
  442. right: 0;
  443. bottom: 0;
  444. display: flex;
  445. height:50px;
  446. border-top: 1px solid #ededed;
  447. .screen-btn-l{
  448. background-color: #fff;
  449. flex: 0.2;
  450. text-align: center;
  451. line-height: 50px;
  452. }
  453. .screen-btn-r{
  454. flex: 0.8;
  455. text-align: center;
  456. line-height: 50px;
  457. background-color: #185AC6;
  458. color:#fff;
  459. }
  460. }
  461. }
  462. .navbar{
  463. display: flex;
  464. justify-content: space-between;
  465. flex: 1;
  466. padding: 0 15px;
  467. }
  468. .navbar-tit{
  469. font-size: 20px;
  470. }
  471. .navbar-screen{
  472. display: flex;
  473. align-items: center;
  474. span{
  475. margin-right: 2px;
  476. color:#999;
  477. }
  478. }
  479. .detailed-time{
  480. display: flex;
  481. justify-content: space-between;
  482. align-items: center;
  483. padding: 10px 20px;
  484. font-size: 16px;
  485. p{
  486. color:#666;
  487. }
  488. }
  489. .detailed-item{
  490. background-color: #fff;
  491. display: flex;
  492. justify-content: space-between;
  493. padding: 10px 20px;
  494. border-bottom: 1px solid #ededed;
  495. .detailed-item-name{
  496. h4{
  497. font-weight: normal;
  498. }
  499. p{
  500. font-size: 15px;
  501. margin-top: 4px;
  502. color:#A2A9B5;
  503. }
  504. }
  505. .detailed-item-num{
  506. display: flex;
  507. align-items: center;
  508. h2{
  509. margin-right: 4px;
  510. }
  511. }
  512. }
  513. .showName{
  514. font-weight: unset;
  515. font-weight: unset;
  516. overflow: hidden;
  517. text-overflow: ellipsis;
  518. white-space: nowrap;
  519. font-size: 16px;
  520. }
  521. </style>