bdjj.vue 9.5 KB

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