account-bean.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. <template>
  2. <view class="container account clearfix">
  3. <au-custom :navbar-data='nvabarData' @navigateBack="hanldNavigateBack"></au-custom>
  4. <view class="account-header">
  5. <view class="h-account" :style="{paddingTop:CustomBar+'px',backgroundImage: 'url('+account_bg+')'}">
  6. <view class="m-account">
  7. <view class="m-m money">
  8. <text class="m-t b">{{ userBeans }}</text>
  9. </view>
  10. <view class="m-m title">
  11. <text class="m-p">可用数量</text>
  12. </view>
  13. <text class="iconfont icon-tishi" @click="showAccounExp"></text>
  14. </view>
  15. </view>
  16. <view class="h-calendar">
  17. <!-- 插入模式 切换年月-->
  18. <uni-calendar :selected="infoData.selected" @monthSwitch="monthSwitch" />
  19. </view>
  20. <view class="h-typeTab clearfix">
  21. <view
  22. v-for="(item, index) in navList" :key="index"
  23. class="nav-item"
  24. :class="{current: tabCurrentIndex === index}"
  25. @click="tabClick(index)"
  26. >
  27. {{item.text}}
  28. <view class="line"></view>
  29. </view>
  30. </view>
  31. </view>
  32. <!-- @scrolltolower="toLower" -->
  33. <scroll-view class="h-swiper-content" scroll-y :style="{paddingTop:CustomBar+234+'px'}">
  34. <!-- 空白页 -->
  35. <view v-if="isEmpty" class="empty-account">
  36. <image class="empty-account-image" :src="StaticUrl+'icon/icon-empty-account.png'" mode="aspectFit"></image>
  37. <text class="error-text">{{errorText}}</text>
  38. </view>
  39. <!-- 余额明细列表 -->
  40. <view v-else class="list-account">
  41. <view v-for="(item,index) in beansList" :key="index" class="list-item">
  42. <view class="list-t">
  43. <view class="t-t">{{ item.beansType | BeansStatusFilter }}</view>
  44. <view class="t-t bold" :style="{color:item.type == '1' ? '#ff2a2a' : '#15C47A'}">
  45. <text class="txt">{{item.type == 1 ? '+' : '-'}}</text>
  46. <text class="txt">¥{{item.num}}</text>
  47. </view>
  48. </view>
  49. <view class="list-b">
  50. <view class="t-t">{{item.addTime}}</view>
  51. <view class="t-t">{{item.type =='1'? '收入' : '支出'}}</view>
  52. </view>
  53. </view>
  54. <!--加载loadding-->
  55. <tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
  56. <tui-nomore :visible="!pullUpOn" bgcolor="#FFFFFF" :text='nomoreText'></tui-nomore>
  57. <!--加载loadding-->
  58. </view>
  59. </scroll-view>
  60. <view class="showAccounExp" :class="[isShowAccounExp == true ? 'show':'hide']" @tap="hideAccounExp">
  61. <image src="https://img.caimei365.com/group1/M00/03/95/Cmis216Sk_SAZeZlAA2oDvspRRU204.png" mode=""></image>
  62. <text class="iconfont icon-close" @click="hideAccounExp"></text>
  63. </view>
  64. </view>
  65. </template>
  66. <script>
  67. import tuiLoadmore from "@/components/tui-components/loadmore/loadmore"
  68. import tuiNomore from "@/components/tui-components/nomore/nomore"
  69. import uniCalendar from '@/components/uni-calendar/uni-calendar.vue'
  70. var date = new Date();
  71. export default{
  72. components: {
  73. uniCalendar,
  74. tuiLoadmore,
  75. tuiNomore
  76. },
  77. data() {
  78. return{
  79. StaticUrl:this.$Static,
  80. nvabarData: { //顶部自定义导航
  81. showCapsule:1, // 是否显示左上角图标 1表示显示 0表示不显示,
  82. showSearch: 0,
  83. title: '采美豆明细', // 导航栏 中间的标题
  84. haveBack:true,
  85. textColor:'#ffffff',
  86. textLeft:this.$store.state.isIphone,
  87. },
  88. account_bg:'https://img.caimei365.com/group1/M00/03/D0/Cmis21-PpUqAbubBAADf1kTyhjs098.png',
  89. isIphoneX:this.$store.state.isIphoneX,
  90. CustomBar:this.CustomBar,// 顶部导航栏高度
  91. listQuery:{
  92. year: date.getFullYear(), //年
  93. month: date.getMonth()+1, //月
  94. userId: '', //用户ID
  95. pageNum:1, //页数
  96. pageSize:10, //加载条数
  97. type: 0, //查询余额类型
  98. },
  99. userBeans:0,
  100. tabCurrentIndex: 0, //标签选择索引
  101. infoData: {selected: []}, //日期选择
  102. beansList: [], //余额列表
  103. isShowAccounExp:false, //控制明细说明文字显示
  104. isRefreshing:false,
  105. isNomore:false,
  106. isEmpty:false,
  107. loadding: false,
  108. pullUpOn: true,
  109. hasNextPage: false,
  110. pullFlag: true,
  111. nomoreText: '上拉显示更多',
  112. errorText:'本月没有任何余额收支记录',
  113. navList: [
  114. {state: 0,text: '全部'},
  115. {state: 1,text: '收入'},
  116. {state: 2,text: '支出'},
  117. ],
  118. isCheckObject:{
  119. 0:['','本月没有采美豆收支记录'],
  120. 1:[1, '本月没有采美豆收入记录!'],
  121. 2:[2, '本月没有采美豆支出记录!'],
  122. },
  123. }
  124. },
  125. onLoad() {
  126. this.$api.getStorage().then((resolve) =>{
  127. this.listQuery.userId =resolve.userId ? resolve.userId : 0
  128. this.GetAccountInitData()
  129. })
  130. },
  131. filters: {
  132. BeansStatusFilter: function(state){
  133. let stateText = ''
  134. let stateTextObject={
  135. 1:'注册机构',
  136. 2:'升级会员机构',
  137. 3:'普通机构完善资料',
  138. 4:'会员机构完善资料',
  139. 5:'下单',
  140. 6:'线上支付订单',
  141. 7:'确认收货',
  142. 8:'系统发放',
  143. 9:'抵用退回',
  144. 10:'抵用运费',
  145. 11:'退款回收'
  146. };
  147. Object.keys(stateTextObject).forEach(function(key){
  148. if(key == state){
  149. stateText = stateTextObject[key]
  150. }
  151. });
  152. return stateText;
  153. },
  154. },
  155. methods: {
  156. GetAccountInitData(index){//获取余额明细数据列表
  157. Object.keys(this.isCheckObject).forEach(key => {
  158. if (+key === +index) {
  159. this.listQuery.type = this.isCheckObject[key][0]
  160. this.errorText = this.isCheckObject[key][1]
  161. }
  162. })
  163. this.UserService.GetUserClubBeansList(this.listQuery).then(response =>{
  164. let data = response.data
  165. let list = data.pageInfo.list
  166. this.userBeans = data.userBeans
  167. this.hasNextPage = data.pageInfo.hasNextPage;
  168. if(list && list.length > 0){
  169. this.isEmpty = false;
  170. this.beansList = [...list];
  171. }else{
  172. this.isEmpty = true
  173. }
  174. if(this.hasNextPage){
  175. this.pullUpOn = false
  176. this.nomoreText = '上拉显示更多'
  177. }else{
  178. if(this.beansList.length < 10){
  179. this.pullUpOn = true
  180. }else{
  181. this.pullUpOn = false
  182. this.nomoreText = '已至底部'
  183. }
  184. }
  185. }).catch(error =>{
  186. this.$util.msg(error.msg,2000)
  187. })
  188. },
  189. GetOnReachBottomData(index){//上拉加载
  190. this.listQuery.pageNum += 1
  191. this.UserService.GetUserClubBeansList(this.listQuery).then(response =>{
  192. let data = response.data
  193. let list = data.pageInfo.list
  194. this.userBeans = data.userBeans
  195. this.hasNextPage = data.pageInfo.hasNextPage;
  196. this.beansList = this.beansList.concat(list)
  197. this.pullFlag = false;// 防上拉暴滑
  198. setTimeout(()=>{this.pullFlag = true;},500)
  199. if(this.hasNextPage){
  200. this.pullUpOn = false
  201. this.nomoreText = '上拉显示更多'
  202. }else{
  203. this.loadding = false
  204. this.pullUpOn = false
  205. this.nomoreText = '已至底部'
  206. }
  207. }).catch(error =>{
  208. this.$util.msg(error.msg,2000)
  209. })
  210. },
  211. tabClick(index){//tab点击
  212. this.tabCurrentIndex = index;
  213. this.listQuery.type = index;
  214. this.pageNum = 1
  215. this.beansList = []
  216. this.pullUpOn = true //隐藏
  217. this.GetAccountInitData();
  218. },
  219. monthSwitch(e) {
  220. this.listQuery.year = e.year;
  221. this.listQuery.month = e.month;
  222. this.GetAccountInitData();
  223. },
  224. cheakType(type){
  225. let typeTextHtml,
  226. typeObject={
  227. 1:'余额抵扣',
  228. 2:'多收退款到余额',
  229. 3:'申请退款',
  230. 4:'余额充值',
  231. 5:'余额提现',
  232. 6:'订金订单充值',
  233. 7:'余额订单充值',
  234. 8:'订金订单退款',
  235. 9:'余额订单退款'
  236. };
  237. Object.keys(typeObject).forEach(function(key){
  238. if(key == type){
  239. typeTextHtml = typeObject[key]
  240. }
  241. });
  242. return typeTextHtml;
  243. },
  244. hanldNavigateBack(){
  245. uni.navigateBack({
  246. delta: 1
  247. });
  248. },
  249. showAccounExp(){
  250. this.isShowAccounExp = true
  251. },
  252. hideAccounExp(){
  253. this.isShowAccounExp = false
  254. }
  255. },
  256. onReachBottom() {
  257. if(this.hasNextPage){
  258. this.loadding = true
  259. this.pullUpOn = true
  260. this.GetOnReachBottomData()
  261. }
  262. },
  263. onPullDownRefresh() {//下拉刷新
  264. this.listQuery.pageNum = 1;
  265. this.GetAccountInitData()
  266. uni.stopPullDownRefresh()
  267. },
  268. onShow() {
  269. // this.beansList = []
  270. }
  271. }
  272. </script>
  273. <style lang="scss">
  274. page, .container{
  275. background: #FFFFFF;
  276. height: 100%;
  277. }
  278. .account{
  279. width: 100%;
  280. height: auto;
  281. position: relative;
  282. }
  283. .account-header{
  284. width: 100%;
  285. height: auto;
  286. position: fixed;
  287. top: 0;
  288. left: 0;
  289. z-index: 998;
  290. }
  291. .h-account{
  292. width: 100%;
  293. height: 258rpx;
  294. position: relative;
  295. background-size: cover;
  296. }
  297. .h-calendar{
  298. width: 100%;
  299. height: auto;
  300. }
  301. .m-account{
  302. width: 100%;
  303. height: 258rpx;
  304. padding:50rpx 24rpx;
  305. box-sizing: border-box;
  306. position: relative;
  307. .icon-tishi{
  308. position: absolute;
  309. right: 30rpx;
  310. top: 20rpx;
  311. font-size: 44rpx;
  312. color: #FFFFFF;
  313. text-align: right;
  314. line-height: 74rpx;
  315. }
  316. .m-m{
  317. width: 100%;
  318. }
  319. .title{
  320. height: 48rpx;
  321. text-align: center;
  322. .m-p{
  323. width: 100%;
  324. font-size: 28rpx;
  325. color: #FFFFFF;
  326. line-height: 40rpx;
  327. }
  328. }
  329. .money{
  330. height: 90rpx;
  331. text-align: center;
  332. .m-t{
  333. font-size:58rpx;
  334. color: #FFFFFF;
  335. line-height: 90rpx;
  336. &.b{
  337. font-weight: bold;
  338. }
  339. &.s{
  340. font-size: 40rpx;
  341. }
  342. }
  343. }
  344. }
  345. .h-swiper{
  346. width: 702rpx;
  347. height: 40rpx;
  348. padding: 24rpx;
  349. display: flex;
  350. .uni-input{
  351. flex: 8;
  352. font-size: $font-size-28;
  353. color: $text-color;
  354. text-align: center;
  355. line-height: 40rpx;
  356. }
  357. .iconfont{
  358. flex: 1;
  359. text-align: center;
  360. }
  361. }
  362. .h-typeTab{
  363. width: 702rpx;
  364. padding:0 24rpx;
  365. background: #fff;
  366. position: relative;
  367. z-index: 10;
  368. .nav-item{
  369. width: 33.3%;
  370. height: 40rpx;
  371. line-height:40rpx;
  372. padding: 26rpx 0 22rpx 0;
  373. font-size: $font-size-28;
  374. float: left;
  375. color: $text-color;
  376. text-align: center;
  377. position: relative;
  378. .line{
  379. width: 70rpx;
  380. height: 4rpx;
  381. background-color: #FFFFFF;
  382. position: absolute;
  383. bottom: 10rpx;
  384. left: 50%;
  385. margin-left: -35rpx;
  386. }
  387. &.current{
  388. color: $color-system;
  389. .line{
  390. background-color: $color-system;
  391. }
  392. }
  393. }
  394. }
  395. .h-swiper-content{
  396. width: 100%;
  397. height: calc(100% - 478rpx);
  398. position: relative;
  399. background: #FFFFFF;
  400. box-sizing: border-box;
  401. .list-account{
  402. width: 100%;
  403. height: auto;
  404. box-sizing: border-box;
  405. padding: 0 24rpx;
  406. background: #FFFFFF;
  407. }
  408. .icon-jiazai{
  409. color: #666666;
  410. font-size: 36rpx;
  411. }
  412. .loading {
  413. width: 100%;
  414. font-size: 28rpx;
  415. color: #999999;
  416. line-height: 36rpx;
  417. text-align: center;
  418. padding: 20rpx 0;
  419. &-no .line{
  420. width: 30%;
  421. margin: 0 auto;
  422. position: relative;
  423. &:before{
  424. content: "";
  425. width: 80rpx;
  426. height: 1px;
  427. background: #999999;
  428. position: absolute;
  429. left: -50rpx;
  430. top: 18rpx;
  431. }
  432. &:after{
  433. content: "";
  434. width: 80rpx;
  435. height: 1px;
  436. background: #999999;
  437. position: absolute;
  438. right: -50rpx;
  439. top: 18rpx;
  440. }
  441. }
  442. }
  443. .list-item{
  444. width: 100%;
  445. height: 140rpx;
  446. padding: 20rpx 0;
  447. border-bottom: 1px solid #EBEBEB;
  448. box-sizing: border-box;
  449. background: #FFFFFF;
  450. &:last-child{
  451. border-bottom: none;
  452. }
  453. .list-t{
  454. height: 54rpx;
  455. line-height: 54rpx;
  456. font-size: $font-size-32;
  457. color: #333333;
  458. display: flex;
  459. .t-t{
  460. flex: 1;
  461. &:nth-child(1){
  462. text-align: left;
  463. }
  464. &:nth-child(2){
  465. text-align: right;
  466. }
  467. &.bold{
  468. font-weight: bold;
  469. }
  470. }
  471. }
  472. .list-b{
  473. height: 46rpx;
  474. line-height: 46rpx;
  475. font-size:$font-size-28;;
  476. color: $text-color;
  477. display: flex;
  478. .t-t{
  479. flex: 1;
  480. color: #9aa5b5;
  481. &:nth-child(1){
  482. text-align: left;
  483. }
  484. &:nth-child(2){
  485. text-align: right;
  486. }
  487. .txt{
  488. color: #FF2A2A;
  489. }
  490. &.bold{
  491. font-weight: bold;
  492. }
  493. }
  494. }
  495. }
  496. }
  497. .showAccounExp{
  498. width: 100%;
  499. height: 100%;
  500. display: flex;
  501. align-items: center;
  502. justify-content: center;
  503. flex-direction: column;
  504. position: fixed;
  505. left: 0;
  506. top: 100%;
  507. opacity: 0;
  508. background: rgba(0,0,0,.5);
  509. z-index: 999;
  510. image{
  511. width: 750rpx;
  512. height: 1052rpx;
  513. }
  514. .icon-close{
  515. position: absolute;
  516. color: #FFFFFF;
  517. font-size:60rpx ;
  518. bottom: 15%;
  519. left: 50%;
  520. margin-left: -32rpx;
  521. }
  522. }
  523. .showAccounExp.show{
  524. top: 0;
  525. opacity: 1;
  526. animation:rundtop 0.3s;
  527. }
  528. .showAccounExp.hide{
  529. top: 100%;
  530. opacity: 0;
  531. animation:rundbottom 0.3s;
  532. }
  533. @keyframes rundtop{
  534. 0%{top: 100%;opacity: 0;}
  535. 100%{top:0;opacity: 1;}
  536. }
  537. @keyframes rundbottom{
  538. 0%{top: 0;opacity: 1;}
  539. 100%{top:100%;opacity: 0;}
  540. }
  541. /*空列表显示样式*/
  542. .empty-account {
  543. display: flex;
  544. align-items: center;
  545. justify-content: center;
  546. flex-direction: column;
  547. background: $bg-color;
  548. min-height: 800rpx;
  549. &-image {
  550. width: 260rpx;
  551. height: 260rpx;
  552. }
  553. .error-text{
  554. font-size: $font-size-28;
  555. color: $text-color;
  556. line-height: 88rpx;
  557. }
  558. }
  559. .swiper-box{
  560. min-height: 750rpx;
  561. }
  562. .list-scroll-content{
  563. height: 100%;
  564. }
  565. .uni-swiper-item{
  566. height: auto;
  567. }
  568. .load1,
  569. .load2,
  570. .load3 {
  571. height: 24px;
  572. width: 24px
  573. }
  574. .load2 {
  575. transform: rotate(30deg)
  576. }
  577. .load3 {
  578. transform: rotate(60deg)
  579. }
  580. .load1 view:nth-child(1) {
  581. animation-delay: 0s
  582. }
  583. .load2 view:nth-child(1) {
  584. animation-delay: .13s
  585. }
  586. .load3 view:nth-child(1) {
  587. animation-delay: .26s
  588. }
  589. .load1 view:nth-child(2) {
  590. animation-delay: .39s
  591. }
  592. .load2 view:nth-child(2) {
  593. animation-delay: .52s
  594. }
  595. .load3 view:nth-child(2) {
  596. animation-delay: .65s
  597. }
  598. .load1 view:nth-child(3) {
  599. animation-delay: .78s
  600. }
  601. .load2 view:nth-child(3) {
  602. animation-delay: .91s
  603. }
  604. .load3 view:nth-child(3) {
  605. animation-delay: 1.04s
  606. }
  607. .load1 view:nth-child(4) {
  608. animation-delay: 1.17s
  609. }
  610. .load2 view:nth-child(4) {
  611. animation-delay: 1.3s
  612. }
  613. .load3 view:nth-child(4) {
  614. animation-delay: 1.43s
  615. }
  616. @-webkit-keyframes load {
  617. 0% {
  618. opacity: 1
  619. }
  620. 100% {
  621. opacity: .2
  622. }
  623. }
  624. </style>