team.vue 8.3 KB

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