mytihuo.vue 10 KB

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