award.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  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"><image class="goback" src="../../static/icon/fanhui.png" mode=""></image></view>
  7. <view class="header">我的奖金</view>
  8. </view>
  9. <view class="content-bg"><image src="../../static/img/tg-bg.png" mode=""></image></view>
  10. <view class="money-box">
  11. <view class="money">{{ yj || 0 }}</view>
  12. <view>我的奖金</view>
  13. </view>
  14. <view class="moneybtn-box">
  15. <view class="money-btn"></view>
  16. <view class="money-btn" @click="navto('/pages/user/withdrawal')">奖金提现</view>
  17. <!-- <view class="money-btn"></view> -->
  18. </view>
  19. </view>
  20. <view class="info-box flex">
  21. <view class="info-item">
  22. <view class="info-font">累计收入</view>
  23. <view class="info-num">{{ sr || '0' }}</view>
  24. </view>
  25. <view class="shu"></view>
  26. <view class="info-item">
  27. <view class="info-font">累计支出</view>
  28. <view class="info-num">{{ zc || '0' }}</view>
  29. </view>
  30. </view>
  31. <view class="navbar">
  32. <view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
  33. </view>
  34. <swiper :current="tabCurrentIndex" :style="{ height: height }" class="swiper-box" duration="300" @change="changeTab">
  35. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  36. <scroll-view scroll-y="true" class="list-scroll-content" @scrolltolower="loadData">
  37. <!-- 空白页 -->
  38. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  39. <!-- 订单列表 -->
  40. <view>
  41. <view class="order-item flex" v-for="(item, index) in tabItem.orderList" :key="index">
  42. <view class="title-box">
  43. <view class="title">
  44. <text>{{ item.title }}</text>
  45. </view>
  46. <view class="time">
  47. <text>{{ item.add_time }}</text>
  48. </view>
  49. </view>
  50. <view class="money">
  51. <view>{{ (item.pm == 0 ? '-' : '+') + item.number }}</view>
  52. </view>
  53. </view>
  54. </view>
  55. <uni-load-more :status="tabItem.loadingType" v-if="!(tabItem.orderList.length == 0 && tabItem.loaded)"></uni-load-more>
  56. </scroll-view>
  57. </swiper-item>
  58. </swiper>
  59. </view>
  60. </template>
  61. <script>
  62. import { mapState, mapMutations } from 'vuex';
  63. import { getCommissionInfo, getUser, brokerageList } from '@/api/user.js';
  64. import { getMoneyStyle } from '@/utils/rocessor.js';
  65. import { mapGetters } from 'vuex';
  66. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  67. import empty from '@/components/empty';
  68. import { spreadCommission, userBalance, extractBank } from '@/api/wallet.js';
  69. export default {
  70. filters: {
  71. getMoneyStyle
  72. },
  73. components: {
  74. empty,
  75. uniLoadMore
  76. },
  77. onReady(res) {
  78. var _this = this;
  79. uni.getSystemInfo({
  80. success: resu => {
  81. const query = uni.createSelectorQuery();
  82. query.select('.swiper-box').boundingClientRect();
  83. query.exec(function(res) {
  84. _this.height = resu.windowHeight - res[0].top + 'px';
  85. console.log('打印页面的剩余高度', _this.height);
  86. });
  87. },
  88. fail: res => {}
  89. });
  90. },
  91. data() {
  92. return {
  93. userInfo: {},
  94. sr: '',
  95. zc: '',
  96. yj: '',
  97. height: '',
  98. // 头部图高度
  99. maxheight: '',
  100. tabCurrentIndex: 0,
  101. orderStatusSum: 0,
  102. recharge: 0,
  103. navList: [
  104. // {
  105. // state: 0,
  106. // text: '全部',
  107. // loadingType: 'more',
  108. // orderList: [],
  109. // page: 1, //当前页数
  110. // limit: 10 //每次信息条数
  111. // },
  112. {
  113. state: 0,
  114. text: '支出',
  115. loadingType: 'more',
  116. orderList: [],
  117. page: 1, //当前页数
  118. limit: 10 //每次信息条数
  119. },
  120. {
  121. state: 1,
  122. text: '收入',
  123. loadingType: 'more',
  124. orderList: [],
  125. page: 1, //当前页数
  126. limit: 10 //每次信息条数
  127. }
  128. ],
  129. money: ''
  130. };
  131. },
  132. onLoad(options) {},
  133. onShow() {
  134. this.extractBank();
  135. this.getUserInfo();
  136. },
  137. methods: {
  138. getUserInfo() {
  139. getUser({}).then(({ data }) => {
  140. console.log(data, 'data');
  141. this.userInfo = data;
  142. this.loadData();
  143. });
  144. },
  145. extractBank() {
  146. extractBank().then(res => {
  147. console.log(res);
  148. this.yj = res.data.brokerage_price;
  149. });
  150. },
  151. toBack() {
  152. uni.switchTab({
  153. url: '/pages/user/user'
  154. });
  155. },
  156. // 页面跳转
  157. navto(e) {
  158. uni.navigateTo({
  159. url: e
  160. });
  161. },
  162. //获取收入支出信息
  163. async loadData(source) {
  164. let obj = this;
  165. //这里是将订单挂载到tab列表下
  166. let index = this.tabCurrentIndex;
  167. let navItem = this.navList[index];
  168. let state = navItem.state;
  169. if (source === 'tabChange' && navItem.loaded === true) {
  170. //tab切换只有第一次需要加载数据
  171. return;
  172. }
  173. if (navItem.loadingType === 'loading') {
  174. //防止重复加载
  175. return;
  176. }
  177. // 修改当前对象状态为加载中
  178. navItem.loadingType = 'loading';
  179. // alert(obj.userInfo.vip)
  180. console.log(obj.userInfo);
  181. brokerageList(
  182. {
  183. page: navItem.page,
  184. limit: navItem.limit,
  185. uid: obj.userInfo.uid
  186. },
  187. state
  188. )
  189. .then(({ data }) => {
  190. obj.sr = data.general_expend;
  191. obj.zc = data.general_income;
  192. navItem.orderList = navItem.orderList.concat(data.list);
  193. //判断是否还有数据, 有改为more, 没有改为noMore
  194. if (navItem.limit == data.list.length) {
  195. navItem.loadingType = 'more';
  196. return;
  197. } else {
  198. navItem.loadingType = 'noMore';
  199. }
  200. uni.hideLoading();
  201. this.$set(navItem, 'loaded', true);
  202. })
  203. .catch(e => {
  204. console.log(e);
  205. });
  206. },
  207. //swiper 切换
  208. changeTab(e) {
  209. this.tabCurrentIndex = e.target.current;
  210. this.loadData('tabChange');
  211. },
  212. //顶部tab点击
  213. tabClick(index) {
  214. this.tabCurrentIndex = index;
  215. }
  216. }
  217. };
  218. </script>
  219. <style lang="scss">
  220. page {
  221. background: #f1f1f1;
  222. height: 100%;
  223. }
  224. .status_bar {
  225. height: var(--status-bar-height);
  226. width: 100%;
  227. }
  228. .content-money {
  229. position: relative;
  230. height: 480rpx;
  231. .content-bg {
  232. position: absolute;
  233. top: 0;
  234. left: 0;
  235. right: 0;
  236. width: 750rpx;
  237. height: 480rpx;
  238. image {
  239. width: 100%;
  240. height: 100%;
  241. }
  242. }
  243. .body-title {
  244. height: 80rpx;
  245. text-align: center;
  246. font-size: 35rpx;
  247. position: relative;
  248. .header {
  249. position: absolute;
  250. left: 0;
  251. top: 0;
  252. width: 100%;
  253. font-size: 36rpx;
  254. font-family: PingFang SC;
  255. font-weight: bold;
  256. color: #fffeff;
  257. height: 80rpx;
  258. font-size: 36rpx;
  259. font-weight: 700;
  260. z-index: 9;
  261. display: flex;
  262. justify-content: center;
  263. align-items: center;
  264. }
  265. .goback-box {
  266. position: absolute;
  267. left: 18rpx;
  268. top: 0;
  269. height: 80rpx;
  270. display: flex;
  271. align-items: center;
  272. }
  273. .goback {
  274. z-index: 100;
  275. width: 34rpx;
  276. height: 34rpx;
  277. }
  278. }
  279. }
  280. .info-box {
  281. width: 670rpx;
  282. height: 186rpx;
  283. background: #ffffff;
  284. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  285. border-radius: 20rpx;
  286. margin: -100rpx auto 0;
  287. position: relative;
  288. z-index: 2;
  289. .info-item {
  290. width: 50%;
  291. display: flex;
  292. flex-direction: column;
  293. align-items: center;
  294. line-height: 1;
  295. .info-font {
  296. font-size: 30rpx;
  297. font-family: PingFang SC;
  298. font-weight: bold;
  299. color: #999999;
  300. }
  301. .info-num {
  302. margin-top: 30rpx;
  303. font-size: 30rpx;
  304. font-family: PingFang SC;
  305. font-weight: bold;
  306. color: #181818;
  307. }
  308. }
  309. .shu {
  310. width: 2rpx;
  311. height: 74rpx;
  312. background: #dcdfe6;
  313. }
  314. }
  315. .money-box {
  316. position: relative;
  317. z-index: 2;
  318. /* #ifdef H5 */
  319. padding-top: 90rpx;
  320. /* #endif */
  321. color: #ffffff;
  322. text-align: center;
  323. /* #ifdef APP-PLUS */
  324. height: 200rpx;
  325. display: flex;
  326. flex-direction: column;
  327. justify-content: center;
  328. /* #endif */
  329. /* #ifdef MP-WEIXIN */
  330. padding-top: 40rpx;
  331. /* #endif */
  332. .money {
  333. font-size: 72rpx;
  334. font-family: PingFang SC;
  335. font-weight: bold;
  336. color: #ffffff;
  337. }
  338. .text {
  339. font-size: 30rpx;
  340. }
  341. }
  342. .moneybtn-box {
  343. display: flex;
  344. justify-content: space-between;
  345. position: relative;
  346. z-index: 2;
  347. color: #ffffff;
  348. padding: 0rpx 50rpx;
  349. font-size: 30rpx;
  350. font-family: PingFang SC;
  351. font-weight: bold;
  352. color: #ffffff;
  353. }
  354. .navbar {
  355. margin-top: 20rpx;
  356. display: flex;
  357. height: 88rpx;
  358. padding: 0 5px;
  359. background: #fff;
  360. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  361. position: relative;
  362. z-index: 10;
  363. .nav-item {
  364. flex: 1;
  365. display: flex;
  366. justify-content: center;
  367. align-items: center;
  368. height: 100%;
  369. font-size: 15px;
  370. color: #999999;
  371. position: relative;
  372. &.current {
  373. color: #000;
  374. &:after {
  375. content: '';
  376. position: absolute;
  377. left: 50%;
  378. bottom: 0;
  379. transform: translateX(-50%);
  380. width: 44px;
  381. height: 0;
  382. border-bottom: 2px solid #fe5b38;
  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>