commission.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. {extend name="public/container"}
  2. {block name="title"}我的账户{/block}
  3. {extend name="public/container"}
  4. {block name="head"}
  5. <style>
  6. .loading-line{background-color: #fff;}
  7. </style>
  8. {/block}
  9. {block name="content"}
  10. <body style="background:#f5f5f5;">
  11. <div id="user-balance" class="user-balance">
  12. <section>
  13. <div class="list-info">
  14. <div class="link-list" ref="nav" @touchmove.prevent="">
  15. <ul>
  16. <li class="border-1px"><i class="icon"></i>余额明细</li>
  17. </ul>
  18. </div>
  19. <div class="info-list" ref="bsDom">
  20. <div style="-webkit-overflow-scrolling : touch; position: relative;">
  21. <ul>
  22. <li class="border-1px flex" v-for="item in group.list" v-cloak="">
  23. <div class="txt-content">
  24. <p v-text="item.mark"></p>
  25. <span v-text="item.add_time"></span>
  26. </div>
  27. <div class="count" :class="{increase:item.pm == 1}">{{item.pm == 1 ? '+' : '-'}}{{item.number}}</div>
  28. </li>
  29. </ul>
  30. <p class="loading-line" v-show="loading == true"><i></i><span>正在加载中</span><i></i></p>
  31. <p class="loading-line" v-show="loading == false && group.loaded == false" v-cloak=""><i></i><span>加载更多</span><i></i></p>
  32. <p class="loading-line" v-show="loading == false && group.loaded == true" v-cloak=""><i></i><span>没有更多了</span><i></i></p>
  33. </div>
  34. </div>
  35. </div>
  36. </section>
  37. </div>
  38. <script>
  39. (function(){
  40. var minRecharge = 0,uid = "{$uid}";
  41. requirejs(['vue','helper','better-scroll','store'],function(Vue,$h,BScroll,storeApi){
  42. var wxApi = mapleWx($jssdk());
  43. new Vue({
  44. el:'#user-balance',
  45. data:{
  46. showRechargeCard:false,
  47. minRecharge:minRecharge,
  48. rechargePrice:'',
  49. group:{
  50. first:0,
  51. limit:20,
  52. list:[],
  53. loaded:false
  54. },
  55. loading: false,
  56. scroll:null,
  57. },
  58. watch:{
  59. showRechargeCard:function(){
  60. this.rechargePrice = '';
  61. }
  62. },
  63. methods:{
  64. getList:function(){
  65. if(this.loading) return;
  66. var that = this,type = 'group',group = that.group;
  67. if(group.loaded) return ;
  68. this.loading = true;
  69. storeApi.baseGet($h.U({
  70. c:"auth_api",
  71. a:"get_user_brokerage_list",
  72. p:{
  73. uid:uid,
  74. first:group.first,
  75. limit:group.limit
  76. }
  77. }),function(res){
  78. var list = res.data.data,groupLength = group.list.length;
  79. that.scroll.stop();
  80. group.loaded = list.length < group.limit;
  81. group.first += list.length;
  82. group.list = group.list.concat(list);
  83. that.$set(that,type,group);
  84. that.loading = false;
  85. that.$nextTick(function(){
  86. if(list.length || !groupLength) that.scroll.refresh();
  87. if(!groupLength) setTimeout(function(){that.scroll.scrollTo(0,0,300);},0);
  88. that.scroll.finishPullUp();
  89. });
  90. },function(){that.loading = false});
  91. },
  92. toRecharge:function(){
  93. if(rechargePrice == '') return ;
  94. var rechargePrice = parseFloat(this.rechargePrice);
  95. if(rechargePrice != this.rechargePrice || rechargePrice <= 0)
  96. return $h.pushMsgOnce('请输入正确的充值金额');
  97. if(rechargePrice < minRecharge)
  98. return $h.pushMsgOnce('充值金额不能低于'+parseFloat(minRecharge));
  99. this.showRechargeCard = false;
  100. this.rechargePrice = '';
  101. storeApi.userWechatRecharge(rechargePrice,function(res){
  102. wxApi.chooseWXPay(res.data.data,function(){
  103. that.showRechargeCard = false;
  104. $h.pushMsgOnce('成功充值'+rechargePrice);
  105. });
  106. });
  107. },
  108. bScrollInit:function () {
  109. var that = this;
  110. this.$refs.bsDom.style.height = (
  111. document.documentElement.clientHeight -
  112. this.$refs.nav.offsetHeight - 6.5
  113. )+'px';
  114. this.$refs.bsDom.style.overflow = 'hidden';
  115. this.scroll = new BScroll(this.$refs.bsDom,{observeDOM:false,useTransition:false,click:true,probeType:1,cancelable:false,deceleration:0.005,snapThreshold:0.01});
  116. this.scroll.on('pullingUp',function(){
  117. that.loading == false && that.getList();
  118. })
  119. }
  120. },
  121. mounted:function(){
  122. this.bScrollInit();
  123. this.getList();
  124. }
  125. })
  126. });
  127. })();
  128. </script>
  129. {/block}