detail.vue 10 KB

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