index.vue 9.8 KB

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