myAppointment.vue 9.0 KB

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