award.vue 10 KB

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