index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  1. <template>
  2. <view>
  3. <ujp-navbar :is-back="false">
  4. <view class="navbar">
  5. <view class="navbar-tit">分润记录</view>
  6. <view class="navbar-screen" v-show="current==0" @click="popupShow = true"><span>筛选</span>
  7. <u-icon name="filter-2-fill" custom-prefix="custom-icon" color="#b0b8c8" size="32"></u-icon>
  8. </view>
  9. </view>
  10. </ujp-navbar>
  11. <u-popup v-model="popupShow" mode="top" height="80%">
  12. <view class="popup-screen">
  13. <view class="screen">
  14. <view class="screen-item">
  15. <view class="screen-head">查询日期</view>
  16. <view class="screen-main2">
  17. <u-calendar v-model="showdate" mode="date" @change="changedate"></u-calendar>
  18. <u-input :value="queryDate?queryDate:'选择时间筛选'" :type="type" :border="border"
  19. @click="showdate = true" />
  20. <!--
  21. <u-action-sheet :list="actionSheetList" v-model="show" @click="actionSheetCallback"></u-action-sheet>
  22. -->
  23. </view>
  24. </view>
  25. <view class="screen-item">
  26. <view class="screen-head">充电桩类型</view>
  27. <view class="screen-main">
  28. <view :class="{
  29. active:selecttype==''
  30. }" @click="selecttype=''" class="screen-entry ">全部</view>
  31. <view :class="{
  32. active:selecttype=='0'
  33. }" @click="selecttype='0'" class="screen-entry type1">自行车充电</view>
  34. <view :class="{
  35. active:selecttype=='2'
  36. }" @click="selecttype='2'" class="screen-entry type3">交流慢充</view>
  37. <view :class="{
  38. active:selecttype=='1'
  39. }" @click="selecttype='1'" class="screen-entry type2">直流快充</view>
  40. </view>
  41. </view>
  42. <view class="screen-item">
  43. <view class="screen-head">站点</view>
  44. <view class="screen-main">
  45. <view class="screen-entry " :class="{
  46. active:selectstationId==''
  47. }" @click="selectstationId=''">全部</view>
  48. <view v-for="(item,i) in stationList" :key="i" :class="{
  49. active:selectstationId==item.id
  50. }" @click="selectstationId=item.id,selectdeviceNo=''" class="screen-entry">{{item.name}}</view>
  51. </view>
  52. </view>
  53. <view class="screen-item">
  54. <view class="screen-head">桩号</view>
  55. <view class="screen-main">
  56. <view class="screen-entry " :class="{
  57. active:selectdeviceNo==''
  58. }" @click="selectdeviceNo=''">全部</view>
  59. <view v-for="(item,i) in stationListSon" :key="i"
  60. v-show="selectstationId?(selectstationId==item.stationId):true" :class="{
  61. active:selectdeviceNo==item.deviceNo
  62. }" @click="selectdeviceNo=item.deviceNo" class="screen-entry">{{item.name}}</view>
  63. </view>
  64. </view>
  65. </view>
  66. <view class="screen-foot">
  67. <view class="screen-btn-l" @click="resetBtn">重置</view>
  68. <view class="screen-btn-r" @click="okbtn">确定</view>
  69. </view>
  70. </view>
  71. </u-popup>
  72. <u-tabs :list="tabList" bar-width="100" :is-scroll="false" :current="current" @change="change" inactive-color="#acb2af"
  73. active-color="#101010"></u-tabs>
  74. <!-- 充电订单 -->
  75. <view class="detailed" v-show="current==0">
  76. <view style="text-align: center;margin-top: 100px" v-if="!list.length">
  77. <img src="@/assets/img/blankpage.png">
  78. <view>查询为空</view>
  79. </view>
  80. <view class="detailed-list" v-for="(item ,index) in list"
  81. @click="gotoUrl('pagesFinance/share/details?id='+item.id)" :key="index">
  82. <view class="detailed-time" v-if="item.show">
  83. <p>{{item.showtime}}</p>
  84. <p>共收{{showMap.get(item.showtime).num}}笔,{{showNumJP(showMap.get(item.showtime).amount)}}元</p>
  85. </view>
  86. <view class="detailed-item">
  87. <view class="detailed-item-name" style="
  88. width: 70%;
  89. ">
  90. <h2 class="showName">{{item.stationName}}/{{item.deviceName}}</h2>
  91. <p
  92. v-if="item.chargingRecord"
  93. :style="{
  94. color:colorList[item.chargingRecord.platform%3]
  95. }">{{item.chargingRecord.platformText}}</p>
  96. </view>
  97. <view class="detailed-item-name" style="
  98. min-width: 60px;
  99. width: 30%;
  100. ">
  101. <h2 style=" text-align: end;">{{showNumJP(item.shareProfitAmount)}}元</h2>
  102. <p style=" text-align: end;">{{item.createTime?item.createTime.slice(10):''}}</p>
  103. </view>
  104. <view class="sign" v-if="item.status=='1'">
  105. <img src="../../assets/img/tixian.png" alt="">
  106. </view>
  107. </view>
  108. </view>
  109. <u-divider v-if="list.length&&list.length == recordsTotal" color="#B6BDC3" style="margin-top:20px;"
  110. bg-color="#f7f7f7">已经到底了</u-divider>
  111. </view>
  112. <!-- 包月卡 -->
  113. <view class="detailed"
  114. style=" padding-bottom: 20px;" v-show="current==1">
  115. <view style="text-align: center;margin-top: 100px" v-if="!list2.length">
  116. <img src="@/assets/img/blankpage.png">
  117. <view>查询为空</view>
  118. </view>
  119. <view class="detailed-list" v-for="(item ,index) in list2"
  120. @click="gotoUrl('pagesFinance/share/monthlyCardDetails?id='+item.id)"
  121. :key="index"
  122. >
  123. <view class="detailed-time" v-if="item.show" >
  124. <p>{{item.showtime}}</p>
  125. <!-- {{showMap2.get(item.showtime).num}}笔, -->
  126. <p v-if="showMap2">共收{{showMap2.get(item.showtime).amount.toFixed(2)}}元</p>
  127. </view>
  128. <view class="detailed-item">
  129. <view class="detailed-item-name" style="
  130. width: 70%;
  131. ">
  132. <h2 class="showName" v-if="item.stationName">{{item.stationName}}/{{item.deviceName}}</h2>
  133. <h2 class="showName" v-else>平台收益</h2>
  134. <p>{{item.regUserCardNo}}</p>
  135. </view>
  136. <view class="detailed-item-name" style="
  137. min-width: 60px;
  138. width: 30%;
  139. ">
  140. <h2 style=" text-align: end;">{{item.shareProfitAmount.toFixed(2)}}元</h2>
  141. <p style=" text-align: end;">{{item.stationName?item.stationProportion:item.disProportion}}%</p>
  142. </view>
  143. <view class="sign" v-if="item.status==2">
  144. <img src="../../assets/img/tixian.png" alt="">
  145. </view>
  146. </view>
  147. </view>
  148. <u-divider v-if="list2.length&&list2.length == recordsTotal2" color="#B6BDC3" style="margin-top:20px;" bg-color="#f7f7f7">已经到底了</u-divider>
  149. </view>
  150. <Tabbar ref="tabbarMain" :current="2"></Tabbar>
  151. </view>
  152. </template>
  153. <script>
  154. import Tabbar from '@/components/TabbarFinance.vue'
  155. import * as API from '@/apis/finance.js'
  156. import {
  157. currentTimeStamp,
  158. parseUnixTime
  159. } from '@/utils'
  160. export default {
  161. data() {
  162. return {
  163. showdate: false,
  164. startTime: "",
  165. queryDate: "",
  166. endTime: "",
  167. selecttype: "",
  168. selectstationId: "",
  169. selectdeviceNo: "",
  170. title: "",
  171. year: "",
  172. startyear: "",
  173. endyear: "",
  174. current: 0,
  175. tabList: [{
  176. name: '分润记录'
  177. }, {
  178. name: '月卡分润'
  179. }],
  180. params: {
  181. year: true,
  182. month: false,
  183. day: false,
  184. hour: false,
  185. minute: false,
  186. second: false,
  187. // timestamp: true,
  188. },
  189. colorList:["#00B962","#1677FF","#eb372a"],
  190. form: {
  191. },
  192. pageIndex: 1,
  193. recordsTotal: 0,
  194. list: [],
  195. pageIndex2: 1,
  196. recordsTotal2: 0,
  197. list2: [],
  198. showMap2:null,
  199. popupShow: false,
  200. tabbarList: [{
  201. iconPath: "bar-chart-box-fill",
  202. selectedIconPath: "bar-chart-box-fill",
  203. text: '统计',
  204. count: 0,
  205. isDot: true,
  206. customIcon: true,
  207. },
  208. {
  209. iconPath: "article-fill",
  210. selectedIconPath: "article-fill",
  211. text: '明细',
  212. midButton: true,
  213. customIcon: true,
  214. },
  215. {
  216. iconPath: "account-pin-box-fill",
  217. selectedIconPath: "account-pin-box-fill",
  218. text: '我的',
  219. count: 0,
  220. isDot: false,
  221. customIcon: true,
  222. },
  223. ],
  224. showMap: null,
  225. //current: 0,
  226. value: '',
  227. type: 'select',
  228. show: false,
  229. border: true,
  230. stationList: [],
  231. stationListSon: [],
  232. actionSheetList: [{
  233. text: '男'
  234. },
  235. {
  236. text: '女'
  237. },
  238. {
  239. text: '保密'
  240. }
  241. ],
  242. }
  243. },
  244. components: {
  245. Tabbar
  246. },
  247. onShow() {
  248. if (this.$refs.tabbarMain) {
  249. this.$refs.tabbarMain.setcount(2);
  250. }
  251. },
  252. onReachBottom() {
  253. this.myLoadmore();
  254. },
  255. onLoad() {
  256. // this.queryDate=parseUnixTime(new Date(),"{y}-{m}-{d}")
  257. this.startyear = new Date().getFullYear()
  258. console.log(this.startyear)
  259. this.endyear = this.startyear - 3
  260. console.log(this.endyear)
  261. },
  262. onReady() {
  263. this.getList()
  264. this.getList2()
  265. this.getStation()
  266. },
  267. methods: {
  268. change(index) {
  269. this.current = index;
  270. },
  271. showDateMoth(date) {
  272. var back = date;
  273. if (date) {
  274. var k = date.slice(5, 6)
  275. console.log(k)
  276. if (k == '0') {
  277. back = date.slice(6, 7)
  278. } else {
  279. back = date.slice(5, 7)
  280. }
  281. }
  282. return back;
  283. },
  284. changedate(e) {
  285. console.log(e)
  286. this.queryDate = e.result
  287. },
  288. resetBtn() {
  289. // this.queryDate=parseUnixTime(new Date(),"{y}-{m}-{d}")
  290. this.year = ""
  291. this.startTime = ""
  292. this.endTime = ""
  293. this.selecttype = ""
  294. this.selectstationId = ""
  295. this.selectdeviceNo = ""
  296. this.pageIndex = 1;
  297. this.form = {
  298. queryDate: "",
  299. pageIndex: this.pageIndex,
  300. type: this.selecttype,
  301. stationId: this.selectstationId,
  302. deviceNo: this.selectdeviceNo,
  303. };
  304. this.popupShow = false;
  305. this.list = [];
  306. this.getList()
  307. },
  308. okbtn() {
  309. this.popupShow = false;
  310. this.pageIndex = 1;
  311. this.form = {
  312. queryDate: this.queryDate,
  313. pageIndex: this.pageIndex,
  314. type: this.selecttype,
  315. stationId: this.selectstationId,
  316. deviceNo: this.selectdeviceNo,
  317. };
  318. this.list = [];
  319. this.getList()
  320. },
  321. getList() {
  322. uni.showLoading({
  323. title: "加载中",
  324. mask: true,
  325. })
  326. this.form.pageIndex = this.pageIndex
  327. this.form.pageSize = 20
  328. API.recordData(this.form).then((res) => {
  329. this.list = [
  330. ...this.list,
  331. ...res.data.data
  332. ];
  333. var showMap = new Map()
  334. this.list.forEach(item => {
  335. var ktime = item.createTime.split(" ")[0]
  336. if (showMap.has(ktime)) {
  337. item.show = false;
  338. } else {
  339. var Amount = item.todaySPAmount
  340. var num = item.todaySPNum
  341. showMap.set(ktime, {
  342. amount: Amount,
  343. num: num
  344. })
  345. item.show = true;
  346. item.showtime = ktime;
  347. }
  348. })
  349. this.showMap = showMap;
  350. this.recordsTotal = res.data.recordsTotal
  351. uni.hideLoading()
  352. }).catch(error => {
  353. uni.showToast({
  354. title: error
  355. })
  356. })
  357. },
  358. getList2() {
  359. uni.showLoading({
  360. title: "加载中",
  361. mask: true,
  362. })
  363. API.cardProfitData({
  364. pageIndex:this.pageIndex2,
  365. pageSize:20
  366. }).then((res) => {
  367. var showMap=new Map()
  368. this.showMap2=showMap;
  369. this.list2 = [
  370. ...this.list2,
  371. ...res.data.data
  372. ];
  373. this.list2.forEach(item=>{
  374. if(item.createTime){
  375. var ktime=item.createTime.split(" ")[0]
  376. if(showMap.has(ktime)){
  377. item.show=false;
  378. }else{
  379. var Amount=item.todayAmount
  380. var num=0;//item.totalNum
  381. showMap.set(ktime,{
  382. amount:Amount,
  383. num:num
  384. })
  385. item.show=true;
  386. item.showtime=ktime;
  387. }
  388. }
  389. })
  390. this.showMap2=showMap;
  391. this.recordsTotal2 = res.data.recordsTotal
  392. uni.hideLoading()
  393. }).catch(error => {
  394. uni.showToast({
  395. title: error
  396. })
  397. })
  398. },
  399. getStation(bl) {
  400. API.stationList().then((res) => {
  401. this.stationList = res.data.stationList
  402. this.stationListSon = res.data.deviceList
  403. }).catch(error => {
  404. uni.showToast({
  405. title: error
  406. })
  407. })
  408. },
  409. myLoadmore() {
  410. if(this.current==0){
  411. if (this.list.length < this.recordsTotal) {
  412. this.pageIndex += 1;
  413. this.getList()
  414. }
  415. }else{
  416. if (this.list2.length < this.recordsTotal2) {
  417. this.pageIndex2 += 1;
  418. this.getList2()
  419. }
  420. }
  421. },
  422. // 点击actionSheet回调
  423. actionSheetCallback(index) {
  424. this.value = this.actionSheetList[index].text;
  425. }
  426. }
  427. }
  428. </script>
  429. <style>
  430. page {
  431. background-color: #F7F7F7;
  432. }
  433. </style>
  434. <style lang="scss" scoped>
  435. .popup-screen {
  436. padding: 20px;
  437. position: relative;
  438. .screen {
  439. padding-bottom: 30px;
  440. }
  441. .screen-item {
  442. margin-bottom: 20px;
  443. .screen-head {
  444. margin-bottom: 8px;
  445. font-size: 16px;
  446. }
  447. .screen-main {
  448. // display: -webkit-box;
  449. display: flex;
  450. flex-wrap: wrap;
  451. }
  452. .screen-entry {
  453. width: 29%;
  454. padding: 6px 0;
  455. display: flex;
  456. align-items: center;
  457. justify-content: center;
  458. background-color: #F2F5FA;
  459. text-align: center;
  460. margin-bottom: 10px;
  461. border-radius: 3px;
  462. margin-right: 6px;
  463. }
  464. .screen-entry.active {
  465. background-color: #185AC6;
  466. color: #fff;
  467. }
  468. }
  469. .screen-foot {
  470. position: fixed;
  471. left: 0;
  472. right: 0;
  473. bottom: 0;
  474. display: flex;
  475. height: 50px;
  476. border-top: 1px solid #ededed;
  477. .screen-btn-l {
  478. background-color: #fff;
  479. flex: 0.2;
  480. text-align: center;
  481. line-height: 50px;
  482. }
  483. .screen-btn-r {
  484. flex: 0.8;
  485. text-align: center;
  486. line-height: 50px;
  487. background-color: #185AC6;
  488. color: #fff;
  489. }
  490. }
  491. }
  492. .navbar {
  493. display: flex;
  494. justify-content: space-between;
  495. flex: 1;
  496. padding: 0 15px;
  497. }
  498. .navbar-tit {
  499. font-size: 20px;
  500. }
  501. .navbar-screen {
  502. display: flex;
  503. align-items: center;
  504. span {
  505. margin-right: 2px;
  506. color: #999;
  507. }
  508. }
  509. .product_tip{
  510. position: absolute;
  511. top: 0;
  512. right: 0;
  513. width: 26px;
  514. height: 26px;
  515. text-align: right;
  516. p{
  517. font-size: 12px;
  518. color: #ffffff;
  519. transform: rotate(45deg);
  520. position: relative;
  521. top: 0rpx;
  522. right: 0rpx;
  523. }
  524. .product_tip_bg{
  525. width: 0;
  526. height: 0;
  527. border-bottom: 44rpx solid #FD662A;
  528. border-right: 44rpx solid transparent;
  529. border-left: 44rpx solid transparent;
  530. transform: rotate(45deg);
  531. position: absolute;
  532. top: -7rpx;
  533. right: -29rpx;
  534. }
  535. }
  536. .detailed-time {
  537. display: flex;
  538. justify-content: space-between;
  539. align-items: center;
  540. padding: 10px 20px;
  541. font-size: 16px;
  542. p {
  543. color: #666;
  544. }
  545. }
  546. .detailed-item {
  547. background-color: #fff;
  548. display: flex;
  549. justify-content: space-between;
  550. padding: 10px 20px;
  551. border-bottom: 1px solid #ededed;
  552. position: relative;
  553. .sign{
  554. width: 32px;
  555. height: 32px;
  556. position: absolute;
  557. top: 0;
  558. right: 0;
  559. img{
  560. width: 100%;
  561. }
  562. }
  563. .detailed-item-name {
  564. h4 {
  565. font-weight: normal;
  566. }
  567. p {
  568. font-size: 15px;
  569. margin-top: 4px;
  570. color: #A2A9B5;
  571. }
  572. }
  573. .detailed-item-num {
  574. display: flex;
  575. align-items: center;
  576. h2 {
  577. margin-right: 4px;
  578. }
  579. }
  580. }
  581. .showName {
  582. font-weight: unset;
  583. overflow: hidden;
  584. text-overflow: ellipsis;
  585. white-space: nowrap;
  586. font-size: 16px;
  587. }
  588. .u-tabs{
  589. /deep/.uni-scroll-view-content {
  590. width: 56.2% !important;
  591. margin: auto;
  592. }
  593. }
  594. /deep/.u-tab-bar {
  595. background-color: #0076FF !important;
  596. }
  597. </style>