team.vue 7.5 KB

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