check.vue 6.1 KB

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