qudou.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  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">
  7. <image class="goback" src="../../static/icon/fanhui.png" mode=""></image>
  8. </view>
  9. <view class="header">积分</view>
  10. </view>
  11. <view class="content-bg">
  12. <image src="../../static/img/myfans.png" mode=""></image>
  13. </view>
  14. <view class="money-box">
  15. <view class="money">{{ userInfo.integral }}</view>
  16. <view>当前余额</view>
  17. </view>
  18. </view>
  19. <view class="info-box flex">
  20. <view class="info-item">
  21. <view class="info-font">累计收入</view>
  22. <view class="info-num">{{ recharge }}</view>
  23. </view>
  24. <view class="shu"></view>
  25. <view class="info-item">
  26. <view class="info-font">累计支出</view>
  27. <view class="info-num">{{ orderStatusSum }}</view>
  28. </view>
  29. </view>
  30. <view class="navbar">
  31. <view v-for="(item, index) in navList" :key="index" class="nav-item"
  32. :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
  33. </view>
  34. <swiper :current="tabCurrentIndex" :style="{ height: maxheight }" class="swiper-box" duration="300"
  35. @change="changeTab">
  36. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  37. <scroll-view scroll-y="true" class="list-scroll-content" @scrolltolower="loadData">
  38. <!-- 空白页 -->
  39. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  40. <!-- 订单列表 -->
  41. <view>
  42. <view class="order-item flex" v-for="(item, index) in tabItem.orderList" :key="index">
  43. <view class="title-box">
  44. <view class="title">
  45. <text>{{ item.mark }}</text>
  46. </view>
  47. <view class="time">
  48. <text>{{ item.add_time }}</text>
  49. </view>
  50. </view>
  51. <view class="money">
  52. <view>{{ (item.pm == 0 ? '-' : '+') + item.number }}</view>
  53. <view v-if="item.status == 0" class="status">待发放</view>
  54. </view>
  55. </view>
  56. </view>
  57. <!-- <uni-load-more :status="tabItem.loadingType" v-if="!(tabItem.orderList.length == 0 && tabItem.loaded)"></uni-load-more> -->
  58. </scroll-view>
  59. </swiper-item>
  60. </swiper>
  61. </view>
  62. </template>
  63. <script>
  64. import {
  65. integrallist
  66. } from '@/api/wallet.js';
  67. import {
  68. mapState,
  69. mapMutations
  70. } from 'vuex';
  71. import {
  72. getUserInfo
  73. } from '@/api/user.js';
  74. import uniLoadMore from '@/uview-ui/components/u-loadmore/u-loadmore.vue';
  75. import empty from '@/uview-ui/components/u-empty/u-empty.vue';
  76. export default {
  77. computed: {
  78. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  79. },
  80. components: {
  81. empty,
  82. uniLoadMore
  83. },
  84. onReady(res) {
  85. var _this = this;
  86. uni.getSystemInfo({
  87. success: resu => {
  88. const query = uni.createSelectorQuery();
  89. query.select('.swiper-box').boundingClientRect();
  90. query.exec(function(res) {
  91. _this.maxheight = resu.windowHeight - res[0].top + 'px';
  92. console.log('打印页面的剩余高度', _this.height);
  93. });
  94. },
  95. fail: res => {}
  96. });
  97. },
  98. data() {
  99. return {
  100. // 头部图高度
  101. maxheight: '',
  102. tabCurrentIndex: 0,
  103. orderStatusSum: 0,
  104. recharge: 0,
  105. navList: [{
  106. state: 0,
  107. text: '收入',
  108. loadingType: 'more',
  109. orderList: [],
  110. page: 1, //当前页数
  111. limit: 1000, //每次信息条数
  112. loaded: false
  113. },
  114. {
  115. state: 1,
  116. text: '支出',
  117. loadingType: 'more',
  118. orderList: [],
  119. page: 1, //当前页数
  120. limit: 1000, //每次信息条数
  121. loaded: false
  122. }
  123. ],
  124. money: ''
  125. };
  126. },
  127. onLoad(options) {},
  128. onShow() {
  129. this.loadData();
  130. this.loadBaseData();
  131. },
  132. methods: {
  133. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  134. // 页面跳转
  135. navto(e) {
  136. uni.navigateTo({
  137. url: e
  138. });
  139. },
  140. loadBaseData() {
  141. getUserInfo({})
  142. .then(({
  143. data
  144. }) => {
  145. this.setUserInfo(data);
  146. })
  147. .catch(e => {
  148. console.log(e);
  149. });
  150. },
  151. // 点击返回 我的页面
  152. toBack() {
  153. uni.navigateBack({});
  154. },
  155. //获取收入支出信息
  156. async loadData(source) {
  157. let obj = this;
  158. //这里是将订单挂载到tab列表下
  159. let index = this.tabCurrentIndex;
  160. let navItem = this.navList[index];
  161. let state = navItem.state;
  162. console.log(source, 'iwiwiwiwi');
  163. if (source === 'tabChange' && navItem.loaded === true) {
  164. //tab切换只有第一次需要加载数据
  165. return;
  166. }
  167. if (navItem.loadingType === 'loading') {
  168. //防止重复加载
  169. return;
  170. }
  171. // 修改当前对象状态为加载中
  172. navItem.loadingType = 'loading';
  173. integrallist({
  174. page: navItem.page,
  175. limit: navItem.limit
  176. })
  177. .then(({
  178. data
  179. }) => {
  180. // obj.recharge = data.income;
  181. // obj.orderStatusSum = data.expend;
  182. if (state == 0) {
  183. navItem.orderList = data.zj;
  184. }
  185. if (state == 1) {
  186. navItem.orderList = data.kc;
  187. }
  188. })
  189. .catch(e => {
  190. console.log(e);
  191. });
  192. },
  193. //swiper 切换
  194. changeTab(e) {
  195. this.tabCurrentIndex = e.target.current;
  196. this.loadData('tabChange');
  197. },
  198. //顶部tab点击
  199. tabClick(index) {
  200. this.tabCurrentIndex = index;
  201. }
  202. }
  203. };
  204. </script>
  205. <style lang="scss">
  206. page {
  207. background: #f1f1f1;
  208. height: 100%;
  209. }
  210. .status_bar {
  211. height: var(--status-bar-height);
  212. width: 100%;
  213. }
  214. .moneybtn-box {
  215. position: relative;
  216. z-index: 2;
  217. color: $font-color-dark;
  218. font-size: 28rpx;
  219. font-weight: bold;
  220. background-color: #FFF;
  221. border-radius: 30rpx;
  222. margin: -100rpx 30rpx 30rpx 30rpx;
  223. height: 180rpx;
  224. .money-btn {
  225. flex-grow: 1;
  226. line-height: 1;
  227. .tipIcon {
  228. width: 55rpx;
  229. height: 55rpx;
  230. }
  231. }
  232. .money-bt-line {
  233. border: 1px solid $border-color-base;
  234. height: 100rpx;
  235. }
  236. }
  237. .content-money {
  238. position: relative;
  239. height: 480rpx;
  240. .content-bg {
  241. position: absolute;
  242. top: 0;
  243. left: 0;
  244. right: 0;
  245. width: 750rpx;
  246. height: 480rpx;
  247. image {
  248. width: 100%;
  249. height: 100%;
  250. }
  251. }
  252. .body-title {
  253. height: 80rpx;
  254. text-align: center;
  255. font-size: 35rpx;
  256. position: relative;
  257. .header {
  258. position: absolute;
  259. left: 0;
  260. top: 0;
  261. width: 100%;
  262. font-size: 36rpx;
  263. font-family: PingFang SC;
  264. font-weight: bold;
  265. color: #fffeff;
  266. height: 80rpx;
  267. font-size: 36rpx;
  268. font-weight: 700;
  269. z-index: 9;
  270. display: flex;
  271. justify-content: center;
  272. align-items: center;
  273. }
  274. .goback-box {
  275. position: absolute;
  276. left: 18rpx;
  277. top: 0;
  278. height: 80rpx;
  279. display: flex;
  280. align-items: center;
  281. }
  282. .goback {
  283. z-index: 100;
  284. width: 34rpx;
  285. height: 34rpx;
  286. }
  287. }
  288. }
  289. .info-box {
  290. width: 670rpx;
  291. height: 186rpx;
  292. background: #ffffff;
  293. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  294. border-radius: 20rpx;
  295. margin: -100rpx auto 0;
  296. position: relative;
  297. z-index: 2;
  298. .info-item {
  299. width: 50%;
  300. display: flex;
  301. flex-direction: column;
  302. align-items: center;
  303. line-height: 1;
  304. .info-font {
  305. font-size: 30rpx;
  306. font-weight: bold;
  307. color: #999999;
  308. }
  309. .info-num {
  310. margin-top: 30rpx;
  311. font-size: 30rpx;
  312. font-family: PingFang SC;
  313. font-weight: bold;
  314. color: #181818;
  315. }
  316. }
  317. .shu {
  318. width: 2rpx;
  319. height: 74rpx;
  320. background: #dcdfe6;
  321. }
  322. }
  323. .money-box {
  324. position: relative;
  325. z-index: 2;
  326. padding-top: 90rpx;
  327. color: #ffffff;
  328. text-align: center;
  329. .money {
  330. font-size: 72rpx;
  331. font-family: PingFang SC;
  332. font-weight: bold;
  333. color: #ffffff;
  334. }
  335. .text {
  336. font-size: 30rpx;
  337. }
  338. }
  339. .navbar {
  340. margin-top: 20rpx;
  341. display: flex;
  342. height: 88rpx;
  343. padding: 0 5px;
  344. background: #fff;
  345. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  346. position: relative;
  347. z-index: 10;
  348. .nav-item {
  349. flex: 1;
  350. display: flex;
  351. justify-content: center;
  352. align-items: center;
  353. height: 100%;
  354. font-size: 15px;
  355. color: #999999;
  356. position: relative;
  357. &.current {
  358. color: #000;
  359. &:after {
  360. content: '';
  361. position: absolute;
  362. left: 50%;
  363. bottom: 0;
  364. transform: translateX(-50%);
  365. width: 44px;
  366. height: 0;
  367. border-bottom: 2px solid #fe5b38;
  368. }
  369. }
  370. }
  371. }
  372. //列表
  373. .swiper-box {
  374. .order-item:last-child {
  375. margin-bottom: 60rpx;
  376. }
  377. .order-item {
  378. padding: 20rpx 30rpx;
  379. line-height: 1.5;
  380. .title-box {
  381. .title {
  382. font-size: $font-lg;
  383. color: $font-color-base;
  384. }
  385. .time {
  386. font-size: $font-base;
  387. color: $font-color-light;
  388. }
  389. }
  390. .money {
  391. color: #fd5b23;
  392. font-size: $font-lg;
  393. text-align: right;
  394. .status {
  395. color: $font-color-light;
  396. }
  397. }
  398. }
  399. }
  400. .list-scroll-content {
  401. background: #ffffff;
  402. height: 100%;
  403. }
  404. .content {
  405. height: 100%;
  406. .empty-content {
  407. background-color: #ffffff;
  408. }
  409. }
  410. .btn-box {
  411. width: 674rpx;
  412. height: 88rpx;
  413. background: linear-gradient(0deg, #2e58ff, #32c6ff);
  414. border-radius: 44rpx;
  415. font-size: 36rpx;
  416. font-family: PingFang SC;
  417. font-weight: 500;
  418. color: #ffffff;
  419. text-align: center;
  420. line-height: 88rpx;
  421. position: fixed;
  422. bottom: 48rpx;
  423. left: 0;
  424. right: 0;
  425. margin: 0 auto;
  426. }
  427. </style>