team.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="status_bar"><!-- 这里是状态栏 --></view>
  5. <view class="body-title">
  6. <view class="goback-box" @click="toBack">
  7. <image class="goback" src="../../static/icon/fanhui.png" mode=""></image>
  8. </view>
  9. <view class="header">我的推广</view>
  10. </view>
  11. <view class="content-bg">
  12. <image src="../../static/img/break-bg.png" mode=""></image>
  13. </view>
  14. <view class="money-box">
  15. <view class="money">{{ all || '0' }}</view>
  16. <view>我的推广人数</view>
  17. <view class="tip">
  18. *三个月不推广,绿色积分停止发放。自己复投或推广后重新激活*
  19. </view>
  20. </view>
  21. </view>
  22. <!-- <view class="yeji">
  23. <view class="yeji-a">
  24. <view class="yeji-buttom">{{ userInfo.self_achievement * 1 || 0 }}</view>
  25. <view class="yeji-top">个人业绩</view>
  26. </view>
  27. <view class="border"></view>
  28. <view class="yeji-a">
  29. <view class="yeji-buttom">{{ userInfo.group_achievement * 1 || 0 }}</view>
  30. <view class="yeji-top">团队业绩</view>
  31. </view>
  32. </view> -->
  33. <swiper :current="tabCurrentIndex" :style="{ height: maxheight }" class="swiper-box" duration="300"
  34. @change="changeTab">
  35. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  36. <scroll-view class="list-scroll-content" :style="{ height: maxheight }" scroll-y
  37. @scrolltolower="loadData">
  38. <!-- 空白页 -->
  39. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  40. <!-- 订单列表 -->
  41. <view v-for="(item, index) in tabItem.orderList" :key="index" class="order-item flex">
  42. <view class="title-box flex_item">
  43. <view class="title-avatar"
  44. v-if="item.avatar == 'http://kaifa.crmeb.net/uploads/attach/2019/08/20190807/723adbdd4e49a0f9394dfc700ab5dba3.png'">
  45. <image src="../../static/img/hlogo.png"></image>
  46. </view>
  47. <view class="title-avatar" v-else>
  48. <image :src="item.avatar|| '../../static/img/logo.png'"></image>
  49. </view>
  50. <view class="list_tpl">
  51. <view class="title">
  52. <view class="title-name clamp">{{ item.phone }}</view>
  53. </view>
  54. <view class="time">
  55. <text>{{ item.time }}</text>
  56. </view>
  57. </view>
  58. <view class="list-left">
  59. <!-- <view class="money">
  60. <text>第{{ item.layer }}层</text>
  61. </view> -->
  62. <view class="money">
  63. <text>{{ item.numberCount == null ? '未购买' : item.numberCount + '元' }}</text>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  69. </scroll-view>
  70. </swiper-item>
  71. </swiper>
  72. </view>
  73. </template>
  74. <script>
  75. import {
  76. spread
  77. } from '@/api/user.js';
  78. import {
  79. mapState,
  80. mapMutations
  81. } from 'vuex';
  82. export default {
  83. onReady(res) {
  84. var _this = this;
  85. uni.getSystemInfo({
  86. success: resu => {
  87. const query = uni.createSelectorQuery();
  88. query.select('.swiper-box').boundingClientRect();
  89. query.exec(function(res) {
  90. _this.maxheight = resu.windowHeight - res[0].top + 'px';
  91. console.log('打印页面的剩余高度', _this.height);
  92. });
  93. },
  94. fail: res => {}
  95. });
  96. },
  97. data() {
  98. return {
  99. // 头部图高度
  100. maxheight: '',
  101. tabCurrentIndex: 0,
  102. navList: [{
  103. state: 0,
  104. text: '直接推荐',
  105. loadingType: 'more',
  106. orderList: [],
  107. page: 1, //当前页数
  108. limit: 10 //每次信息条数
  109. }],
  110. all: '',
  111. list: ''
  112. };
  113. },
  114. computed: {
  115. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  116. },
  117. onLoad(options) {},
  118. onShow() {
  119. this.loadData();
  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. spread({
  149. page: navItem.page,
  150. limit: navItem.limit
  151. })
  152. .then(({
  153. data
  154. }) => {
  155. console.log(data);
  156. this.total = data.total;
  157. this.totalLevel = data.totalLevel;
  158. this.all = this.total;
  159. if (data.list.length > 0) {
  160. this.list = data.list;
  161. navItem.orderList = navItem.orderList.concat(data.list);
  162. navItem.page++;
  163. }
  164. this.$nextTick(function() {
  165. if (navItem.limit == data.list.length) {
  166. //判断是否还有数据, 有改为 more, 没有改为noMore
  167. navItem.loadingType = 'more';
  168. return;
  169. } else {
  170. //判断是否还有数据, 有改为 more, 没有改为noMore
  171. navItem.loadingType = 'noMore';
  172. }
  173. });
  174. this.$set(navItem, 'loaded', true);
  175. })
  176. .catch(e => {
  177. console.log(e);
  178. });
  179. },
  180. //swiper 切换
  181. changeTab(e) {
  182. this.tabCurrentIndex = e.target.current;
  183. this.loadData('tabChange');
  184. },
  185. //顶部tab点击
  186. tabClick(index) {
  187. this.tabCurrentIndex = index;
  188. },
  189. // 点击返回 我的页面
  190. toBack() {
  191. uni.switchTab({
  192. url: '/pages/user/user'
  193. });
  194. }
  195. }
  196. };
  197. </script>
  198. <style lang="scss">
  199. page {
  200. background: #f8f8f8;
  201. height: 100%;
  202. }
  203. .status_bar {
  204. height: var(--status-bar-height);
  205. width: 100%;
  206. background: #5dbc7c;
  207. }
  208. .content-money {
  209. position: relative;
  210. height: 480rpx;
  211. .content-bg {
  212. position: absolute;
  213. top: 0;
  214. left: 0;
  215. right: 0;
  216. width: 750rpx;
  217. height: 480rpx;
  218. image {
  219. width: 100%;
  220. height: 100%;
  221. }
  222. }
  223. .body-title {
  224. height: 80rpx;
  225. text-align: center;
  226. font-size: 35rpx;
  227. position: relative;
  228. .header {
  229. position: absolute;
  230. left: 0;
  231. top: 0;
  232. width: 100%;
  233. font-size: 36rpx;
  234. font-family: PingFang SC;
  235. font-weight: bold;
  236. color: #fffeff;
  237. height: 80rpx;
  238. font-size: 36rpx;
  239. font-weight: 700;
  240. z-index: 9;
  241. display: flex;
  242. justify-content: center;
  243. align-items: center;
  244. }
  245. .goback-box {
  246. position: absolute;
  247. left: 18rpx;
  248. top: 0;
  249. height: 80rpx;
  250. display: flex;
  251. align-items: center;
  252. }
  253. .goback {
  254. z-index: 100;
  255. width: 34rpx;
  256. height: 34rpx;
  257. }
  258. }
  259. }
  260. .money-box {
  261. position: relative;
  262. z-index: 2;
  263. padding-top: 70rpx;
  264. color: #ffffff;
  265. text-align: center;
  266. .money {
  267. font-size: 72rpx;
  268. font-family: PingFang SC;
  269. font-weight: bold;
  270. color: #ffffff;
  271. }
  272. .text {
  273. font-size: 30rpx;
  274. }
  275. }
  276. .tip {
  277. padding: 20rpx;
  278. text-align: center;
  279. // color: #db1935;
  280. font-size: 36rpx;
  281. }
  282. .order-item {
  283. padding: 20rpx 30rpx;
  284. line-height: 1.5;
  285. .title-box {
  286. width: 100%;
  287. .title-avatar {
  288. flex-shrink: 0;
  289. width: 100rpx;
  290. height: 100rpx;
  291. margin-right: 25rpx;
  292. border-radius: 100%;
  293. image {
  294. width: 100%;
  295. height: 100%;
  296. border-radius: 100%;
  297. }
  298. }
  299. .list_tpl {
  300. width: 74%;
  301. .title {
  302. display: flex;
  303. justify-content: flex-start;
  304. font-size: $font-lg;
  305. color: $font-color-base;
  306. overflow: hidden; //超出的文本隐藏
  307. text-overflow: ellipsis; //溢出用省略号显示
  308. white-space: nowrap;
  309. line-height: 1;
  310. text-align: center;
  311. .title-name {
  312. max-width: 60%;
  313. }
  314. .dl {
  315. margin-left: 10rpx;
  316. width: 93rpx;
  317. height: 32rpx;
  318. border-radius: 16rpx;
  319. image {
  320. width: 93rpx;
  321. height: 32rpx;
  322. border-radius: 16rpx;
  323. }
  324. }
  325. .class {
  326. display: inline-block;
  327. margin-left: 10rpx;
  328. padding: 6rpx;
  329. text-align: center;
  330. border: 1px solid #2e58ff;
  331. border-radius: 16rpx;
  332. font-size: 20rpx;
  333. font-family: PingFang SC;
  334. font-weight: 500;
  335. color: #2e58ff;
  336. }
  337. }
  338. .time {
  339. font-size: $font-base;
  340. color: $font-color-light;
  341. }
  342. }
  343. }
  344. .list-left {
  345. width: 50%;
  346. }
  347. .money {
  348. text-align: right;
  349. color: #db1935;
  350. font-size: $font-lg;
  351. }
  352. }
  353. .yeji {
  354. position: relative;
  355. margin: -72rpx auto 0;
  356. width: 690rpx;
  357. height: 143rpx;
  358. background: #ffffff;
  359. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
  360. border-radius: 10rpx;
  361. display: flex;
  362. align-items: center;
  363. .yeji-a {
  364. width: 50%;
  365. display: flex;
  366. flex-direction: column;
  367. justify-content: center;
  368. align-items: center;
  369. .yeji-top {
  370. font-size: 28rpx;
  371. font-family: PingFang SC;
  372. font-weight: bold;
  373. color: #333333;
  374. }
  375. .yeji-buttom {
  376. font-size: 42rpx;
  377. font-family: PingFang SC;
  378. font-weight: bold;
  379. color: #333333;
  380. }
  381. }
  382. .border {
  383. width: 1rpx;
  384. height: 51rpx;
  385. background: #dddddd;
  386. }
  387. }
  388. </style>