index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. <template>
  2. <view :style="colorStyle">
  3. <view class="promoter-list">
  4. <view class='promoterHeader bg-color'>
  5. <view class='headerCon acea-row row-between-wrapper'>
  6. <view>
  7. <view class='name'>{{$t(`推广人数`)}}</view>
  8. <view><text class='num'>{{teamCount}}</text>{{$t('人')}}</view>
  9. </view>
  10. <view class='iconfont icon-tuandui'></view>
  11. </view>
  12. </view>
  13. <view class='nav acea-row row-around' v-if="brokerage_level == 2">
  14. <view :class="grade == 0 ? 'item on' : 'item'" @click='setType(0)'>{{$t(`一级`)}}({{total}})</view>
  15. <view :class="grade == 1 ? 'item on' : 'item'" @click='setType(1)'>{{$t(`二级`)}}({{totalLevel}})</view>
  16. </view>
  17. <!-- <form @submit.prevent="submitForm">
  18. </form> -->
  19. <view class='search acea-row row-between-wrapper'>
  20. <view class='input'><input :placeholder='$t(`点击搜索会员名称`)' placeholder-class='placeholder'
  21. v-model="keyword" @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 == 'childCount DESC'">
  27. {{$t(`团队排序`)}}
  28. <image src='../static/sort1.png'></image>
  29. </view>
  30. <view class="sortItem" @click='setSort("")' v-else-if="sort == 'childCount ASC'">{{$t(`团队排序`)}}
  31. <image src='../static/sort3.png'></image>
  32. </view>
  33. <view class="sortItem" @click='setSort("childCount DESC")' v-else>{{$t(`团队排序`)}}
  34. <image src='../static/sort2.png'></image>
  35. </view>
  36. <view class="sortItem" @click='setSort("numberCount ASC")' v-if="sort == 'numberCount DESC'">
  37. {{$t(`金额排序`)}}
  38. <image src='../static/sort1.png'></image>
  39. </view>
  40. <view class="sortItem" @click='setSort("")' v-else-if="sort == 'numberCount ASC'">{{$t(`金额排序`)}}
  41. <image src='../static/sort3.png'></image>
  42. </view>
  43. <view class="sortItem" @click='setSort("numberCount DESC")' v-else>{{$t(`金额排序`)}}
  44. <image src='../static/sort2.png'></image>
  45. </view>
  46. <view class="sortItem" @click='setSort("orderCount ASC")' v-if="sort == 'orderCount DESC'">
  47. {{$t(`订单排序`)}}
  48. <image src='../static/sort1.png'></image>
  49. </view>
  50. <view class="sortItem" @click='setSort("")' v-else-if="sort == 'orderCount ASC'">{{$t(`订单排序`)}}
  51. <image src='../static/sort3.png'></image>
  52. </view>
  53. <view class="sortItem" @click='setSort("orderCount DESC")' v-else>{{$t(`订单排序`)}}
  54. <image src='../static/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>{{$t(`加入时间`)}}: {{item.time}}</view>
  66. </view>
  67. </view>
  68. <view class="right">
  69. <view><text class='num font-num'>{{item.childCount ? item.childCount : 0}}</text>{{$t(`人`)}}
  70. </view>
  71. <view><text class="num">{{item.orderCount ? item.orderCount : 0}}</text>{{$t(`单`)}}</view>
  72. <view><text class="num">{{item.numberCount ? item.numberCount : 0}}</text>{{$t(`元`)}}</view>
  73. </view>
  74. </view>
  75. </block>
  76. <view class="no-data" v-if="!recordList.length && !loading">
  77. <view class='emptyBox'>
  78. <image :src="imgHost + '/statics/images/no-thing.png'"></image>
  79. <view class="tips">{{$t(`暂无数据`)}}</view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. <!-- #ifdef MP -->
  85. <!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
  86. <!-- #endif -->
  87. <!-- #ifndef MP -->
  88. <home></home>
  89. <!-- #endif -->
  90. </view>
  91. </template>
  92. <script>
  93. import {
  94. spreadPeople
  95. } from '@/api/user.js';
  96. import {
  97. toLogin
  98. } from '@/libs/login.js';
  99. import {
  100. mapGetters
  101. } from "vuex";
  102. // #ifdef MP
  103. import authorize from '@/components/Authorize';
  104. // #endif
  105. import home from '@/components/home';
  106. import colors from '@/mixins/color.js';
  107. import {
  108. HTTP_REQUEST_URL
  109. } from '@/config/app';
  110. export default {
  111. components: {
  112. // #ifdef MP
  113. authorize,
  114. // #endif
  115. home
  116. },
  117. mixins: [colors],
  118. data() {
  119. return {
  120. imgHost: HTTP_REQUEST_URL,
  121. total: 0,
  122. totalLevel: 0,
  123. teamCount: 0,
  124. page: 1,
  125. limit: 20,
  126. keyword: '',
  127. sort: '',
  128. grade: 0,
  129. status: false,
  130. recordList: [],
  131. isAuto: false, //没有授权的不会自动授权
  132. isShowAuth: false, //是否隐藏授权
  133. brokerage_level: 0,
  134. loading: false
  135. };
  136. },
  137. computed: mapGetters(['isLogin']),
  138. onLoad() {
  139. if (this.isLogin) {
  140. this.userSpreadNewList();
  141. } else {
  142. toLogin();
  143. }
  144. },
  145. onShow: function() {
  146. // if (this.is_show) this.userSpreadNewList();
  147. },
  148. onHide: function() {
  149. this.is_show = true;
  150. },
  151. methods: {
  152. onLoadFun: function(e) {
  153. this.userSpreadNewList();
  154. },
  155. // 授权关闭
  156. authColse: function(e) {
  157. this.isShowAuth = e
  158. },
  159. setSort: function(sort) {
  160. let that = this;
  161. that.sort = sort;
  162. that.page = 1;
  163. that.limit = 20;
  164. that.status = false;
  165. that.$set(that, 'recordList', []);
  166. that.userSpreadNewList();
  167. },
  168. // setKeyword: function(e) {
  169. // this.keyword = e.detail.value;
  170. // },
  171. submitForm: function() {
  172. this.page = 1;
  173. this.limit = 20;
  174. this.status = false;
  175. this.$set(this, 'recordList', []);
  176. this.userSpreadNewList();
  177. },
  178. setType: function(grade) {
  179. if (this.grade != grade) {
  180. this.grade = grade;
  181. this.page = 1;
  182. this.limit = 20;
  183. this.keyword = '';
  184. this.sort = '';
  185. this.status = false;
  186. this.$set(this, 'recordList', []);
  187. this.userSpreadNewList();
  188. }
  189. },
  190. userSpreadNewList: function() {
  191. if (this.loading) return
  192. this.loading = true
  193. let that = this;
  194. let page = that.page;
  195. let limit = that.limit;
  196. let status = that.status;
  197. let keyword = that.keyword;
  198. let sort = that.sort;
  199. let grade = that.grade;
  200. let recordList = that.recordList;
  201. let recordListNew = [];
  202. if (status == true) return;
  203. spreadPeople({
  204. page: page,
  205. limit: limit,
  206. keyword: keyword,
  207. grade: grade,
  208. sort: sort,
  209. }).then(res => {
  210. let len = res.data.list.length;
  211. let recordListData = res.data.list;
  212. recordListNew = recordList.concat(recordListData);
  213. that.total = res.data.total;
  214. that.totalLevel = res.data.totalLevel;
  215. that.teamCount = res.data.count;
  216. that.status = limit > len;
  217. that.page = page + 1;
  218. that.$set(that, 'recordList', recordListNew);
  219. that.brokerage_level = res.data.brokerage_level;
  220. this.loading = false
  221. }).catch(err => {
  222. this.loading = false
  223. })
  224. }
  225. },
  226. onReachBottom: function() {
  227. if (this.teamCount > this.recordList.length) {
  228. this.userSpreadNewList();
  229. }
  230. }
  231. }
  232. </script>
  233. <style scoped lang="scss">
  234. .promoter-list .nav {
  235. background-color: #fff;
  236. height: 86rpx;
  237. line-height: 86rpx;
  238. font-size: 28rpx;
  239. color: #282828;
  240. border-bottom: 1rpx solid #eee;
  241. }
  242. .promoter-list .nav .item.on {
  243. border-bottom: 5rpx solid var(--view-theme);
  244. color: var(--view-theme);
  245. }
  246. .promoter-list .search {
  247. width: 100%;
  248. background-color: #fff;
  249. height: 86rpx;
  250. padding-left: 30rpx;
  251. box-sizing: border-box;
  252. }
  253. .promoter-list .search .input {
  254. width: 610rpx;
  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: 45rpx;
  280. color: #515151;
  281. width: 110rpx;
  282. height: 60rpx;
  283. line-height: 60rpx;
  284. }
  285. .promoter-list .list {
  286. margin-top: 12rpx;
  287. }
  288. .promoter-list .list .sortNav {
  289. background-color: #fff;
  290. height: 76rpx;
  291. border-bottom: 1rpx solid #eee;
  292. color: #333;
  293. font-size: 28rpx;
  294. }
  295. .promoter-list .list .sortNav .sortItem {
  296. text-align: center;
  297. flex: 1;
  298. }
  299. .promoter-list .list .sortNav .sortItem image {
  300. width: 24rpx;
  301. height: 24rpx;
  302. margin-left: 6rpx;
  303. vertical-align: -3rpx;
  304. }
  305. .promoter-list .list .item {
  306. background-color: #fff;
  307. border-bottom: 1rpx solid #eee;
  308. height: 152rpx;
  309. padding: 0 30rpx 0 20rpx;
  310. font-size: 24rpx;
  311. color: #666;
  312. }
  313. .promoter-list .list .item .picTxt {
  314. width: 440rpx;
  315. }
  316. .promoter-list .list .item .picTxt .pictrue {
  317. width: 106rpx;
  318. height: 106rpx;
  319. border-radius: 50%;
  320. }
  321. .promoter-list .list .item .picTxt .pictrue image {
  322. width: 100%;
  323. height: 100%;
  324. border-radius: 50%;
  325. border: 3rpx solid #fff;
  326. box-shadow: 0 0 10rpx #aaa;
  327. box-sizing: border-box;
  328. }
  329. .promoter-list .list .item .picTxt .text {
  330. width: 304rpx;
  331. font-size: 24rpx;
  332. color: #666;
  333. }
  334. .promoter-list .list .item .picTxt .text .name {
  335. font-size: 28rpx;
  336. color: #333;
  337. margin-bottom: 13rpx;
  338. }
  339. .promoter-list .list .item .right {
  340. width: 240rpx;
  341. text-align: right;
  342. font-size: 22rpx;
  343. color: #333;
  344. }
  345. .promoter-list .list .item .right .num {
  346. margin-right: 7rpx;
  347. }
  348. .no-data {
  349. background-color: #fff;
  350. padding-bottom: 30rpx;
  351. padding: 180rpx 0 calc(100vh - 1030rpx);
  352. .emptyBox {
  353. text-align: center;
  354. padding-top: 20rpx;
  355. .tips {
  356. color: #aaa;
  357. font-size: 26rpx;
  358. }
  359. image {
  360. width: 414rpx;
  361. height: 304rpx;
  362. }
  363. }
  364. }
  365. </style>