index.vue 10 KB

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