backlog.vue 9.1 KB

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