index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="status_bar">
  5. <!-- 这里是状态栏 -->
  6. </view>
  7. <view class="body-title">
  8. <view class="goback-box" @click="toBack">
  9. <image class="goback" src="../../../static/icon/fanhui.png" mode=""></image>
  10. </view>
  11. <view class="header">我的推广</view>
  12. </view>
  13. <view class="content-bg">
  14. <image src="http://ygs.hqgjsmc.com/baseimg/zhihuanjuan.png" mode=""></image>
  15. </view>
  16. <view class="money-box">
  17. <view class="">
  18. <view class="money">{{ userInfo.spread_total }}</view>
  19. <view>我的推广人数</view>
  20. </view>
  21. <!-- <view class="" style="width: 50%;">
  22. <view class="money">{{ order_count || '0' }}</view>
  23. <view>团队业绩</view>
  24. </view> -->
  25. </view>
  26. </view>
  27. <view class="navbar">
  28. <view class="nav-item" :class="{ current: grade === 0 }" @click="setType(0)">一级</view>
  29. <view class="nav-item" :class="{ current: grade == 1 }" @click="setType(1)">二级</view>
  30. </view>
  31. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="userSpreadNewList">
  32. <!-- 空白页 -->
  33. <!-- <empty v-if="recordList.length === 0"></empty> -->
  34. <!-- 订单列表 -->
  35. <view v-for="(item, index) in recordList" :key="index" class="order-item flex">
  36. <view class="title-box flex_item">
  37. <view class="title-avatar">
  38. <image :src="item.avatar|| '../../../static/error/missing-face.png'" style="width: 100rpx;height: 100rpx;"></image>
  39. </view>
  40. <view class="list_tpl">
  41. <view class="title">
  42. <text>{{ item.nickname || '' }}</text>
  43. </view>
  44. <view class="time">
  45. <text>{{ item.spread_time }}</text>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. <!-- <uni-load-more :status="tabItem.loadingType"></uni-load-more> -->
  51. <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
  52. </scroll-view>
  53. </view>
  54. </template>
  55. <!-- <template>
  56. <view :style="viewColor">
  57. <view class="promoter-list">
  58. <view class='promoterHeader'>
  59. <view class='headerCon acea-row row-between-wrapper'>
  60. <view>
  61. <view class='name'>推广人数</view>
  62. <view><text class='num'>{{userInfo.spread_total}}</text>人</view>
  63. </view>
  64. <view class='iconfont icon-tuandui'></view>
  65. </view>
  66. </view>
  67. <view class='nav acea-row row-around'>
  68. <view :class="grade == 0 ? 'item on' : 'item'" @click='setType(0)'>一级({{userInfo.one_level_count}})</view>
  69. <view :class="grade == 1 ? 'item on' : 'item'" @click='setType(1)'>二级({{userInfo.two_level_count}})</view>
  70. </view>
  71. <view class='search acea-row row-between-wrapper'>
  72. <view class='input'><input placeholder='点击搜索会员名称' placeholder-class='placeholder' v-model="keyword" @confirm="submitForm" confirm-type='search' name="search"></input></view>
  73. <button class='iconfont icon-sousuo2' @click="submitForm"></button>
  74. </view>
  75. <view class='list'>
  76. <view class="sortNav acea-row row-middle">
  77. <view class="sortItem" @click='setSort("spread_count ASC")' v-if="sort == 'spread_count DESC'">团队排序
  78. <image :src="domain+'/static/diy/sort1'+keyColor+'.png'"></image>
  79. </view>
  80. <view class="sortItem" @click='setSort("")' v-else-if="sort == 'spread_count ASC'">团队排序
  81. <image :src="domain+'/static/diy/sort3'+keyColor+'.png'"></image>
  82. </view>
  83. <view class="sortItem" @click='setSort("spread_count DESC")' v-else>团队排序
  84. <image src="/static/images/sort2.png"></image>
  85. </view>
  86. <view class="sortItem" @click='setSort("pay_price ASC")' v-if="sort == 'pay_price DESC'">金额排序
  87. <image :src="domain+'/static/diy/sort1'+keyColor+'.png'"></image>
  88. </view>
  89. <view class="sortItem" @click='setSort("")' v-else-if="sort == 'pay_price ASC'">金额排序
  90. <image :src="domain+'/static/diy/sort3'+keyColor+'.png'"></image>
  91. </view>
  92. <view class="sortItem" @click='setSort("pay_price DESC")' v-else>金额排序
  93. <image src="/static/images/sort2.png"></image>
  94. </view>
  95. <view class="sortItem" @click='setSort("pay_count ASC")' v-if="sort == 'pay_count DESC'">订单排序
  96. <image :src="domain+'/static/diy/sort1'+keyColor+'.png'"></image>
  97. </view>
  98. <view class="sortItem" @click='setSort("")' v-else-if="sort == 'pay_count ASC'">订单排序
  99. <image :src="domain+'/static/diy/sort3'+keyColor+'.png'"></image>
  100. </view>
  101. <view class="sortItem" @click='setSort("pay_count DESC")' v-else>订单排序
  102. <image src="/static/images/sort2.png"></image>
  103. </view>
  104. </view>
  105. <block v-for="(item,index) in recordList" :key="index">
  106. <view class='item acea-row row-between-wrapper'>
  107. <view class="picTxt acea-row row-between-wrapper">
  108. <view class='pictrue'>
  109. <image :src='item.avatar ? item.avatar : "/static/images/f.png"'></image>
  110. </view>
  111. <view class='text'>
  112. <view class='name line1'>{{item.nickname}}</view>
  113. <view>加入时间: {{item.spread_time}}</view>
  114. </view>
  115. </view>
  116. <view class="right">
  117. <view><text class='num t-color'>{{item.spread_count ? item.spread_count : 0}}</text>人</view>
  118. <view><text class="num">{{item.pay_count ? item.pay_count : 0}}</text>单</view>
  119. <view><text class="num">{{item.pay_price ? item.pay_price : 0}}</text>元</view>
  120. </view>
  121. </view>
  122. </block>
  123. </view>
  124. </view>
  125. <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
  126. </view>
  127. </template> -->
  128. <script>
  129. // +----------------------------------------------------------------------
  130. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  131. // +----------------------------------------------------------------------
  132. // | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
  133. // +----------------------------------------------------------------------
  134. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  135. // +----------------------------------------------------------------------
  136. // | Author: CRMEB Team <admin@crmeb.com>
  137. // +----------------------------------------------------------------------
  138. import {
  139. spreadPeople,
  140. getUserInfo,
  141. spreadInfo
  142. } from '@/api/user.js';
  143. import {
  144. mapGetters
  145. } from "vuex";
  146. import authorize from '@/components/Authorize';
  147. import {
  148. HTTP_REQUEST_URL
  149. } from '@/config/app';
  150. export default {
  151. components: {
  152. authorize
  153. },
  154. data() {
  155. return {
  156. domain: HTTP_REQUEST_URL,
  157. total: 0,
  158. totalLevel: 0,
  159. teamCount: 0,
  160. page: 1,
  161. limit: 20,
  162. keyword: '',
  163. sort: '',
  164. grade: 0,
  165. status: false,
  166. recordList: [],
  167. isAuto: false, //没有授权的不会自动授权
  168. isShowAuth: false, //是否隐藏授权
  169. userInfo: {}
  170. };
  171. },
  172. computed: mapGetters(['isLogin', 'viewColor', 'keyColor']),
  173. onLoad() {
  174. if (this.isLogin) {
  175. this.userSpreadNewList();
  176. this.getUserInfo()
  177. } else {
  178. this.isAuto = true;
  179. this.isShowAuth = true
  180. }
  181. },
  182. onShow: function() {
  183. if (this.is_show) {
  184. this.userSpreadNewList();
  185. this.getUserInfo();
  186. }
  187. },
  188. onHide: function() {
  189. this.is_show = true;
  190. },
  191. methods: {
  192. toBack() {
  193. uni.switchTab({
  194. url: '/pages/user/index'
  195. })
  196. },
  197. getUserInfo() {
  198. spreadInfo().then(res => {
  199. this.userInfo = res.data
  200. });
  201. },
  202. onLoadFun: function(e) {
  203. this.isShowAuth = false;
  204. this.userSpreadNewList();
  205. this.getUserInfo()
  206. },
  207. // 授权关闭
  208. authColse: function(e) {
  209. this.isShowAuth = e
  210. },
  211. setSort: function(sort) {
  212. let that = this;
  213. that.sort = sort;
  214. that.page = 1;
  215. that.limit = 20;
  216. that.status = false;
  217. that.$set(that, 'recordList', []);
  218. that.userSpreadNewList();
  219. },
  220. // setKeyword: function(e) {
  221. // this.keyword = e.detail.value;
  222. // },
  223. submitForm: function() {
  224. this.page = 1;
  225. this.limit = 20;
  226. this.status = false;
  227. this.$set(this, 'recordList', []);
  228. this.userSpreadNewList();
  229. },
  230. setType: function(grade) {
  231. if (this.grade != grade) {
  232. this.grade = grade;
  233. this.page = 1;
  234. this.limit = 20;
  235. this.keyword = '';
  236. this.sort = '';
  237. this.status = false;
  238. this.$set(this, 'recordList', []);
  239. this.userSpreadNewList();
  240. }
  241. },
  242. userSpreadNewList: function() {
  243. let that = this;
  244. let page = that.page;
  245. let limit = that.limit;
  246. let status = that.status;
  247. let keyword = that.keyword;
  248. let sort = that.sort;
  249. let grade = that.grade;
  250. let recordList = that.recordList;
  251. let recordListNew = [];
  252. if (status == true) return;
  253. spreadPeople({
  254. page: page,
  255. limit: limit,
  256. keyword: keyword,
  257. level: grade + 1,
  258. sort: sort,
  259. }).then(res => {
  260. let len = res.data.list.length;
  261. let recordListData = res.data.list;
  262. recordListNew = recordList.concat(recordListData);
  263. that.total = res.data.total;
  264. that.totalLevel = res.data.totalLevel;
  265. that.teamCount = that.$util.$h.Add(Number(res.data.total), Number(res.data.totalLevel));
  266. that.status = limit > len;
  267. that.page = page + 1;
  268. that.$set(that, 'recordList', recordListNew);
  269. });
  270. }
  271. },
  272. // onReachBottom: function() {
  273. // this.userSpreadNewList();
  274. // }
  275. }
  276. </script>
  277. <!-- <style scoped lang="scss">
  278. .promoterHeader {
  279. background-image: linear-gradient(to right, var(--view-bntColor21) 0%, var(--view-bntColor22) 100%);
  280. }
  281. .t-color {
  282. color: var(--view-theme);
  283. }
  284. .promoter-list .nav {
  285. background-color: #fff;
  286. height: 86rpx;
  287. line-height: 86rpx;
  288. font-size: 28rpx;
  289. color: #282828;
  290. border-bottom: 1rpx solid #eee;
  291. }
  292. .promoter-list .nav .item.on {
  293. border-bottom: 5rpx solid var(--view-theme);
  294. color: var(--view-theme);
  295. }
  296. .promoter-list .search {
  297. width: 100%;
  298. background-color: #fff;
  299. height: 86rpx;
  300. padding-left: 30rpx;
  301. box-sizing: border-box;
  302. }
  303. .promoter-list .search .input {
  304. width: 610rpx;
  305. height: 60rpx;
  306. border-radius: 50rpx;
  307. background-color: #f5f5f5;
  308. text-align: center;
  309. position: relative;
  310. }
  311. .promoter-list .search .input input {
  312. height: 100%;
  313. font-size: 26rpx;
  314. width: 610rpx;
  315. text-align: center;
  316. }
  317. .promoter-list .search .input .placeholder {
  318. color: #bbb;
  319. }
  320. .promoter-list .search .input .iconfont {
  321. position: absolute;
  322. right: 28rpx;
  323. color: #999;
  324. font-size: 28rpx;
  325. top: 50%;
  326. transform: translateY(-50%);
  327. }
  328. .promoter-list .search .iconfont {
  329. font-size: 45rpx;
  330. color: #515151;
  331. width: 110rpx;
  332. height: 60rpx;
  333. line-height: 60rpx;
  334. }
  335. .promoter-list .list {
  336. margin-top: 12rpx;
  337. }
  338. .promoter-list .list .sortNav {
  339. background-color: #fff;
  340. height: 76rpx;
  341. border-bottom: 1rpx solid #eee;
  342. color: #333;
  343. font-size: 28rpx;
  344. }
  345. .promoter-list .list .sortNav .sortItem {
  346. text-align: center;
  347. flex: 1;
  348. }
  349. .promoter-list .list .sortNav .sortItem image {
  350. width: 24rpx;
  351. height: 24rpx;
  352. margin-left: 6rpx;
  353. vertical-align: -3rpx;
  354. }
  355. .promoter-list .list .item {
  356. background-color: #fff;
  357. border-bottom: 1rpx solid #eee;
  358. height: 152rpx;
  359. padding: 0 30rpx 0 20rpx;
  360. font-size: 24rpx;
  361. color: #666;
  362. }
  363. .promoter-list .list .item .picTxt {
  364. width: 440rpx;
  365. }
  366. .promoter-list .list .item .picTxt .pictrue {
  367. width: 106rpx;
  368. height: 106rpx;
  369. border-radius: 50%;
  370. }
  371. .promoter-list .list .item .picTxt .pictrue image {
  372. width: 100%;
  373. height: 100%;
  374. border-radius: 50%;
  375. border: 3rpx solid #fff;
  376. box-shadow: 0 0 10rpx #aaa;
  377. box-sizing: border-box;
  378. }
  379. .promoter-list .list .item .picTxt .text {
  380. width: 304rpx;
  381. font-size: 24rpx;
  382. color: #666;
  383. }
  384. .promoter-list .list .item .picTxt .text .name {
  385. font-size: 28rpx;
  386. color: #333;
  387. margin-bottom: 13rpx;
  388. }
  389. .promoter-list .list .item .right {
  390. width: 240rpx;
  391. text-align: right;
  392. font-size: 22rpx;
  393. color: #333;
  394. }
  395. .promoter-list .list .item .right .num{
  396. margin-right: 7rpx;
  397. }
  398. </style>
  399. -->
  400. <style lang="scss">
  401. page {
  402. background: #ffffff;
  403. height: 100%;
  404. }
  405. .status_bar {
  406. height: var(--status-bar-height);
  407. width: 100%;
  408. }
  409. .content-money {
  410. position: relative;
  411. height: 480rpx;
  412. .content-bg {
  413. position: absolute;
  414. top: 0;
  415. left: 0;
  416. right: 0;
  417. width: 750rpx;
  418. height: 480rpx;
  419. image {
  420. width: 100%;
  421. height: 100%;
  422. }
  423. }
  424. .body-title {
  425. height: 80rpx;
  426. text-align: center;
  427. font-size: 35rpx;
  428. position: relative;
  429. .header {
  430. position: absolute;
  431. left: 0;
  432. top: 0;
  433. width: 100%;
  434. font-size: 36rpx;
  435. font-family: PingFang SC;
  436. font-weight: bold;
  437. color: #fffeff;
  438. height: 80rpx;
  439. font-size: 36rpx;
  440. font-weight: 700;
  441. z-index: 9;
  442. display: flex;
  443. justify-content: center;
  444. align-items: center;
  445. }
  446. .goback-box {
  447. position: absolute;
  448. left: 18rpx;
  449. top: 0;
  450. height: 80rpx;
  451. display: flex;
  452. align-items: center;
  453. }
  454. .goback {
  455. z-index: 100;
  456. width: 34rpx;
  457. height: 34rpx;
  458. }
  459. }
  460. }
  461. .money-box {
  462. position: relative;
  463. z-index: 2;
  464. /* #ifdef H5 */
  465. padding-top: 80rpx;
  466. /* #endif */
  467. color: #ffffff;
  468. text-align: center;
  469. /* #ifdef APP-PLUS */
  470. height: 250rpx;
  471. display: flex;
  472. flex-direction: column;
  473. justify-content: center;
  474. /* #endif */
  475. display: flex;
  476. justify-content: center;
  477. .money {
  478. font-size: 72rpx;
  479. font-family: PingFang SC;
  480. font-weight: bold;
  481. color: #ffffff;
  482. }
  483. .text {
  484. font-size: 30rpx;
  485. }
  486. }
  487. // 列表
  488. .swiper-box {
  489. padding-top: 10rpx;
  490. }
  491. .order-item {
  492. padding: 20rpx 30rpx;
  493. line-height: 1.5;
  494. .title-box {
  495. width: 100%;
  496. .title-avatar {
  497. width: 100rpx;
  498. height: 100rpx;
  499. margin-right: 25rpx;
  500. // image {
  501. // width: 100rpx;
  502. // height: 100rpx;
  503. // border-radius: 50%;
  504. // }
  505. }
  506. .list_tpl {
  507. width: 85%;
  508. .title {
  509. font-size: $font-lg;
  510. color: $font-color-base;
  511. overflow: hidden; //超出的文本隐藏
  512. text-overflow: ellipsis; //溢出用省略号显示
  513. white-space: nowrap;
  514. }
  515. .time {
  516. margin-top: 15rpx;
  517. font-size: 22rpx;
  518. color: $font-color-light;
  519. }
  520. }
  521. }
  522. .money {
  523. color: #DB1935;
  524. font-size: $font-lg;
  525. }
  526. }
  527. .list-scroll-content {
  528. height: 100%;
  529. }
  530. .content {
  531. height: 100%;
  532. .empty-content {
  533. background-color: #ffffff;
  534. }
  535. }
  536. .navbar {
  537. margin-top: 20rpx;
  538. display: flex;
  539. height: 88rpx;
  540. padding: 0 5px;
  541. background: #fff;
  542. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  543. position: relative;
  544. z-index: 10;
  545. .nav-item {
  546. flex: 1;
  547. display: flex;
  548. justify-content: center;
  549. align-items: center;
  550. height: 100%;
  551. font-size: 15px;
  552. color: #999999;
  553. position: relative;
  554. &.current {
  555. color: #000;
  556. &:after {
  557. content: '';
  558. position: absolute;
  559. left: 50%;
  560. bottom: 0;
  561. transform: translateX(-50%);
  562. width: 44px;
  563. height: 0;
  564. border-bottom: 2px solid #fe5b38;
  565. }
  566. }
  567. }
  568. }
  569. </style>