account-bean.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  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-emptybeans@2x.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. 12:'登录奖励'
  142. };
  143. Object.keys(stateTextObject).forEach(function(key){
  144. if(key == state){
  145. stateText = stateTextObject[key]
  146. }
  147. });
  148. return stateText;
  149. },
  150. },
  151. methods: {
  152. GetAccountInitData(index){//获取余额明细数据列表
  153. Object.keys(this.isCheckObject).forEach(key => {
  154. if (+key === +index) {
  155. this.listQuery.type = this.isCheckObject[key][0]
  156. this.errorText = this.isCheckObject[key][1]
  157. }
  158. })
  159. this.UserService.GetUserClubBeansList(this.listQuery).then(response =>{
  160. let data = response.data
  161. let list = data.pageInfo.list
  162. this.userBeans = data.userBeans
  163. this.hasNextPage = data.pageInfo.hasNextPage;
  164. if(list && list.length > 0){
  165. this.isEmpty = false;
  166. this.beansList = [...list];
  167. }else{
  168. this.isEmpty = true
  169. }
  170. if(this.hasNextPage){
  171. this.pullUpOn = false
  172. this.nomoreText = '上拉显示更多'
  173. }else{
  174. if(this.beansList.length < 10){
  175. this.pullUpOn = true
  176. }else{
  177. this.pullUpOn = false
  178. this.nomoreText = '已至底部'
  179. }
  180. }
  181. }).catch(error =>{
  182. this.$util.msg(error.msg,2000)
  183. })
  184. },
  185. GetOnReachBottomData(index){//上拉加载
  186. this.listQuery.pageNum += 1
  187. this.UserService.GetUserClubBeansList(this.listQuery).then(response =>{
  188. let data = response.data
  189. let list = data.pageInfo.list
  190. this.userBeans = data.userBeans
  191. this.hasNextPage = data.pageInfo.hasNextPage;
  192. this.beansList = this.beansList.concat(list)
  193. this.pullFlag = false;// 防上拉暴滑
  194. setTimeout(()=>{this.pullFlag = true;},500)
  195. if(this.hasNextPage){
  196. this.pullUpOn = false
  197. this.nomoreText = '上拉显示更多'
  198. }else{
  199. this.loadding = false
  200. this.pullUpOn = false
  201. this.nomoreText = '已至底部'
  202. }
  203. }).catch(error =>{
  204. this.$util.msg(error.msg,2000)
  205. })
  206. },
  207. tabClick(index){//tab点击
  208. this.tabCurrentIndex = index;
  209. this.listQuery.type = index;
  210. this.listQuery.pageNum = 1
  211. this.beansList = []
  212. this.pullUpOn = true //隐藏
  213. this.GetAccountInitData();
  214. },
  215. monthSwitch(e) {
  216. this.listQuery.year = e.year;
  217. this.listQuery.month = e.month;
  218. this.GetAccountInitData();
  219. },
  220. cheakType(type){
  221. let typeTextHtml,
  222. typeObject={
  223. 1:'余额抵扣',
  224. 2:'多收退款到余额',
  225. 3:'申请退款',
  226. 4:'余额充值',
  227. 5:'余额提现',
  228. 6:'订金订单充值',
  229. 7:'余额订单充值',
  230. 8:'订金订单退款',
  231. 9:'余额订单退款'
  232. };
  233. Object.keys(typeObject).forEach(function(key){
  234. if(key == type){
  235. typeTextHtml = typeObject[key]
  236. }
  237. });
  238. return typeTextHtml;
  239. },
  240. hanldNavigateBack(){
  241. uni.navigateBack({
  242. delta: 1
  243. });
  244. },
  245. },
  246. onReachBottom() {
  247. if(this.hasNextPage){
  248. this.loadding = true
  249. this.pullUpOn = true
  250. this.GetOnReachBottomData()
  251. }
  252. },
  253. onPullDownRefresh() {//下拉刷新
  254. this.listQuery.pageNum = 1;
  255. this.GetAccountInitData()
  256. uni.stopPullDownRefresh()
  257. },
  258. onShow() {
  259. // this.beansList = []
  260. }
  261. }
  262. </script>
  263. <style lang="scss">
  264. page, .container{
  265. background: #FFFFFF;
  266. height: 100%;
  267. }
  268. .account{
  269. width: 100%;
  270. height: auto;
  271. position: relative;
  272. }
  273. .account-header{
  274. width: 100%;
  275. height: auto;
  276. position: fixed;
  277. top: 0;
  278. left: 0;
  279. z-index: 998;
  280. }
  281. .h-account{
  282. width: 100%;
  283. height: 258rpx;
  284. position: relative;
  285. background-size: cover;
  286. }
  287. .h-calendar{
  288. width: 100%;
  289. height: auto;
  290. }
  291. .m-account{
  292. width: 100%;
  293. height: 258rpx;
  294. padding:50rpx 24rpx;
  295. box-sizing: border-box;
  296. position: relative;
  297. .icon-tishi{
  298. position: absolute;
  299. right: 30rpx;
  300. top: 20rpx;
  301. font-size: 44rpx;
  302. color: #FFFFFF;
  303. text-align: right;
  304. line-height: 74rpx;
  305. }
  306. .m-m{
  307. width: 100%;
  308. }
  309. .title{
  310. height: 48rpx;
  311. text-align: center;
  312. .m-p{
  313. width: 100%;
  314. font-size: 28rpx;
  315. color: #FFFFFF;
  316. line-height: 40rpx;
  317. }
  318. }
  319. .money{
  320. height: 90rpx;
  321. text-align: center;
  322. .m-t{
  323. font-size:58rpx;
  324. color: #FFFFFF;
  325. line-height: 90rpx;
  326. &.b{
  327. font-weight: bold;
  328. }
  329. &.s{
  330. font-size: 40rpx;
  331. }
  332. }
  333. }
  334. }
  335. .h-swiper{
  336. width: 702rpx;
  337. height: 40rpx;
  338. padding: 24rpx;
  339. display: flex;
  340. .uni-input{
  341. flex: 8;
  342. font-size: $font-size-28;
  343. color: $text-color;
  344. text-align: center;
  345. line-height: 40rpx;
  346. }
  347. .iconfont{
  348. flex: 1;
  349. text-align: center;
  350. }
  351. }
  352. .h-typeTab{
  353. width: 702rpx;
  354. padding:0 24rpx;
  355. background: #fff;
  356. position: relative;
  357. z-index: 10;
  358. .nav-item{
  359. width: 33.3%;
  360. height: 40rpx;
  361. line-height:40rpx;
  362. padding: 26rpx 0 22rpx 0;
  363. font-size: $font-size-28;
  364. float: left;
  365. color: $text-color;
  366. text-align: center;
  367. position: relative;
  368. .line{
  369. width: 70rpx;
  370. height: 4rpx;
  371. background-color: #FFFFFF;
  372. position: absolute;
  373. bottom: 10rpx;
  374. left: 50%;
  375. margin-left: -35rpx;
  376. }
  377. &.current{
  378. color: $color-system;
  379. .line{
  380. background-color: $color-system;
  381. }
  382. }
  383. }
  384. }
  385. .h-swiper-content{
  386. width: 100%;
  387. height: calc(100% - 478rpx);
  388. position: relative;
  389. background: #FFFFFF;
  390. box-sizing: border-box;
  391. .list-account{
  392. width: 100%;
  393. height: auto;
  394. box-sizing: border-box;
  395. padding: 0 24rpx;
  396. background: #FFFFFF;
  397. }
  398. .icon-jiazai{
  399. color: #666666;
  400. font-size: 36rpx;
  401. }
  402. .loading {
  403. width: 100%;
  404. font-size: 28rpx;
  405. color: #999999;
  406. line-height: 36rpx;
  407. text-align: center;
  408. padding: 20rpx 0;
  409. &-no .line{
  410. width: 30%;
  411. margin: 0 auto;
  412. position: relative;
  413. &:before{
  414. content: "";
  415. width: 80rpx;
  416. height: 1px;
  417. background: #999999;
  418. position: absolute;
  419. left: -50rpx;
  420. top: 18rpx;
  421. }
  422. &:after{
  423. content: "";
  424. width: 80rpx;
  425. height: 1px;
  426. background: #999999;
  427. position: absolute;
  428. right: -50rpx;
  429. top: 18rpx;
  430. }
  431. }
  432. }
  433. .list-item{
  434. width: 100%;
  435. height: 140rpx;
  436. padding: 20rpx 0;
  437. border-bottom: 1px solid #EBEBEB;
  438. box-sizing: border-box;
  439. background: #FFFFFF;
  440. &:last-child{
  441. border-bottom: none;
  442. }
  443. .list-t{
  444. height: 54rpx;
  445. line-height: 54rpx;
  446. font-size: $font-size-32;
  447. color: #333333;
  448. display: flex;
  449. .t-t{
  450. flex: 1;
  451. &:nth-child(1){
  452. text-align: left;
  453. }
  454. &:nth-child(2){
  455. text-align: right;
  456. }
  457. &.bold{
  458. font-weight: bold;
  459. }
  460. }
  461. }
  462. .list-b{
  463. height: 46rpx;
  464. line-height: 46rpx;
  465. font-size:$font-size-28;;
  466. color: $text-color;
  467. display: flex;
  468. .t-t{
  469. flex: 1;
  470. color: #999999;
  471. &:nth-child(1){
  472. text-align: left;
  473. }
  474. &:nth-child(2){
  475. text-align: right;
  476. }
  477. .txt{
  478. color: #FF2A2A;
  479. }
  480. &.bold{
  481. font-weight: bold;
  482. }
  483. }
  484. }
  485. }
  486. }
  487. /*空列表显示样式*/
  488. .empty-account {
  489. display: flex;
  490. align-items: center;
  491. justify-content: center;
  492. flex-direction: column;
  493. background: $bg-color;
  494. min-height: 800rpx;
  495. &-image {
  496. width: 260rpx;
  497. height: 260rpx;
  498. }
  499. .error-text{
  500. font-size: $font-size-28;
  501. color: $text-color;
  502. line-height: 88rpx;
  503. }
  504. }
  505. .swiper-box{
  506. min-height: 750rpx;
  507. }
  508. .list-scroll-content{
  509. height: 100%;
  510. }
  511. .uni-swiper-item{
  512. height: auto;
  513. }
  514. .load1,
  515. .load2,
  516. .load3 {
  517. height: 24px;
  518. width: 24px
  519. }
  520. .load2 {
  521. transform: rotate(30deg)
  522. }
  523. .load3 {
  524. transform: rotate(60deg)
  525. }
  526. .load1 view:nth-child(1) {
  527. animation-delay: 0s
  528. }
  529. .load2 view:nth-child(1) {
  530. animation-delay: .13s
  531. }
  532. .load3 view:nth-child(1) {
  533. animation-delay: .26s
  534. }
  535. .load1 view:nth-child(2) {
  536. animation-delay: .39s
  537. }
  538. .load2 view:nth-child(2) {
  539. animation-delay: .52s
  540. }
  541. .load3 view:nth-child(2) {
  542. animation-delay: .65s
  543. }
  544. .load1 view:nth-child(3) {
  545. animation-delay: .78s
  546. }
  547. .load2 view:nth-child(3) {
  548. animation-delay: .91s
  549. }
  550. .load3 view:nth-child(3) {
  551. animation-delay: 1.04s
  552. }
  553. .load1 view:nth-child(4) {
  554. animation-delay: 1.17s
  555. }
  556. .load2 view:nth-child(4) {
  557. animation-delay: 1.3s
  558. }
  559. .load3 view:nth-child(4) {
  560. animation-delay: 1.43s
  561. }
  562. @-webkit-keyframes load {
  563. 0% {
  564. opacity: 1
  565. }
  566. 100% {
  567. opacity: .2
  568. }
  569. }
  570. </style>