index.vue 9.5 KB

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