award.vue 9.8 KB

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