account-bean.vue 12 KB

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