index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  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">
  105. <h2>{{item.flowNo?item.flowNo:'无充电单号'}}</h2>
  106. <p>{{item.stationName}}/{{item.deviceName}}</p>
  107. </view>
  108. <view class="detailed-item-name" style="
  109. width: 80px;
  110. ">
  111. <h2 style=" text-align: end;">{{item.actualFee?item.actualFee:0}}元</h2>
  112. <p style=" text-align: end;" >{{item.endTime?item.endTime.slice(11):''}}</p>
  113. </view>
  114. </view>
  115. </view>
  116. <u-divider v-if="list.length&&list.length == recordsTotal" color="#B6BDC3" style="margin-top:20px;" bg-color="#f4f0f0">已经到底了</u-divider>
  117. </view>
  118. <Tabbar :current="1" ref="tabbarMain"></Tabbar>
  119. </view>
  120. </template>
  121. <script>
  122. import Tabbar from '@/components/TabbarFinance.vue'
  123. import * as API from '@/apis/finance.js'
  124. // import {
  125. // beforeTimeStamp,
  126. // currentTimeStamp,
  127. // parseUnixTime
  128. // } from '@/utils'
  129. export default {
  130. data() {
  131. return {
  132. showdate: false,
  133. startTime: "",
  134. endTime: "",
  135. selecttype:"",
  136. selectstationId:"",
  137. selectdeviceNo:"",
  138. title:"",
  139. form:{
  140. },
  141. pageIndex: 1,
  142. recordsTotal: 0,
  143. list: [],
  144. popupShow: false,
  145. tabbarList: [{
  146. iconPath: "bar-chart-box-fill",
  147. selectedIconPath: "bar-chart-box-fill",
  148. text: '统计',
  149. count: 0,
  150. isDot: true,
  151. customIcon: true,
  152. },
  153. {
  154. iconPath: "article-fill",
  155. selectedIconPath: "article-fill",
  156. text: '明细',
  157. midButton: true,
  158. customIcon: true,
  159. },
  160. {
  161. iconPath: "account-pin-box-fill",
  162. selectedIconPath: "account-pin-box-fill",
  163. text: '我的',
  164. count: 0,
  165. isDot: false,
  166. customIcon: true,
  167. },
  168. ],
  169. showMap:null,
  170. current: 0,
  171. value: '',
  172. type: 'select',
  173. show: false,
  174. border: true,
  175. stationList:[],
  176. stationListSon:[],
  177. actionSheetList: [
  178. {
  179. text: '男'
  180. },
  181. {
  182. text: '女'
  183. },
  184. {
  185. text: '保密'
  186. }
  187. ],
  188. }
  189. },
  190. components: {
  191. Tabbar
  192. },
  193. onReachBottom() {
  194. if (this.list.length < this.recordsTotal) {
  195. this.myLoadmore();
  196. }
  197. },
  198. onShow() {
  199. if(this.$refs.tabbarMain){
  200. this.$refs.tabbarMain.setcount(1);
  201. }
  202. },
  203. onLoad() {
  204. },
  205. onReady() {
  206. // this.startDate=parseUnixTime(beforeTimeStamp(5),"{y}-{m}-{d}")
  207. // this.endDate=parseUnixTime(new Date(),"{y}-{m}-{d}")
  208. this.getList()
  209. this.getStation()
  210. },
  211. methods: {
  212. changedate(e) {
  213. this.startTime = e.startDate
  214. this.endTime = e.endDate
  215. },
  216. resetBtn(){
  217. this.startTime=""
  218. this.endTime=""
  219. this.selecttype=""
  220. this.selectstationId=""
  221. this.selectdeviceNo=""
  222. this.pageIndex = 1;
  223. this.form = {
  224. startDate:"",
  225. endDate:"",
  226. pageIndex: this.pageIndex,
  227. type:this.selecttype,
  228. stationId:this.selectstationId,
  229. deviceNo:this.selectdeviceNo,
  230. };
  231. this.popupShow=false;
  232. this.list = [];
  233. this.getList()
  234. },
  235. okbtn(){
  236. this.popupShow=false;
  237. this.pageIndex = 1;
  238. this.form = {
  239. startDate:this.startTime,
  240. endDate:this.endTime,
  241. pageIndex: this.pageIndex,
  242. type:this.selecttype,
  243. stationId:this.selectstationId,
  244. deviceNo:this.selectdeviceNo,
  245. };
  246. this.list = [];
  247. this.getList()
  248. },
  249. getList() {
  250. uni.showLoading({
  251. title: "加载中",
  252. mask: true,
  253. })
  254. this.form.pageIndex=this.pageIndex
  255. this.form.pageSize=20
  256. API.incomeList(this.form).then((res) => {
  257. this.list = [
  258. ...this.list,
  259. ...res.data.data
  260. ];
  261. var showMap=new Map()
  262. this.list.forEach(item=>{
  263. var ktime=item.endTime.split(" ")[0]
  264. if(showMap.has(ktime)){
  265. item.show=false;
  266. }else{
  267. var Amount=item.totalAmount
  268. var num=item.totalNum
  269. showMap.set(ktime,{
  270. amount:Amount,
  271. num:num
  272. })
  273. item.show=true;
  274. item.showtime=ktime;
  275. }
  276. })
  277. this.showMap=showMap;
  278. this.recordsTotal = res.data.recordsTotal
  279. uni.hideLoading()
  280. }).catch(error => {
  281. uni.showToast({
  282. title: error
  283. })
  284. })
  285. },
  286. getStation(bl) {
  287. API.stationList().then((res) => {
  288. this.stationList = res.data.stationList
  289. this.stationListSon=res.data.deviceList
  290. }).catch(error => {
  291. uni.showToast({
  292. title: error
  293. })
  294. })
  295. },
  296. myLoadmore() {
  297. this.pageIndex += 1;
  298. this.getList()
  299. },
  300. // 点击actionSheet回调
  301. actionSheetCallback(index) {
  302. this.value = this.actionSheetList[index].text;
  303. }
  304. }
  305. }
  306. </script>
  307. <style>
  308. page{
  309. background-color: #F7F7F7;
  310. }
  311. </style>
  312. <style lang="scss" scoped>
  313. .popup-screen{
  314. padding: 20px;
  315. position: relative;
  316. .screen{
  317. padding-bottom: 30px;
  318. }
  319. .screen-item{
  320. margin-bottom: 20px;
  321. .screen-head{
  322. margin-bottom: 8px;
  323. font-size: 16px;
  324. }
  325. .screen-main{
  326. display: flex;
  327. // display: -webkit-box;
  328. flex-wrap: wrap;
  329. }
  330. .screen-entry{
  331. width: 29%;
  332. padding:6px 0;
  333. display: flex;
  334. align-items: center;
  335. justify-content: center;
  336. background-color: #F2F5FA ;
  337. text-align: center;
  338. margin-bottom: 10px;
  339. border-radius: 3px;
  340. margin-right: 6px;
  341. }
  342. .screen-entry.active{
  343. background-color: #185AC6;
  344. color:#fff;
  345. }
  346. }
  347. .screen-foot{
  348. position: fixed;
  349. left: 0;
  350. right: 0;
  351. bottom: 0;
  352. display: flex;
  353. height:50px;
  354. border-top: 1px solid #ededed;
  355. .screen-btn-l{
  356. background-color: #fff;
  357. flex: 0.2;
  358. text-align: center;
  359. line-height: 50px;
  360. }
  361. .screen-btn-r{
  362. flex: 0.8;
  363. text-align: center;
  364. line-height: 50px;
  365. background-color: #185AC6;
  366. color:#fff;
  367. }
  368. }
  369. }
  370. .navbar{
  371. display: flex;
  372. justify-content: space-between;
  373. flex: 1;
  374. padding: 0 15px;
  375. }
  376. .navbar-tit{
  377. font-size: 20px;
  378. }
  379. .navbar-screen{
  380. display: flex;
  381. align-items: center;
  382. span{
  383. margin-right: 2px;
  384. color:#999;
  385. }
  386. }
  387. .detailed-time{
  388. display: flex;
  389. justify-content: space-between;
  390. align-items: center;
  391. padding: 10px 20px;
  392. font-size: 16px;
  393. p{
  394. color:#666;
  395. }
  396. }
  397. .detailed-item{
  398. background-color: #fff;
  399. display: flex;
  400. justify-content: space-between;
  401. padding: 10px 20px;
  402. border-bottom: 1px solid #ededed;
  403. .detailed-item-name{
  404. h4{
  405. font-weight: normal;
  406. }
  407. p{
  408. font-size: 15px;
  409. margin-top: 4px;
  410. color:#A2A9B5;
  411. }
  412. }
  413. .detailed-item-num{
  414. display: flex;
  415. align-items: center;
  416. h2{
  417. margin-right: 4px;
  418. }
  419. }
  420. }
  421. </style>