award.vue 10 KB

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