account-bean.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  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. 14:'购买超级会员',
  144. 15:'系统扣除',
  145. 16:'系统退回',
  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.listQuery.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. },
  250. onReachBottom() {
  251. if(this.hasNextPage){
  252. this.loadding = true
  253. this.pullUpOn = true
  254. this.GetOnReachBottomData()
  255. }
  256. },
  257. onPullDownRefresh() {//下拉刷新
  258. this.listQuery.pageNum = 1
  259. this.GetAccountInitData()
  260. uni.stopPullDownRefresh()
  261. },
  262. onShow() {
  263. // this.beansList = []
  264. }
  265. }
  266. </script>
  267. <style lang="scss">
  268. page, .container{
  269. background: #FFFFFF;
  270. height: 100%;
  271. }
  272. .account{
  273. width: 100%;
  274. height: auto;
  275. position: relative;
  276. }
  277. .account-header{
  278. width: 100%;
  279. height: auto;
  280. position: fixed;
  281. top: 0;
  282. left: 0;
  283. z-index: 998;
  284. }
  285. .h-account{
  286. width: 100%;
  287. height: 258rpx;
  288. position: relative;
  289. background-size: cover;
  290. }
  291. .h-calendar{
  292. width: 100%;
  293. height: auto;
  294. }
  295. .m-account{
  296. width: 100%;
  297. height: 258rpx;
  298. padding:50rpx 24rpx;
  299. box-sizing: border-box;
  300. position: relative;
  301. .icon-tishi{
  302. position: absolute;
  303. right: 30rpx;
  304. top: 20rpx;
  305. font-size: 44rpx;
  306. color: #FFFFFF;
  307. text-align: right;
  308. line-height: 74rpx;
  309. }
  310. .m-m{
  311. width: 100%;
  312. }
  313. .title{
  314. height: 48rpx;
  315. text-align: center;
  316. .m-p{
  317. width: 100%;
  318. font-size: 28rpx;
  319. color: #FFFFFF;
  320. line-height: 40rpx;
  321. }
  322. }
  323. .money{
  324. height: 90rpx;
  325. text-align: center;
  326. .m-t{
  327. font-size:58rpx;
  328. color: #FFFFFF;
  329. line-height: 90rpx;
  330. &.b{
  331. font-weight: bold;
  332. }
  333. &.s{
  334. font-size: 40rpx;
  335. }
  336. }
  337. }
  338. }
  339. .h-swiper{
  340. width: 702rpx;
  341. height: 40rpx;
  342. padding: 24rpx;
  343. display: flex;
  344. .uni-input{
  345. flex: 8;
  346. font-size: $font-size-28;
  347. color: $text-color;
  348. text-align: center;
  349. line-height: 40rpx;
  350. }
  351. .iconfont{
  352. flex: 1;
  353. text-align: center;
  354. }
  355. }
  356. .h-typeTab{
  357. width: 702rpx;
  358. padding:0 24rpx;
  359. background: #fff;
  360. position: relative;
  361. z-index: 10;
  362. .nav-item{
  363. width: 33.3%;
  364. height: 40rpx;
  365. line-height:40rpx;
  366. padding: 26rpx 0 22rpx 0;
  367. font-size: $font-size-28;
  368. float: left;
  369. color: $text-color;
  370. text-align: center;
  371. position: relative;
  372. .line{
  373. width: 70rpx;
  374. height: 4rpx;
  375. background-color: #FFFFFF;
  376. position: absolute;
  377. bottom: 10rpx;
  378. left: 50%;
  379. margin-left: -35rpx;
  380. }
  381. &.current{
  382. color: $color-system;
  383. .line{
  384. background-color: $color-system;
  385. }
  386. }
  387. }
  388. }
  389. .h-swiper-content{
  390. width: 100%;
  391. height: calc(100% - 478rpx);
  392. position: relative;
  393. background: #FFFFFF;
  394. box-sizing: border-box;
  395. .list-account{
  396. width: 100%;
  397. height: auto;
  398. box-sizing: border-box;
  399. padding: 0 24rpx;
  400. background: #FFFFFF;
  401. }
  402. .icon-jiazai{
  403. color: #666666;
  404. font-size: 36rpx;
  405. }
  406. .loading {
  407. width: 100%;
  408. font-size: 28rpx;
  409. color: #999999;
  410. line-height: 36rpx;
  411. text-align: center;
  412. padding: 20rpx 0;
  413. &-no .line{
  414. width: 30%;
  415. margin: 0 auto;
  416. position: relative;
  417. &:before{
  418. content: "";
  419. width: 80rpx;
  420. height: 1px;
  421. background: #999999;
  422. position: absolute;
  423. left: -50rpx;
  424. top: 18rpx;
  425. }
  426. &:after{
  427. content: "";
  428. width: 80rpx;
  429. height: 1px;
  430. background: #999999;
  431. position: absolute;
  432. right: -50rpx;
  433. top: 18rpx;
  434. }
  435. }
  436. }
  437. .list-item{
  438. width: 100%;
  439. height: 140rpx;
  440. padding: 20rpx 0;
  441. border-bottom: 1px solid #EBEBEB;
  442. box-sizing: border-box;
  443. background: #FFFFFF;
  444. &:last-child{
  445. border-bottom: none;
  446. }
  447. .list-t{
  448. height: 54rpx;
  449. line-height: 54rpx;
  450. font-size: $font-size-32;
  451. color: #333333;
  452. display: flex;
  453. .t-t{
  454. flex: 1;
  455. &:nth-child(1){
  456. text-align: left;
  457. }
  458. &:nth-child(2){
  459. text-align: right;
  460. }
  461. &.bold{
  462. font-weight: bold;
  463. }
  464. }
  465. }
  466. .list-b{
  467. height: 46rpx;
  468. line-height: 46rpx;
  469. font-size:$font-size-28;;
  470. color: $text-color;
  471. display: flex;
  472. .t-t{
  473. flex: 1;
  474. color: #999999;
  475. &:nth-child(1){
  476. text-align: left;
  477. }
  478. &:nth-child(2){
  479. text-align: right;
  480. }
  481. .txt{
  482. color: #FF2A2A;
  483. }
  484. &.bold{
  485. font-weight: bold;
  486. }
  487. }
  488. }
  489. }
  490. }
  491. /*空列表显示样式*/
  492. .empty-account {
  493. display: flex;
  494. align-items: center;
  495. justify-content: center;
  496. flex-direction: column;
  497. background: $bg-color;
  498. min-height: 800rpx;
  499. &-image {
  500. width: 260rpx;
  501. height: 260rpx;
  502. }
  503. .error-text{
  504. font-size: $font-size-28;
  505. color: $text-color;
  506. line-height: 88rpx;
  507. }
  508. }
  509. .swiper-box{
  510. min-height: 750rpx;
  511. }
  512. .list-scroll-content{
  513. height: 100%;
  514. }
  515. .uni-swiper-item{
  516. height: auto;
  517. }
  518. .load1,
  519. .load2,
  520. .load3 {
  521. height: 24px;
  522. width: 24px
  523. }
  524. .load2 {
  525. transform: rotate(30deg)
  526. }
  527. .load3 {
  528. transform: rotate(60deg)
  529. }
  530. .load1 view:nth-child(1) {
  531. animation-delay: 0s
  532. }
  533. .load2 view:nth-child(1) {
  534. animation-delay: .13s
  535. }
  536. .load3 view:nth-child(1) {
  537. animation-delay: .26s
  538. }
  539. .load1 view:nth-child(2) {
  540. animation-delay: .39s
  541. }
  542. .load2 view:nth-child(2) {
  543. animation-delay: .52s
  544. }
  545. .load3 view:nth-child(2) {
  546. animation-delay: .65s
  547. }
  548. .load1 view:nth-child(3) {
  549. animation-delay: .78s
  550. }
  551. .load2 view:nth-child(3) {
  552. animation-delay: .91s
  553. }
  554. .load3 view:nth-child(3) {
  555. animation-delay: 1.04s
  556. }
  557. .load1 view:nth-child(4) {
  558. animation-delay: 1.17s
  559. }
  560. .load2 view:nth-child(4) {
  561. animation-delay: 1.3s
  562. }
  563. .load3 view:nth-child(4) {
  564. animation-delay: 1.43s
  565. }
  566. @-webkit-keyframes load {
  567. 0% {
  568. opacity: 1
  569. }
  570. 100% {
  571. opacity: .2
  572. }
  573. }
  574. </style>