account-bean.vue 12 KB

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