index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  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="borderPad">
  14. <view class='nav acea-row row-around'>
  15. <view :class="grade == 0 ? 'item on' : 'item'" @click='setType(0)'>一级({{peopleData.firstSpreadNum}})</view>
  16. <view :class="grade == 1 ? 'item on' : 'item'" @click='setType(1)'>二级({{peopleData.secondSpreadNum}})
  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="keywords"
  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='../static/images/sort1.png'></image>
  30. </view>
  31. <view class="sortItem" @click='setSort("childCount")' v-else-if="sort == 'childCountASC'">团队排序
  32. <image src='../static/images/sort3.png'></image>
  33. </view>
  34. <view class="sortItem" @click='setSort("childCount","DESC")' v-else>团队排序
  35. <image src='../static/images/sort2.png'></image>
  36. </view>
  37. <view class="sortItem" @click='setSort("numberCount","ASC")' v-if="sort == 'numberCountDESC'">
  38. 金额排序
  39. <image src='../static/images/sort1.png'></image>
  40. </view>
  41. <view class="sortItem" @click='setSort("numberCount")' v-else-if="sort == 'numberCountASC'">金额排序
  42. <image src='../static/images/sort3.png'></image>
  43. </view>
  44. <view class="sortItem" @click='setSort("numberCount","DESC")' v-else>金额排序
  45. <image src='../static/images/sort2.png'></image>
  46. </view>
  47. <view class="sortItem" @click='setSort("orderCount","ASC")' v-if="sort == 'orderCountDESC'">订单排序
  48. <image src='../static/images/sort1.png'></image>
  49. </view>
  50. <view class="sortItem" @click='setSort("orderCount")' v-else-if="sort == 'orderCountASC'">订单排序
  51. <image src='../static/images/sort3.png'></image>
  52. </view>
  53. <view class="sortItem" @click='setSort("orderCount","DESC")' v-else>订单排序
  54. <image src='../static/images/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.amountCount ? item.amountCount : 0}}</text>元</view>
  73. </view>
  74. </view>
  75. </block>
  76. <view class='loadingicon acea-row row-center-wrapper'>
  77. <text class='loading iconfont icon-jiazai' :hidden='loadingList==false'></text>
  78. </view>
  79. <block v-if="recordList.length == 0 && isShow && !loadingList">
  80. <emptyPage title="暂无推广人数~" mTop="19%" :imgSrc="urlDomain+'crmebimage/presets/noJilu.png'"></emptyPage>
  81. </block>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. </template>
  87. <script>
  88. // +----------------------------------------------------------------------
  89. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  90. // +----------------------------------------------------------------------
  91. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  92. // +----------------------------------------------------------------------
  93. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  94. // +----------------------------------------------------------------------
  95. // | Author: CRMEB Team <admin@crmeb.com>
  96. // +----------------------------------------------------------------------
  97. import {
  98. spreadPeople,
  99. spreadPeoCount
  100. } from '@/api/user.js';
  101. import {toLogin} from '@/libs/login.js';
  102. import {mapGetters} from "vuex";
  103. import emptyPage from '@/components/emptyPage.vue'
  104. import {setThemeColor} from '@/utils/setTheme.js'
  105. const app = getApp();
  106. export default {
  107. components: {
  108. emptyPage
  109. },
  110. data() {
  111. return {
  112. urlDomain: this.$Cache.get("imgHost"),
  113. page: 1,
  114. limit: 20,
  115. keywords: '',
  116. sort: '',
  117. isAsc: '',
  118. sortKey: '',
  119. grade: 0,
  120. status: false,
  121. loadingList: false,
  122. recordList: [],
  123. peopleData: {},
  124. isShow: false,
  125. theme:app.globalData.theme,
  126. bgColor:'#e93323'
  127. };
  128. },
  129. computed: mapGetters(['isLogin']),
  130. onLoad() {
  131. if (this.isLogin) {
  132. this.userSpreadNewList();
  133. this.spreadPeoCount();
  134. } else {
  135. toLogin();
  136. }
  137. let that = this;
  138. that.bgColor = setThemeColor();
  139. uni.setNavigationBarColor({
  140. frontColor: '#ffffff',
  141. backgroundColor:that.bgColor,
  142. });
  143. },
  144. onShow: function() {
  145. if (this.is_show) this.userSpreadNewList();
  146. },
  147. onHide: function() {
  148. this.is_show = true;
  149. },
  150. methods: {
  151. setSort: function(sortKey, isAsc) {
  152. let that = this;
  153. that.isAsc = isAsc;
  154. that.sort = sortKey + isAsc;
  155. that.sortKey = sortKey;
  156. that.page = 1;
  157. that.limit = 20;
  158. that.status = false;
  159. that.$set(that, 'recordList', []);
  160. that.userSpreadNewList();
  161. },
  162. submitForm: function() {
  163. this.page = 1;
  164. this.limit = 20;
  165. this.status = false;
  166. this.$set(this, 'recordList', []);
  167. this.userSpreadNewList();
  168. },
  169. setType: function(grade) {
  170. if (this.grade != grade) {
  171. this.grade = grade;
  172. this.page = 1;
  173. this.limit = 20;
  174. this.keywords = '';
  175. this.sort = '';
  176. this.isAsc = '';
  177. this.status = false;
  178. this.loadingList = false;
  179. this.$set(this, 'recordList', []);
  180. this.userSpreadNewList();
  181. }
  182. },
  183. spreadPeoCount() {
  184. spreadPeoCount().then(res => {
  185. this.peopleData = res.data;
  186. });
  187. },
  188. userSpreadNewList: function() {
  189. let that = this;
  190. let page = that.page;
  191. let limit = that.limit;
  192. let status = that.status;
  193. let keyword = encodeURIComponent(that.keywords);
  194. let isAsc = that.isAsc;
  195. let sortKey = that.sortKey;
  196. let grade = that.grade;
  197. let recordList = that.recordList;
  198. let recordListNew = [];
  199. if (that.loadingList) return;
  200. if (status == true) return;
  201. this.loadingList = true;
  202. spreadPeople({
  203. page: page,
  204. limit: limit,
  205. keyword: keyword,
  206. grade: grade,
  207. sortKey: sortKey,
  208. isAsc: isAsc
  209. }).then(res => {
  210. let recordListData = res.data ? res.data : [];
  211. let len = recordListData.length;
  212. recordListNew = recordList.concat(recordListData);
  213. that.status = limit > len;
  214. that.page = page + 1;
  215. that.$set(that, 'recordList', recordListNew || []);
  216. that.loadingList = false;
  217. that.isShow = true;
  218. });
  219. }
  220. },
  221. onReachBottom: function() {
  222. this.userSpreadNewList();
  223. }
  224. }
  225. </script>
  226. <style scoped lang="scss">
  227. .promoter-list .nav {
  228. background-color: #fff;
  229. height: 86rpx;
  230. line-height: 86rpx;
  231. font-size: 28rpx;
  232. color: #282828;
  233. border-bottom: 1rpx solid #eee;
  234. border-top-left-radius: 14rpx;
  235. border-top-right-radius: 14rpx;
  236. margin-top: -30rpx;
  237. }
  238. .promoterHeader{
  239. @include main_bg_color(theme);
  240. }
  241. .promoter-list .nav .item.on {
  242. @include main_color(theme);
  243. @include tab_border_bottom(theme);
  244. }
  245. .promoter-list .search {
  246. width: 100%;
  247. background-color: #fff;
  248. height: 100rpx;
  249. padding: 0 24rpx;
  250. box-sizing: border-box;
  251. border-bottom-left-radius: 14rpx;
  252. border-bottom-right-radius: 14rpx;
  253. }
  254. .promoter-list .search .input {
  255. width: 592rpx;
  256. height: 60rpx;
  257. border-radius: 50rpx;
  258. background-color: #f5f5f5;
  259. text-align: center;
  260. position: relative;
  261. }
  262. .promoter-list .search .input input {
  263. height: 100%;
  264. font-size: 26rpx;
  265. width: 610rpx;
  266. text-align: center;
  267. }
  268. .promoter-list .search .input .placeholder {
  269. color: #bbb;
  270. }
  271. .promoter-list .search .input .iconfont {
  272. position: absolute;
  273. right: 28rpx;
  274. color: #999;
  275. font-size: 28rpx;
  276. top: 50%;
  277. transform: translateY(-50%);
  278. }
  279. .promoter-list .search .iconfont {
  280. font-size: 32rpx;
  281. color: #515151;
  282. height: 60rpx;
  283. line-height: 60rpx;
  284. }
  285. .promoter-list .list {
  286. margin-top: 20rpx;
  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. border-top-left-radius: 14rpx;
  295. border-top-right-radius: 14rpx;
  296. }
  297. .promoter-list .list .sortNav .sortItem {
  298. text-align: center;
  299. flex: 1;
  300. }
  301. .promoter-list .list .sortNav .sortItem image {
  302. width: 24rpx;
  303. height: 24rpx;
  304. margin-left: 6rpx;
  305. vertical-align: -3rpx;
  306. }
  307. .promoter-list .list .item {
  308. background-color: #fff;
  309. border-bottom: 1rpx solid #eee;
  310. height: 152rpx;
  311. padding: 0 24rpx;
  312. font-size: 24rpx;
  313. color: #666;
  314. }
  315. .promoter-list .list .item .picTxt .pictrue {
  316. width: 106rpx;
  317. height: 106rpx;
  318. border-radius: 50%;
  319. }
  320. .promoter-list .list .item .picTxt .pictrue image {
  321. width: 100%;
  322. height: 100%;
  323. border-radius: 50%;
  324. border: 3rpx solid #fff;
  325. box-shadow: 0 0 10rpx #aaa;
  326. box-sizing: border-box;
  327. }
  328. .promoter-list .list .item .picTxt .text {
  329. // width: 304rpx;
  330. font-size: 24rpx;
  331. color: #666;
  332. margin-left: 14rpx;
  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. text-align: right;
  341. font-size: 22rpx;
  342. color: #333;
  343. }
  344. .promoter-list .list .item .right .num {
  345. margin-right: 7rpx;
  346. }
  347. </style>