index.vue 16 KB

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