check.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <template>
  2. <view class="container">
  3. <!-- 筛选区域 -->
  4. <picker @change="bindPickerChange" :value="currentIndex" :range="array" range-key="text">
  5. <view class="search">
  6. <view>
  7. {{ array[currentIndex].text }}
  8. </view>
  9. </view>
  10. </picker>
  11. <!-- 列表区域 -->
  12. <view class="list">
  13. <!-- 每一个资料区域 -->
  14. <view class="list_item" v-for="item in dataList" :key="item.id">
  15. <!-- 标题区域 -->
  16. <view class="item_title">
  17. <view class="title_text">入学登记</view>
  18. {{ item.createTime }}
  19. </view>
  20. <!-- 信息区域 -->
  21. <view class="item_body">
  22. <view class="type check" v-if="item.status == 0">待审批</view>
  23. <view class="type pass" v-if="item.status == 1">已通过</view>
  24. <view class="type reject" v-if="item.status == 2">已拒绝</view>
  25. <view class="box">孩子姓名:{{ item.name }}</view>
  26. <view class="box">性别:{{ item.sexId == 1 ? '男' : '女' }}</view>
  27. <view class="box">
  28. 照片:
  29. <image v-if="!item.headImage" class="box_img" src="/static/images/header.png" mode="aspectFill"></image>
  30. <image v-else class="box_img" :src="item.headImage" mode="aspectFill"></image>
  31. </view>
  32. <view class="box">年级:{{ item.gradeName }}</view>
  33. <view class="box">班级:{{ item.schoolClassName }}</view>
  34. <!-- 家属数组区域 -->
  35. <view v-for="(ele, index) in item.list" :key="index">
  36. <view class="box">家属:{{ ele.name }}</view>
  37. <view class="box">手机号码:{{ ele.phone }}</view>
  38. <view class="box">家属与本人的关系:{{ ele.ship }}</view>
  39. </view>
  40. <view class="btns" v-if="item.status == 0">
  41. <view class="btn reject" @click="clickBtn(item.id, 2)">拒绝</view>
  42. <view class="btn agree" @click="clickBtn(item.id, 1)">同意</view>
  43. </view>
  44. </view>
  45. </view>
  46. <NoData v-if="!dataList.length" />
  47. </view>
  48. </view>
  49. </template>
  50. <script setup>
  51. import { onLoad, onReachBottom } from '@dcloudio/uni-app'
  52. import { ref } from 'vue'
  53. import { myRequest } from '@/utils/api.js'
  54. import { decryptDes } from '@/utils/des.js'
  55. import NoData from '@/components/noData.vue'
  56. // 当前激活索引
  57. const currentIndex = ref(0)
  58. // 状态数组
  59. const array = ref([
  60. {
  61. text: '全部',
  62. value: ''
  63. },
  64. {
  65. text: '待审批',
  66. value: 0
  67. },
  68. {
  69. text: '已通过',
  70. value: 1
  71. },
  72. {
  73. text: '已拒绝',
  74. value: 2
  75. }
  76. ])
  77. // 当前页
  78. const currentPage = ref(1)
  79. // 总条数
  80. const total = ref(0)
  81. // 资料审批数组
  82. const dataList = ref([])
  83. onLoad(() => {
  84. // 获取资料审批数组
  85. getData()
  86. })
  87. // 页面下拉刷新回调
  88. onReachBottom(() => {
  89. if (total.value > dataList.value.length) {
  90. currentPage.value++
  91. getData()
  92. } else {
  93. uni.showToast({
  94. title: '没有更多数据了~',
  95. icon: 'none'
  96. })
  97. }
  98. })
  99. // 获取资料审批数组
  100. const getData = async () => {
  101. const res = await myRequest({
  102. url: '/wanzai/api/smartEnrollmentUser/list',
  103. data: {
  104. currentPage: currentPage.value,
  105. pageCount: 4,
  106. status: array.value[currentIndex.value].value
  107. }
  108. })
  109. // console.log(res)
  110. const result = JSON.parse(decryptDes(res.data))
  111. // console.log(result)
  112. dataList.value = [...dataList.value, ...result.list]
  113. total.value = result.totalCount
  114. }
  115. // 切换状态时的回调
  116. const bindPickerChange = (e) => {
  117. // console.log(e.detail.value)
  118. if (e.detail.value != currentIndex.value) {
  119. currentIndex.value = e.detail.value
  120. currentPage.value = 1
  121. dataList.value = []
  122. getData()
  123. }
  124. }
  125. // 点击同意拒绝按钮回调
  126. const clickBtn = (id, type) => {
  127. uni.showModal({
  128. title: '提示',
  129. content: `确定${type == 1 ? '同意' : '拒绝'}该审批吗?`,
  130. success: (res) => {
  131. if (res.confirm) {
  132. clickBtnReq(id, type)
  133. }
  134. }
  135. })
  136. }
  137. // 审批请求
  138. const clickBtnReq = async (id, type) => {
  139. const res = await myRequest({
  140. url: '/wanzai/api/smartEnrollmentUser/examine',
  141. method: 'post',
  142. data: {
  143. id: id,
  144. status: type
  145. }
  146. })
  147. // console.log(res)
  148. if (res.code == 200) {
  149. uni.showToast({
  150. title: res.message,
  151. icon: 'success'
  152. })
  153. setTimeout(() => {
  154. currentPage.value = 1
  155. dataList.value = []
  156. getData()
  157. }, 1500)
  158. }
  159. }
  160. </script>
  161. <style lang="scss" scoped>
  162. .container {
  163. box-sizing: border-box;
  164. padding: 30rpx 20rpx;
  165. height: 100vh;
  166. overflow-y: auto;
  167. background: linear-gradient(180deg, #f2f7ff 0%, #f2f7ff 100%);
  168. .search {
  169. display: flex;
  170. align-items: center;
  171. justify-content: space-between;
  172. box-sizing: border-box;
  173. padding: 0 30rpx;
  174. width: 284rpx;
  175. height: 80rpx;
  176. font-size: 28rpx;
  177. border-radius: 55rpx;
  178. background-color: #fff;
  179. }
  180. .list {
  181. margin-top: 30rpx;
  182. .list_item {
  183. margin-bottom: 30rpx;
  184. border-radius: 8rpx;
  185. background-color: #fff;
  186. .item_title {
  187. display: flex;
  188. align-items: center;
  189. justify-content: space-between;
  190. padding: 0 30rpx;
  191. height: 90rpx;
  192. color: #808080;
  193. font-size: 24rpx;
  194. border-bottom: 2rpx solid #e6e6e6;
  195. .title_text {
  196. font-size: 28rpx;
  197. font-weight: bold;
  198. color: #000;
  199. }
  200. }
  201. .item_body {
  202. position: relative;
  203. padding: 25rpx 30rpx;
  204. .type {
  205. position: absolute;
  206. top: 16rpx;
  207. right: 30rpx;
  208. font-size: 28rpx;
  209. }
  210. .check {
  211. color: #ff8d1a;
  212. }
  213. .pass {
  214. color: #0061ff;
  215. }
  216. .reject {
  217. color: #d43030;
  218. }
  219. .box {
  220. display: flex;
  221. margin-bottom: 20rpx;
  222. font-size: 28rpx;
  223. color: #383838;
  224. .box_img {
  225. width: 116rpx;
  226. height: 155rpx;
  227. border-radius: 4rpx;
  228. }
  229. }
  230. .btns {
  231. display: flex;
  232. align-items: center;
  233. justify-content: flex-end;
  234. .btn {
  235. display: flex;
  236. justify-content: center;
  237. align-items: center;
  238. margin-left: 28rpx;
  239. width: 146rpx;
  240. height: 80rpx;
  241. font-size: 28rpx;
  242. color: #fff;
  243. border-radius: 10rpx;
  244. }
  245. .reject {
  246. background-color: #d43030;
  247. }
  248. .agree {
  249. background-color: #0061ff;
  250. }
  251. }
  252. }
  253. }
  254. }
  255. }
  256. </style>