detail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  1. <template>
  2. <view class="container">
  3. <!-- 详情内容 -->
  4. <view class="detail-container">
  5. <!-- 对接信息 -->
  6. <view class="section">
  7. <view class="section-title">
  8. <image class="title-icon" src="/static/images/person.png" mode="aspectFit"></image>
  9. <view class="title">
  10. 对接信息
  11. </view>
  12. </view>
  13. <view class="info-item">
  14. <text class="label">所属部门</text>
  15. <text class="value">{{visitDetail.department}}</text>
  16. </view>
  17. <view class="info-item">
  18. <text class="label">员工姓名</text>
  19. <text class="value">{{visitDetail.employeeName}}</text>
  20. </view>
  21. </view>
  22. <!-- 访问信息 -->
  23. <view class="section">
  24. <view class="section-title">
  25. <image class="title-icon" src="/static/images/calendar.png" mode="aspectFit"></image>
  26. <view class="title">
  27. 访问信息
  28. </view>
  29. </view>
  30. <view class="info-item">
  31. <text class="label">访问事由</text>
  32. <text class="value">{{visitDetail.visitReason}}</text>
  33. </view>
  34. <view class="info-item">
  35. <text class="label">到访时间</text>
  36. <text class="value">{{visitDetail.visitTime}}</text>
  37. </view>
  38. <view class="info-item">
  39. <text class="label">访客姓名</text>
  40. <text class="value">{{visitDetail.visitorName}}</text>
  41. </view>
  42. <view class="info-item">
  43. <text class="label">访客单位</text>
  44. <text class="value">{{visitDetail.visitorCompany}}</text>
  45. </view>
  46. <view class="info-item">
  47. <text class="label">手机号</text>
  48. <text class="value">{{visitDetail.visitorPhone}}</text>
  49. </view>
  50. </view>
  51. <!-- 随行人员 -->
  52. <view class="section" v-if="visitDetail.accompanyPersons && visitDetail.accompanyPersons.length > 0">
  53. <view class="section-title">
  54. <image class="title-icon" src="/static/images/person.png" mode="aspectFit"></image>
  55. <view class="title">
  56. 随行人员
  57. </view>
  58. </view>
  59. <view class="accompany-list">
  60. <view class="info-item" v-for="(person, index) in visitDetail.accompanyPersons" :key="index">
  61. <text class="label">随行人员{{index + 1}}</text>
  62. <view class="accompany-info">
  63. <text class="value">{{person.name}}</text>
  64. <text class="phone">{{person.phone}}</text>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. <!-- 使用车辆 -->
  70. <view class="section" v-if="visitDetail.useVehicle">
  71. <view class="section-title">
  72. <image class="title-icon" src="/static/images/cart.png" mode="aspectFit"></image>
  73. <view class="title">
  74. 车辆信息
  75. </view>
  76. <text class="vehicle-number">{{visitDetail.vehicleNumber}}</text>
  77. </view>
  78. <view class="info-item">
  79. <text class="label">接客时间</text>
  80. <text class="value">{{visitDetail.pickupTime}}</text>
  81. </view>
  82. <view class="info-item">
  83. <text class="label">接客地点</text>
  84. <text class="value">{{visitDetail.pickupLocation}}</text>
  85. </view>
  86. </view>
  87. </view>
  88. <!-- 操作按钮 - 仅待审核状态显示 -->
  89. <view class="action-container" v-if="visitDetail.status === '待审核'">
  90. <button class="reject-btn" @click="handleReject">拒绝</button>
  91. <button class="approve-btn" @click="handleApprove">通过</button>
  92. </view>
  93. <!-- 确认弹框 -->
  94. <uni-popup ref="confirmPopup" type="center">
  95. <view class="confirm-popup">
  96. <view class="popup-content">
  97. <view class="popup-title">{{confirmAction === 'approve' ? '确认通过' : '确认拒绝'}}</view>
  98. <view class="popup-message">
  99. {{confirmAction === 'approve' ? '确定要通过这个访问申请吗?' : '确定要拒绝这个访问申请吗?'}}
  100. </view>
  101. <view class="popup-buttons">
  102. <button class="cancel-btn" @click="cancelAction">取消</button>
  103. <button class="confirm-btn"
  104. @click="confirmAction === 'approve' ? approveVisit() : rejectVisit()">
  105. 确定
  106. </button>
  107. </view>
  108. </view>
  109. </view>
  110. </uni-popup>
  111. <!-- 结果提示弹框 -->
  112. <uni-popup ref="resultPopup" type="center">
  113. <view class="result-popup">
  114. <view class="popup-content">
  115. <view class="result-icon" :class="resultType">
  116. <uni-icons :type="resultType === 'success' ? 'checkmarkempty' : 'closeempty'" size="60"
  117. :color="resultType === 'success' ? '#52c41a' : '#ff4757'"></uni-icons>
  118. </view>
  119. <view class="popup-title">{{resultTitle}}</view>
  120. <view class="popup-message">{{resultMessage}}</view>
  121. <button class="close-btn" @click="closeResultPopup">确定</button>
  122. </view>
  123. </view>
  124. </uni-popup>
  125. </view>
  126. </template>
  127. <script>
  128. export default {
  129. data() {
  130. return {
  131. visitId: '',
  132. visitDetail: {
  133. id: '',
  134. department: '',
  135. employeeName: '',
  136. visitReason: '',
  137. visitTime: '',
  138. visitorName: '',
  139. visitorCompany: '',
  140. visitorPhone: '',
  141. status: '',
  142. useVehicle: false,
  143. vehicleNumber: '',
  144. pickupTime: '',
  145. pickupLocation: '',
  146. accompanyPersons: []
  147. },
  148. confirmAction: '', // 'approve' 或 'reject'
  149. resultType: '', // 'success' 或 'error'
  150. resultTitle: '',
  151. resultMessage: ''
  152. }
  153. },
  154. onLoad(options) {
  155. if (options.id) {
  156. this.visitId = options.id;
  157. this.visitDetail.status = options.status || '待审核';
  158. this.getVisitDetail();
  159. }
  160. },
  161. methods: {
  162. // 获取访问详情
  163. getVisitDetail() {
  164. // 模拟数据,实际应该调用接口
  165. const mockDetail = {
  166. id: this.visitId,
  167. department: '技术部',
  168. employeeName: '张河嘉',
  169. visitReason: '参加业务研究计划',
  170. visitTime: '2025-08-09',
  171. visitorName: '安晓伟',
  172. visitorCompany: '某某某公司',
  173. visitorPhone: '13012345678',
  174. status: this.visitDetail.status, // 从上一页传来的状态
  175. useVehicle: true,
  176. vehicleNumber: '冀A·12345',
  177. pickupTime: '2025-08-09 16:30',
  178. pickupLocation: '石家庄新华区',
  179. accompanyPersons: [{
  180. name: '李四',
  181. phone: '13987654321'
  182. },
  183. {
  184. name: '王五',
  185. phone: '13876543210'
  186. }
  187. ]
  188. };
  189. this.visitDetail = mockDetail;
  190. },
  191. // 处理拒绝
  192. handleReject() {
  193. this.confirmAction = 'reject';
  194. this.$refs.confirmPopup.open();
  195. },
  196. // 处理通过
  197. handleApprove() {
  198. this.confirmAction = 'approve';
  199. this.$refs.confirmPopup.open();
  200. },
  201. // 取消操作
  202. cancelAction() {
  203. this.$refs.confirmPopup.close();
  204. this.confirmAction = '';
  205. },
  206. // 确认通过
  207. approveVisit() {
  208. this.$refs.confirmPopup.close();
  209. // 模拟接口调用
  210. uni.showLoading({
  211. title: '处理中...'
  212. });
  213. setTimeout(() => {
  214. uni.hideLoading();
  215. // 更新状态
  216. this.visitDetail.status = '待访问';
  217. // 显示成功提示
  218. this.resultType = 'success';
  219. this.resultTitle = '审核通过';
  220. this.resultMessage = '访问申请已通过,访客将收到通知';
  221. this.$refs.resultPopup.open();
  222. }, 1000);
  223. },
  224. // 确认拒绝
  225. rejectVisit() {
  226. this.$refs.confirmPopup.close();
  227. // 模拟接口调用
  228. uni.showLoading({
  229. title: '处理中...'
  230. });
  231. setTimeout(() => {
  232. uni.hideLoading();
  233. // 更新状态
  234. this.visitDetail.status = '已拒绝';
  235. // 显示成功提示
  236. this.resultType = 'success';
  237. this.resultTitle = '审核完成';
  238. this.resultMessage = '访问申请已拒绝,访客将收到通知';
  239. this.$refs.resultPopup.open();
  240. }, 1000);
  241. },
  242. // 关闭结果弹框
  243. closeResultPopup() {
  244. this.$refs.resultPopup.close();
  245. // 返回上一页
  246. uni.navigateBack();
  247. }
  248. }
  249. }
  250. </script>
  251. <style lang="scss" scoped>
  252. .container {
  253. min-height: 100vh;
  254. background-color: #f5f5f5;
  255. padding-bottom: 140rpx;
  256. }
  257. .detail-container {
  258. padding: 20rpx;
  259. }
  260. .section {
  261. background-color: #fff;
  262. border-radius: 16rpx;
  263. margin-bottom: 20rpx;
  264. padding: 30rpx;
  265. }
  266. .section-title {
  267. margin-bottom: 30rpx;
  268. display: flex;
  269. align-items: center;
  270. }
  271. .title {
  272. font-size: 32rpx;
  273. font-weight: 600;
  274. color: #333;
  275. }
  276. .title-icon {
  277. width: 40rpx;
  278. height: 40rpx;
  279. margin-right: 15rpx;
  280. }
  281. .vehicle-number {
  282. font-size: 28rpx;
  283. color: #666;
  284. font-weight: normal;
  285. margin-left: auto;
  286. }
  287. .info-item {
  288. display: flex;
  289. align-items: flex-start;
  290. margin-bottom: 24rpx;
  291. &:last-child {
  292. margin-bottom: 0;
  293. }
  294. }
  295. .label {
  296. width: 160rpx;
  297. font-size: 28rpx;
  298. color: #666;
  299. flex-shrink: 0;
  300. line-height: 1.5;
  301. }
  302. .value {
  303. flex: 1;
  304. font-size: 28rpx;
  305. color: #333;
  306. line-height: 1.5;
  307. word-break: break-all;
  308. }
  309. .accompany-info {
  310. flex: 1;
  311. display: flex;
  312. flex-direction: column;
  313. gap: 8rpx;
  314. .value {
  315. font-size: 28rpx;
  316. color: #333;
  317. }
  318. .phone {
  319. font-size: 24rpx;
  320. color: #666;
  321. }
  322. }
  323. .action-container {
  324. position: fixed;
  325. bottom: 0;
  326. left: 0;
  327. right: 0;
  328. padding: 20rpx;
  329. background-color: #fff;
  330. box-shadow: 0 -2rpx 8rpx rgba(0, 0, 0, 0.1);
  331. display: flex;
  332. gap: 20rpx;
  333. }
  334. .reject-btn,
  335. .approve-btn {
  336. flex: 1;
  337. height: 88rpx;
  338. border-radius: 44rpx;
  339. border: none;
  340. font-size: 32rpx;
  341. font-weight: 600;
  342. }
  343. .reject-btn {
  344. background-color: #fff;
  345. color: #ff4757;
  346. border: 2rpx solid #ff4757;
  347. }
  348. .approve-btn {
  349. background: #39833b;
  350. color: #fff;
  351. }
  352. // 弹框样式
  353. .confirm-popup,
  354. .result-popup {
  355. .popup-content {
  356. background-color: #fff;
  357. border-radius: 20rpx;
  358. padding: 60rpx 40rpx 40rpx;
  359. width: 560rpx;
  360. text-align: center;
  361. }
  362. .popup-title {
  363. font-size: 36rpx;
  364. font-weight: 600;
  365. color: #333;
  366. margin-bottom: 20rpx;
  367. }
  368. .popup-message {
  369. font-size: 28rpx;
  370. color: #666;
  371. line-height: 1.6;
  372. margin-bottom: 40rpx;
  373. }
  374. }
  375. .popup-buttons {
  376. display: flex;
  377. gap: 20rpx;
  378. .cancel-btn,
  379. .confirm-btn {
  380. flex: 1;
  381. height: 80rpx;
  382. border-radius: 40rpx;
  383. font-size: 28rpx;
  384. border: none;
  385. }
  386. .cancel-btn {
  387. background-color: #f5f5f5;
  388. color: #666;
  389. }
  390. .confirm-btn {
  391. background: linear-gradient(135deg, #ff6b35 0%, #ff9500 100%);
  392. color: #fff;
  393. }
  394. }
  395. .result-icon {
  396. margin-bottom: 30rpx;
  397. &.success {
  398. // success icon styling handled by uni-icons color
  399. }
  400. &.error {
  401. // error icon styling handled by uni-icons color
  402. }
  403. }
  404. .close-btn {
  405. width: 100%;
  406. height: 80rpx;
  407. background: linear-gradient(135deg, #ff6b35 0%, #ff9500 100%);
  408. border-radius: 40rpx;
  409. color: #fff;
  410. font-size: 28rpx;
  411. border: none;
  412. }
  413. </style>