index.vue 14 KB

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