consumption.vue 8.6 KB

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