team.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="status_bar"><!-- 这里是状态栏 --></view>
  5. <view class="money-box">
  6. <view class="money-frame">
  7. <view class="money_num">
  8. <text class="money_ren">共</text>
  9. {{ all || '0' }}
  10. <text class="money_ren">人</text>
  11. </view>
  12. </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. background: #5dbc7c;
  170. padding-bottom: 30rpx;
  171. .buttom-box {
  172. position: relative;
  173. background-color: #ffffff;
  174. text-align: center;
  175. margin: 0 30rpx;
  176. padding: 30rpx 0;
  177. border-radius: $border-radius-sm;
  178. margin-top: -80rpx;
  179. .buttom {
  180. font-size: $font-lg;
  181. flex-grow: 1;
  182. .money {
  183. font-weight: bold;
  184. font-size: 32rpx;
  185. color: #ff0000;
  186. }
  187. }
  188. .text {
  189. color: #666666;
  190. }
  191. .interval {
  192. width: 2rpx;
  193. height: 60rpx;
  194. background-color: #eeeeee;
  195. }
  196. .icon {
  197. height: 50rpx;
  198. width: 48rpx;
  199. margin: 0 auto;
  200. .icon-img {
  201. width: 100%;
  202. height: 100%;
  203. }
  204. }
  205. }
  206. }
  207. .money-box {
  208. height: 484rpx;
  209. color: #ffffff;
  210. text-align: center;
  211. font-size: 35rpx;
  212. position: relative;
  213. .header {
  214. position: absolute;
  215. left: 0;
  216. top: 0;
  217. width: 100%;
  218. height: 80rpx;
  219. font-size: 32rpx;
  220. font-weight: 700;
  221. z-index: 99;
  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. .right {
  240. position: absolute;
  241. top: 140rpx;
  242. right: 40rpx;
  243. text-align: right;
  244. line-height: 1;
  245. .right-num {
  246. font-size: 50rpx;
  247. font-family: PingFang SC;
  248. font-weight: bold;
  249. color: #ffffff;
  250. }
  251. .right-font {
  252. margin-top: 10rpx;
  253. font-size: 24rpx;
  254. font-family: PingFang SC;
  255. font-weight: 400;
  256. color: #ffffff;
  257. }
  258. .time {
  259. font-size: 26rpx;
  260. font-family: PingFang SC;
  261. font-weight: 500;
  262. color: #ffffff;
  263. line-height: 35px;
  264. }
  265. }
  266. .user {
  267. position: absolute;
  268. top: 140rpx;
  269. left: 34rpx;
  270. display: flex;
  271. justify-content: flex-start;
  272. align-items: center;
  273. z-index: 10;
  274. .avtor {
  275. width: 102rpx;
  276. height: 102rpx;
  277. border-radius: 50%;
  278. position: relative;
  279. .portrait {
  280. width: 100%;
  281. height: 100%;
  282. border-radius: 50%;
  283. }
  284. .he {
  285. position: absolute;
  286. height: 30rpx;
  287. bottom: -4rpx;
  288. left: 0;
  289. .image {
  290. width: 102rpx;
  291. height: 30rpx;
  292. }
  293. }
  294. }
  295. .name {
  296. margin-left: 30rpx;
  297. font-size: 36rpx;
  298. font-family: PingFang SC;
  299. font-weight: 500;
  300. color: #ffffff;
  301. display: flex;
  302. justify-content: start;
  303. .name-left {
  304. width: 220rpx;
  305. }
  306. .name-right {
  307. margin-left: 20rpx;
  308. width: 50rpx;
  309. height: 60rpx;
  310. position: relative;
  311. image {
  312. width: 100%;
  313. height: 100%;
  314. }
  315. .level {
  316. position: absolute;
  317. top: 35%;
  318. left: 50%;
  319. margin-left: -12rpx;
  320. font-size: 20rpx;
  321. }
  322. }
  323. }
  324. .id {
  325. margin-left: 30rpx;
  326. font-size: 30rpx;
  327. font-family: PingFang SC;
  328. font-weight: 500;
  329. color: #ffffff;
  330. }
  331. }
  332. .money_img {
  333. width: 100%;
  334. height: 120rpx;
  335. text-align: center;
  336. padding-top: 50rpx;
  337. padding-bottom: 135rpx;
  338. image {
  339. width: 120rpx;
  340. height: 120rpx;
  341. border: 4rpx solid #fd5f6f;
  342. border-radius: 50%;
  343. }
  344. }
  345. .money-frame {
  346. position: absolute;
  347. top: 0;
  348. width: 100%;
  349. padding-top: 200rpx;
  350. }
  351. .money_num {
  352. font-size: 72rpx;
  353. font-family: PingFang SC;
  354. font-weight: bold;
  355. color: #ffffff;
  356. .money_ren {
  357. font-size: 36rpx;
  358. }
  359. }
  360. }
  361. .order-item {
  362. padding: 20rpx 30rpx;
  363. line-height: 1.5;
  364. .title-box {
  365. width: 100%;
  366. .title-avatar {
  367. flex-shrink: 0;
  368. width: 100rpx;
  369. height: 100rpx;
  370. margin-right: 25rpx;
  371. border-radius: 100%;
  372. image {
  373. width: 100%;
  374. height: 100%;
  375. border-radius: 100%;
  376. }
  377. }
  378. .list_tpl {
  379. width: 85%;
  380. .title {
  381. display: flex;
  382. justify-content: flex-start;
  383. font-size: $font-lg;
  384. color: $font-color-base;
  385. overflow: hidden; //超出的文本隐藏
  386. text-overflow: ellipsis; //溢出用省略号显示
  387. white-space: nowrap;
  388. line-height: 1;
  389. text-align: center;
  390. .title-name {
  391. max-width: 40%;
  392. }
  393. .dl {
  394. margin-left: 10rpx;
  395. width: 93rpx;
  396. height: 32rpx;
  397. border-radius: 16rpx;
  398. image {
  399. width: 93rpx;
  400. height: 32rpx;
  401. border-radius: 16rpx;
  402. }
  403. }
  404. .class {
  405. display: inline-block;
  406. margin-left: 10rpx;
  407. padding: 6rpx;
  408. text-align: center;
  409. border: 1px solid #2e58ff;
  410. border-radius: 16rpx;
  411. font-size: 20rpx;
  412. font-family: PingFang SC;
  413. font-weight: 500;
  414. color: #2e58ff;
  415. }
  416. }
  417. .time {
  418. font-size: $font-base;
  419. color: $font-color-light;
  420. }
  421. }
  422. }
  423. .money {
  424. width: 50%;
  425. text-align: right;
  426. color: #db1935;
  427. font-size: $font-lg;
  428. }
  429. }
  430. .yeji {
  431. position: relative;
  432. margin: -72rpx auto 0;
  433. width: 690rpx;
  434. height: 143rpx;
  435. background: #ffffff;
  436. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
  437. border-radius: 10rpx;
  438. display: flex;
  439. align-items: center;
  440. .yeji-a {
  441. width: 50%;
  442. display: flex;
  443. flex-direction: column;
  444. justify-content: center;
  445. align-items: center;
  446. .yeji-top {
  447. font-size: 28rpx;
  448. font-family: PingFang SC;
  449. font-weight: bold;
  450. color: #333333;
  451. }
  452. .yeji-buttom {
  453. font-size: 42rpx;
  454. font-family: PingFang SC;
  455. font-weight: bold;
  456. color: #333333;
  457. }
  458. }
  459. .border {
  460. width: 1rpx;
  461. height: 51rpx;
  462. background: #dddddd;
  463. }
  464. }
  465. </style>