extension.vue 10 KB

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