team.vue 8.3 KB

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