qudou.vue 8.5 KB

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