index.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  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.firstBrokerageUserCount + peopleData.secondBrokerageUserCount}}</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="level === 1 ? 'item on' : 'item'" @click='setType(1)'>一级({{peopleData.firstBrokerageUserCount}})</view>
  16. <view :class="level === 2 ? 'item on' : 'item'" @click='setType(2)'>二级({{peopleData.secondBrokerageUserCount}})
  17. </view>
  18. </view>
  19. <view class='search acea-row row-between-wrapper'>
  20. <view class='input'><input placeholder='点击搜索会员名称' placeholder-class='placeholder' v-model="nickname"
  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("userCount","asc")' v-if="sort === 'userCountDESC'">团队排序
  27. <image src='/static/images/sort1.png'></image>
  28. </view>
  29. <view class="sortItem" @click='setSort("userCount", "desc")' v-else-if="sort === 'userCountASC'">团队排序
  30. <image src='/static/images/sort3.png'></image>
  31. </view>
  32. <view class="sortItem" @click='setSort("userCount","desc")' v-else>团队排序
  33. <image src='/static/images/sort2.png'></image>
  34. </view>
  35. <view class="sortItem" @click='setSort("price","asc")' v-if="sort === 'priceDESC'">
  36. 金额排序
  37. <image src='/static/images/sort1.png'></image>
  38. </view>
  39. <view class="sortItem" @click='setSort("price", "desc")' v-else-if="sort === 'priceASC'">金额排序
  40. <image src='/static/images/sort3.png'></image>
  41. </view>
  42. <view class="sortItem" @click='setSort("price","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", "desc")' 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>加入时间: {{ formatDate(item.brokerageTime) }}</view>
  64. </view>
  65. </view>
  66. <view class="right">
  67. <view><text class='num font-color'>{{ item.brokerageUserCount || 0}}</text>人
  68. </view>
  69. <view><text class="num">{{ item.orderCount|| 0}}</text>单</view>
  70. <view><text class="num">{{ fen2yuan(item.brokeragePrice || 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. <home></home>
  82. </view>
  83. </template>
  84. <script>
  85. import { toLogin } from '@/libs/login.js';
  86. import { mapGetters } from "vuex";
  87. import emptyPage from '@/components/emptyPage.vue'
  88. import Loading from "@/components/Loading";
  89. import home from '@/components/home';
  90. import * as BrokerageAPI from '@/api/trade/brokerage.js'
  91. import * as Util from '@/utils/util.js';
  92. import dayjs from "@/plugin/dayjs/dayjs.min.js";
  93. export default {
  94. components: {
  95. Loading,
  96. emptyPage,
  97. home
  98. },
  99. data() {
  100. return {
  101. peopleData: {
  102. firstBrokerageUserCount: 0,
  103. secondBrokerageUserCount: 0
  104. },
  105. recordList: [],
  106. page: 1,
  107. limit: 20,
  108. nickname: '',
  109. isAsc: 'desc',
  110. sortKey: 'userCount',
  111. sort: 'userCountDESC',
  112. level: 1,
  113. status: false,
  114. loadingList: false,
  115. isShow: false,
  116. };
  117. },
  118. computed: mapGetters(['isLogin']),
  119. onLoad() {
  120. if (!this.isLogin) {
  121. toLogin();
  122. return;
  123. }
  124. this.userSpreadNewList();
  125. this.spreadPeoCount();
  126. },
  127. onShow: function() {
  128. if (this.is_show) this.userSpreadNewList();
  129. },
  130. onHide: function() {
  131. this.is_show = true;
  132. },
  133. methods: {
  134. setSort: function(sortKey, isAsc) {
  135. this.isAsc = isAsc;
  136. this.sort = sortKey + isAsc.toUpperCase();
  137. this.sortKey = sortKey;
  138. this.page = 1;
  139. this.limit = 20;
  140. this.status = false;
  141. this.$set(this, 'recordList', []);
  142. this.userSpreadNewList();
  143. },
  144. submitForm: function() {
  145. this.page = 1;
  146. this.limit = 20;
  147. this.status = false;
  148. this.$set(this, 'recordList', []);
  149. this.userSpreadNewList();
  150. },
  151. setType: function(level) {
  152. if (this.level !== level) {
  153. this.level = level;
  154. this.page = 1;
  155. this.limit = 20;
  156. this.nickname = '';
  157. this.status = false;
  158. this.loadingList = false;
  159. this.$set(this, 'recordList', []);
  160. this.userSpreadNewList();
  161. }
  162. },
  163. spreadPeoCount() {
  164. BrokerageAPI.getBrokerageUserSummary().then(res => {
  165. this.peopleData = res.data;
  166. });
  167. },
  168. userSpreadNewList: function() {
  169. let page = this.page;
  170. let limit = this.limit;
  171. let status = this.status;
  172. let recordList = this.recordList;
  173. let recordListNew = [];
  174. if (this.loadingList || status) {
  175. return;
  176. }
  177. BrokerageAPI.getBrokerageUserChildSummaryPage({
  178. pageNo: page,
  179. pageSize: limit,
  180. nickname: this.nickname,
  181. level: this.level,
  182. 'sortingField.field': this.sortKey,
  183. 'sortingField.order': this.isAsc,
  184. }).then(res => {
  185. let recordListData = res.data.list ? res.data.list : [];
  186. let len = recordListData.length;
  187. recordListNew = recordList.concat(recordListData);
  188. this.status = limit > len;
  189. this.page = page + 1;
  190. this.$set(this, 'recordList', recordListNew || []);
  191. this.loadingList = false;
  192. if (this.recordList.length === 0) {
  193. this.isShow = true;
  194. }
  195. });
  196. },
  197. fen2yuan(price) {
  198. return Util.fen2yuan(price)
  199. },
  200. formatDate: function(date) {
  201. return dayjs(date).format("YYYY-MM-DD HH:mm:ss");
  202. },
  203. },
  204. onReachBottom: function() {
  205. this.userSpreadNewList();
  206. }
  207. }
  208. </script>
  209. <style scoped lang="scss">
  210. .promoter-list .nav {
  211. background-color: #fff;
  212. height: 86rpx;
  213. line-height: 86rpx;
  214. font-size: 28rpx;
  215. color: #282828;
  216. border-bottom: 1rpx solid #eee;
  217. border-top-left-radius: 14rpx;
  218. border-top-right-radius: 14rpx;
  219. margin-top: -30rpx;
  220. }
  221. .promoter-list .nav .item.on {
  222. border-bottom: 5rpx solid $theme-color;
  223. color: $theme-color;
  224. }
  225. .promoter-list .search {
  226. width: 100%;
  227. background-color: #fff;
  228. height: 100rpx;
  229. padding: 0 24rpx;
  230. box-sizing: border-box;
  231. border-bottom-left-radius: 14rpx;
  232. border-bottom-right-radius: 14rpx;
  233. }
  234. .promoter-list .search .input {
  235. width: 592rpx;
  236. height: 60rpx;
  237. border-radius: 50rpx;
  238. background-color: #f5f5f5;
  239. text-align: center;
  240. position: relative;
  241. }
  242. .promoter-list .search .input input {
  243. height: 100%;
  244. font-size: 26rpx;
  245. width: 610rpx;
  246. text-align: center;
  247. }
  248. .promoter-list .search .input .placeholder {
  249. color: #bbb;
  250. }
  251. .promoter-list .search .input .iconfont {
  252. position: absolute;
  253. right: 28rpx;
  254. color: #999;
  255. font-size: 28rpx;
  256. top: 50%;
  257. transform: translateY(-50%);
  258. }
  259. .promoter-list .search .iconfont {
  260. font-size: 32rpx;
  261. color: #515151;
  262. height: 60rpx;
  263. line-height: 60rpx;
  264. }
  265. .promoter-list .list {
  266. margin-top: 20rpx;
  267. }
  268. .promoter-list .list .sortNav {
  269. background-color: #fff;
  270. height: 76rpx;
  271. border-bottom: 1rpx solid #eee;
  272. color: #333;
  273. font-size: 28rpx;
  274. border-top-left-radius: 14rpx;
  275. border-top-right-radius: 14rpx;
  276. }
  277. .promoter-list .list .sortNav .sortItem {
  278. text-align: center;
  279. flex: 1;
  280. }
  281. .promoter-list .list .sortNav .sortItem image {
  282. width: 24rpx;
  283. height: 24rpx;
  284. margin-left: 6rpx;
  285. vertical-align: -3rpx;
  286. }
  287. .promoter-list .list .item {
  288. background-color: #fff;
  289. border-bottom: 1rpx solid #eee;
  290. height: 152rpx;
  291. padding: 0 24rpx;
  292. font-size: 24rpx;
  293. color: #666;
  294. }
  295. .promoter-list .list .item .picTxt .pictrue {
  296. width: 106rpx;
  297. height: 106rpx;
  298. border-radius: 50%;
  299. }
  300. .promoter-list .list .item .picTxt .pictrue image {
  301. width: 100%;
  302. height: 100%;
  303. border-radius: 50%;
  304. border: 3rpx solid #fff;
  305. box-shadow: 0 0 10rpx #aaa;
  306. box-sizing: border-box;
  307. }
  308. .promoter-list .list .item .picTxt .text {
  309. // width: 304rpx;
  310. font-size: 24rpx;
  311. color: #666;
  312. margin-left: 14rpx;
  313. }
  314. .promoter-list .list .item .picTxt .text .name {
  315. font-size: 28rpx;
  316. color: #333;
  317. margin-bottom: 13rpx;
  318. }
  319. .promoter-list .list .item .right {
  320. text-align: right;
  321. font-size: 22rpx;
  322. color: #333;
  323. }
  324. .promoter-list .list .item .right .num {
  325. margin-right: 7rpx;
  326. }
  327. </style>