sickNote.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <view>
  3. <u-navbar title="请假"></u-navbar>
  4. <view class="main">
  5. <view class="sick-note" v-for="(item,index) in leaveList" :key="index">
  6. <view class="head">
  7. <view class="name">
  8. {{item.studentName}}的请假条
  9. </view>
  10. <view class="state1" v-if="item.status == 0">
  11. 待处理
  12. </view>
  13. <view class="state2" v-if="item.status == 1">
  14. 已审核
  15. </view>
  16. <view class="state3" v-if="item.status == -1">
  17. 已取消
  18. </view>
  19. </view>
  20. <view class="infos">
  21. <view class="class">
  22. {{item.className}}
  23. </view>
  24. <view class="date">
  25. {{item.createTime.slice(0,10)}}
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="bottom">
  31. <button @click="toLeave">请假</button>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import * as sickNoteApi from '@/apis/parents/sickNote.js'
  37. export default {
  38. data() {
  39. return {
  40. leaveList: [],
  41. pageNum: 1,
  42. pageSize: 10,
  43. recordsTotal: 0,
  44. years: '',
  45. studentId: ''
  46. }
  47. },
  48. onReady() {
  49. if (this.carhelp.getStudentId()) {
  50. this.studentId = this.carhelp.getStudentId().studentId;
  51. this.getLeaveList();
  52. }
  53. },
  54. onReachBottom() {
  55. if (this.leaveList.length < this.recordsTotal) {
  56. this.myLoadmore();
  57. }
  58. },
  59. methods: {
  60. toLeave() {
  61. uni.navigateTo({
  62. url: '/pages/parents/sickNote/leave'
  63. })
  64. },
  65. myLoadmore() {
  66. this.pageNum += 1;
  67. this.getLeaveList()
  68. },
  69. getLeaveList(bl) {
  70. uni.showLoading({
  71. title: "加载中",
  72. mask: true,
  73. })
  74. if (bl) {
  75. this.leaveList = [];
  76. this.pageNum = 1;
  77. }
  78. sickNoteApi.loadStudentLeaveLog({
  79. studentId: this.studentId,
  80. yyyyMM: this.years,
  81. pageNum: this.pageNum,
  82. pageSize: this.pageSize
  83. }).then((res) => {
  84. uni.hideLoading();
  85. this.leaveList = [
  86. ...this.leaveList,
  87. ...res.data.data
  88. ];
  89. this.recordsTotal = res.data.recordsTotal;
  90. }).catch(error => {
  91. uni.showToast({
  92. title: error,
  93. icon: "none"
  94. })
  95. })
  96. }
  97. }
  98. }
  99. </script>
  100. <style lang="scss" scoped>
  101. .main {
  102. padding: 12px;
  103. .sick-note {
  104. padding: 16px 12px;
  105. border-radius: 12px;
  106. background-color: #fff;
  107. margin-bottom: 12px;
  108. .head {
  109. display: flex;
  110. justify-content: space-between;
  111. align-items: center;
  112. .name {
  113. color: rgba(51, 51, 51, 1);
  114. font-size: 16px;
  115. }
  116. .state1 {
  117. line-height: 24px;
  118. border-radius: 50px;
  119. background-color: rgba(255, 255, 255, 1);
  120. color: rgba(22, 119, 255, 1);
  121. font-size: 12px;
  122. text-align: center;
  123. border: 1px solid 1px solid rgba(22, 119, 255, 1);
  124. padding: 0 16rpx;
  125. }
  126. .state2 {
  127. line-height: 24px;
  128. border-radius: 50px;
  129. background-color: rgba(255, 255, 255, 1);
  130. color: rgba(0, 187, 170, 1);
  131. font-size: 12px;
  132. text-align: center;
  133. border: 1px solid rgba(0, 187, 170, 1);
  134. padding: 0 16rpx;
  135. }
  136. .state3 {
  137. line-height: 24px;
  138. border-radius: 50px;
  139. background-color: rgba(255, 255, 255, 1);
  140. color: rgba(153, 153, 153, 1);
  141. font-size: 12px;
  142. text-align: center;
  143. border: 1px solid 1px solid rgba(153, 153, 153, 1);
  144. padding: 0 16rpx;
  145. }
  146. .checked {
  147. border: 1px solid rgba(204, 204, 204, 1);
  148. color: rgba(119, 119, 119, 1);
  149. }
  150. }
  151. .infos {
  152. display: flex;
  153. justify-content: space-between;
  154. align-items: center;
  155. margin-top: 8px;
  156. .class {
  157. color: rgba(51, 51, 51, 1);
  158. }
  159. .date {
  160. color: rgba(119, 119, 119, 1);
  161. }
  162. }
  163. }
  164. }
  165. .bottom {
  166. padding: 10px 16px;
  167. background-color: #fff;
  168. position: fixed;
  169. left: 0;
  170. right: 0;
  171. bottom: 0;
  172. button {
  173. border-radius: 50px;
  174. background-color: rgba(13, 186, 199, 1);
  175. color: rgba(255, 255, 255, 1);
  176. font-size: 16px;
  177. line-height: 40px;
  178. }
  179. }
  180. </style>