index.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. <template>
  2. <view :style="colorStyle">
  3. <view class="promoter-list">
  4. <view class='promoterHeader bg-color'>
  5. <view class='headerCon acea-row row-between-wrapper'>
  6. <view>
  7. <view class='name'>{{$t(`推广人数`)}}</view>
  8. <view><text class='num'>{{teamCount}}</text>{{$t('人')}}</view>
  9. </view>
  10. <view class='iconfont icon-tuandui'></view>
  11. </view>
  12. </view>
  13. <view class='nav acea-row row-around' v-if="brokerage_level == 2">
  14. <view :class="grade == 0 ? 'item on' : 'item'" @click='setType(0)'>{{$t(`一级`)}}({{total}})</view>
  15. <view :class="grade == 1 ? 'item on' : 'item'" @click='setType(1)'>{{$t(`二级`)}}({{totalLevel}})</view>
  16. </view>
  17. <!-- <form @submit.prevent="submitForm">
  18. </form> -->
  19. <view class='search acea-row row-between-wrapper'>
  20. <view class='input'><input :placeholder='$t(`点击搜索会员名称`)' placeholder-class='placeholder' v-model="keyword" @confirm="submitForm" confirm-type='search' name="search"></input></view>
  21. <button class='iconfont icon-sousuo2' @click="submitForm"></button>
  22. </view>
  23. <view class='list'>
  24. <view class="sortNav acea-row row-middle">
  25. <view class="sortItem" @click='setSort("childCount ASC")' v-if="sort == 'childCount DESC'">{{$t(`团队排序`)}}
  26. <image src='../static/sort1.png'></image>
  27. </view>
  28. <view class="sortItem" @click='setSort("")' v-else-if="sort == 'childCount ASC'">{{$t(`团队排序`)}}
  29. <image src='../static/sort3.png'></image>
  30. </view>
  31. <view class="sortItem" @click='setSort("childCount DESC")' v-else>{{$t(`团队排序`)}}
  32. <image src='../static/sort2.png'></image>
  33. </view>
  34. <view class="sortItem" @click='setSort("numberCount ASC")' v-if="sort == 'numberCount DESC'">{{$t(`金额排序`)}}
  35. <image src='../static/sort1.png'></image>
  36. </view>
  37. <view class="sortItem" @click='setSort("")' v-else-if="sort == 'numberCount ASC'">{{$t(`金额排序`)}}
  38. <image src='../static/sort3.png'></image>
  39. </view>
  40. <view class="sortItem" @click='setSort("numberCount DESC")' v-else>{{$t(`金额排序`)}}
  41. <image src='../static/sort2.png'></image>
  42. </view>
  43. <view class="sortItem" @click='setSort("orderCount ASC")' v-if="sort == 'orderCount DESC'">{{$t(`订单排序`)}}
  44. <image src='../static/sort1.png'></image>
  45. </view>
  46. <view class="sortItem" @click='setSort("")' v-else-if="sort == 'orderCount ASC'">{{$t(`订单排序`)}}
  47. <image src='../static/sort3.png'></image>
  48. </view>
  49. <view class="sortItem" @click='setSort("orderCount DESC")' v-else>{{$t(`订单排序`)}}
  50. <image src='../static/sort2.png'></image>
  51. </view>
  52. </view>
  53. <block v-for="(item,index) in recordList" :key="index">
  54. <view class='item acea-row row-between-wrapper'>
  55. <view class="picTxt acea-row row-between-wrapper">
  56. <view class='pictrue'>
  57. <image :src='item.avatar'></image>
  58. </view>
  59. <view class='text'>
  60. <view class='name line1'>{{item.nickname}}</view>
  61. <view>{{$t(`加入时间`)}}: {{item.time}}</view>
  62. </view>
  63. </view>
  64. <view class="right">
  65. <view><text class='num font-num'>{{item.childCount ? item.childCount : 0}}</text>{{$t(`人`)}}</view>
  66. <view><text class="num">{{item.orderCount ? item.orderCount : 0}}</text>{{$t(`单`)}}</view>
  67. <view><text class="num">{{item.numberCount ? item.numberCount : 0}}</text>{{$t(`元`)}}</view>
  68. </view>
  69. </view>
  70. </block>
  71. </view>
  72. </view>
  73. <!-- #ifdef MP -->
  74. <!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
  75. <!-- #endif -->
  76. <!-- #ifndef MP -->
  77. <home></home>
  78. <!-- #endif -->
  79. </view>
  80. </template>
  81. <script>
  82. import {
  83. spreadPeople
  84. } from '@/api/user.js';
  85. import {
  86. toLogin
  87. } from '@/libs/login.js';
  88. import {
  89. mapGetters
  90. } from "vuex";
  91. // #ifdef MP
  92. import authorize from '@/components/Authorize';
  93. // #endif
  94. import home from '@/components/home';
  95. import colors from '@/mixins/color.js';
  96. export default {
  97. components: {
  98. // #ifdef MP
  99. authorize,
  100. // #endif
  101. home
  102. },
  103. mixins:[colors],
  104. data() {
  105. return {
  106. total: 0,
  107. totalLevel: 0,
  108. teamCount: 0,
  109. page: 1,
  110. limit: 20,
  111. keyword: '',
  112. sort: '',
  113. grade: 0,
  114. status: false,
  115. recordList: [],
  116. isAuto: false, //没有授权的不会自动授权
  117. isShowAuth: false ,//是否隐藏授权
  118. brokerage_level: 0
  119. };
  120. },
  121. computed: mapGetters(['isLogin']),
  122. onLoad() {
  123. if (this.isLogin) {
  124. this.userSpreadNewList();
  125. } else {
  126. toLogin();
  127. }
  128. },
  129. onShow: function() {
  130. if (this.is_show) this.userSpreadNewList();
  131. },
  132. onHide: function() {
  133. this.is_show = true;
  134. },
  135. methods: {
  136. onLoadFun: function(e) {
  137. this.userSpreadNewList();
  138. },
  139. // 授权关闭
  140. authColse: function(e) {
  141. this.isShowAuth = e
  142. },
  143. setSort: function(sort) {
  144. let that = this;
  145. that.sort = sort;
  146. that.page = 1;
  147. that.limit = 20;
  148. that.status = false;
  149. that.$set(that, 'recordList', []);
  150. that.userSpreadNewList();
  151. },
  152. // setKeyword: function(e) {
  153. // this.keyword = e.detail.value;
  154. // },
  155. submitForm: function() {
  156. this.page = 1;
  157. this.limit = 20;
  158. this.status = false;
  159. this.$set(this, 'recordList', []);
  160. this.userSpreadNewList();
  161. },
  162. setType: function(grade) {
  163. if (this.grade != grade) {
  164. this.grade = grade;
  165. this.page = 1;
  166. this.limit = 20;
  167. this.keyword = '';
  168. this.sort = '';
  169. this.status = false;
  170. this.$set(this, 'recordList', []);
  171. this.userSpreadNewList();
  172. }
  173. },
  174. userSpreadNewList: function() {
  175. let that = this;
  176. let page = that.page;
  177. let limit = that.limit;
  178. let status = that.status;
  179. let keyword = that.keyword;
  180. let sort = that.sort;
  181. let grade = that.grade;
  182. let recordList = that.recordList;
  183. let recordListNew = [];
  184. if (status == true) return;
  185. spreadPeople({
  186. page: page,
  187. limit: limit,
  188. keyword: keyword,
  189. grade: grade,
  190. sort: sort,
  191. }).then(res => {
  192. let len = res.data.list.length;
  193. let recordListData = res.data.list;
  194. recordListNew = recordList.concat(recordListData);
  195. that.total = res.data.total;
  196. that.totalLevel = res.data.totalLevel;
  197. that.teamCount = res.data.count;
  198. that.status = limit > len;
  199. that.page = page + 1;
  200. that.$set(that, 'recordList', recordListNew);
  201. that.brokerage_level = res.data.brokerage_level;
  202. });
  203. }
  204. },
  205. onReachBottom: function() {
  206. this.userSpreadNewList();
  207. }
  208. }
  209. </script>
  210. <style scoped lang="scss">
  211. .promoter-list .nav {
  212. background-color: #fff;
  213. height: 86rpx;
  214. line-height: 86rpx;
  215. font-size: 28rpx;
  216. color: #282828;
  217. border-bottom: 1rpx solid #eee;
  218. }
  219. .promoter-list .nav .item.on {
  220. border-bottom: 5rpx solid var(--view-theme);
  221. color: var(--view-theme);
  222. }
  223. .promoter-list .search {
  224. width: 100%;
  225. background-color: #fff;
  226. height: 86rpx;
  227. padding-left: 30rpx;
  228. box-sizing: border-box;
  229. }
  230. .promoter-list .search .input {
  231. width: 610rpx;
  232. height: 60rpx;
  233. border-radius: 50rpx;
  234. background-color: #f5f5f5;
  235. text-align: center;
  236. position: relative;
  237. }
  238. .promoter-list .search .input input {
  239. height: 100%;
  240. font-size: 26rpx;
  241. width: 610rpx;
  242. text-align: center;
  243. }
  244. .promoter-list .search .input .placeholder {
  245. color: #bbb;
  246. }
  247. .promoter-list .search .input .iconfont {
  248. position: absolute;
  249. right: 28rpx;
  250. color: #999;
  251. font-size: 28rpx;
  252. top: 50%;
  253. transform: translateY(-50%);
  254. }
  255. .promoter-list .search .iconfont {
  256. font-size: 45rpx;
  257. color: #515151;
  258. width: 110rpx;
  259. height: 60rpx;
  260. line-height: 60rpx;
  261. }
  262. .promoter-list .list {
  263. margin-top: 12rpx;
  264. }
  265. .promoter-list .list .sortNav {
  266. background-color: #fff;
  267. height: 76rpx;
  268. border-bottom: 1rpx solid #eee;
  269. color: #333;
  270. font-size: 28rpx;
  271. }
  272. .promoter-list .list .sortNav .sortItem {
  273. text-align: center;
  274. flex: 1;
  275. }
  276. .promoter-list .list .sortNav .sortItem image {
  277. width: 24rpx;
  278. height: 24rpx;
  279. margin-left: 6rpx;
  280. vertical-align: -3rpx;
  281. }
  282. .promoter-list .list .item {
  283. background-color: #fff;
  284. border-bottom: 1rpx solid #eee;
  285. height: 152rpx;
  286. padding: 0 30rpx 0 20rpx;
  287. font-size: 24rpx;
  288. color: #666;
  289. }
  290. .promoter-list .list .item .picTxt {
  291. width: 440rpx;
  292. }
  293. .promoter-list .list .item .picTxt .pictrue {
  294. width: 106rpx;
  295. height: 106rpx;
  296. border-radius: 50%;
  297. }
  298. .promoter-list .list .item .picTxt .pictrue image {
  299. width: 100%;
  300. height: 100%;
  301. border-radius: 50%;
  302. border: 3rpx solid #fff;
  303. box-shadow: 0 0 10rpx #aaa;
  304. box-sizing: border-box;
  305. }
  306. .promoter-list .list .item .picTxt .text {
  307. width: 304rpx;
  308. font-size: 24rpx;
  309. color: #666;
  310. }
  311. .promoter-list .list .item .picTxt .text .name {
  312. font-size: 28rpx;
  313. color: #333;
  314. margin-bottom: 13rpx;
  315. }
  316. .promoter-list .list .item .right {
  317. width: 240rpx;
  318. text-align: right;
  319. font-size: 22rpx;
  320. color: #333;
  321. }
  322. .promoter-list .list .item .right .num{
  323. margin-right: 7rpx;
  324. }
  325. </style>