team.vue 7.8 KB

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