backlog.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  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. // 分段器当前索引
  113. const activeCurrent = ref(0)
  114. // 当前页
  115. const currentPage = ref(1)
  116. // 记录总条数
  117. const total = ref(0)
  118. // 分段器数组
  119. const controlList = ['待审核', '已拒绝', '已推送']
  120. // 待办记录
  121. const list = ref([])
  122. // 弹窗元素标记
  123. const popup = ref(null)
  124. // 弹窗详细信息
  125. const popObj = ref({})
  126. onLoad(() => {
  127. getData()
  128. })
  129. // 页面上拉到最底部时触发的回调
  130. onReachBottom(() => {
  131. if (total.value > list.value.length) {
  132. currentPage.value++
  133. getData()
  134. } else {
  135. uni.showToast({
  136. title: '没有更多数据了',
  137. icon: 'none'
  138. })
  139. }
  140. })
  141. // 获取到访代办数据
  142. const getData = async () => {
  143. const res = await myRequest({
  144. url: '/wanzai/api/smartVisitor/visitingAgencys',
  145. data: {
  146. currentPage: currentPage.value,
  147. pageCount: 6,
  148. userId: uni.getStorageSync('userInfo').id,
  149. type: activeCurrent.value - 0 + 1
  150. }
  151. })
  152. // console.log(res)
  153. total.value = res.data.totalCount
  154. list.value = [...list.value, ...res.data.list]
  155. }
  156. // 切换分段器时的回调
  157. const onClickItem = (e) => {
  158. if (activeCurrent.value != e.currentIndex) {
  159. activeCurrent.value = e.currentIndex
  160. currentPage.value = 1
  161. list.value = []
  162. getData()
  163. }
  164. }
  165. // 点击每一条待办记录时的回调
  166. const handleClick = (item) => {
  167. popObj.value = item
  168. popup.value.open()
  169. }
  170. // 点击拒绝按钮回调
  171. const handleReject = (id) => {
  172. handleExamine(id, 2)
  173. }
  174. // 点击同意按钮回调
  175. const handleAgree = (id) => {
  176. handleExamine(id, 1)
  177. }
  178. // 审核回调
  179. const handleExamine = (id, type) => {
  180. uni.showModal({
  181. title: '提示',
  182. content: type == 1 ? '确定同意并推送吗?' : '确定拒绝吗?',
  183. success: (res) => {
  184. if (res.confirm) {
  185. handleExamineReq(id, type)
  186. }
  187. }
  188. })
  189. }
  190. // 审核请求
  191. const handleExamineReq = async (id, type) => {
  192. const res = await myRequest({
  193. url: '/wanzai/api/smartVisitor/examineRecord',
  194. data: {
  195. id,
  196. type
  197. }
  198. })
  199. // console.log(res)
  200. uni.showToast({
  201. title: type == 1 ? '已同意该审核' : '已拒绝该审核',
  202. icon: 'success',
  203. duration: 2000
  204. })
  205. setTimeout(() => {
  206. list.value = []
  207. currentPage.value = 1
  208. getData()
  209. }, 2000)
  210. }
  211. // 点击弹窗 x 图标时的回调
  212. const closePop = () => {
  213. popup.value.close()
  214. }
  215. </script>
  216. <style lang="scss" scoped>
  217. .container {
  218. box-sizing: border-box;
  219. padding-bottom: 30rpx;
  220. min-height: 100vh;
  221. background-color: #f1f6fe;
  222. .body {
  223. padding: 0 20rpx;
  224. .body_box {
  225. padding: 0 20rpx 0 30rpx;
  226. box-sizing: border-box;
  227. margin-top: 20rpx;
  228. width: 710rpx;
  229. border-radius: 15rpx;
  230. background-color: #fff;
  231. .box_title {
  232. display: flex;
  233. justify-content: space-between;
  234. align-items: center;
  235. height: 83rpx;
  236. font-size: 28rpx;
  237. border-bottom: 1rpx solid #e6e6e6;
  238. .title_msg {
  239. display: flex;
  240. align-items: center;
  241. .msg_name {
  242. font-weight: bold;
  243. }
  244. .msg_time {
  245. margin-left: 15rpx;
  246. color: #a6a6a6;
  247. font-size: 24rpx;
  248. }
  249. }
  250. .title_type {
  251. color: #0061ff;
  252. }
  253. .red {
  254. color: #d43030;
  255. }
  256. .green {
  257. color: #00baad;
  258. }
  259. }
  260. .box_info {
  261. display: flex;
  262. flex-direction: column;
  263. .info_box {
  264. display: flex;
  265. align-items: center;
  266. height: 65rpx;
  267. font-size: 24rpx;
  268. .box_key {
  269. width: 120rpx;
  270. color: #a6a6a6;
  271. }
  272. .box_value {
  273. flex: 1;
  274. margin-left: 95rpx;
  275. overflow: hidden;
  276. text-overflow: ellipsis;
  277. white-space: nowrap;
  278. }
  279. }
  280. }
  281. .box_btn {
  282. display: flex;
  283. justify-content: flex-end;
  284. align-items: center;
  285. height: 130rpx;
  286. border-top: 1rpx solid #e6e6e6;
  287. .button {
  288. display: flex;
  289. justify-content: center;
  290. align-items: center;
  291. width: 146rpx;
  292. height: 80rpx;
  293. color: #fff;
  294. font-size: 28rpx;
  295. border-radius: 10rpx;
  296. }
  297. .reject {
  298. background-color: #d43030;
  299. }
  300. .agree {
  301. margin-left: 28rpx;
  302. width: 214rpx;
  303. background-color: #0061ff;
  304. }
  305. }
  306. }
  307. }
  308. .popup_box {
  309. padding-bottom: 50rpx;
  310. width: 710rpx;
  311. border-radius: 22rpx;
  312. background-color: #fff;
  313. .pop_header {
  314. display: flex;
  315. justify-content: center;
  316. align-items: center;
  317. position: relative;
  318. height: 94rpx;
  319. font-size: 28rpx;
  320. border-bottom: 1rpx solid #e6e6e6;
  321. .header_icon {
  322. position: absolute;
  323. top: 18rpx;
  324. right: 25rpx;
  325. font-size: 40rpx;
  326. }
  327. }
  328. .pop_info {
  329. display: flex;
  330. margin-top: 22rpx;
  331. padding: 0 35rpx;
  332. font-size: 28rpx;
  333. .info_key {
  334. color: #999999;
  335. }
  336. .info_value {
  337. flex: 1;
  338. }
  339. .blue {
  340. color: #0061ff;
  341. }
  342. .red {
  343. color: #d43030;
  344. }
  345. .green {
  346. color: #00baad;
  347. }
  348. }
  349. .pop_btn {
  350. display: flex;
  351. justify-content: flex-end;
  352. align-items: center;
  353. margin-top: 28rpx;
  354. padding-top: 40rpx;
  355. box-sizing: border-box;
  356. height: 129rpx;
  357. border-top: 1rpx solid #e6e6e6;
  358. .button {
  359. display: flex;
  360. justify-content: center;
  361. align-items: center;
  362. width: 146rpx;
  363. height: 80rpx;
  364. color: #fff;
  365. font-size: 28rpx;
  366. border-radius: 10rpx;
  367. }
  368. .reject {
  369. background-color: #d43030;
  370. }
  371. .agree {
  372. margin-left: 28rpx;
  373. margin-right: 36rpx;
  374. width: 214rpx;
  375. background-color: #0061ff;
  376. }
  377. }
  378. }
  379. }
  380. // 修改顶部分段器样式
  381. ::v-deep {
  382. .segmented-control {
  383. height: 100rpx;
  384. background-color: #fff;
  385. }
  386. }
  387. </style>