award.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  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. <home></home>
  62. </view>
  63. </template>
  64. <script>
  65. import {
  66. mapState,
  67. mapMutations
  68. } from 'vuex';
  69. import {loadIndexs} from '@/api/index.js'
  70. import { getCommissionInfo,getUser } from '@/api/user.js';
  71. import { getMoneyStyle } from '@/utils/rocessor.js';
  72. import { mapGetters } from 'vuex';
  73. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  74. import empty from '@/components/empty';
  75. import { spreadCommission, userBalance,extractBank } from '@/api/wallet.js';
  76. export default {
  77. filters: {
  78. getMoneyStyle
  79. },
  80. components: {
  81. empty,
  82. uniLoadMore
  83. },
  84. onReady(res) {
  85. var _this = this;
  86. uni.getSystemInfo({
  87. success: resu => {
  88. const query = uni.createSelectorQuery();
  89. query.select('.swiper-box').boundingClientRect();
  90. query.exec(function(res) {
  91. _this.height = resu.windowHeight - res[0].top + 'px';
  92. console.log('打印页面的剩余高度', _this.height);
  93. });
  94. },
  95. fail: res => {}
  96. });
  97. },
  98. data() {
  99. return {
  100. auth: 1,
  101. userInfo: {},
  102. yj: '',
  103. height: '',
  104. // 头部图高度
  105. maxheight: '',
  106. tabCurrentIndex: 0,
  107. orderStatusSum: 0,
  108. recharge: 0,
  109. navList: [
  110. // {
  111. // state: 0,
  112. // text: '全部',
  113. // loadingType: 'more',
  114. // orderList: [],
  115. // page: 1, //当前页数
  116. // limit: 10 //每次信息条数
  117. // },
  118. {
  119. state: 4,
  120. text: '支出',
  121. loadingType: 'more',
  122. orderList: [],
  123. page: 1, //当前页数
  124. limit: 10 //每次信息条数
  125. },
  126. {
  127. state: 3,
  128. text: '收入',
  129. loadingType: 'more',
  130. orderList: [],
  131. page: 1, //当前页数
  132. limit: 10 //每次信息条数
  133. }
  134. ],
  135. money: ''
  136. };
  137. },
  138. onLoad(options) {},
  139. onShow() {
  140. this.extractBank()
  141. this.getUserInfo()
  142. this.loadData();
  143. this.getIndex()
  144. },
  145. methods: {
  146. getIndex() {
  147. loadIndexs().then(res => {
  148. this.auth = res.data.auth
  149. })
  150. },
  151. getUserInfo() {
  152. getUser({}).then(({ data }) => {
  153. this.userInfo = data
  154. });
  155. },
  156. extractBank() {
  157. extractBank().then(res => {
  158. console.log(res)
  159. this.yj = res.data.brokerage_price
  160. })
  161. },
  162. toBack() {
  163. uni.switchTab({
  164. url: '/pages/user/user'
  165. });
  166. },
  167. // 页面跳转
  168. navto(e) {
  169. uni.navigateTo({
  170. url: e
  171. });
  172. },
  173. //获取收入支出信息
  174. async loadData(source) {
  175. let obj = this;
  176. //这里是将订单挂载到tab列表下
  177. let index = this.tabCurrentIndex;
  178. let navItem = this.navList[index];
  179. let state = navItem.state;
  180. if (source === 'tabChange' && navItem.loaded === true) {
  181. //tab切换只有第一次需要加载数据
  182. return;
  183. }
  184. if (navItem.loadingType === 'loading') {
  185. //防止重复加载
  186. return;
  187. }
  188. // 修改当前对象状态为加载中
  189. navItem.loadingType = 'loading';
  190. spreadCommission({
  191. page: navItem.page,
  192. limit: navItem.limit,
  193. },state)
  194. .then(({ data }) => {
  195. try{
  196. if(data.length > 0) {
  197. navItem.orderList = navItem.orderList.concat(data[0].list);
  198. console.log(navItem.orderList);
  199. navItem.page++;
  200. }
  201. //判断是否还有数据, 有改为more, 没有改为noMore
  202. if (navItem.limit == data.length) {
  203. navItem.loadingType = 'more';
  204. return;
  205. } else {
  206. navItem.loadingType = 'noMore';
  207. }
  208. uni.hideLoading();
  209. this.$set(navItem, 'loaded', true);
  210. }catch(e){
  211. console.log(e,'ee');
  212. //TODO handle the exception
  213. }
  214. })
  215. .catch(e => {
  216. console.log(e);
  217. });
  218. },
  219. //swiper 切换
  220. changeTab(e) {
  221. this.tabCurrentIndex = e.target.current;
  222. this.loadData('tabChange');
  223. },
  224. //顶部tab点击
  225. tabClick(index) {
  226. this.tabCurrentIndex = index;
  227. }
  228. }
  229. };
  230. </script>
  231. <style lang="scss">
  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: #fffeff;
  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: #ffffff;
  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: #ffffff;
  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: #ffffff;
  360. padding: 50rpx 50rpx 0;
  361. font-size: 30rpx;
  362. font-family: PingFang SC;
  363. font-weight: bold;
  364. color: #ffffff;
  365. }
  366. .navbar {
  367. margin-top: 20rpx;
  368. display: flex;
  369. height: 88rpx;
  370. padding: 0 5px;
  371. background: #fff;
  372. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  373. position: relative;
  374. z-index: 10;
  375. .nav-item {
  376. flex: 1;
  377. display: flex;
  378. justify-content: center;
  379. align-items: center;
  380. height: 100%;
  381. font-size: 15px;
  382. color: #999999;
  383. position: relative;
  384. &.current {
  385. color: #000;
  386. &:after {
  387. content: '';
  388. position: absolute;
  389. left: 50%;
  390. bottom: 0;
  391. transform: translateX(-50%);
  392. width: 44px;
  393. height: 0;
  394. border-bottom: 2px solid #fe5b38;
  395. }
  396. }
  397. }
  398. }
  399. //列表
  400. .swiper-box {
  401. .order-item:last-child {
  402. margin-bottom: 60rpx;
  403. }
  404. .order-item {
  405. padding: 20rpx 30rpx;
  406. line-height: 1.5;
  407. .title-box {
  408. .title {
  409. font-size: $font-lg;
  410. color: $font-color-base;
  411. }
  412. .time {
  413. font-size: $font-base;
  414. color: $font-color-light;
  415. }
  416. }
  417. .money {
  418. color: #fd5b23;
  419. font-size: $font-lg;
  420. text-align: right;
  421. .status {
  422. color: $font-color-light;
  423. }
  424. }
  425. }
  426. }
  427. .list-scroll-content {
  428. background: #ffffff;
  429. height: 100%;
  430. }
  431. .content {
  432. height: 100%;
  433. .empty-content {
  434. background-color: #ffffff;
  435. }
  436. }
  437. .btn-box {
  438. width: 674rpx;
  439. height: 88rpx;
  440. background: linear-gradient(0deg, #2e58ff, #32c6ff);
  441. border-radius: 44rpx;
  442. font-size: 36rpx;
  443. font-family: PingFang SC;
  444. font-weight: 500;
  445. color: #ffffff;
  446. text-align: center;
  447. line-height: 88rpx;
  448. position: fixed;
  449. bottom: 48rpx;
  450. left: 0;
  451. right: 0;
  452. margin: 0 auto;
  453. }
  454. </style>