award.vue 10 KB

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