extension.vue 9.6 KB

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