backlog.vue 10 KB

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