award.vue 9.8 KB

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