PromoterList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. <template>
  2. <view class="promoter-list">
  3. <!-- 头部背景 -->
  4. <view class="header">
  5. <view class="promoter-count">
  6. <view class="title">推广总人数</view>
  7. <view class="count">{{ (parseInt(first) || 0) + (parseInt(second) || 0) }}<text class="unit">人</text></view>
  8. <view class="subtitle">您已成功推广的会员总数</view>
  9. </view>
  10. </view>
  11. <!-- 筛选导航 -->
  12. <view class="nav acea-row row-around">
  13. <view class="item" :class="screen.grade == 0 ? 'on' : ''" @click="checkGrade(0)">一级({{ first || '0' }})</view>
  14. <view class="item" :class="screen.grade == 1 ? 'on' : ''" @click="checkGrade(1)">二级({{ second || '0' }})</view>
  15. </view>
  16. <!-- 搜索框 -->
  17. <view class="search acea-row row-between-wrapper">
  18. <form @submit.prevent="submitForm">
  19. <view class="input">
  20. <input placeholder="点击搜索会员名称" v-model="screen.keyword" />
  21. <text class="iconfont icon-guanbi" @click="screen.keyword = ''"></text>
  22. </view>
  23. </form>
  24. <view class="iconfont icon-sousuo2"></view>
  25. </view>
  26. <!-- 排序导航 -->
  27. <view class="sortNav acea-row row-middle" :class="fixedState === true ? 'on' : ''">
  28. <view class="sortItem" @click="sort('childCount')">
  29. 团队排序
  30. <image src="../../../static/user/sort1.png" v-if="childCount == 1" />
  31. <image src="../../../static/user/sort2.png" v-if="childCount == 2" />
  32. <image src="../../../static/user/sort3.png" v-if="childCount == 3" />
  33. </view>
  34. <view class="sortItem" @click="sort('numberCount')">
  35. 金额排序
  36. <image src="../../../static/user/sort1.png" v-if="numberCount == 1" />
  37. <image src="../../../static/user/sort2.png" v-if="numberCount == 2" />
  38. <image src="../../../static/user/sort3.png" v-if="numberCount == 3" />
  39. </view>
  40. <view class="sortItem" @click="sort('orderCount')">
  41. 订单排序
  42. <image src="../../../static/user/sort1.png" v-if="orderCount == 1" />
  43. <image src="../../../static/user/sort2.png" v-if="orderCount == 2" />
  44. <image src="../../../static/user/sort3.png" v-if="orderCount == 3" />
  45. </view>
  46. </view>
  47. <!-- 列表内容 -->
  48. <view :class="fixedState === true ? 'sortList' : ''">
  49. <view class="item acea-row row-between-wrapper" v-for="(val, spreadListIndex) in spreadList" :key="spreadListIndex">
  50. <view class="picTxt acea-row row-between-wrapper">
  51. <view class="pictrue">
  52. <image :src="val.avatar" />
  53. </view>
  54. <view class="text">
  55. <view class="name line1">{{ val.nickname }}</view>
  56. <view>加入时间: {{ val.time }}</view>
  57. </view>
  58. </view>
  59. <view class="right">
  60. <view>
  61. <text class="font-color-red">{{ val.childCount }}</text>人
  62. </view>
  63. <view>{{ val.orderCount }} 单</view>
  64. <view>{{ val.numberCount ? val.numberCount : 0 }} 元</view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. export default {
  72. name: 'PromoterList',
  73. props: {},
  74. data: function () {
  75. return {
  76. fixedState: false,
  77. screen: {
  78. page: 1,
  79. limit: 15,
  80. grade: 0,
  81. keyword: '',
  82. sort: '',
  83. },
  84. childCount: 2,
  85. numberCount: 2,
  86. orderCount: 2,
  87. loaded: false,
  88. loading: false,
  89. spreadList: [],
  90. loadTitle: '',
  91. first: '',
  92. second: '',
  93. }
  94. },
  95. mounted: function () {
  96. this.getSpreadUsers()
  97. },
  98. onReachBottom() {
  99. !this.loading && this.getSpreadUsers()
  100. },
  101. watch: {
  102. 'screen.sort': function () {
  103. this.screen.page = 0
  104. this.loaded = false
  105. this.loading = false
  106. this.spreadList = []
  107. this.getSpreadUsers()
  108. },
  109. },
  110. methods: {
  111. handleScroll: function () {
  112. // var scrollTop =
  113. // document.documentElement.scrollTop || document.body.scrollTop;
  114. // var offsetTop = document.querySelector(".header").clientHeight;
  115. // if (scrollTop >= offsetTop) {
  116. // this.fixedState = true;
  117. // } else {
  118. // this.fixedState = false;
  119. // }
  120. },
  121. submitForm: function () {
  122. this.screen.page = 0
  123. this.loaded = false
  124. this.loading = false
  125. this.spreadList = []
  126. this.getSpreadUsers()
  127. },
  128. getSpreadUsers: function () {
  129. let that = this,
  130. screen = that.screen
  131. if (that.loaded || that.loading) return
  132. that.loading = true
  133. uni.showLoading({
  134. title: '加载中...'
  135. })
  136. this.$api.request('post', 'user/app/spread/people',screen).then(
  137. (res) => {
  138. uni.hideLoading()
  139. that.loading = false
  140. that.spreadList.push.apply(that.spreadList, res.data.list)
  141. that.loaded = res.data.list.length < that.screen.limit
  142. that.loadTitle = that.loaded ? '人家是有底线的' : '上拉加载更多'
  143. that.screen.page = that.screen.page + 1
  144. that.first = res.data.total
  145. that.second = res.data.totalLevel
  146. },
  147. (err) => {
  148. uni.hideLoading()
  149. uni.showToast({
  150. title: err.msg || err.response.data.msg || err.response.data.message,
  151. icon: 'none',
  152. duration: 2000,
  153. })
  154. },
  155. 300
  156. )
  157. },
  158. checkGrade: function (val) {
  159. if (val == this.screen.grade) return
  160. else {
  161. this.screen.page = 1
  162. this.screen.grade = val
  163. this.loading = false
  164. this.loaded = false
  165. this.spreadList = []
  166. this.getSpreadUsers()
  167. }
  168. },
  169. sort: function (types) {
  170. let that = this
  171. switch (types) {
  172. case 'childCount':
  173. if (that.childCount == 2) {
  174. that.childCount = 1
  175. that.orderCount = 2
  176. that.numberCount = 2
  177. that.screen.sort = 'childCount DESC'
  178. } else if (that.childCount == 1) {
  179. that.childCount = 3
  180. that.orderCount = 2
  181. that.numberCount = 2
  182. that.screen.sort = 'childCount ASC'
  183. } else if (that.childCount == 3) {
  184. that.childCount = 2
  185. that.orderCount = 2
  186. that.numberCount = 2
  187. that.screen.sort = ''
  188. }
  189. break
  190. case 'numberCount':
  191. if (that.numberCount == 2) {
  192. that.numberCount = 1
  193. that.orderCount = 2
  194. that.childCount = 2
  195. that.screen.sort = 'numberCount DESC'
  196. } else if (that.numberCount == 1) {
  197. that.numberCount = 3
  198. that.orderCount = 2
  199. that.childCount = 2
  200. that.screen.sort = 'numberCount ASC'
  201. } else if (that.numberCount == 3) {
  202. that.numberCount = 2
  203. that.orderCount = 2
  204. that.childCount = 2
  205. that.screen.sort = ''
  206. }
  207. break
  208. case 'orderCount':
  209. if (that.orderCount == 2) {
  210. that.orderCount = 1
  211. that.numberCount = 2
  212. that.childCount = 2
  213. that.screen.sort = 'orderCount DESC'
  214. } else if (that.orderCount == 1) {
  215. that.orderCount = 3
  216. that.numberCount = 2
  217. that.childCount = 2
  218. that.screen.sort = 'orderCount ASC'
  219. } else if (that.orderCount == 3) {
  220. that.orderCount = 2
  221. that.numberCount = 2
  222. that.childCount = 2
  223. that.screen.sort = ''
  224. }
  225. break
  226. default:
  227. that.screen.sort = ''
  228. }
  229. },
  230. },
  231. }
  232. </script>
  233. <style lang="less">
  234. .promoter-list {
  235. .header {
  236. background-image: url('https://kxmalls.oss-cn-hangzhou.aliyuncs.com/bg/bg.png');
  237. background-repeat: no-repeat;
  238. background-size: 100% 110%;
  239. width: 100%;
  240. height: 300rpx;
  241. padding: 0 30rpx;
  242. box-sizing: border-box;
  243. color: #fff;
  244. .promoter-count {
  245. text-align: center;
  246. padding: 50rpx 0;
  247. .title {
  248. font-size: 28rpx;
  249. opacity: 0.9;
  250. margin-bottom: 10rpx;
  251. }
  252. .count {
  253. font-size: 72rpx;
  254. font-weight: bold;
  255. line-height: 1.2;
  256. font-family: 'Arial Rounded MT Bold', 'Helvetica Rounded', sans-serif;
  257. text-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.1);
  258. .unit {
  259. font-size: 36rpx;
  260. font-weight: normal;
  261. margin-left: 8rpx;
  262. }
  263. }
  264. .subtitle {
  265. font-size: 24rpx;
  266. opacity: 0.8;
  267. margin-top: 10rpx;
  268. }
  269. }
  270. .name {
  271. font-size: 30rpx;
  272. padding-top: 50rpx;
  273. justify-content: center;
  274. }
  275. .num {
  276. text-align: center;
  277. font-size: 60rpx;
  278. margin-top: 20rpx;
  279. font-family: 'GuildfordProBook 5';
  280. }
  281. .profit {
  282. padding: 0 20rpx;
  283. font-size: 24rpx;
  284. margin-top: 30rpx;
  285. .item {
  286. min-width: 200rpx;
  287. text-align: center;
  288. width: 50%;
  289. .money {
  290. font-size: 34rpx;
  291. margin-top: 10rpx;
  292. }
  293. }
  294. }
  295. }
  296. .nav {
  297. justify-content: space-around;
  298. display: flex;
  299. background-color: #fff;
  300. height: 80rpx;
  301. line-height: 80rpx;
  302. font-size: 28rpx;
  303. color: #282828;
  304. border-bottom: 1px solid #eee;
  305. .item {
  306. height: 100%;
  307. &.on {
  308. color: #eb3729;
  309. border-bottom: 5rpx solid #eb3729;
  310. }
  311. }
  312. }
  313. .search {
  314. align-items: center;
  315. display: flex;
  316. justify-content: space-around;
  317. background-color: #fff;
  318. height: 90rpx;
  319. padding: 0 30rpx;
  320. border-bottom: 1px solid #eee;
  321. flex-wrap: wrap;
  322. border-bottom: 1px solid #eee;
  323. .input {
  324. width: 630rpx;
  325. height: 60rpx;
  326. border-radius: 50rpx;
  327. background-color: #f5f5f5;
  328. position: relative;
  329. input {
  330. height: 100%;
  331. width: 620rpx;
  332. font-size: 26rpx;
  333. padding: 0 30rpx;
  334. box-sizing: border-box;
  335. &::placeholder {
  336. color: #bbb;
  337. }
  338. }
  339. .iconfont {
  340. position: absolute;
  341. right: 28rpx;
  342. top: 50%;
  343. transform: translateY(-50%);
  344. color: #999;
  345. font-size: 28rpx;
  346. }
  347. }
  348. .iconfont {
  349. font-size: 40rpx;
  350. color: #515151;
  351. }
  352. }
  353. .sortNav {
  354. background-color: #fff;
  355. height: 80rpx;
  356. border-bottom: 1px solid #eee;
  357. color: #333;
  358. font-size: 28rpx;
  359. &.on {
  360. position: fixed;
  361. top: 0;
  362. left: 0;
  363. width: 100%;
  364. z-index: 5;
  365. }
  366. .sortItem {
  367. text-align: center;
  368. flex: 1;
  369. display: flex;
  370. align-items: center;
  371. justify-content: center;
  372. image {
  373. width: 24rpx;
  374. height: 24rpx;
  375. margin-left: 6rpx;
  376. }
  377. }
  378. }
  379. .sortList {
  380. margin-top: 80rpx;
  381. }
  382. .item {
  383. background-color: #fff;
  384. border-bottom: 1px solid #eee;
  385. height: 160rpx;
  386. padding: 0 30rpx;
  387. font-size: 24rpx;
  388. color: #666;
  389. .picTxt {
  390. width: 440rpx;
  391. .pictrue {
  392. width: 100rpx;
  393. height: 100rpx;
  394. border-radius: 50%;
  395. overflow: hidden;
  396. image {
  397. width: 100%;
  398. height: 100%;
  399. border-radius: 50%;
  400. border: 3rpx solid #fff;
  401. box-shadow: 0 0 7rpx #aaa;
  402. box-sizing: border-box;
  403. }
  404. }
  405. .text {
  406. width: 300rpx;
  407. margin-left: 20rpx;
  408. .name {
  409. font-size: 28rpx;
  410. color: #333;
  411. margin-bottom: 10rpx;
  412. }
  413. }
  414. }
  415. .right {
  416. width: 240rpx;
  417. text-align: right;
  418. font-size: 22rpx;
  419. color: #333;
  420. .font-color-red {
  421. color: #eb3729;
  422. }
  423. }
  424. }
  425. }
  426. .acea-row {
  427. display: flex;
  428. flex-wrap: wrap;
  429. }
  430. </style>