extension.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="money-box">
  5. <!-- <view class="goback-box" @click="toBack">
  6. <image class="goback" src="../../static/img/tgbg.png" mode=""></image>
  7. </view> -->
  8. <!-- <view class="header">我的推广</view> -->
  9. <image class="tuiguang_bg" src="../../static/img/tgbg.png"></image>
  10. <!-- <view class="money_img"><image :src="list.avatar || img"></image></view> -->
  11. <view class="money-frame">
  12. <!-- <view class="money_name">我的推广</view> -->
  13. <view class="money_num">
  14. {{total || 0}}
  15. <text class="money_ren">人</text>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="flex buttom-box">
  20. <view class="buttom" @click="tabClick(0)">
  21. <!-- <view class="money">{{total || 0}}</view> -->
  22. <text class="text" :class="{ current: tabCurrentIndex === 0 }">一级推广</text>
  23. </view>
  24. <!-- <view class="buttom" @click="tabClick(1)">
  25. <view class="money">{{totalLevel || 0}}</view>
  26. <text class="text" :class="{ current: tabCurrentIndex === 1 }">二级推广</text>
  27. </view> -->
  28. </view>
  29. </view>
  30. <swiper :current="tabCurrentIndex" :style="{ height: maxheight + 'px' }" class="swiper-box" duration="300"
  31. @change="changeTab">
  32. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  33. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  34. <!-- 空白页 -->
  35. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  36. <!-- 订单列表 -->
  37. <view v-for="(item, index) in tabItem.orderList" :key="index" class="order-item flex">
  38. <view class="title-box flex_item">
  39. <view class="title-avatar">
  40. <image src="../../static/error/logo.png" mode=""></image>
  41. </view>
  42. <view class="list_tpl">
  43. <view class="title flex">
  44. <text>{{ item.nickname }}{{item.level}}</text>
  45. </view>
  46. <view class="time">
  47. <text>{{ item.time }}</text>
  48. </view>
  49. <view class="time">
  50. <text>手机号:{{item.phone}}</text>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  56. </scroll-view>
  57. </swiper-item>
  58. </swiper>
  59. </view>
  60. </template>
  61. <script>
  62. import {
  63. getExtensionData,
  64. getUserInfo,
  65. getSpreadPeople
  66. } from '@/api/user.js';
  67. import {
  68. mapState,
  69. mapMutations
  70. } from 'vuex';
  71. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  72. import empty from '@/components/empty';
  73. export default {
  74. components: {
  75. empty,
  76. uniLoadMore,
  77. },
  78. onReady() {
  79. // 初始化获取页面宽度
  80. uni.createSelectorQuery()
  81. .select('.content')
  82. .fields({
  83. size: true
  84. },
  85. data => {
  86. // console.log(data);
  87. // console.log(Math.floor((data.width / 750) * 300));
  88. // 保存头部高度
  89. this.maxheight = data.height - Math.floor((data.width / 750) * 470) - 44;
  90. // console.log(this.maxheight);
  91. }
  92. )
  93. .exec();
  94. },
  95. data() {
  96. return {
  97. // 头部图高度
  98. maxheight: '',
  99. tabCurrentIndex: 0,
  100. navList: [{
  101. state: 0,
  102. text: '一级推广',
  103. loadingType: 'more',
  104. orderList: [],
  105. page: 1, //当前页数
  106. limit: 10 //每次信息条数
  107. }],
  108. all: '',
  109. list: '',
  110. total: '',
  111. totalLevel: '',
  112. img: 'http://kaifa.crmeb.net/uploads/attach/2019/08/20190807/723adbdd4e49a0f9394dfc700ab5dba3.png',
  113. userInfo: {}
  114. };
  115. },
  116. onLoad(options) {},
  117. onShow() {
  118. this.loadData();
  119. this.loadAll()
  120. },
  121. methods: {
  122. // 页面跳转
  123. navto(e) {
  124. uni.navigateTo({
  125. url: e
  126. });
  127. },
  128. //获取推广人数信息
  129. async loadData(source) {
  130. //这里是将订单挂载到tab列表下
  131. let index = this.tabCurrentIndex;
  132. let navItem = this.navList[index];
  133. let state = navItem.state;
  134. if (source === 'tabChange' && navItem.loaded === true) {
  135. //tab切换只有第一次需要加载数据
  136. return;
  137. }
  138. if (navItem.loadingType === 'loading') {
  139. //防止重复加载
  140. return;
  141. }
  142. if (navItem.loadingType === 'noMore') {
  143. //防止重复加载
  144. return;
  145. }
  146. // 修改当前对象状态为加载中
  147. navItem.loadingType = 'loading';
  148. getSpreadPeople({
  149. page: navItem.page,
  150. limit: navItem.limit,
  151. keyword: '',
  152. // sort: 'ASC/DESC',
  153. // level: index,
  154. // sort:'uid desc'
  155. // sort: 'pay_price ASC'
  156. grade: state
  157. }, )
  158. .then(({
  159. data
  160. }) => {
  161. console.log(data);
  162. this.total = data.total;
  163. this.totalLevel = data.totalLevel;
  164. // this.all = this.total + this.totalLevel;
  165. if (data.list.length > 0) {
  166. this.list = data.list
  167. const D = data.list.map((e) => {
  168. e.level = +e.level;
  169. return e;
  170. })
  171. navItem.orderList = navItem.orderList.concat(D);
  172. navItem.page++;
  173. }
  174. this.$nextTick(function() {
  175. if (navItem.limit == data.list.length) {
  176. //判断是否还有数据, 有改为 more, 没有改为noMore
  177. navItem.loadingType = 'more';
  178. return;
  179. } else {
  180. //判断是否还有数据, 有改为 more, 没有改为noMore
  181. navItem.loadingType = 'noMore';
  182. }
  183. })
  184. this.$set(navItem, 'loaded', true);
  185. })
  186. .catch(e => {
  187. console.log(e);
  188. });
  189. },
  190. //swiper 切换
  191. changeTab(e) {
  192. this.tabCurrentIndex = e.target.current;
  193. this.loadData('tabChange');
  194. },
  195. //顶部tab点击
  196. tabClick(index) {
  197. this.tabCurrentIndex = index;
  198. },
  199. // 点击返回 我的页面
  200. toBack() {
  201. uni.switchTab({
  202. url: '/pages/user/user'
  203. })
  204. },
  205. loadAll() {
  206. getUserInfo().then(res => {
  207. this.userInfo = res.data
  208. console.log(res, '6666666666666666666')
  209. });
  210. }
  211. }
  212. };
  213. </script>
  214. <style lang="scss">
  215. page {
  216. background: #ffffff;
  217. height: 100%;
  218. }
  219. .itemVip {
  220. font-size: 24rpx;
  221. line-height: 1;
  222. color: #FFFFFF;
  223. border-radius: 99rpx;
  224. padding: 10rpx 20rpx;
  225. margin-left: 10rpx;
  226. }
  227. .lv1 {
  228. background-image: linear-gradient(to right, #a9a9a9, #a9a9a9);
  229. }
  230. .lv2 {
  231. background-image: linear-gradient(to right, #ffc107, #ffc107);
  232. }
  233. .lv3 {
  234. background-image: linear-gradient(to right, #e51c23, #e51c23);
  235. }
  236. .lv4 {
  237. background-image: linear-gradient(to right, #000000, #000000);
  238. }
  239. .lv5 {
  240. background-image: linear-gradient(to right, #000000, #000000);
  241. }
  242. .lv6 {
  243. background-image: linear-gradient(to right, #000000, #000000);
  244. }
  245. .content-money {
  246. // padding-bottom: 30rpx;
  247. background: $page-color-base;
  248. .buttom-box {
  249. position: relative;
  250. background-color: #ffffff;
  251. text-align: center;
  252. padding: 30rpx 0;
  253. .buttom {
  254. flex-grow: 1;
  255. }
  256. .money {
  257. font-size: 32rpx;
  258. font-weight: bold;
  259. color: #921a23;
  260. }
  261. .text {
  262. padding-bottom: 26rpx;
  263. font-size: 28rpx;
  264. font-weight: 500;
  265. color: #666666;
  266. &.current {
  267. border-bottom: 2px solid #921a23;
  268. }
  269. }
  270. .icon {
  271. height: 50rpx;
  272. width: 48rpx;
  273. margin: 0 auto;
  274. .icon-img {
  275. width: 100%;
  276. height: 100%;
  277. }
  278. }
  279. }
  280. }
  281. .money-box {
  282. // background: $base-color;
  283. height: 380rpx;
  284. color: #FF4C4C;
  285. text-align: center;
  286. font-size: 35rpx;
  287. position: relative;
  288. // padding-top: 60rpx;
  289. .header {
  290. position: absolute;
  291. left: 0;
  292. top: 0;
  293. width: 100%;
  294. height: 80rpx;
  295. font-size: 36rpx;
  296. font-weight: bold;
  297. z-index: 99;
  298. display: flex;
  299. justify-content: center;
  300. align-items: center;
  301. }
  302. .goback-box {
  303. position: absolute;
  304. left: 29rpx;
  305. top: 0;
  306. height: 80rpx;
  307. display: flex;
  308. align-items: center;
  309. }
  310. .goback {
  311. z-index: 100;
  312. width: 34rpx;
  313. height: 34rpx;
  314. }
  315. .tuiguang_bg {
  316. width: 100%;
  317. height: 400rpx;
  318. position: relative;
  319. }
  320. .money_img {
  321. width: 100%;
  322. height: 120rpx;
  323. text-align: center;
  324. padding-top: 50rpx;
  325. padding-bottom: 135rpx;
  326. image {
  327. width: 120rpx;
  328. height: 120rpx;
  329. border: 4rpx solid #FD5F6F;
  330. border-radius: 50%;
  331. }
  332. }
  333. .money-frame {
  334. position: absolute;
  335. top: 0;
  336. width: 100%;
  337. padding-top: 120rpx;
  338. // left: 30rpx;
  339. // height: 460rpx;
  340. // display: flex;
  341. // align-items: flex-start;
  342. // flex-direction: column;
  343. // justify-content: center;
  344. }
  345. .money_name {
  346. width: 100%;
  347. text-align: center;
  348. font-size: 32rpx;
  349. font-family: PingFang SC;
  350. font-weight: bold;
  351. color: #FFFFFF;
  352. }
  353. .money_num {
  354. padding-top: 50rpx;
  355. font-size: 72rpx;
  356. font-family: PingFang SC;
  357. font-weight: bold;
  358. color: #FF4C4C;
  359. .money_ren {
  360. font-size: 36rpx;
  361. }
  362. }
  363. }
  364. // 列表
  365. .swiper-box {
  366. // padding-top: 10rpx;
  367. .order-item {
  368. padding: 20rpx 30rpx;
  369. padding-bottom: 0;
  370. line-height: 1.5;
  371. .title-box {
  372. width: 100%;
  373. &.flex_item {
  374. border-bottom: 1px dashed #999999;
  375. padding-bottom: 20rpx;
  376. }
  377. .title-avatar {
  378. width: 100rpx;
  379. height: 100rpx;
  380. margin-right: 25rpx;
  381. image {
  382. width: 100%;
  383. height: 100%;
  384. border-radius: 100%;
  385. }
  386. }
  387. .list_tpl {
  388. width: 85%;
  389. .title {
  390. font-size: $font-lg;
  391. color: $font-color-base;
  392. overflow: hidden; //超出的文本隐藏
  393. text-overflow: ellipsis; //溢出用省略号显示
  394. white-space: nowrap;
  395. justify-content: space-between;
  396. image {
  397. margin-left: 9rpx;
  398. width: 147rpx;
  399. height: 32rpx;
  400. }
  401. }
  402. .time {
  403. margin-top: 15rpx;
  404. font-size: 22rpx;
  405. color: $font-color-light;
  406. }
  407. }
  408. }
  409. .money {
  410. color: #DB1935;
  411. font-size: $font-lg;
  412. }
  413. }
  414. }
  415. .list-scroll-content {
  416. height: 100%;
  417. }
  418. .content {
  419. height: 100%;
  420. .empty-content {
  421. background-color: #ffffff;
  422. }
  423. }
  424. .tg-wrapper {
  425. width: 100%;
  426. background-color: #f7f7f7;
  427. padding: 20rpx 0;
  428. .tg-box {
  429. display: flex;
  430. justify-content: center;
  431. width: 690rpx;
  432. height: 143rpx;
  433. background-color: #fff;
  434. margin: 0 auto;
  435. align-items: center;
  436. .tg-item {
  437. width: 33%;
  438. display: flex;
  439. flex-direction: column;
  440. justify-content: center;
  441. align-items: center;
  442. .tg-tit {
  443. font-size: 24rpx;
  444. font-family: PingFang SC;
  445. font-weight: bold;
  446. color: #333333;
  447. }
  448. .tg-val {
  449. padding-top: 15rpx;
  450. font-size: 34rpx;
  451. font-family: PingFang SC;
  452. font-weight: bold;
  453. color: #333333;
  454. }
  455. }
  456. .tg-jg {
  457. width: 1rpx;
  458. height: 51rpx;
  459. background: #DDDDDD;
  460. }
  461. }
  462. }
  463. </style>