tdjj.vue 9.4 KB

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