index.vue 7.5 KB

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