index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  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="false&&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",'#d5dc21','#00e0d4','#e536e0'],
  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. var list= res.data.stationList
  402. var list2=list.sort(function(item1,item2){
  403. if(item1.stationNo.indexOf("D")==0){
  404. return 1
  405. }
  406. return (item1.stationNo>item2.stationNo)?1:-1
  407. })
  408. for(var i in list2){
  409. //console.log(list2[i].stationNo)
  410. }
  411. this.stationList =list2
  412. this.stationListSon=res.data.deviceList
  413. }).catch(error => {
  414. uni.showToast({
  415. title: error
  416. })
  417. })
  418. },
  419. myLoadmore() {
  420. if(this.current==0){
  421. if (this.list.length < this.recordsTotal) {
  422. this.pageIndex += 1;
  423. this.getList()
  424. }
  425. }else{
  426. if (this.list2.length < this.recordsTotal2) {
  427. this.pageIndex2 += 1;
  428. this.getList2()
  429. }
  430. }
  431. },
  432. // 点击actionSheet回调
  433. actionSheetCallback(index) {
  434. this.value = this.actionSheetList[index].text;
  435. }
  436. }
  437. }
  438. </script>
  439. <style>
  440. page {
  441. background-color: #F7F7F7;
  442. }
  443. </style>
  444. <style lang="scss" scoped>
  445. .popup-screen {
  446. padding: 20px;
  447. position: relative;
  448. .screen {
  449. padding-bottom: 30px;
  450. }
  451. .screen-item {
  452. margin-bottom: 20px;
  453. .screen-head {
  454. margin-bottom: 8px;
  455. font-size: 16px;
  456. }
  457. .screen-main {
  458. // display: -webkit-box;
  459. display: flex;
  460. flex-wrap: wrap;
  461. }
  462. .screen-entry {
  463. width: 29%;
  464. padding: 6px 0;
  465. display: flex;
  466. align-items: center;
  467. justify-content: center;
  468. background-color: #F2F5FA;
  469. text-align: center;
  470. margin-bottom: 10px;
  471. border-radius: 3px;
  472. margin-right: 6px;
  473. }
  474. .screen-entry.active {
  475. background-color: #185AC6;
  476. color: #fff;
  477. }
  478. }
  479. .screen-foot {
  480. position: fixed;
  481. left: 0;
  482. right: 0;
  483. bottom: 0;
  484. display: flex;
  485. height: 50px;
  486. border-top: 1px solid #ededed;
  487. .screen-btn-l {
  488. background-color: #fff;
  489. flex: 0.2;
  490. text-align: center;
  491. line-height: 50px;
  492. }
  493. .screen-btn-r {
  494. flex: 0.8;
  495. text-align: center;
  496. line-height: 50px;
  497. background-color: #185AC6;
  498. color: #fff;
  499. }
  500. }
  501. }
  502. .navbar {
  503. display: flex;
  504. justify-content: space-between;
  505. flex: 1;
  506. padding: 0 15px;
  507. }
  508. .navbar-tit {
  509. font-size: 20px;
  510. }
  511. .navbar-screen {
  512. display: flex;
  513. align-items: center;
  514. span {
  515. margin-right: 2px;
  516. color: #999;
  517. }
  518. }
  519. .product_tip{
  520. position: absolute;
  521. top: 0;
  522. right: 0;
  523. width: 26px;
  524. height: 26px;
  525. text-align: right;
  526. p{
  527. font-size: 12px;
  528. color: #ffffff;
  529. transform: rotate(45deg);
  530. position: relative;
  531. top: 0rpx;
  532. right: 0rpx;
  533. }
  534. .product_tip_bg{
  535. width: 0;
  536. height: 0;
  537. border-bottom: 44rpx solid #FD662A;
  538. border-right: 44rpx solid transparent;
  539. border-left: 44rpx solid transparent;
  540. transform: rotate(45deg);
  541. position: absolute;
  542. top: -7rpx;
  543. right: -29rpx;
  544. }
  545. }
  546. .detailed-time {
  547. display: flex;
  548. justify-content: space-between;
  549. align-items: center;
  550. padding: 10px 20px;
  551. font-size: 16px;
  552. p {
  553. color: #666;
  554. }
  555. }
  556. .detailed-item {
  557. background-color: #fff;
  558. display: flex;
  559. justify-content: space-between;
  560. padding: 10px 20px;
  561. border-bottom: 1px solid #ededed;
  562. position: relative;
  563. .sign{
  564. width: 32px;
  565. height: 32px;
  566. position: absolute;
  567. top: 0;
  568. right: 0;
  569. img{
  570. width: 100%;
  571. }
  572. }
  573. .detailed-item-name {
  574. h4 {
  575. font-weight: normal;
  576. }
  577. p {
  578. font-size: 15px;
  579. margin-top: 4px;
  580. color: #A2A9B5;
  581. }
  582. }
  583. .detailed-item-num {
  584. display: flex;
  585. align-items: center;
  586. h2 {
  587. margin-right: 4px;
  588. }
  589. }
  590. }
  591. .showName {
  592. font-weight: unset;
  593. overflow: hidden;
  594. text-overflow: ellipsis;
  595. white-space: nowrap;
  596. font-size: 16px;
  597. }
  598. .u-tabs{
  599. /deep/.uni-scroll-view-content {
  600. width: 56.2% !important;
  601. margin: auto;
  602. }
  603. }
  604. /deep/.u-tab-bar {
  605. background-color: #0076FF !important;
  606. }
  607. </style>