fhsy.vue 9.0 KB

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