team.vue 7.5 KB

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