jinDou.vue 8.9 KB

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