tuijian.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template>
  2. <view class="main">
  3. <view class="btn btns">
  4. <image src="../../static/tuijian/mytuijian.png" mode=""></image>
  5. <view class="txt">
  6. 我的上级:{{upUser!=null? upUser.realname:'总部'}}
  7. <!-- 我的推荐人:{{upUser!=null? upUser.realname:'总部'}} -->
  8. </view>
  9. </view>
  10. <view class="btn btns">
  11. <image src="../../static/tuijian/mine.png" mode=""></image>
  12. <view class="txt">
  13. 我推荐的人
  14. </view>
  15. </view>
  16. <view class="infoboxData" v-if="tuijians.length<=0">暂无数据</view>
  17. <view class="infobox btns" v-for="( item , index ) in tuijians" :key="index">
  18. <view class="top">
  19. <image :src="item.avatar" mode=""></image>
  20. <view class="name">
  21. {{item.realname}}
  22. </view>
  23. <view class="time">
  24. 注册时间:{{item.register_time}}
  25. </view>
  26. <view class="num">
  27. 推广{{item.invite_num}}人
  28. </view>
  29. </view>
  30. <view class="bottom">
  31. <view class="xiaofei">
  32. 消费{{item.consume_amount}}元
  33. </view>
  34. <view class="dans">
  35. {{item.complete_order_num}}个订单
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. export default {
  43. data() {
  44. return {
  45. tuijians:[],
  46. param: {
  47. page: 0
  48. },
  49. loadingType: 0,
  50. upUser:{}
  51. }
  52. },
  53. onLoad() {
  54. this.loadInviteUserList();
  55. },
  56. onReachBottom() {
  57. if (this.loadingType !== 0) {
  58. return;
  59. }
  60. this.loadingType = 1;
  61. this.loadPage();
  62. },
  63. onPullDownRefresh() {
  64. this.loadInviteUserList();
  65. },
  66. methods: {
  67. loadInviteUserList: function() {
  68. this.loadingType = 1;
  69. this.param.page = 0;
  70. this.loadPage();
  71. },
  72. loadPage: async function() {
  73. if (this.loadingType == 2) {
  74. return;
  75. }
  76. try {
  77. this.param.page++;
  78. let data = await this.$request.post('/api/userPromote/inviteUserList', this.param, false);
  79. console.log(data)
  80. if (data.code == 200) {
  81. this.upUser = data.data.upUser;
  82. if (data.data.list.current_page == 1) {
  83. this.tuijians = [];
  84. }
  85. this.tuijians = this.tuijians.concat(data.data.list.data);
  86. if (data.data.list.data.current_page == data.data.list.last_page) {
  87. this.loadingType = 2;
  88. } else {
  89. this.loadingType = 0;
  90. }
  91. } else {
  92. uni.showToast({
  93. icon: 'none',
  94. title: data.message
  95. });
  96. this.loadingType = 0;
  97. }
  98. } catch (e) {
  99. console.info(e)
  100. uni.showToast({
  101. icon: 'none',
  102. title: '数据获取失败'
  103. });
  104. this.loadingType = 0;
  105. }
  106. uni.stopPullDownRefresh();
  107. }
  108. }
  109. }
  110. </script>
  111. <style>
  112. page{
  113. background: #F5F5F5;
  114. }
  115. .main{
  116. width: 100vw;
  117. height: auto;margin-bottom: 20px;
  118. }
  119. .main .btns{
  120. width: 90vw;
  121. height: 60px;
  122. border-radius: 5px;
  123. background: #fff;
  124. margin:0 5vw;
  125. margin-top: 5vw;
  126. }
  127. .main .btn{
  128. display: flex;
  129. }
  130. .btn image{
  131. width: 20px;
  132. height: 20px;
  133. margin: 20px;
  134. }
  135. .btn .txt{
  136. width: auto;
  137. height: 20px;
  138. font-size: 32rpx;
  139. line-height: 20px;
  140. margin: 20px 0;
  141. font-family: PingFangSC-Regular, sans-serif;
  142. }
  143. .infoboxData{
  144. text-align: center;
  145. margin: 15px 0;
  146. font-size: 32rpx;
  147. font-family: PingFangSC-Regular, sans-serif;
  148. }
  149. .main .infobox{
  150. width: 90vw;
  151. height: auto;
  152. padding: 15px;
  153. }
  154. .infobox .top{
  155. width: 100%;
  156. height: 70px;
  157. position: relative;
  158. border-bottom: 1px solid #d8d8d8;
  159. }
  160. .top image{
  161. width: 60px;
  162. height: 60px;
  163. border-radius: 60px;
  164. background: #eee;
  165. }
  166. .top .name{
  167. width: auto;
  168. height: 30px;
  169. line-height: 30px;
  170. font-size: 16px;
  171. color: #555;
  172. position: absolute;
  173. top: 0;
  174. left: 70px;
  175. }
  176. .top .time{
  177. width: auto;
  178. height: 30px;
  179. line-height: 30px;
  180. color: #888;
  181. font-size: 14px;
  182. position: absolute;
  183. top: 30px;
  184. left: 70px;
  185. }
  186. .top .num{
  187. width: auto;
  188. height: 30px;
  189. line-height: 30px;
  190. padding: 0 10px;
  191. position: absolute;
  192. top: 0;
  193. right: 0;
  194. color: #777;
  195. }
  196. .infobox .bottom{
  197. width: 100%;
  198. height: 30px;
  199. line-height: 40px;
  200. display: flex;
  201. justify-content: space-between;
  202. color: #888;
  203. font-size: 14px;
  204. }
  205. </style>