qudou.vue 9.2 KB

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