index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  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" @click="popupShow = true"><span>筛选</span><u-icon name="filter-2-fill" custom-prefix="custom-icon" color="#b0b8c8" size="32"></u-icon></view>
  7. </view>
  8. </u-navbar>
  9. <u-popup v-model="popupShow" mode="top" height="80%" >
  10. <view class="popup-screen">
  11. <view class="screen">
  12. <view class="screen-item">
  13. <view class="screen-head">查询日期</view>
  14. <view class="screen-main2">
  15. <u-calendar v-model="showdate" mode="range" @change="changedate"></u-calendar>
  16. <u-input :value="startTime?startTime+'至'+endTime:'选择时间筛选'" :type="type" :border="border" @click="showdate = true" />
  17. <!--
  18. <u-action-sheet :list="actionSheetList" v-model="show" @click="actionSheetCallback"></u-action-sheet>
  19. --></view>
  20. </view>
  21. <view class="screen-item">
  22. <view class="screen-head">充电桩类型</view>
  23. <view class="screen-main">
  24. <view
  25. :class="{
  26. active:selecttype==''
  27. }" @click="selecttype=''"
  28. class="screen-entry ">全部</view>
  29. <view
  30. :class="{
  31. active:selecttype=='0'
  32. }" @click="selecttype='0'"
  33. class="screen-entry type1">自行车充电</view>
  34. <view
  35. :class="{
  36. active:selecttype=='2'
  37. }" @click="selecttype='2'"
  38. class="screen-entry type3">交流慢充</view>
  39. <view
  40. :class="{
  41. active:selecttype=='1'
  42. }" @click="selecttype='1'"
  43. class="screen-entry type2">直流快充</view>
  44. </view>
  45. </view>
  46. <view class="screen-item">
  47. <view class="screen-head">站点</view>
  48. <view class="screen-main">
  49. <view class="screen-entry "
  50. :class="{
  51. active:selectstationId==''
  52. }"
  53. @click="selectstationId=''"
  54. >全部</view>
  55. <view
  56. v-for="(item,i) in stationList" :key="i"
  57. :class="{
  58. active:selectstationId==item.id
  59. }"
  60. @click="selectstationId=item.id,selectdeviceNo=''"
  61. class="screen-entry" >{{item.name}}</view>
  62. </view>
  63. </view>
  64. <view
  65. class="screen-item">
  66. <view class="screen-head">桩号</view>
  67. <view class="screen-main">
  68. <view class="screen-entry "
  69. :class="{
  70. active:selectdeviceNo==''
  71. }"
  72. @click="selectdeviceNo=''"
  73. >全部</view>
  74. <view
  75. v-for="(item,i) in stationListSon" :key="i"
  76. v-show="selectstationId?(selectstationId==item.stationId):true"
  77. :class="{
  78. active:selectdeviceNo==item.deviceNo
  79. }"
  80. @click="selectdeviceNo=item.deviceNo"
  81. class="screen-entry" >{{item.name}}</view>
  82. </view>
  83. </view>
  84. </view>
  85. <view class="screen-foot">
  86. <view class="screen-btn-l" @click="resetBtn" >重置</view>
  87. <view class="screen-btn-r" @click="okbtn" >确定</view>
  88. </view>
  89. </view>
  90. </u-popup>
  91. <view class="detailed">
  92. <view style="text-align: center;margin-top: 100px" v-if="!list.length">
  93. <img src="@/assets/img/blankpage.png">
  94. <view>查询为空</view>
  95. </view>
  96. <view class="detailed-list" v-for="(item ,index) in list"
  97. @click="gotoUrl('pagesFinance/detailed/details?id='+item.id)"
  98. :key="index">
  99. <view class="detailed-time" v-if="item.show">
  100. <p>{{item.showtime}}</p>
  101. <p>共收{{showMap.get(item.showtime).num}}笔,{{showMap.get(item.showtime).amount}}元</p>
  102. </view>
  103. <view class="detailed-item">
  104. <view class="detailed-item-name" style="
  105. width: 70%;
  106. ">
  107. <h2 class="showName">{{item.stationName}}/{{item.deviceName}}</h2>
  108. <p>{{item.flowNo?item.flowNo:'无充电单号'}}</p>
  109. </view>
  110. <view class="detailed-item-name" style="
  111. min-width: 60px;
  112. width: 30%;
  113. ">
  114. <h2 style=" text-align: end;">{{item.actualFee?item.actualFee:0}}元</h2>
  115. <p style=" text-align: end;" >{{item.endTime?item.endTime.slice(11):''}}</p>
  116. </view>
  117. </view>
  118. </view>
  119. <u-divider v-if="list.length&&list.length == recordsTotal" color="#B6BDC3" style="margin-top:20px;" bg-color="#f4f0f0">已经到底了</u-divider>
  120. </view>
  121. <Tabbar :current="1" ref="tabbarMain"></Tabbar>
  122. </view>
  123. </template>
  124. <script>
  125. import Tabbar from '@/components/TabbarFinance.vue'
  126. import * as API from '@/apis/finance.js'
  127. // import {
  128. // beforeTimeStamp,
  129. // currentTimeStamp,
  130. // parseUnixTime
  131. // } from '@/utils'
  132. export default {
  133. data() {
  134. return {
  135. showdate: false,
  136. startTime: "",
  137. endTime: "",
  138. selecttype:"",
  139. selectstationId:"",
  140. selectdeviceNo:"",
  141. title:"",
  142. form:{
  143. },
  144. pageIndex: 1,
  145. recordsTotal: 0,
  146. list: [],
  147. popupShow: false,
  148. tabbarList: [{
  149. iconPath: "bar-chart-box-fill",
  150. selectedIconPath: "bar-chart-box-fill",
  151. text: '统计',
  152. count: 0,
  153. isDot: true,
  154. customIcon: true,
  155. },
  156. {
  157. iconPath: "article-fill",
  158. selectedIconPath: "article-fill",
  159. text: '明细',
  160. midButton: true,
  161. customIcon: true,
  162. },
  163. {
  164. iconPath: "account-pin-box-fill",
  165. selectedIconPath: "account-pin-box-fill",
  166. text: '我的',
  167. count: 0,
  168. isDot: false,
  169. customIcon: true,
  170. },
  171. ],
  172. showMap:null,
  173. current: 0,
  174. value: '',
  175. type: 'select',
  176. show: false,
  177. border: true,
  178. stationList:[],
  179. stationListSon:[],
  180. actionSheetList: [
  181. {
  182. text: '男'
  183. },
  184. {
  185. text: '女'
  186. },
  187. {
  188. text: '保密'
  189. }
  190. ],
  191. }
  192. },
  193. components: {
  194. Tabbar
  195. },
  196. onReachBottom() {
  197. if (this.list.length < this.recordsTotal) {
  198. this.myLoadmore();
  199. }
  200. },
  201. onShow() {
  202. if(this.$refs.tabbarMain){
  203. this.$refs.tabbarMain.setcount(1);
  204. }
  205. },
  206. onLoad() {
  207. },
  208. onReady() {
  209. this.getList()
  210. this.getStation()
  211. },
  212. methods: {
  213. changedate(e) {
  214. this.startTime = e.startDate
  215. this.endTime = e.endDate
  216. },
  217. resetBtn(){
  218. this.startTime=""
  219. this.endTime=""
  220. this.selecttype=""
  221. this.selectstationId=""
  222. this.selectdeviceNo=""
  223. this.pageIndex = 1;
  224. this.form = {
  225. startDate:"",
  226. endDate:"",
  227. pageIndex: this.pageIndex,
  228. type:this.selecttype,
  229. stationId:this.selectstationId,
  230. deviceNo:this.selectdeviceNo,
  231. };
  232. this.popupShow=false;
  233. this.list = [];
  234. this.getList()
  235. },
  236. okbtn(){
  237. this.popupShow=false;
  238. this.pageIndex = 1;
  239. this.form = {
  240. startDate:this.startTime,
  241. endDate:this.endTime,
  242. pageIndex: this.pageIndex,
  243. type:this.selecttype,
  244. stationId:this.selectstationId,
  245. deviceNo:this.selectdeviceNo,
  246. };
  247. this.list = [];
  248. this.getList()
  249. },
  250. getList() {
  251. uni.showLoading({
  252. title: "加载中",
  253. mask: true,
  254. })
  255. this.form.pageIndex=this.pageIndex
  256. this.form.pageSize=20
  257. API.incomeList(this.form).then((res) => {
  258. this.list = [
  259. ...this.list,
  260. ...res.data.data
  261. ];
  262. var showMap=new Map()
  263. this.list.forEach(item=>{
  264. if(item.endTime){
  265. var ktime=item.endTime.split(" ")[0]
  266. if(showMap.has(ktime)){
  267. item.show=false;
  268. }else{
  269. var Amount=item.totalAmount
  270. var num=item.totalNum
  271. showMap.set(ktime,{
  272. amount:Amount,
  273. num:num
  274. })
  275. item.show=true;
  276. item.showtime=ktime;
  277. }
  278. }
  279. })
  280. this.showMap=showMap;
  281. this.recordsTotal = res.data.recordsTotal
  282. uni.hideLoading()
  283. }).catch(error => {
  284. uni.showToast({
  285. title: error
  286. })
  287. })
  288. },
  289. getStation(bl) {
  290. API.stationList().then((res) => {
  291. this.stationList = res.data.stationList
  292. this.stationListSon=res.data.deviceList
  293. }).catch(error => {
  294. uni.showToast({
  295. title: error
  296. })
  297. })
  298. },
  299. myLoadmore() {
  300. this.pageIndex += 1;
  301. this.getList()
  302. },
  303. // 点击actionSheet回调
  304. actionSheetCallback(index) {
  305. this.value = this.actionSheetList[index].text;
  306. }
  307. }
  308. }
  309. </script>
  310. <style>
  311. page{
  312. background-color: #F7F7F7;
  313. }
  314. </style>
  315. <style lang="scss" scoped>
  316. .popup-screen{
  317. padding: 20px;
  318. position: relative;
  319. .screen{
  320. padding-bottom: 30px;
  321. }
  322. .screen-item{
  323. margin-bottom: 20px;
  324. .screen-head{
  325. margin-bottom: 8px;
  326. font-size: 16px;
  327. }
  328. .screen-main{
  329. display: flex;
  330. // display: -webkit-box;
  331. flex-wrap: wrap;
  332. }
  333. .screen-entry{
  334. width: 29%;
  335. padding:6px 0;
  336. display: flex;
  337. align-items: center;
  338. justify-content: center;
  339. background-color: #F2F5FA ;
  340. text-align: center;
  341. margin-bottom: 10px;
  342. border-radius: 3px;
  343. margin-right: 6px;
  344. }
  345. .screen-entry.active{
  346. background-color: #185AC6;
  347. color:#fff;
  348. }
  349. }
  350. .screen-foot{
  351. position: fixed;
  352. left: 0;
  353. right: 0;
  354. bottom: 0;
  355. display: flex;
  356. height:50px;
  357. border-top: 1px solid #ededed;
  358. .screen-btn-l{
  359. background-color: #fff;
  360. flex: 0.2;
  361. text-align: center;
  362. line-height: 50px;
  363. }
  364. .screen-btn-r{
  365. flex: 0.8;
  366. text-align: center;
  367. line-height: 50px;
  368. background-color: #185AC6;
  369. color:#fff;
  370. }
  371. }
  372. }
  373. .navbar{
  374. display: flex;
  375. justify-content: space-between;
  376. flex: 1;
  377. padding: 0 15px;
  378. }
  379. .navbar-tit{
  380. font-size: 20px;
  381. }
  382. .navbar-screen{
  383. display: flex;
  384. align-items: center;
  385. span{
  386. margin-right: 2px;
  387. color:#999;
  388. }
  389. }
  390. .detailed-time{
  391. display: flex;
  392. justify-content: space-between;
  393. align-items: center;
  394. padding: 10px 20px;
  395. font-size: 16px;
  396. p{
  397. color:#666;
  398. }
  399. }
  400. .detailed-item{
  401. background-color: #fff;
  402. display: flex;
  403. justify-content: space-between;
  404. padding: 10px 20px;
  405. border-bottom: 1px solid #ededed;
  406. .detailed-item-name{
  407. h4{
  408. font-weight: normal;
  409. }
  410. p{
  411. font-size: 15px;
  412. margin-top: 4px;
  413. color:#A2A9B5;
  414. }
  415. }
  416. .detailed-item-num{
  417. display: flex;
  418. align-items: center;
  419. h2{
  420. margin-right: 4px;
  421. }
  422. }
  423. }
  424. .showName{
  425. font-weight: unset;
  426. font-weight: unset;
  427. overflow: hidden;
  428. text-overflow: ellipsis;
  429. white-space: nowrap;
  430. font-size: 16px;
  431. }
  432. </style>