team.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <app-layout>
  3. <app-tab-nav :tabList="tabList" :activeItem="activeTab" @click="tabStatus" padding="0" theme="default"></app-tab-nav>
  4. <view class="item" v-for="item in list" :key="item.id">
  5. <view class="user-info">
  6. <image class="avatar" :src="item.avatar"></image>
  7. <view class="t-omit user-name">{{item.nickname}}</view>
  8. <view class="time">绑定时间:{{item.junior_at}}</view>
  9. </view>
  10. <view class="number">
  11. 推广{{item.peopleCount}}人
  12. <block v-if="item.sys_recommend==1">
  13. <text class="sys-recommend">[平台推荐]</text>
  14. </block>
  15. </view>
  16. <view class="order-info">
  17. <text>{{item.orderPrice}}元</text>
  18. <text class="order-num">{{item.orderCount}}个订单</text>
  19. </view>
  20. </view>
  21. </app-layout>
  22. </template>
  23. <script>
  24. import appTabNav from "../../../components/basic-component/app-tab-nav/app-tab-nav.vue";
  25. import { mapState } from "vuex";
  26. export default {
  27. data() {
  28. return {
  29. tabList: [
  30. {id:1, name: '一级分销'},
  31. ],
  32. loading: null,
  33. list: [],
  34. activeTab: 1,
  35. id: null,
  36. page: 2
  37. }
  38. },
  39. components: {
  40. "app-tab-nav": appTabNav,
  41. },
  42. computed: {
  43. ...mapState({
  44. mall: state => state.mallConfig.mall,
  45. custom_setting: state => state.mallConfig.share_setting_custom,
  46. share_setting: state => state.mallConfig.share_setting,
  47. })
  48. },
  49. methods: {
  50. open(e) {
  51. this.id = e;
  52. },
  53. tabStatus(e) {
  54. this.list = [];
  55. this.page = 2;
  56. this.activeTab = e.currentTarget.dataset.id;
  57. uni.showLoading({
  58. title: '加载中...'
  59. });
  60. this.getList();
  61. },
  62. getList() {
  63. let that = this;
  64. that.$request({
  65. url: that.$api.share.team,
  66. data: {
  67. status: that.activeTab
  68. },
  69. }).then(response=>{
  70. that.$hideLoading();
  71. uni.hideLoading();
  72. if(response.code == 0) {
  73. that.list = response.data.list;
  74. that.first_count = response.data.first_count;
  75. that.second_count = response.data.second_count;
  76. that.third_count = response.data.third_count;
  77. if(that.custom_setting.words.one_share.name) {
  78. if(that.custom_setting.words.one_share.name.length > 7) {
  79. that.custom_setting.words.one_share.name = that.custom_setting.words.one_share.name.substring(0,5) + '...'
  80. }
  81. that.tabList[0].name = that.custom_setting.words.one_share.name + '(' +that.first_count+')'
  82. }else {
  83. that.tabList[0].name = '一级分销(' +that.first_count+')'
  84. }
  85. if(that.second_count > 0) {
  86. let second = {id: 2};
  87. if(that.custom_setting.words.second_share.name.length > 7) {
  88. that.custom_setting.words.second_share.name = that.custom_setting.words.second_share.name.substring(0,5) + '...'
  89. }
  90. second.name = that.custom_setting.words.second_share.name ? that.custom_setting.words.second_share.name + '('+that.second_count+')': '二级分销('+that.second_count+')'
  91. that.tabList[1] = second;
  92. if(that.third_count > 0) {
  93. if(that.custom_setting.words.three_share.name.length > 7) {
  94. that.custom_setting.words.three_share.name = that.custom_setting.words.three_share.name.substring(0,5) + '...'
  95. }
  96. let third = {id: 3};
  97. third.name = that.custom_setting.words.three_share.name ? that.custom_setting.words.three_share.name + '('+that.third_count+')': '三级分销('+that.third_count+')'
  98. that.tabList[2] = third;
  99. }
  100. }
  101. }else {
  102. uni.showToast({
  103. title: response.msg,
  104. icon: 'none',
  105. duration: 1000
  106. });
  107. }
  108. }).catch(response => {
  109. that.$hideLoading();
  110. uni.hideLoading();
  111. that.$event.on(that.$const.EVENT_USER_LOGIN).then(()=>{
  112. that.getList();
  113. });
  114. });
  115. },
  116. getMore() {
  117. let that = this;
  118. let url;
  119. uni.showLoading({
  120. title: '加载中...'
  121. });
  122. that.$request({
  123. url: that.$api.share.team,
  124. data: {
  125. status: that.activeTab,
  126. page: that.page
  127. },
  128. }).then(response=>{
  129. that.$hideLoading();
  130. uni.hideLoading();
  131. if(response.code == 0) {
  132. if(response.data.list.length > 0) {
  133. that.loading = null;
  134. that.list = that.list.concat(response.data.list);
  135. that.page++;
  136. }
  137. }else {
  138. uni.showToast({
  139. title: response.msg,
  140. icon: 'none',
  141. duration: 1000
  142. });
  143. }
  144. }).catch(e => {
  145. that.$hideLoading();
  146. uni.hideLoading();
  147. });
  148. },
  149. toGoods(id) {
  150. uni.navigateTo({
  151. url: '/pages/goods/goods?id=' + id
  152. });
  153. },
  154. },
  155. onLoad(options) {
  156. let that = this;
  157. uni.setNavigationBarTitle({
  158. title: that.custom_setting.menus.team.name
  159. });
  160. that.$showLoading({
  161. type: 'global',
  162. text: '加载中...'
  163. });
  164. that.getList();
  165. },
  166. onReachBottom() {
  167. this.getMore();
  168. }
  169. }
  170. </script>
  171. <style scoped lang="scss">
  172. .item {
  173. background-color: #fff;
  174. padding: #{24rpx};
  175. color: #353535;
  176. margin-bottom: #{25rpx};
  177. }
  178. .user-info {
  179. width: 60%;
  180. display: inline-block;
  181. height: #{136rpx};
  182. }
  183. .avatar {
  184. height: #{100rpx};
  185. width: #{100rpx};
  186. float: left;
  187. margin-right: #{25rpx};
  188. }
  189. .user-info .user-name {
  190. width: 40%;
  191. }
  192. .time {
  193. font-size: #{24rpx};
  194. color: #666;
  195. margin-top: #{20rpx};
  196. }
  197. .number {
  198. float: right;
  199. font-size: #{24rpx};
  200. }
  201. .number .sys-recommend{
  202. color: #ff0000;
  203. display: block;
  204. }
  205. .order-info {
  206. color: #666;
  207. border-top: #{1rpx} solid #e2e2e2;
  208. padding-top: #{24rpx};
  209. font-size: #{30rpx};
  210. }
  211. .order-num {
  212. float: right;
  213. }
  214. </style>