award.vue 9.4 KB

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