index.vue 10.0 KB

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