MyGroup.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <view class="MyGroup">
  3. <view class="top-view">
  4. <view class="num-ul">
  5. <view class="num-li">
  6. <view class="num-li-tit">{{ text_set.Offline || '下线' }}总数</view>
  7. <view class="num-li-num">{{ subTotal }}</view>
  8. </view>
  9. <view class="num-li-line"></view>
  10. <view class="num-li">
  11. <view class="num-li-tit">{{ text_set.name || '分销商名称' }}总数</view>
  12. <view class="num-li-num">{{ businessmanTotal }}</view>
  13. </view>
  14. </view>
  15. <view class="grade-ul" v-if="grade_list.length">
  16. <view class="grade-li" @click="tabChange(index)" :class="[level === index + 1 ? 'grade-on' : '']" v-for="(item, index) in grade_list" :key="index">
  17. {{ item.name }}
  18. <view class="ibonfont ibonxiangshangjiantou top-jt-icon" v-if="level === index + 1"></view>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="total-view clearfix" v-if="grade_list.length">
  23. <view class="total-left float_left">
  24. <view class="left-num">总数:{{ pageTotal }}</view>
  25. <view class="line-num"></view>
  26. <view class="left-num">{{ text_set.name || '分销商名称' }}总数:{{ subBusinessmanTotal }}</view>
  27. </view>
  28. </view>
  29. <scroll-view @scrolltolower="scrollBootom" scroll-y="true" :style="style" class="group-ul">
  30. <view class="group-li" v-for="(item, index) in group_list" :key="index">
  31. <view class="user-avator-view"><image class="user-avator" :src="item.avatar" mode="aspectFill"></image></view>
  32. <view class="user-info clearfix">
  33. <view class="user-info-left float_left">
  34. <view class="user-name ellipsis">{{ item.name }}</view>
  35. <view class="user-time">消费:¥{{ item.totalMoney || 0 }}</view>
  36. </view>
  37. <view class="user-info-right float_right">
  38. <view class="user-time" style="padding-top: 0;">{{ $_utils.formatDate(item.createTime) }}</view>
  39. <view class="user-time">订单:{{ item.orderTotal }}</view>
  40. </view>
  41. </view>
  42. </view>
  43. <u-loadmore margin-top="20" v-if="group_list.length" :status="loading_status" />
  44. </scroll-view>
  45. </view>
  46. </template>
  47. <script>
  48. export default {
  49. computed: {
  50. style() {
  51. const systemInfo = uni.getSystemInfoSync();
  52. if(this.distribution_set.level===1){
  53. return `height: calc(100vh - ${systemInfo.statusBarHeight + 82}px)`;
  54. }else{
  55. return `height: calc(100vh - ${systemInfo.statusBarHeight + 171}px)`;
  56. }
  57. },
  58. location() {
  59. return this.$store.state.locationObj;
  60. }
  61. },
  62. data() {
  63. return {
  64. loading_status: 'loadmore',
  65. isLogin: false,
  66. grade_list: [],
  67. current: 0,
  68. myId: 0,
  69. group_list: [],
  70. page: 1,
  71. pageSize: 10,
  72. pageTotal: 0,
  73. level: 1,
  74. text_set: {},
  75. topTotal: 0,
  76. subTotal: 0,
  77. businessmanTotal: 0,
  78. subBusinessmanTotal: 0,
  79. distribution_set:{}
  80. };
  81. },
  82. onLoad(options) {
  83. uni.setNavigationBarColor({
  84. frontColor: '#ffffff',
  85. backgroundColor: '#fe582e'
  86. });
  87. this.text_set = this.$store.state.distributionTextSet;
  88. this.distribution_set = this.$store.state.distributionSet;
  89. this.myId = parseInt(options.id);
  90. if(this.distribution_set.level===2){
  91. this.grade_list = [
  92. {
  93. name: this.text_set.level_one || '一级'
  94. },
  95. {
  96. name: this.text_set.level_two || '二级'
  97. }
  98. ];
  99. }else if(this.distribution_set.level===3){
  100. this.grade_list = [
  101. {
  102. name: this.text_set.level_one || '一级'
  103. },
  104. {
  105. name: this.text_set.level_two || '二级'
  106. },
  107. {
  108. name: this.text_set.level_three || '三级'
  109. }
  110. ];
  111. }
  112. },
  113. onShow() {
  114. this.getAllSub();
  115. },
  116. methods: {
  117. // 查询分销商的下级
  118. async getAllSub() {
  119. this.loading_status = 'loading';
  120. this.$u.api.getAllSub({
  121. id: this.myId,
  122. level: this.level,
  123. page: this.page,
  124. pageSize: this.pageSize
  125. }).then(data=>{
  126. if (this.page === 1) {
  127. this.group_list = data.data;
  128. } else {
  129. this.group_list = this.group_list.concat(data.data);
  130. }
  131. this.pageTotal = data.pageTotal;
  132. this.topTotal = data.topTotal;
  133. this.subTotal = data.subTotal;
  134. this.businessmanTotal = data.businessmanTotal;
  135. this.subBusinessmanTotal = data.subBusinessmanTotal;
  136. this.loading_status = this.$_utils.loadStatus(this.page, this.pageSize, this.pageTotal);
  137. });
  138. },
  139. scrollBootom() {
  140. if (this.pageTotal / this.pageSize > this.page) {
  141. this.page += 1;
  142. this.getAllSub();
  143. }
  144. },
  145. tabChange(index) {
  146. this.current = index;
  147. this.level = index + 1;
  148. this.page = 1;
  149. this.getAllSub();
  150. }
  151. }
  152. };
  153. </script>
  154. <style lang="scss">
  155. .top-view {
  156. color: #ffffff;
  157. background-color: #fe582e;
  158. .num-ul {
  159. padding: 40upx 0;
  160. display: flex;
  161. .num-li {
  162. flex: 2;
  163. text-align: center;
  164. .num-li-tit {
  165. font-size: 24upx;
  166. }
  167. .num-li-num {
  168. font-size: 40upx;
  169. padding-top: 30upx;
  170. }
  171. }
  172. .num-li-line {
  173. width: 1upx;
  174. height: 56upx;
  175. background-color: #fff;
  176. opacity: 0.5;
  177. transform: translateY(70upx);
  178. }
  179. }
  180. .grade-ul {
  181. background-color: rgba($color: #ffffff, $alpha: 0.2);
  182. font-size: 28upx;
  183. display: flex;
  184. color: rgba($color: #ffffff, $alpha: 0.7);
  185. .grade-li {
  186. flex: 2;
  187. text-align: center;
  188. line-height: 90upx;
  189. position: relative;
  190. .top-jt-icon {
  191. position: absolute;
  192. bottom: -10upx;
  193. left: 50%;
  194. transform: translateX(-50%);
  195. display: block;
  196. height: 30upx;
  197. line-height: 30upx;
  198. font-size: 32upx;
  199. color: rgba($color: #ffffff, $alpha: 1);
  200. }
  201. }
  202. .grade-on {
  203. color: rgba($color: #ffffff, $alpha: 1);
  204. font-size: 32upx;
  205. }
  206. }
  207. }
  208. .total-view {
  209. line-height: 90upx;
  210. color: #3d404d;
  211. background-color: #fff1f0;
  212. font-size: 24upx;
  213. .total-left {
  214. .left-num {
  215. padding: 0 24upx;
  216. display: inline-block;
  217. }
  218. .line-num {
  219. display: inline-block;
  220. width: 2upx;
  221. height: 28upx;
  222. background-color: #fff;
  223. }
  224. }
  225. }
  226. .group-ul {
  227. .group-li {
  228. padding: 20upx;
  229. background-color: #fff;
  230. border-radius: 8upx;
  231. .user-avator-view {
  232. display: inline-block;
  233. padding-right: 20upx;
  234. .user-avator {
  235. display: block;
  236. width: 100upx;
  237. height: 100upx;
  238. border-radius: 100%;
  239. }
  240. }
  241. .user-info {
  242. border-bottom: 1upx solid #f4f4f4;
  243. width: 588upx;
  244. display: inline-block;
  245. padding-bottom: 20upx;
  246. .user-name{
  247. width: 310rpx;
  248. -webkit-line-clamp:1;
  249. height: 40rpx;
  250. line-height: 40rpx;
  251. }
  252. .user-time {
  253. color: #999;
  254. font-size: 24upx;
  255. padding-top: 10upx;
  256. }
  257. .user-info-right {
  258. text-align: right;
  259. }
  260. }
  261. }
  262. }
  263. </style>