wallet.vue 8.7 KB

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