index.vue 15 KB

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