You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

193 lines
4.4 KiB

4 weeks ago
  1. <template>
  2. <view class="payment-container">
  3. <view class="top-bar">
  4. <view class="title">缴费记录</view>
  5. </view>
  6. <view class="filter-bar">
  7. <view class="filter-item" :class="{ active: filterType === 'all' }" @click="filterType = 'all'">
  8. 全部
  9. </view>
  10. <view class="filter-item" :class="{ active: filterType === 'pass' }" @click="filterType = 'pass'">
  11. 已缴费
  12. </view>
  13. <view class="filter-item" :class="{ active: filterType === 'pending' }" @click="filterType = 'pending'">
  14. 待缴费
  15. </view>
  16. </view>
  17. <view class="list-container">
  18. <view class="payment-item" v-for="(item, index) in res" :key="index">
  19. <view class="item-header">
  20. <view class="payment-type">
  21. <text>{{ item.room }}</text>
  22. </view>
  23. <view class="payment-status" :class="{ pass: item.pay_status === '0', pending: item.pay_status === '1' }">
  24. {{ item.pay_status === '0' ? '已缴费' : '待缴费' }}
  25. </view>
  26. </view>
  27. <view class="item-body">
  28. <view class="list">
  29. <view class="detail-label">金额</view>
  30. <view>¥{{ item.pay_amount }}</view>
  31. </view>
  32. <view class="list">
  33. <view class="detail-label">缴费日期</view>
  34. <view>{{ item.pay_date }}</view>
  35. </view>
  36. <view class="list">
  37. <view class="detail-label">缴费人</view>
  38. <view>{{ item.username }}</view>
  39. </view>
  40. <view class="list" v-if="item.remark">
  41. <view class="detail-label">备注</view>
  42. <view>{{ item.remark }}</view>
  43. </view>
  44. </view>
  45. </view>
  46. <view v-if="res.length === 0">
  47. <text>暂无缴费记录</text>
  48. </view>
  49. </view>
  50. </view>
  51. </template>
  52. <script setup>
  53. import { ref, computed, onMounted } from 'vue'
  54. import { onShow } from '@dcloudio/uni-app'
  55. const filterType = ref('all')
  56. const payments = ref([
  57. { id: 1, username:'李慧琳', room:'706', pay_amount: 75, pay_date: '2025-07-31', pay_status: '0', remark: '7月宿舍费' },
  58. { id: 2, username:'李慧琳', room:'706', pay_amount: 75, pay_date: '2025-06-30', pay_status: '0', remark: '6月宿舍费' },
  59. { id: 3, username:'李慧琳', room:'706', pay_amount: 75, pay_date: '2025-05-28', pay_status: '0', remark: '5月宿舍费' },
  60. { id: 4, username:'李慧琳', room:'706', pay_amount: 80, pay_date: '2025-08-31', pay_status: '1', remark: '8月宿舍费' }
  61. ])
  62. const res = computed(() => {
  63. switch (filterType.value) {
  64. case 'pass':
  65. return payments.value.filter(item => item.pay_status === '0')
  66. case 'pending':
  67. return payments.value.filter(item => item.pay_status === '1')
  68. default:
  69. return payments.value
  70. }
  71. })
  72. onShow(() => {
  73. const isLogin = uni.getStorageSync('isLogin')
  74. console.log(isLogin)
  75. if (!isLogin) {
  76. uni.redirectTo({
  77. url: '/pages/login/login'
  78. })
  79. }
  80. })
  81. </script>
  82. <style scoped>
  83. .payment-container {
  84. background-color: #f5f5f5;
  85. min-height: 100vh;
  86. }
  87. .top-bar {
  88. display: flex;
  89. align-items: center;
  90. padding: 30rpx 20rpx;
  91. background-color: #fff;
  92. border-bottom: 1px solid #eee;
  93. }
  94. .title {
  95. flex: 1;
  96. text-align: center;
  97. font-size: 34rpx;
  98. font-weight: bold;
  99. }
  100. .filter-bar {
  101. display: flex;
  102. background-color: #fff;
  103. padding: 15rpx 20rpx;
  104. border-bottom: 1px solid #eee;
  105. }
  106. .filter-item {
  107. flex: 1;
  108. text-align: center;
  109. padding: 15rpx 0;
  110. font-size: 28rpx;
  111. border-radius: 30rpx;
  112. }
  113. .filter-item.active {
  114. background-color: #e6f7ff;
  115. color: #36bffa;
  116. }
  117. .list-container {
  118. padding: 20rpx;
  119. }
  120. .payment-item {
  121. background-color: #fff;
  122. border-radius: 16rpx;
  123. padding: 25rpx;
  124. margin-bottom: 20rpx;
  125. box-shadow: 0 5rpx 15rpx rgba(0, 0, 0, 0.05);
  126. }
  127. .item-header {
  128. display: flex;
  129. justify-content: space-between;
  130. align-items: center;
  131. margin-bottom: 10rpx;
  132. padding-bottom: 20rpx;
  133. border-bottom: 1px solid #f5f5f5;
  134. }
  135. .payment-type text {
  136. font-size: 30rpx;
  137. font-weight: bold;
  138. }
  139. .payment-status {
  140. padding: 5rpx 20rpx;
  141. border-radius: 20rpx;
  142. font-size: 30rpx;
  143. }
  144. .payment-status.pass {
  145. background-color: #e6fffb;
  146. color: #00b42a;
  147. }
  148. .payment-status.pending {
  149. background-color: #fff2e8;
  150. color: #ff7d00;
  151. }
  152. .item-body {
  153. display: flex;
  154. flex-direction: column;
  155. }
  156. .list {
  157. display: flex;
  158. justify-content: space-between;
  159. padding: 15rpx 0;
  160. font-size: 28rpx;
  161. }
  162. .detail-label {
  163. color: #666;
  164. }
  165. </style>