wallet.vue 9.3 KB

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