qudou.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  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/withdrawal')">
  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: 0,
  101. text: '收入',
  102. loadingType: 'more',
  103. orderList: [],
  104. page: 1, //当前页数
  105. limit: 1000, //每次信息条数
  106. loaded: false
  107. },
  108. {
  109. state: 1,
  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. })
  158. .then(({ data }) => {
  159. // obj.recharge = data.income;
  160. // obj.orderStatusSum = data.expend;
  161. if(state == 0 ){
  162. navItem.orderList = data.zj
  163. }
  164. if(state == 1 ){
  165. navItem.orderList = data.kc
  166. }
  167. })
  168. .catch(e => {
  169. console.log(e);
  170. });
  171. },
  172. //swiper 切换
  173. changeTab(e) {
  174. this.tabCurrentIndex = e.target.current;
  175. this.loadData('tabChange');
  176. },
  177. //顶部tab点击
  178. tabClick(index) {
  179. this.tabCurrentIndex = index;
  180. }
  181. }
  182. };
  183. </script>
  184. <style lang="scss">
  185. page {
  186. background: #f1f1f1;
  187. height: 100%;
  188. }
  189. .status_bar {
  190. height: var(--status-bar-height);
  191. width: 100%;
  192. }
  193. .content-money {
  194. position: relative;
  195. height: 480rpx;
  196. .content-bg {
  197. position: absolute;
  198. top: 0;
  199. left: 0;
  200. right: 0;
  201. width: 750rpx;
  202. height: 480rpx;
  203. image {
  204. width: 100%;
  205. height: 100%;
  206. }
  207. }
  208. .body-title {
  209. height: 80rpx;
  210. text-align: center;
  211. font-size: 35rpx;
  212. position: relative;
  213. .header {
  214. position: absolute;
  215. left: 0;
  216. top: 0;
  217. width: 100%;
  218. font-size: 36rpx;
  219. font-family: PingFang SC;
  220. font-weight: bold;
  221. color: #fffeff;
  222. height: 80rpx;
  223. font-size: 36rpx;
  224. font-weight: 700;
  225. z-index: 9;
  226. display: flex;
  227. justify-content: center;
  228. align-items: center;
  229. }
  230. .goback-box {
  231. position: absolute;
  232. left: 18rpx;
  233. top: 0;
  234. height: 80rpx;
  235. display: flex;
  236. align-items: center;
  237. }
  238. .goback {
  239. z-index: 100;
  240. width: 34rpx;
  241. height: 34rpx;
  242. }
  243. }
  244. }
  245. .info-box {
  246. width: 670rpx;
  247. height: 186rpx;
  248. background: #ffffff;
  249. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  250. border-radius: 20rpx;
  251. margin: -100rpx auto 0;
  252. position: relative;
  253. z-index: 2;
  254. .info-item {
  255. width: 50%;
  256. display: flex;
  257. flex-direction: column;
  258. align-items: center;
  259. line-height: 1;
  260. .info-font {
  261. font-size: 30rpx;
  262. font-weight: bold;
  263. color: #999999;
  264. }
  265. .info-num {
  266. margin-top: 30rpx;
  267. font-size: 30rpx;
  268. font-family: PingFang SC;
  269. font-weight: bold;
  270. color: #181818;
  271. }
  272. }
  273. .shu {
  274. width: 2rpx;
  275. height: 74rpx;
  276. background: #dcdfe6;
  277. }
  278. }
  279. .money-box {
  280. position: relative;
  281. z-index: 2;
  282. padding-top: 90rpx;
  283. color: #ffffff;
  284. text-align: center;
  285. .money {
  286. font-size: 72rpx;
  287. font-family: PingFang SC;
  288. font-weight: bold;
  289. color: #ffffff;
  290. }
  291. .text {
  292. font-size: 30rpx;
  293. }
  294. }
  295. .money-btn {
  296. position: relative;
  297. z-index: 2;
  298. color: #ffffff;
  299. padding-right: 50rpx;
  300. text-align: right;
  301. font-size: 30rpx;
  302. font-family: PingFang SC;
  303. font-weight: bold;
  304. color: #ffffff;
  305. text {
  306. display: inline-block;
  307. padding-left: 10rpx;
  308. }
  309. }
  310. .navbar {
  311. margin-top: 20rpx;
  312. display: flex;
  313. height: 88rpx;
  314. padding: 0 5px;
  315. background: #fff;
  316. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  317. position: relative;
  318. z-index: 10;
  319. .nav-item {
  320. flex: 1;
  321. display: flex;
  322. justify-content: center;
  323. align-items: center;
  324. height: 100%;
  325. font-size: 15px;
  326. color: #999999;
  327. position: relative;
  328. &.current {
  329. color: #000;
  330. &:after {
  331. content: '';
  332. position: absolute;
  333. left: 50%;
  334. bottom: 0;
  335. transform: translateX(-50%);
  336. width: 44px;
  337. height: 0;
  338. border-bottom: 2px solid #fe5b38;
  339. }
  340. }
  341. }
  342. }
  343. //列表
  344. .swiper-box {
  345. .order-item:last-child {
  346. margin-bottom: 60rpx;
  347. }
  348. .order-item {
  349. padding: 20rpx 30rpx;
  350. line-height: 1.5;
  351. .title-box {
  352. .title {
  353. font-size: $font-lg;
  354. color: $font-color-base;
  355. }
  356. .time {
  357. font-size: $font-base;
  358. color: $font-color-light;
  359. }
  360. }
  361. .money {
  362. color: #fd5b23;
  363. font-size: $font-lg;
  364. text-align: right;
  365. .status {
  366. color: $font-color-light;
  367. }
  368. }
  369. }
  370. }
  371. .list-scroll-content {
  372. background: #ffffff;
  373. height: 100%;
  374. }
  375. .content {
  376. height: 100%;
  377. .empty-content {
  378. background-color: #ffffff;
  379. }
  380. }
  381. .btn-box {
  382. width: 674rpx;
  383. height: 88rpx;
  384. background: linear-gradient(0deg, #2e58ff, #32c6ff);
  385. border-radius: 44rpx;
  386. font-size: 36rpx;
  387. font-family: PingFang SC;
  388. font-weight: 500;
  389. color: #ffffff;
  390. text-align: center;
  391. line-height: 88rpx;
  392. position: fixed;
  393. bottom: 48rpx;
  394. left: 0;
  395. right: 0;
  396. margin: 0 auto;
  397. }
  398. </style>