index.vue 8.4 KB

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