award.vue 12 KB

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