mytihuo.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  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: 1000, //每次信息条数
  145. loaded: false
  146. },
  147. {
  148. state: 1,
  149. text: '支出',
  150. loadingType: 'more',
  151. orderList: [],
  152. page: 1, //当前页数
  153. limit: 1000, //每次信息条数
  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') {
  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. // obj.recharge = data.income;
  218. // obj.orderStatusSum = data.expend;
  219. if (state == 0) {
  220. navItem.orderList = data.zj;
  221. }
  222. if (state == 1) {
  223. navItem.orderList = data.kc;
  224. }
  225. })
  226. .catch(e => {
  227. console.log(e);
  228. });
  229. },
  230. //swiper 切换
  231. changeTab(e) {
  232. this.tabCurrentIndex = e.target.current;
  233. this.loadData('tabChange');
  234. },
  235. //顶部tab点击
  236. tabClick(index) {
  237. this.tabCurrentIndex = index;
  238. }
  239. }
  240. };
  241. </script>
  242. <style lang="scss">
  243. .thorder{
  244. position: absolute;
  245. right: 50rpx;
  246. bottom: 40rpx;
  247. color: #FFF;
  248. z-index: 999;
  249. .thTip{
  250. width: 30rpx;
  251. height: 27rpx;
  252. }
  253. }
  254. page {
  255. background: #f1f1f1;
  256. height: 100%;
  257. }
  258. .status_bar {
  259. height: var(--status-bar-height);
  260. width: 100%;
  261. }
  262. .moneybtn-box {
  263. position: relative;
  264. z-index: 2;
  265. color: $font-color-dark;
  266. font-size: 28rpx;
  267. font-weight: bold;
  268. background-color: #FFF;
  269. border-radius: 30rpx;
  270. margin: -100rpx 30rpx 30rpx 30rpx;
  271. height: 180rpx;
  272. .money-btn {
  273. flex-grow: 1;
  274. line-height: 1;
  275. .title{
  276. color: #999999;
  277. font-size: 30rpx;
  278. padding-bottom: 20rpx;
  279. }
  280. .tipIcon {
  281. width: 55rpx;
  282. height: 55rpx;
  283. }
  284. }
  285. .money-bt-line {
  286. border: 1px solid $border-color-base;
  287. height: 100rpx;
  288. }
  289. }
  290. .content-money {
  291. position: relative;
  292. height: 350rpx;
  293. .content-bg {
  294. position: absolute;
  295. top: 0;
  296. left: 0;
  297. right: 0;
  298. width: 750rpx;
  299. height: 350rpx;
  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-family: PingFang SC;
  317. font-weight: bold;
  318. color: #fffeff;
  319. height: 80rpx;
  320. font-size: 36rpx;
  321. font-weight: 700;
  322. z-index: 9;
  323. display: flex;
  324. justify-content: center;
  325. align-items: center;
  326. }
  327. .goback-box {
  328. position: absolute;
  329. left: 18rpx;
  330. top: 0;
  331. height: 80rpx;
  332. display: flex;
  333. align-items: center;
  334. }
  335. .goback {
  336. z-index: 100;
  337. width: 34rpx;
  338. height: 34rpx;
  339. }
  340. }
  341. }
  342. .info-box {
  343. width: 670rpx;
  344. height: 186rpx;
  345. background: #ffffff;
  346. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  347. border-radius: 20rpx;
  348. margin: -100rpx auto 0;
  349. position: relative;
  350. z-index: 2;
  351. .info-item {
  352. width: 50%;
  353. display: flex;
  354. flex-direction: column;
  355. align-items: center;
  356. line-height: 1;
  357. .info-font {
  358. font-size: 30rpx;
  359. font-weight: bold;
  360. color: #999999;
  361. }
  362. .info-num {
  363. margin-top: 30rpx;
  364. font-size: 30rpx;
  365. font-family: PingFang SC;
  366. font-weight: bold;
  367. color: #181818;
  368. }
  369. }
  370. .shu {
  371. width: 2rpx;
  372. height: 74rpx;
  373. background: #dcdfe6;
  374. }
  375. }
  376. .money-box {
  377. position: relative;
  378. z-index: 2;
  379. padding-top: 90rpx;
  380. color: #ffffff;
  381. text-align: center;
  382. .money {
  383. font-size: 72rpx;
  384. font-family: PingFang SC;
  385. font-weight: bold;
  386. color: #ffffff;
  387. }
  388. .text {
  389. font-size: 30rpx;
  390. }
  391. }
  392. .navbar {
  393. margin-top: 20rpx;
  394. display: flex;
  395. height: 88rpx;
  396. padding: 0 5px;
  397. background: #fff;
  398. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  399. position: relative;
  400. z-index: 10;
  401. .nav-item {
  402. flex: 1;
  403. display: flex;
  404. justify-content: center;
  405. align-items: center;
  406. height: 100%;
  407. font-size: 15px;
  408. color: #999999;
  409. position: relative;
  410. &.current {
  411. color: #000;
  412. &:after {
  413. content: '';
  414. position: absolute;
  415. left: 50%;
  416. bottom: 0;
  417. transform: translateX(-50%);
  418. width: 44px;
  419. height: 0;
  420. border-bottom: 2px solid #fe5b38;
  421. }
  422. }
  423. }
  424. }
  425. //列表
  426. .swiper-box {
  427. .order-item:last-child {
  428. margin-bottom: 60rpx;
  429. }
  430. .order-item {
  431. padding: 20rpx 30rpx;
  432. line-height: 1.5;
  433. .title-box {
  434. .title {
  435. font-size: $font-lg;
  436. color: $font-color-base;
  437. }
  438. .time {
  439. font-size: $font-base;
  440. color: $font-color-light;
  441. }
  442. }
  443. .money {
  444. color: #fd5b23;
  445. font-size: $font-lg;
  446. text-align: right;
  447. .status {
  448. color: $font-color-light;
  449. }
  450. }
  451. }
  452. }
  453. .list-scroll-content {
  454. background: #ffffff;
  455. height: 100%;
  456. }
  457. .content {
  458. height: 100%;
  459. .empty-content {
  460. background-color: #ffffff;
  461. }
  462. }
  463. .btn-box {
  464. width: 674rpx;
  465. height: 88rpx;
  466. background: linear-gradient(0deg, #2e58ff, #32c6ff);
  467. border-radius: 44rpx;
  468. font-size: 36rpx;
  469. font-family: PingFang SC;
  470. font-weight: 500;
  471. color: #ffffff;
  472. text-align: center;
  473. line-height: 88rpx;
  474. position: fixed;
  475. bottom: 48rpx;
  476. left: 0;
  477. right: 0;
  478. margin: 0 auto;
  479. }
  480. </style>