You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

356 lines
9.5 KiB

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