award.vue 11 KB

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