team.vue 8.3 KB

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