backlog.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  1. <template>
  2. <view class="container">
  3. <!-- 分段器区域 -->
  4. <uni-segmented-control :current="activeCurrent" :values="controlList" @clickItem="onClickItem" styleType="text" activeColor="#0061FF"></uni-segmented-control>
  5. <!-- 到访待办记录区域 -->
  6. <view class="body">
  7. <!-- 每一条到访待办记录区域 -->
  8. <view class="body_box" v-for="item in list" :key="item.id" @click="handleClick(item)">
  9. <view class="box_title">
  10. <view class="title_msg">
  11. <view class="msg_name">{{ item.userName }}</view>
  12. <view class="msg_time">/{{ item.createTime }}</view>
  13. </view>
  14. <view class="title_type" v-if="item.statuStr == '待审核'">{{ item.statuStr }}</view>
  15. <view class="title_type red" v-if="item.statuStr == '已拒绝'">{{ item.statuStr }}</view>
  16. <view class="title_type green" v-if="item.statuStr == '已推送'">{{ item.statuStr }}</view>
  17. </view>
  18. <view class="box_info">
  19. <view class="info_box">
  20. <view class="box_key">类别</view>
  21. <view class="box_value">{{ item.visitorType === 1 ? '学生家长预约' : '其他访客预约' }}</view>
  22. </view>
  23. <view class="info_box">
  24. <view class="box_key">来访时间</view>
  25. <view class="box_value">{{ item.visitorTime }}</view>
  26. </view>
  27. <view class="info_box">
  28. <view class="box_key">访问事由</view>
  29. <view class="box_value">{{ item.visitReason }}</view>
  30. </view>
  31. <view class="info_box">
  32. <view class="box_key">{{ item.visitorType === 1 ? '受访学生' : '受访人' }}</view>
  33. <view class="box_value">{{ item.respondentName }}</view>
  34. </view>
  35. </view>
  36. <view class="box_btn" v-if="item.statuStr == '待审核'">
  37. <view class="button reject" @click.stop="handleReject(item)">拒绝</view>
  38. <view class="button agree" @click.stop="handleAgree(item)">同意</view>
  39. </view>
  40. </view>
  41. </view>
  42. <!-- 悬浮设置按钮区域 -->
  43. <view class="set" @click="handleClickSet" v-if="showSet">
  44. <uni-icons type="gear-filled" size="18"></uni-icons>
  45. &nbsp;设置
  46. </view>
  47. <!-- 没有数据时展示的页面 -->
  48. <NoData v-if="!list.length" />
  49. <!-- 详情弹窗区域 -->
  50. <uni-popup ref="popup" type="center" :is-mask-click="false">
  51. <view class="popup_box">
  52. <!-- 弹窗标题区域 -->
  53. <view class="pop_header">
  54. 预约详情
  55. <view class="header_icon" @click="closePop">×</view>
  56. </view>
  57. <!-- 弹窗详细信息区域 -->
  58. <view class="pop_info">
  59. <view class="info_key">状态:</view>
  60. <view class="info_value blue" v-if="popObj.statuStr == '待审核'">{{ popObj.statuStr }}</view>
  61. <view class="info_value red" v-if="popObj.statuStr == '已拒绝'">{{ popObj.statuStr }}</view>
  62. <view class="info_value green" v-if="popObj.statuStr == '已推送'">{{ popObj.statuStr }}</view>
  63. </view>
  64. <view class="pop_info">
  65. <view class="info_key">类别:</view>
  66. <view class="info_value">{{ popObj.visitorType === 1 ? '学生家长预约' : '其他访客预约' }}</view>
  67. </view>
  68. <view class="pop_info">
  69. <view class="info_key">访客姓名:</view>
  70. <view class="info_value">{{ popObj.userName }}</view>
  71. </view>
  72. <view class="pop_info">
  73. <view class="info_key">访客手机号:</view>
  74. <view class="info_value">{{ popObj.userPhone }}</view>
  75. </view>
  76. <view class="pop_info">
  77. <view class="info_key">来访时间:</view>
  78. <view class="info_value">{{ popObj.visitorTime }}</view>
  79. </view>
  80. <view class="pop_info">
  81. <view class="info_key">证件号:</view>
  82. <view class="info_value">{{ popObj.userNumber }}</view>
  83. </view>
  84. <view class="pop_info">
  85. <view class="info_key">访问事由:</view>
  86. <view class="info_value">{{ popObj.visitReason }}</view>
  87. </view>
  88. <view class="pop_info">
  89. <view class="info_key">车牌号:</view>
  90. <view class="info_value">{{ popObj.carNum ? popObj.carNum : '无' }}</view>
  91. </view>
  92. <view class="pop_info">
  93. <view class="info_key">同行人数:</view>
  94. <view class="info_value">{{ popObj.peerNum ? popObj.carNum : '无' }}</view>
  95. </view>
  96. <view class="pop_info">
  97. <view class="info_key">{{ popObj.visitorType === 1 ? '受访学生' : '受访人' }}:</view>
  98. <view class="info_value">{{ popObj.respondentName }}({{ popObj.responcode || popObj.respondentPhone }})</view>
  99. </view>
  100. <!-- 底部按钮区域 -->
  101. <view class="pop_btn" v-if="popObj.statuStr == '待审核'">
  102. <view class="button reject" @click="handleReject(popObj)">拒绝</view>
  103. <view class="button agree" @click="handleAgree(popObj)">同意</view>
  104. </view>
  105. </view>
  106. </uni-popup>
  107. <!-- 底部导航栏区域 -->
  108. <Tabber />
  109. </view>
  110. </template>
  111. <script setup>
  112. import { ref } from 'vue'
  113. import { onLoad, onReachBottom } from '@dcloudio/uni-app'
  114. import Tabber from '@/components/tabber.vue'
  115. import NoData from '@/components/noData.vue'
  116. import { myRequest } from '@/utils/api.js'
  117. import { decryptDes } from '@/utils/des.js'
  118. // 分段器当前索引
  119. const activeCurrent = ref(0)
  120. // 当前页
  121. const currentPage = ref(1)
  122. // 记录总条数
  123. const total = ref(0)
  124. // 分段器数组
  125. const controlList = ['待审核', '已拒绝', '进校核销', '出校核销', '已完成']
  126. // 待办记录
  127. const list = ref([])
  128. // 弹窗元素标记
  129. const popup = ref(null)
  130. // 弹窗详细信息
  131. const popObj = ref({})
  132. // 是否展示设置按钮
  133. const showSet = ref(false)
  134. // 配置信息
  135. const configInfo = ref({})
  136. onLoad(() => {
  137. getConfig()
  138. getData()
  139. })
  140. // 页面上拉到最底部时触发的回调
  141. onReachBottom(() => {
  142. if (total.value > list.value.length) {
  143. currentPage.value++
  144. getData()
  145. } else {
  146. uni.showToast({
  147. title: '没有更多数据了',
  148. icon: 'none'
  149. })
  150. }
  151. })
  152. // 获取配置信息
  153. const getConfig = async () => {
  154. const res = await myRequest({
  155. url: '/wanzai/api/smartVisitorParentsConfig/getUserId',
  156. data: {
  157. userId: uni.getStorageSync('userInfo').id
  158. }
  159. })
  160. // console.log(res)
  161. if (res.code == 200) {
  162. showSet.value = true
  163. const result = JSON.parse(decryptDes(res.data))
  164. // console.log(result)
  165. configInfo.value = result
  166. }
  167. }
  168. // 获取到访代办数据
  169. const getData = async () => {
  170. let type
  171. if (activeCurrent.value == 0) {
  172. type = 1
  173. } else if (activeCurrent.value == 1) {
  174. type = 2
  175. } else if (activeCurrent.value == 2) {
  176. type = 7
  177. } else if (activeCurrent.value == 3) {
  178. type = 8
  179. } else if (activeCurrent.value == 4) {
  180. type = 9
  181. }
  182. const res = await myRequest({
  183. url: '/wanzai/api/smartVisitor/visitingAgencys',
  184. data: {
  185. currentPage: currentPage.value,
  186. pageCount: 6,
  187. userId: uni.getStorageSync('userInfo').id,
  188. type
  189. }
  190. })
  191. // console.log(res)
  192. const result = res.data
  193. total.value = result.totalCount
  194. list.value = [...list.value, ...(result.list || [])]
  195. }
  196. // 切换分段器时的回调
  197. const onClickItem = (e) => {
  198. if (activeCurrent.value != e.currentIndex) {
  199. activeCurrent.value = e.currentIndex
  200. currentPage.value = 1
  201. list.value = []
  202. getData()
  203. }
  204. }
  205. // 点击每一条待办记录时的回调
  206. const handleClick = (item) => {
  207. popObj.value = item
  208. popup.value.open()
  209. }
  210. // 点击拒绝按钮回调
  211. const handleReject = (info) => {
  212. handleExamine(info, 2)
  213. }
  214. // 点击同意按钮回调
  215. const handleAgree = (info) => {
  216. handleExamine(info, 4)
  217. }
  218. // 审核回调
  219. const handleExamine = (info, type) => {
  220. uni.showModal({
  221. title: '提示',
  222. content: type == 4 ? '确定同意吗?' : '确定拒绝吗?',
  223. success: (res) => {
  224. if (res.confirm) {
  225. if (info.visitorType == 1) {
  226. // 学生家长预约审核
  227. handleExamineReq(info.id, type)
  228. } else {
  229. // 其他访客预约审核
  230. handleExamineReq_other(info.id, type)
  231. }
  232. }
  233. }
  234. })
  235. }
  236. // 学生家长预约审核请求
  237. const handleExamineReq = async (id, type) => {
  238. const res = await myRequest({
  239. url: '/wanzai/api/smartVisitor/parentsAudit',
  240. data: {
  241. id,
  242. type
  243. }
  244. })
  245. // console.log(res)
  246. uni.showToast({
  247. title: type == 4 ? '已同意该审核' : '已拒绝该审核',
  248. icon: 'success',
  249. duration: 2000
  250. })
  251. setTimeout(() => {
  252. list.value = []
  253. currentPage.value = 1
  254. getData()
  255. }, 2000)
  256. }
  257. // 其他访客预约审核请求
  258. const handleExamineReq_other = async (id, type) => {
  259. const res = await myRequest({
  260. url: '/wanzai/api/smartVisitor/restsAudit',
  261. data: {
  262. id,
  263. type
  264. }
  265. })
  266. // console.log(res)
  267. uni.showToast({
  268. title: type == 4 ? '已同意该审核' : '已拒绝该审核',
  269. icon: 'success',
  270. duration: 2000
  271. })
  272. setTimeout(() => {
  273. list.value = []
  274. currentPage.value = 1
  275. getData()
  276. }, 2000)
  277. }
  278. // 点击弹窗 x 图标时的回调
  279. const closePop = () => {
  280. popup.value.close()
  281. }
  282. // 点击悬浮设置按钮时的回调
  283. const handleClickSet = () => {
  284. let info = JSON.stringify(configInfo.value)
  285. uni.navigateTo({
  286. url: `/pagesReservation/set/set?info=${info}`
  287. })
  288. }
  289. </script>
  290. <style lang="scss" scoped>
  291. .container {
  292. box-sizing: border-box;
  293. padding-bottom: 30rpx;
  294. min-height: 100vh;
  295. background-color: #f1f6fe;
  296. .body {
  297. padding: 0 20rpx;
  298. .body_box {
  299. padding: 0 20rpx 0 30rpx;
  300. box-sizing: border-box;
  301. margin-top: 20rpx;
  302. width: 710rpx;
  303. border-radius: 15rpx;
  304. background-color: #fff;
  305. .box_title {
  306. display: flex;
  307. justify-content: space-between;
  308. align-items: center;
  309. height: 83rpx;
  310. font-size: 28rpx;
  311. border-bottom: 1rpx solid #e6e6e6;
  312. .title_msg {
  313. display: flex;
  314. align-items: center;
  315. .msg_name {
  316. font-weight: bold;
  317. }
  318. .msg_time {
  319. margin-left: 15rpx;
  320. color: #a6a6a6;
  321. font-size: 24rpx;
  322. }
  323. }
  324. .title_type {
  325. color: #0061ff;
  326. }
  327. .red {
  328. color: #d43030;
  329. }
  330. .green {
  331. color: #00baad;
  332. }
  333. }
  334. .box_info {
  335. display: flex;
  336. flex-direction: column;
  337. .info_box {
  338. display: flex;
  339. align-items: center;
  340. height: 65rpx;
  341. font-size: 24rpx;
  342. .box_key {
  343. width: 120rpx;
  344. color: #a6a6a6;
  345. }
  346. .box_value {
  347. flex: 1;
  348. margin-left: 95rpx;
  349. overflow: hidden;
  350. text-overflow: ellipsis;
  351. white-space: nowrap;
  352. }
  353. }
  354. }
  355. .box_btn {
  356. display: flex;
  357. justify-content: flex-end;
  358. align-items: center;
  359. height: 130rpx;
  360. border-top: 1rpx solid #e6e6e6;
  361. .button {
  362. display: flex;
  363. justify-content: center;
  364. align-items: center;
  365. width: 146rpx;
  366. height: 80rpx;
  367. color: #fff;
  368. font-size: 28rpx;
  369. border-radius: 10rpx;
  370. }
  371. .reject {
  372. background-color: #d43030;
  373. }
  374. .agree {
  375. margin-left: 28rpx;
  376. width: 214rpx;
  377. background-color: #0061ff;
  378. }
  379. }
  380. }
  381. }
  382. .set {
  383. position: fixed;
  384. bottom: 310rpx;
  385. right: 0;
  386. display: flex;
  387. justify-content: center;
  388. align-items: center;
  389. width: 169rpx;
  390. height: 83rpx;
  391. font-size: 28rpx;
  392. border-radius: 110rpx 0 0 110rpx;
  393. box-shadow: 0 2rpx 9rpx rgba(0, 0, 0, 0.25);
  394. background-color: #fff;
  395. }
  396. .popup_box {
  397. padding-bottom: 50rpx;
  398. width: 710rpx;
  399. border-radius: 22rpx;
  400. background-color: #fff;
  401. .pop_header {
  402. display: flex;
  403. justify-content: center;
  404. align-items: center;
  405. position: relative;
  406. height: 94rpx;
  407. font-size: 28rpx;
  408. border-bottom: 1rpx solid #e6e6e6;
  409. .header_icon {
  410. position: absolute;
  411. top: 18rpx;
  412. right: 25rpx;
  413. font-size: 40rpx;
  414. }
  415. }
  416. .pop_info {
  417. display: flex;
  418. margin-top: 22rpx;
  419. padding: 0 35rpx;
  420. font-size: 28rpx;
  421. .info_key {
  422. color: #999999;
  423. }
  424. .info_value {
  425. flex: 1;
  426. }
  427. .blue {
  428. color: #0061ff;
  429. }
  430. .red {
  431. color: #d43030;
  432. }
  433. .green {
  434. color: #00baad;
  435. }
  436. }
  437. .pop_btn {
  438. display: flex;
  439. justify-content: flex-end;
  440. align-items: center;
  441. margin-top: 28rpx;
  442. padding-top: 40rpx;
  443. box-sizing: border-box;
  444. height: 129rpx;
  445. border-top: 1rpx solid #e6e6e6;
  446. .button {
  447. display: flex;
  448. justify-content: center;
  449. align-items: center;
  450. width: 146rpx;
  451. height: 80rpx;
  452. color: #fff;
  453. font-size: 28rpx;
  454. border-radius: 10rpx;
  455. }
  456. .reject {
  457. background-color: #d43030;
  458. }
  459. .agree {
  460. margin-left: 28rpx;
  461. margin-right: 36rpx;
  462. width: 214rpx;
  463. background-color: #0061ff;
  464. }
  465. }
  466. }
  467. }
  468. // 修改顶部分段器样式
  469. ::v-deep {
  470. .segmented-control {
  471. height: 100rpx;
  472. background-color: #fff;
  473. }
  474. }
  475. </style>