bdjj.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  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/bdjj.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. .moneybtn-box {
  336. display: flex;
  337. justify-content: space-between;
  338. position: relative;
  339. z-index: 2;
  340. color: #ffffff;
  341. padding: 0rpx 50rpx;
  342. font-size: 30rpx;
  343. font-family: PingFang SC;
  344. font-weight: bold;
  345. .money-btn {
  346. display: flex;
  347. align-items: center;
  348. .money-btn-icon {
  349. width: 40rpx;
  350. height: 40rpx;
  351. }
  352. .money-font {
  353. margin-left: 10rpx;
  354. }
  355. }
  356. }
  357. .navbar {
  358. margin-top: 20rpx;
  359. display: flex;
  360. height: 88rpx;
  361. padding: 0 5px;
  362. background: #fff;
  363. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  364. position: relative;
  365. z-index: 10;
  366. .nav-item {
  367. flex: 1;
  368. display: flex;
  369. justify-content: center;
  370. align-items: center;
  371. height: 100%;
  372. font-size: 15px;
  373. color: #999999;
  374. position: relative;
  375. &.current {
  376. color: #000;
  377. &:after {
  378. content: '';
  379. position: absolute;
  380. left: 50%;
  381. bottom: 0;
  382. transform: translateX(-50%);
  383. width: 50rpx;
  384. height: 6rpx;
  385. background: linear-gradient(30deg, #FF4C4C, #FE6238);
  386. border-radius: 4rpx;
  387. }
  388. }
  389. }
  390. }
  391. //列表
  392. .swiper-box {
  393. .order-item:last-child {
  394. margin-bottom: 60rpx;
  395. }
  396. .order-item {
  397. padding: 20rpx 30rpx;
  398. line-height: 1.5;
  399. .title-box {
  400. .title {
  401. font-size: $font-lg;
  402. color: $font-color-base;
  403. }
  404. .time {
  405. font-size: $font-base;
  406. color: $font-color-light;
  407. }
  408. }
  409. .money {
  410. color: #fd5b23;
  411. font-size: $font-lg;
  412. text-align: right;
  413. .status {
  414. color: $font-color-light;
  415. }
  416. }
  417. }
  418. }
  419. .list-scroll-content {
  420. background: #ffffff;
  421. height: 100%;
  422. }
  423. .content {
  424. height: 100%;
  425. .empty-content {
  426. background-color: #ffffff;
  427. }
  428. }
  429. .btn-box {
  430. width: 674rpx;
  431. height: 88rpx;
  432. background: linear-gradient(0deg, #2e58ff, #32c6ff);
  433. border-radius: 44rpx;
  434. font-size: 36rpx;
  435. font-family: PingFang SC;
  436. font-weight: 500;
  437. color: #ffffff;
  438. text-align: center;
  439. line-height: 88rpx;
  440. position: fixed;
  441. bottom: 48rpx;
  442. left: 0;
  443. right: 0;
  444. margin: 0 auto;
  445. }
  446. </style>