myMealCard.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <view>
  3. <u-navbar title="我的饭卡"></u-navbar>
  4. <view class="background">
  5. <view class="head">
  6. <view class="balance">
  7. 饭卡余额(元)
  8. </view>
  9. <view class="time">
  10. <!-- <text class="icon"><img src="../../assets/img/riLine-information-line@1x.png" alt=""></text>
  11. <text>下次清零 2023月6月1日 0点</text> -->
  12. </view>
  13. </view>
  14. <view class="main">
  15. <view class="number">
  16. {{balance}}
  17. </view>
  18. <view class="img">
  19. <img src="../../assets/img/ze-card@1x.png" alt="">
  20. </view>
  21. </view>
  22. </view>
  23. <view class="content">
  24. <view class="tabs">
  25. <u-tabs bar-width="100" inactive-color="#bbbbbb" active-color="#101010" :list="list" :is-scroll="false"
  26. :current="current" @change="change"></u-tabs>
  27. </view>
  28. <!-- 消费 -->
  29. <view class="consumption" v-if="this.current==0">
  30. <view class="total">
  31. {{month}}月消费{{payAmountTotal}}元
  32. </view>
  33. <view class="each" v-for="(item,index) in payAmountList" :key="index">
  34. <view class="place-date">
  35. <view class="place">
  36. {{item.deviceName}}
  37. </view>
  38. <view class="date">
  39. {{item.payTime}}
  40. </view>
  41. </view>
  42. <view class="number">
  43. -{{item.payAmount}}
  44. </view>
  45. </view>
  46. </view>
  47. <!-- 餐费存入 -->
  48. <view class="deposit" v-if="this.current==1">
  49. <view class="each" v-for="(item,index) in rechargeRecordList" :key="index">
  50. <view class="place-date">
  51. <view class="place">
  52. {{item.chargeTime.slice(0,4)}}年{{parseInt(item.chargeTime.slice(5,7))}}月餐费存入
  53. </view>
  54. <view class="date">
  55. {{item.chargeTime}}
  56. </view>
  57. </view>
  58. <view class="number">
  59. +{{item.rechargeAmount}}
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <!-- <u-divider bg-color="#F2F4F4" border-color="#CFD2D5">已经到底了</u-divider> -->
  65. </view>
  66. </template>
  67. <script>
  68. import * as mineAPI from '@/apis/pagejs/mine.js'
  69. export default {
  70. data() {
  71. return {
  72. list: [{
  73. name: '余额消费'
  74. }, {
  75. name: '餐费存入'
  76. }],
  77. current: 0,
  78. balance: 0,
  79. payAmountList: [],
  80. payAmountTotal: 0,
  81. rechargeRecordList: [],
  82. month: ''
  83. }
  84. },
  85. onReady() {
  86. var date = new Date();
  87. this.month = date.getMonth() + 1;
  88. this.getCardPayAmountList();
  89. },
  90. methods: {
  91. getCardPayAmountList() {
  92. uni.showLoading({
  93. title: "加载中",
  94. mask: true,
  95. })
  96. mineAPI.cardPayAmountList().then((response) => {
  97. uni.hideLoading();
  98. this.balance = response.data.balance;
  99. this.payAmountList = response.data.payAmountList;
  100. this.payAmountTotal = response.data.payAmountTotal;
  101. this.rechargeRecordList = response.data.rechargeRecordList;
  102. }).catch(error => {
  103. uni.showToast({
  104. title: error,
  105. icon: "none"
  106. })
  107. })
  108. },
  109. change(index) {
  110. this.current = index;
  111. }
  112. }
  113. }
  114. </script>
  115. <style scoped lang="scss">
  116. page {
  117. padding-bottom: 100px;
  118. }
  119. .background {
  120. background: linear-gradient(-0.06deg, rgba(246, 248, 248, 1) -0.15%, rgba(240, 225, 198, 1) 48.47%, rgba(236, 193, 148, 1) 101.15%);
  121. padding: 32rpx;
  122. color: #fff;
  123. height: 231px;
  124. .head {
  125. display: flex;
  126. justify-content: space-between;
  127. align-items: center;
  128. .balance {
  129. color: rgba(51, 51, 51, 1);
  130. font-family: 'Regular';
  131. }
  132. .time {
  133. opacity: 0.7;
  134. color: rgba(49, 54, 66, 1);
  135. font-size: 24rpx;
  136. font-family: 'PingFang Regular';
  137. .icon {
  138. vertical-align: middle;
  139. margin-right: 4rpx;
  140. }
  141. }
  142. }
  143. .main {
  144. display: flex;
  145. justify-content: space-between;
  146. .number {
  147. color: rgba(16, 16, 16, 1);
  148. font-size: 80rpx;
  149. font-weight: bold;
  150. }
  151. .img {
  152. margin-top: -20rpx
  153. }
  154. }
  155. }
  156. .content {
  157. margin: -260rpx 32rpx 24rpx;
  158. background-color: #fff;
  159. border-radius: 8px 8px 0px 0px;
  160. overflow: hidden;
  161. min-height: 800rpx;
  162. /deep/.u-tab-bar {
  163. background-color: #0076FF !important;
  164. }
  165. // 消费
  166. .consumption,
  167. .deposit {
  168. padding: 0 36rpx;
  169. .total {
  170. line-height: 88rpx;
  171. color: rgba(16, 16, 16, 1);
  172. font-size: 36rpx;
  173. border-top: 1px solid #E6E6E6;
  174. font-family: 'Alibaba-PuHuiTi-Regular';
  175. }
  176. .each {
  177. display: flex;
  178. justify-content: space-between;
  179. align-items: center;
  180. padding: 28rpx 0;
  181. border-top: 1px solid #E6E6E6;
  182. .place-date {
  183. .place {
  184. color: #101010;
  185. font-size: 32rpx;
  186. font-weight: bold;
  187. font-family: 'Alibaba-PuHuiTi-Regular';
  188. }
  189. .date {
  190. color: rgba(119, 119, 119, 1);
  191. margin-top: 16rpx;
  192. }
  193. }
  194. .number {
  195. color: rgba(31, 74, 153, 1);
  196. font-size: 48rpx;
  197. font-weight: bold;
  198. }
  199. }
  200. }
  201. }
  202. </style>