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