award.vue 9.5 KB

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