index.vue 9.5 KB

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