team.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  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. <!-- 空白页 -->
  19. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  20. <!-- 订单列表 -->
  21. <view v-for="(item, index) in tabItem.orderList" :key="index" class="order-item flex">
  22. <view class="title-box flex_item">
  23. <view class="title-avatar"><image :src="item.avatar"></image></view>
  24. <view class="list_tpl">
  25. <view class="title">
  26. <view class="title-name clamp">{{ item.nickname }}</view>
  27. </view>
  28. <view class="time">
  29. <text>{{ item.time }}</text>
  30. </view>
  31. </view>
  32. <view class="money">
  33. <text>{{ item.self_achievement == null ? '未购买' : item.self_achievement + '元' }}</text>
  34. </view>
  35. </view>
  36. </view>
  37. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  38. </scroll-view>
  39. </swiper-item>
  40. </swiper>
  41. </view>
  42. </template>
  43. <script>
  44. import { myspread } from '@/api/user.js';
  45. import { mapState, mapMutations } from 'vuex';
  46. export default {
  47. onReady(res) {
  48. var _this = this;
  49. uni.getSystemInfo({
  50. success: resu => {
  51. const query = uni.createSelectorQuery();
  52. query.select('.swiper-box').boundingClientRect();
  53. query.exec(function(res) {
  54. _this.maxheight = resu.windowHeight - res[0].top + 'px';
  55. console.log('打印页面的剩余高度', _this.height);
  56. });
  57. },
  58. fail: res => {}
  59. });
  60. },
  61. data() {
  62. return {
  63. // 头部图高度
  64. maxheight: '',
  65. tabCurrentIndex: 0,
  66. navList: [
  67. {
  68. state: 0,
  69. text: '直接推荐',
  70. loadingType: 'more',
  71. orderList: [],
  72. page: 1, //当前页数
  73. limit: 10 //每次信息条数
  74. }
  75. ],
  76. all: '',
  77. list: '',
  78. };
  79. },
  80. computed: {
  81. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  82. },
  83. onLoad(options) {},
  84. onShow() {
  85. this.loadData();
  86. },
  87. methods: {
  88. // 页面跳转
  89. navto(e) {
  90. uni.navigateTo({
  91. url: e
  92. });
  93. },
  94. //获取收入支出信息
  95. async loadData(source) {
  96. //这里是将订单挂载到tab列表下
  97. let index = this.tabCurrentIndex;
  98. let navItem = this.navList[index];
  99. let state = navItem.state;
  100. if (source === 'tabChange' && navItem.loaded === true) {
  101. //tab切换只有第一次需要加载数据
  102. return;
  103. }
  104. if (navItem.loadingType === 'loading') {
  105. //防止重复加载
  106. return;
  107. }
  108. if (navItem.loadingType === 'noMore') {
  109. //防止重复加载
  110. return;
  111. }
  112. // 修改当前对象状态为加载中
  113. navItem.loadingType = 'loading';
  114. myspread({
  115. page: navItem.page,
  116. limit: navItem.limit
  117. })
  118. .then(({ data }) => {
  119. console.log(data);
  120. this.total = data.total;
  121. this.totalLevel = data.totalLevel;
  122. this.all = this.total + this.totalLevel;
  123. if (data.list.length > 0) {
  124. this.list = data.list;
  125. navItem.orderList = navItem.orderList.concat(data.list);
  126. navItem.page++;
  127. }
  128. this.$nextTick(function() {
  129. if (navItem.limit == data.list.length) {
  130. //判断是否还有数据, 有改为 more, 没有改为noMore
  131. navItem.loadingType = 'more';
  132. return;
  133. } else {
  134. //判断是否还有数据, 有改为 more, 没有改为noMore
  135. navItem.loadingType = 'noMore';
  136. }
  137. });
  138. this.$set(navItem, 'loaded', true);
  139. })
  140. .catch(e => {
  141. console.log(e);
  142. });
  143. },
  144. //swiper 切换
  145. changeTab(e) {
  146. this.tabCurrentIndex = e.target.current;
  147. this.loadData('tabChange');
  148. },
  149. //顶部tab点击
  150. tabClick(index) {
  151. this.tabCurrentIndex = index;
  152. },
  153. // 点击返回 我的页面
  154. toBack() {
  155. uni.switchTab({
  156. url: '/pages/user/user'
  157. });
  158. }
  159. }
  160. };
  161. </script>
  162. <style lang="scss">
  163. page {
  164. background: #f8f8f8;
  165. height: 100%;
  166. }
  167. .status_bar {
  168. height: var(--status-bar-height);
  169. width: 100%;
  170. background: #5dbc7c;
  171. }
  172. .content-money {
  173. background: #5dbc7c;
  174. padding-bottom: 30rpx;
  175. .buttom-box {
  176. position: relative;
  177. background-color: #ffffff;
  178. text-align: center;
  179. margin: 0 30rpx;
  180. padding: 30rpx 0;
  181. border-radius: $border-radius-sm;
  182. margin-top: -80rpx;
  183. .buttom {
  184. font-size: $font-lg;
  185. flex-grow: 1;
  186. .money {
  187. font-weight: bold;
  188. font-size: 32rpx;
  189. color: #ff0000;
  190. }
  191. }
  192. .text {
  193. color: #666666;
  194. }
  195. .interval {
  196. width: 2rpx;
  197. height: 60rpx;
  198. background-color: #eeeeee;
  199. }
  200. .icon {
  201. height: 50rpx;
  202. width: 48rpx;
  203. margin: 0 auto;
  204. .icon-img {
  205. width: 100%;
  206. height: 100%;
  207. }
  208. }
  209. }
  210. }
  211. .money-box {
  212. height: 484rpx;
  213. color: #ffffff;
  214. text-align: center;
  215. font-size: 35rpx;
  216. position: relative;
  217. .header {
  218. position: absolute;
  219. left: 0;
  220. top: 0;
  221. width: 100%;
  222. height: 80rpx;
  223. font-size: 32rpx;
  224. font-weight: 700;
  225. z-index: 99;
  226. display: flex;
  227. justify-content: center;
  228. align-items: center;
  229. }
  230. .goback-box {
  231. position: absolute;
  232. left: 18rpx;
  233. top: 0;
  234. height: 80rpx;
  235. display: flex;
  236. align-items: center;
  237. }
  238. .goback {
  239. z-index: 100;
  240. width: 34rpx;
  241. height: 34rpx;
  242. }
  243. .right {
  244. position: absolute;
  245. top: 140rpx;
  246. right: 40rpx;
  247. text-align: right;
  248. line-height: 1;
  249. .right-num {
  250. font-size: 50rpx;
  251. font-family: PingFang SC;
  252. font-weight: bold;
  253. color: #ffffff;
  254. }
  255. .right-font {
  256. margin-top: 10rpx;
  257. font-size: 24rpx;
  258. font-family: PingFang SC;
  259. font-weight: 400;
  260. color: #ffffff;
  261. }
  262. .time {
  263. font-size: 26rpx;
  264. font-family: PingFang SC;
  265. font-weight: 500;
  266. color: #ffffff;
  267. line-height: 35px;
  268. }
  269. }
  270. .user {
  271. position: absolute;
  272. top: 140rpx;
  273. left: 34rpx;
  274. display: flex;
  275. justify-content: flex-start;
  276. align-items: center;
  277. z-index: 10;
  278. .avtor {
  279. width: 102rpx;
  280. height: 102rpx;
  281. border-radius: 50%;
  282. position: relative;
  283. .portrait {
  284. width: 100%;
  285. height: 100%;
  286. border-radius: 50%;
  287. }
  288. .he {
  289. position: absolute;
  290. height: 30rpx;
  291. bottom: -4rpx;
  292. left: 0;
  293. .image {
  294. width: 102rpx;
  295. height: 30rpx;
  296. }
  297. }
  298. }
  299. .name {
  300. margin-left: 30rpx;
  301. font-size: 36rpx;
  302. font-family: PingFang SC;
  303. font-weight: 500;
  304. color: #ffffff;
  305. display: flex;
  306. justify-content: start;
  307. .name-left {
  308. width: 220rpx;
  309. }
  310. .name-right {
  311. margin-left: 20rpx;
  312. width: 50rpx;
  313. height: 60rpx;
  314. position: relative;
  315. image {
  316. width: 100%;
  317. height: 100%;
  318. }
  319. .level {
  320. position: absolute;
  321. top: 35%;
  322. left: 50%;
  323. margin-left: -12rpx;
  324. font-size: 20rpx;
  325. }
  326. }
  327. }
  328. .id {
  329. margin-left: 30rpx;
  330. font-size: 30rpx;
  331. font-family: PingFang SC;
  332. font-weight: 500;
  333. color: #ffffff;
  334. }
  335. }
  336. .money_img {
  337. width: 100%;
  338. height: 120rpx;
  339. text-align: center;
  340. padding-top: 50rpx;
  341. padding-bottom: 135rpx;
  342. image {
  343. width: 120rpx;
  344. height: 120rpx;
  345. border: 4rpx solid #fd5f6f;
  346. border-radius: 50%;
  347. }
  348. }
  349. .money-frame {
  350. position: absolute;
  351. top: 0;
  352. width: 100%;
  353. padding-top: 200rpx;
  354. }
  355. .money_num {
  356. font-size: 72rpx;
  357. font-family: PingFang SC;
  358. font-weight: bold;
  359. color: #ffffff;
  360. .money_ren {
  361. font-size: 36rpx;
  362. }
  363. }
  364. }
  365. .order-item {
  366. padding: 20rpx 30rpx;
  367. line-height: 1.5;
  368. .title-box {
  369. width: 100%;
  370. .title-avatar {
  371. flex-shrink: 0;
  372. width: 100rpx;
  373. height: 100rpx;
  374. margin-right: 25rpx;
  375. border-radius: 100%;
  376. image {
  377. width: 100%;
  378. height: 100%;
  379. border-radius: 100%;
  380. }
  381. }
  382. .list_tpl {
  383. width: 85%;
  384. .title {
  385. display: flex;
  386. justify-content: flex-start;
  387. font-size: $font-lg;
  388. color: $font-color-base;
  389. overflow: hidden; //超出的文本隐藏
  390. text-overflow: ellipsis; //溢出用省略号显示
  391. white-space: nowrap;
  392. line-height: 1;
  393. text-align: center;
  394. .title-name {
  395. max-width: 40%;
  396. }
  397. .dl {
  398. margin-left: 10rpx;
  399. width: 93rpx;
  400. height: 32rpx;
  401. border-radius: 16rpx;
  402. image {
  403. width: 93rpx;
  404. height: 32rpx;
  405. border-radius: 16rpx;
  406. }
  407. }
  408. .class {
  409. display: inline-block;
  410. margin-left: 10rpx;
  411. padding: 6rpx;
  412. text-align: center;
  413. border: 1px solid #2e58ff;
  414. border-radius: 16rpx;
  415. font-size: 20rpx;
  416. font-family: PingFang SC;
  417. font-weight: 500;
  418. color: #2e58ff;
  419. }
  420. }
  421. .time {
  422. font-size: $font-base;
  423. color: $font-color-light;
  424. }
  425. }
  426. }
  427. .money {
  428. width: 50%;
  429. text-align: right;
  430. color: #db1935;
  431. font-size: $font-lg;
  432. }
  433. }
  434. .yeji {
  435. position: relative;
  436. margin: -72rpx auto 0;
  437. width: 690rpx;
  438. height: 143rpx;
  439. background: #ffffff;
  440. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
  441. border-radius: 10rpx;
  442. display: flex;
  443. align-items: center;
  444. .yeji-a {
  445. width: 50%;
  446. display: flex;
  447. flex-direction: column;
  448. justify-content: center;
  449. align-items: center;
  450. .yeji-top {
  451. font-size: 28rpx;
  452. font-family: PingFang SC;
  453. font-weight: bold;
  454. color: #333333;
  455. }
  456. .yeji-buttom {
  457. font-size: 42rpx;
  458. font-family: PingFang SC;
  459. font-weight: bold;
  460. color: #333333;
  461. }
  462. }
  463. .border {
  464. width: 1rpx;
  465. height: 51rpx;
  466. background: #dddddd;
  467. }
  468. }
  469. </style>