index.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  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)}}元</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.createTime?item.createTime.slice(11,16):''}}</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.createTime.split(" ")[0]
  264. if(showMap.has(ktime)){
  265. item.show=false;
  266. }else{
  267. var Amount=item.totalAmount
  268. showMap.set(ktime,Amount)
  269. item.show=true;
  270. item.showtime=ktime;
  271. }
  272. })
  273. this.showMap=showMap;
  274. this.recordsTotal = res.data.recordsTotal
  275. uni.hideLoading()
  276. }).catch(error => {
  277. uni.showToast({
  278. title: error
  279. })
  280. })
  281. },
  282. getStation(bl) {
  283. API.stationList().then((res) => {
  284. this.stationList = res.data.stationList
  285. this.stationListSon=res.data.deviceList
  286. }).catch(error => {
  287. uni.showToast({
  288. title: error
  289. })
  290. })
  291. },
  292. myLoadmore() {
  293. this.pageIndex += 1;
  294. this.getList()
  295. },
  296. // 点击actionSheet回调
  297. actionSheetCallback(index) {
  298. this.value = this.actionSheetList[index].text;
  299. }
  300. }
  301. }
  302. </script>
  303. <style>
  304. page{
  305. background-color: #F7F7F7;
  306. }
  307. </style>
  308. <style lang="scss" scoped>
  309. .popup-screen{
  310. padding: 20px;
  311. position: relative;
  312. .screen{
  313. padding-bottom: 30px;
  314. }
  315. .screen-item{
  316. margin-bottom: 20px;
  317. .screen-head{
  318. margin-bottom: 8px;
  319. font-size: 16px;
  320. }
  321. .screen-main{
  322. display: flex;
  323. // display: -webkit-box;
  324. flex-wrap: wrap;
  325. }
  326. .screen-entry{
  327. width: 29%;
  328. padding:6px 0;
  329. display: flex;
  330. align-items: center;
  331. justify-content: center;
  332. background-color: #F2F5FA ;
  333. text-align: center;
  334. margin-bottom: 10px;
  335. border-radius: 3px;
  336. margin-right: 6px;
  337. }
  338. .screen-entry.active{
  339. background-color: #185AC6;
  340. color:#fff;
  341. }
  342. }
  343. .screen-foot{
  344. position: fixed;
  345. left: 0;
  346. right: 0;
  347. bottom: 0;
  348. display: flex;
  349. height:50px;
  350. border-top: 1px solid #ededed;
  351. .screen-btn-l{
  352. background-color: #fff;
  353. flex: 0.2;
  354. text-align: center;
  355. line-height: 50px;
  356. }
  357. .screen-btn-r{
  358. flex: 0.8;
  359. text-align: center;
  360. line-height: 50px;
  361. background-color: #185AC6;
  362. color:#fff;
  363. }
  364. }
  365. }
  366. .navbar{
  367. display: flex;
  368. justify-content: space-between;
  369. flex: 1;
  370. padding: 0 15px;
  371. }
  372. .navbar-tit{
  373. font-size: 20px;
  374. }
  375. .navbar-screen{
  376. display: flex;
  377. align-items: center;
  378. span{
  379. margin-right: 2px;
  380. color:#999;
  381. }
  382. }
  383. .detailed-time{
  384. display: flex;
  385. justify-content: space-between;
  386. align-items: center;
  387. padding: 10px 20px;
  388. font-size: 16px;
  389. p{
  390. color:#666;
  391. }
  392. }
  393. .detailed-item{
  394. background-color: #fff;
  395. display: flex;
  396. justify-content: space-between;
  397. padding: 10px 20px;
  398. border-bottom: 1px solid #ededed;
  399. .detailed-item-name{
  400. h4{
  401. font-weight: normal;
  402. }
  403. p{
  404. font-size: 15px;
  405. margin-top: 4px;
  406. color:#A2A9B5;
  407. }
  408. }
  409. .detailed-item-num{
  410. display: flex;
  411. align-items: center;
  412. h2{
  413. margin-right: 4px;
  414. }
  415. }
  416. }
  417. </style>