tdjj.vue 9.4 KB

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