index.vue 9.4 KB

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