award.vue 9.8 KB

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