index.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. <template>
  2. <view :style="viewColor">
  3. <view class="promoter-list">
  4. <view class="promoter-header">
  5. <view class="search">
  6. <view class="search-content acea-row row-middle">
  7. <text class="iconfont icon-sousuo"></text>
  8. <input type='text' v-model="keyword" placeholder='搜索用户名称' @confirm="searchSubmitValue" confirm-type='search'
  9. name="search" placeholder-class='placeholder' />
  10. </view>
  11. </view>
  12. </view>
  13. <view class='nav acea-row row-around'>
  14. <view :class="grade == 0 ? 'item on' : 'item'" @click='setType(0)'>一级({{userInfo.one_level_count}})</view>
  15. <view :class="grade == 1 ? 'item on' : 'item'" @click='setType(1)'>二级({{userInfo.two_level_count}})</view>
  16. </view>
  17. <timeSlot @changeTime="changeTime"></timeSlot>
  18. <view class='list'>
  19. <view class="sortNav acea-row row-middle">
  20. <view class="sortItem" @click='setSort("spread_count ASC")' v-if="sort == 'spread_count DESC'">团队排序
  21. <image :src="domain+'/static/diy/sort1'+keyColor+'.png'"></image>
  22. </view>
  23. <view class="sortItem" @click='setSort("")' v-else-if="sort == 'spread_count ASC'">团队排序
  24. <image :src="domain+'/static/diy/sort3'+keyColor+'.png'"></image>
  25. </view>
  26. <view class="sortItem" @click='setSort("spread_count DESC")' v-else>团队排序
  27. <image :src="`${domain}/static/images/sort2.png`"></image>
  28. </view>
  29. <view class="sortItem" @click='setSort("pay_price ASC")' v-if="sort == 'pay_price DESC'">金额排序
  30. <image :src="domain+'/static/diy/sort1'+keyColor+'.png'"></image>
  31. </view>
  32. <view class="sortItem" @click='setSort("")' v-else-if="sort == 'pay_price ASC'">金额排序
  33. <image :src="domain+'/static/diy/sort3'+keyColor+'.png'"></image>
  34. </view>
  35. <view class="sortItem" @click='setSort("pay_price DESC")' v-else>金额排序
  36. <image :src="`${domain}/static/images/sort2.png`"></image>
  37. </view>
  38. <view class="sortItem" @click='setSort("pay_count ASC")' v-if="sort == 'pay_count DESC'">订单排序
  39. <image :src="domain+'/static/diy/sort1'+keyColor+'.png'"></image>
  40. </view>
  41. <view class="sortItem" @click='setSort("")' v-else-if="sort == 'pay_count ASC'">订单排序
  42. <image :src="domain+'/static/diy/sort3'+keyColor+'.png'"></image>
  43. </view>
  44. <view class="sortItem" @click='setSort("pay_count DESC")' v-else>订单排序
  45. <image :src="`${domain}/static/images/sort2.png`"></image>
  46. </view>
  47. </view>
  48. <block v-for="(item,index) in recordList" :key="index">
  49. <view class='item acea-row row-between-wrapper'>
  50. <view class="picTxt acea-row row-between-wrapper">
  51. <view class='pictrue'>
  52. <image :src='item.avatar ? item.avatar : "/static/images/f.png"'></image>
  53. </view>
  54. <view class='text'>
  55. <view class='name line1'>{{item.nickname}}</view>
  56. <view>加入时间: {{item.spread_time}}</view>
  57. </view>
  58. </view>
  59. <view class="right">
  60. <view><text class='num t-color'>{{item.spread_count ? item.spread_count : 0}}</text></view>
  61. <view><text class="num">{{item.pay_count ? item.pay_count : 0}}</text></view>
  62. <view><text class="num">{{item.pay_price ? item.pay_price : 0}}</text></view>
  63. </view>
  64. </view>
  65. </block>
  66. </view>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. // +----------------------------------------------------------------------
  72. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  73. // +----------------------------------------------------------------------
  74. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  75. // +----------------------------------------------------------------------
  76. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  77. // +----------------------------------------------------------------------
  78. // | Author: CRMEB Team <admin@crmeb.com>
  79. // +----------------------------------------------------------------------
  80. import { spreadPeople, getUserInfo, spreadInfo } from '@/api/user.js';
  81. import { mapGetters } from "vuex";
  82. import { HTTP_REQUEST_URL } from '@/config/app';
  83. import { toLogin } from '@/libs/login.js';
  84. import timeSlot from '@/components/timeSlot/index.vue';
  85. export default {
  86. components: {
  87. timeSlot
  88. },
  89. data() {
  90. return {
  91. domain: HTTP_REQUEST_URL,
  92. total: 0,
  93. totalLevel: 0,
  94. teamCount: 0,
  95. page: 1,
  96. limit: 20,
  97. keyword: '',
  98. start: 0,
  99. stop: 0,
  100. sort: '',
  101. grade: 0,
  102. status: false,
  103. recordList: [],
  104. userInfo:{},
  105. times: [],
  106. };
  107. },
  108. computed: mapGetters(['isLogin','viewColor','keyColor']),
  109. onLoad() {
  110. if (this.isLogin) {
  111. this.userSpreadNewList();
  112. this.getUserInfo()
  113. } else {
  114. toLogin()
  115. }
  116. },
  117. onShow: function() {
  118. if (this.is_show){
  119. this.userSpreadNewList();
  120. this.getUserInfo();
  121. }
  122. },
  123. onHide: function() {
  124. this.is_show = true;
  125. },
  126. methods: {
  127. getUserInfo(){
  128. spreadInfo().then(res => {
  129. this.userInfo = res.data
  130. });
  131. },
  132. setSort: function(sort) {
  133. let that = this;
  134. that.sort = sort;
  135. that.page = 1;
  136. that.limit = 20;
  137. that.status = false;
  138. that.$set(that, 'recordList', []);
  139. that.userSpreadNewList();
  140. },
  141. changeTime(time) {
  142. this.start = time.start
  143. this.stop = time.stop
  144. this.searchSubmitValue()
  145. },
  146. searchSubmitValue(e) {
  147. this.page = 1;
  148. this.limit = 20;
  149. this.status = false;
  150. this.$set(this, 'recordList', []);
  151. this.$set(this, 'times', []);
  152. this.userSpreadNewList()
  153. },
  154. setType: function(grade) {
  155. if (this.grade != grade) {
  156. this.grade = grade;
  157. this.page = 1;
  158. this.limit = 20;
  159. this.keyword = '';
  160. this.sort = '';
  161. this.status = false;
  162. this.$set(this, 'recordList', []);
  163. this.userSpreadNewList();
  164. }
  165. },
  166. userSpreadNewList: function() {
  167. let that = this;
  168. let page = that.page;
  169. let limit = that.limit;
  170. let status = that.status;
  171. let keyword = that.keyword;
  172. let sort = that.sort;
  173. let grade = that.grade;
  174. let start = that.start;
  175. let stop = that.stop;
  176. let recordList = that.recordList;
  177. let recordListNew = [];
  178. if (status == true) return;
  179. spreadPeople({
  180. page: page,
  181. limit: limit,
  182. keyword: keyword,
  183. level: grade+1,
  184. sort: sort,
  185. start: start,
  186. stop: stop
  187. }).then(res => {
  188. let len = res.data.list.length;
  189. let recordListData = res.data.list;
  190. recordListNew = recordList.concat(recordListData);
  191. that.total = res.data.total;
  192. that.totalLevel = res.data.totalLevel;
  193. that.teamCount = that.$util.$h.Add(Number(res.data.total), Number(res.data.totalLevel));
  194. that.status = limit > len;
  195. that.page = page + 1;
  196. that.$set(that, 'recordList', recordListNew);
  197. });
  198. }
  199. },
  200. onReachBottom: function() {
  201. this.userSpreadNewList();
  202. }
  203. }
  204. </script>
  205. <style scoped lang="scss">
  206. .promoterHeader {
  207. background-image: linear-gradient(to right, var(--view-bntColor21) 0%, var(--view-bntColor22) 100%);
  208. }
  209. .t-color {
  210. color: var(--view-theme);
  211. }
  212. .promoter-header{
  213. width: 100%;
  214. }
  215. .search {
  216. padding: 17rpx 30rpx;
  217. background-color: var(--view-theme);
  218. .search-content {
  219. width: 100%;
  220. height: 60rpx;
  221. padding: 0 30rpx;
  222. border-radius: 30rpx;
  223. background-color: #FFFFFF;
  224. font-size: 26rpx;
  225. }
  226. .iconfont {
  227. margin-right: 10rpx;
  228. font-size: 26rpx;
  229. color: #999999;
  230. }
  231. .placeholder {
  232. font-size: 26rpx;
  233. color: #999999;
  234. }
  235. .input {
  236. flex: 1;
  237. }
  238. }
  239. .promoter-list .nav {
  240. background-color: #fff;
  241. height: 86rpx;
  242. line-height: 86rpx;
  243. font-size: 28rpx;
  244. color: #282828;
  245. border-bottom: 1px solid #eee;
  246. }
  247. .promoter-list .nav .item.on {
  248. border-bottom: 5rpx solid var(--view-theme);
  249. color: var(--view-theme);
  250. }
  251. .promoter-list .list {
  252. margin-top: 12rpx;
  253. }
  254. .promoter-list .list .sortNav {
  255. background-color: #fff;
  256. height: 76rpx;
  257. border-bottom: 1px solid #eee;
  258. color: #333;
  259. font-size: 28rpx;
  260. }
  261. .promoter-list .list .sortNav .sortItem {
  262. text-align: center;
  263. flex: 1;
  264. }
  265. .promoter-list .list .sortNav .sortItem image {
  266. width: 24rpx;
  267. height: 24rpx;
  268. margin-left: 6rpx;
  269. vertical-align: -3rpx;
  270. }
  271. .promoter-list .list .item {
  272. background-color: #fff;
  273. border-bottom: 1px solid #eee;
  274. height: 152rpx;
  275. padding: 0 30rpx 0 20rpx;
  276. font-size: 24rpx;
  277. color: #666;
  278. }
  279. .promoter-list .list .item .picTxt {
  280. width: 440rpx;
  281. }
  282. .promoter-list .list .item .picTxt .pictrue {
  283. width: 106rpx;
  284. height: 106rpx;
  285. border-radius: 50%;
  286. }
  287. .promoter-list .list .item .picTxt .pictrue image {
  288. width: 100%;
  289. height: 100%;
  290. border-radius: 50%;
  291. border: 3rpx solid #fff;
  292. box-shadow: 0 0 10rpx #aaa;
  293. box-sizing: border-box;
  294. }
  295. .promoter-list .list .item .picTxt .text {
  296. width: 304rpx;
  297. font-size: 24rpx;
  298. color: #666;
  299. }
  300. .promoter-list .list .item .picTxt .text .name {
  301. font-size: 28rpx;
  302. color: #333;
  303. margin-bottom: 13rpx;
  304. }
  305. .promoter-list .list .item .right {
  306. width: 240rpx;
  307. text-align: right;
  308. font-size: 22rpx;
  309. color: #333;
  310. }
  311. .promoter-list .list .item .right .num{
  312. margin-right: 7rpx;
  313. }
  314. </style>