myAppointment.vue 8.7 KB

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