foodBusinessLicense.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830
  1. <template>
  2. <div class="card content-box">
  3. <div class="content-section">
  4. <div class="tip-text">食品经营许可证到期时间:{{ expirationTime || "--" }}</div>
  5. <div class="action-buttons">
  6. <el-button type="primary" @click="handleReplace"> 更换 </el-button>
  7. <el-button type="primary" @click="handleViewChangeRecord"> 查看变更记录 </el-button>
  8. </div>
  9. </div>
  10. <div class="license-container" v-if="licenseImage">
  11. <div class="license-display">
  12. <el-image :src="licenseImage" fit="contain" class="license-image" :preview-src-list="[licenseImage]">
  13. <template #error>
  14. <div class="empty-image-box">
  15. <el-icon class="empty-icon">
  16. <Picture />
  17. </el-icon>
  18. </div>
  19. </template>
  20. </el-image>
  21. </div>
  22. </div>
  23. <div v-else class="empty-license">
  24. <el-empty description="暂无食品经营许可证" :image-size="100" />
  25. </div>
  26. <!-- 更换食品经营许可证弹窗 -->
  27. <el-dialog
  28. v-model="replaceDialogVisible"
  29. title="更换食品经营许可证"
  30. width="600px"
  31. :before-close="handleReplaceDialogClose"
  32. :close-on-click-modal="false"
  33. :close-on-press-escape="false"
  34. >
  35. <div class="replace-upload-area" :class="{ 'upload-full': uploadedImageCount >= 1 }">
  36. <div class="upload-tip">只允许上传jpg,jpeg,png格式图片;上传图片不得超过20M</div>
  37. <el-upload
  38. v-model:file-list="fileList"
  39. list-type="picture-card"
  40. :accept="'.jpg,.jpeg,.png'"
  41. :limit="1"
  42. :auto-upload="false"
  43. :disabled="hasUnuploadedImages"
  44. :on-change="handleUploadChange"
  45. :on-exceed="handleUploadExceed"
  46. :on-preview="handlePictureCardPreview"
  47. :before-remove="handleBeforeRemove"
  48. :on-remove="handleRemove"
  49. :show-file-list="true"
  50. >
  51. <template #trigger>
  52. <div v-if="uploadedImageCount < 1" class="upload-trigger-card el-upload--picture-card">
  53. <el-icon>
  54. <Plus />
  55. </el-icon>
  56. <div class="upload-tip">({{ uploadedImageCount }}/1)</div>
  57. </div>
  58. </template>
  59. </el-upload>
  60. </div>
  61. <template #footer>
  62. <div class="dialog-footer">
  63. <el-button @click="handleCancelReplace" :disabled="hasUnuploadedImages"> 取消 </el-button>
  64. <el-button type="primary" @click="handleSubmitReplace" :disabled="hasUnuploadedImages"> 去审核 </el-button>
  65. </div>
  66. </template>
  67. </el-dialog>
  68. <!-- 图片预览 -->
  69. <el-image-viewer
  70. v-if="imageViewerVisible"
  71. :url-list="imageViewerUrlList"
  72. :initial-index="imageViewerInitialIndex"
  73. @close="imageViewerVisible = false"
  74. />
  75. <!-- 变更记录弹窗 -->
  76. <el-dialog v-model="changeRecordDialogVisible" title="变更记录" width="900px" :close-on-click-modal="false">
  77. <el-scrollbar height="400px" class="change-record-scrollbar">
  78. <div v-if="changeRecordList && changeRecordList.length > 0" class="change-record-content">
  79. <div v-for="(item, index) in changeRecordList" :key="index" class="record-group">
  80. <div class="record-date">
  81. {{ item.createdDateFormat }}
  82. </div>
  83. <div class="record-items">
  84. <div class="record-item">
  85. <div class="record-status-badge" :class="getStatusClass(item.licenseExecuteStatus)">
  86. {{ item.licenseExecuteName }}
  87. </div>
  88. <el-image
  89. :src="item.imgUrl"
  90. fit="cover"
  91. class="record-image"
  92. :preview-src-list="changeRecordList.map(record => record.imgUrl)"
  93. :initial-index="index"
  94. >
  95. <template #error>
  96. <div class="image-slot">
  97. <el-icon><Picture /></el-icon>
  98. </div>
  99. </template>
  100. </el-image>
  101. </div>
  102. </div>
  103. <div v-if="item.reasonRefusal" class="rejection-reason">拒绝原因: {{ item.reasonRefusal }}</div>
  104. </div>
  105. </div>
  106. <div v-else class="empty-record">
  107. <el-empty description="暂无变更记录" :image-size="100" />
  108. </div>
  109. </el-scrollbar>
  110. <template #footer>
  111. <div class="dialog-footer">
  112. <el-button type="primary" @click="changeRecordDialogVisible = false"> 关闭 </el-button>
  113. </div>
  114. </template>
  115. </el-dialog>
  116. </div>
  117. </template>
  118. <script setup lang="ts" name="foodBusinessLicense">
  119. import { ref, computed, onMounted } from "vue";
  120. import { ElMessage, ElMessageBox } from "element-plus";
  121. import { Picture, Plus } from "@element-plus/icons-vue";
  122. import type { UploadProps, UploadFile } from "element-plus";
  123. import {
  124. getFoodBusinessLicense,
  125. uploadContractImage,
  126. submitFoodLicenseReview,
  127. getChangeRecords,
  128. getStoreFoodLicenceStatus
  129. } from "@/api/modules/licenseManagement";
  130. import { localGet } from "@/utils";
  131. // 状态映射对象
  132. const statusMap: Record<number, { name: string; class: string }> = {
  133. 1: { name: "审核通过", class: "status-success" },
  134. 2: { name: "审核中", class: "status-pending" },
  135. 3: { name: "审核拒绝", class: "status-failed" }
  136. };
  137. const id = localGet("createdId");
  138. const licenseImage = ref<string>("");
  139. const expirationTime = ref<string>("");
  140. const replaceDialogVisible = ref(false);
  141. const changeRecordDialogVisible = ref(false);
  142. const fileList = ref<UploadFile[]>([]);
  143. const changeRecordList = ref<any>([]);
  144. // ==================== 图片上传相关变量 ====================
  145. const uploading = ref(false);
  146. const pendingUploadFiles = ref<UploadFile[]>([]);
  147. const imageUrlList = ref<string[]>([]); // 存储图片URL列表
  148. // 图片预览相关
  149. const imageViewerVisible = ref(false);
  150. const imageViewerUrlList = ref<string[]>([]);
  151. const imageViewerInitialIndex = ref(0);
  152. // 计算属性:获取已成功上传的图片数量
  153. const uploadedImageCount = computed(() => {
  154. return fileList.value.filter((file: any) => file.status === "success" && file.url).length;
  155. });
  156. // 计算属性:检查是否有未上传完成的图片
  157. const hasUnuploadedImages = computed(() => {
  158. // 检查是否有正在上传的文件
  159. if (uploading.value || pendingUploadFiles.value.length > 0) {
  160. return true;
  161. }
  162. // 检查文件列表中是否有状态为 "ready"(待上传)或 "uploading"(上传中)的图片
  163. if (fileList.value && fileList.value.length > 0) {
  164. return fileList.value.some((file: any) => {
  165. return file.status === "ready" || file.status === "uploading";
  166. });
  167. }
  168. return false;
  169. });
  170. onMounted(async () => {
  171. await initData();
  172. });
  173. const initData = async () => {
  174. const params = {
  175. id: id
  176. };
  177. const res: any = await getFoodBusinessLicense(params);
  178. if (res.code == 200) {
  179. licenseImage.value = res.data[0]?.imgUrl;
  180. expirationTime.value = res.data[0]?.expirationTime;
  181. }
  182. };
  183. const handleReplace = async () => {
  184. fileList.value = [];
  185. imageUrlList.value = [];
  186. pendingUploadFiles.value = [];
  187. uploading.value = false;
  188. const params = {
  189. id: localGet("createdId")
  190. };
  191. const res: any = await getStoreFoodLicenceStatus(params);
  192. if (res.data.foodLicenceStatus == 2) {
  193. ElMessage.warning("食品经营许可证审核中,请耐心等待");
  194. } else {
  195. replaceDialogVisible.value = true;
  196. }
  197. };
  198. const handleViewChangeRecord = async () => {
  199. try {
  200. const params = {
  201. storeId: localGet("createdId")
  202. };
  203. const res: any = await getChangeRecords(params);
  204. if (res.code === 200) {
  205. changeRecordList.value = res.data;
  206. } else {
  207. // 请求失败时清空数据
  208. changeRecordList.value = [];
  209. }
  210. changeRecordDialogVisible.value = true;
  211. } catch (error) {
  212. ElMessage.error("获取变更记录失败");
  213. // 发生错误时清空数据并显示空状态
  214. changeRecordList.value = [];
  215. changeRecordDialogVisible.value = true;
  216. }
  217. };
  218. /**
  219. * 检查文件是否在排队中(未上传)
  220. * @param file 文件对象
  221. * @returns 是否在排队中
  222. */
  223. const isFilePending = (file: any): boolean => {
  224. // 只检查 ready 状态(排队中),不包括 uploading(正在上传)
  225. if (file.status === "ready") {
  226. return true;
  227. }
  228. // 检查是否在待上传队列中
  229. if (pendingUploadFiles.value.some(item => item.uid === file.uid)) {
  230. return true;
  231. }
  232. return false;
  233. };
  234. /**
  235. * 图片上传 - 删除前确认
  236. * @param uploadFile 要删除的文件对象
  237. * @param uploadFiles 当前文件列表
  238. * @returns Promise<boolean>,true 允许删除,false 阻止删除
  239. */
  240. const handleBeforeRemove = async (uploadFile: any, uploadFiles: any[]): Promise<boolean> => {
  241. // 如果文件在排队中(未上传),禁止删除
  242. if (isFilePending(uploadFile)) {
  243. ElMessage.warning("图片尚未上传,请等待上传完成后再删除");
  244. return false;
  245. }
  246. try {
  247. await ElMessageBox.confirm("确定要删除这张图片吗?", "提示", {
  248. confirmButtonText: "确定",
  249. cancelButtonText: "取消",
  250. type: "warning"
  251. });
  252. // 用户确认删除,返回 true 允许删除
  253. return true;
  254. } catch {
  255. // 用户取消删除,返回 false 阻止删除
  256. return false;
  257. }
  258. };
  259. /**
  260. * 图片上传 - 移除图片回调(删除成功后调用)
  261. * @param uploadFile 已删除的文件对象
  262. * @param uploadFiles 删除后的文件列表
  263. */
  264. const handleRemove: UploadProps["onRemove"] = (uploadFile, uploadFiles) => {
  265. // 从被删除的文件对象中获取 url
  266. const file = uploadFile as any;
  267. const imageUrl = file.url;
  268. if (imageUrl) {
  269. // 从 imageUrl 数组中删除对应的 URL
  270. const urlIndex = imageUrlList.value.indexOf(imageUrl);
  271. if (urlIndex > -1) {
  272. imageUrlList.value.splice(urlIndex, 1);
  273. }
  274. }
  275. if (file.url && file.url.startsWith("blob:")) {
  276. URL.revokeObjectURL(file.url);
  277. }
  278. // 同步文件列表
  279. fileList.value = [...uploadFiles];
  280. // 删除成功后提示
  281. ElMessage.success("图片已删除");
  282. };
  283. /**
  284. * 上传文件超出限制提示
  285. */
  286. const handleUploadExceed: UploadProps["onExceed"] = () => {
  287. ElMessage.warning("最多只能上传1张图片");
  288. };
  289. /**
  290. * el-upload 文件变更(选中或移除)
  291. */
  292. const handleUploadChange: UploadProps["onChange"] = async (uploadFile, uploadFiles) => {
  293. // 检查文件类型,只允许 jpg 和 png
  294. if (uploadFile.raw) {
  295. const fileType = uploadFile.raw.type.toLowerCase();
  296. const fileName = uploadFile.name.toLowerCase();
  297. const validTypes = ["image/jpeg", "image/jpg", "image/png"];
  298. const validExtensions = [".jpg", ".jpeg", ".png"];
  299. // 检查 MIME 类型或文件扩展名
  300. const isValidType = validTypes.includes(fileType) || validExtensions.some(ext => fileName.endsWith(ext));
  301. if (!isValidType) {
  302. // 从文件列表中移除不符合类型的文件
  303. const index = fileList.value.findIndex((f: any) => f.uid === uploadFile.uid);
  304. if (index > -1) {
  305. fileList.value.splice(index, 1);
  306. }
  307. // 从 uploadFiles 中移除
  308. const uploadIndex = uploadFiles.findIndex((f: any) => f.uid === uploadFile.uid);
  309. if (uploadIndex > -1) {
  310. uploadFiles.splice(uploadIndex, 1);
  311. }
  312. // 如果文件有 blob URL,释放它
  313. if (uploadFile.url && uploadFile.url.startsWith("blob:")) {
  314. URL.revokeObjectURL(uploadFile.url);
  315. }
  316. ElMessage.warning("只支持上传 JPG、JPEG 和 PNG 格式的图片");
  317. return;
  318. }
  319. // 检查文件大小,不得超过20M
  320. const maxSize = 20 * 1024 * 1024; // 20MB
  321. if (uploadFile.raw.size > maxSize) {
  322. // 从文件列表中移除超过大小的文件
  323. const index = fileList.value.findIndex((f: any) => f.uid === uploadFile.uid);
  324. if (index > -1) {
  325. fileList.value.splice(index, 1);
  326. }
  327. // 从 uploadFiles 中移除
  328. const uploadIndex = uploadFiles.findIndex((f: any) => f.uid === uploadFile.uid);
  329. if (uploadIndex > -1) {
  330. uploadFiles.splice(uploadIndex, 1);
  331. }
  332. // 如果文件有 blob URL,释放它
  333. if (uploadFile.url && uploadFile.url.startsWith("blob:")) {
  334. URL.revokeObjectURL(uploadFile.url);
  335. }
  336. ElMessage.warning("上传图片不得超过20M");
  337. return;
  338. }
  339. }
  340. // 同步文件列表到表单数据(只添加通过验证的文件)
  341. const existingIndex = fileList.value.findIndex((f: any) => f.uid === uploadFile.uid);
  342. if (existingIndex === -1) {
  343. fileList.value.push(uploadFile);
  344. }
  345. const readyFiles = fileList.value.filter(file => file.status === "ready");
  346. if (readyFiles.length) {
  347. readyFiles.forEach(file => {
  348. if (!pendingUploadFiles.value.some(item => item.uid === file.uid)) {
  349. pendingUploadFiles.value.push(file);
  350. }
  351. });
  352. }
  353. processUploadQueue();
  354. };
  355. /**
  356. * 处理上传队列 - 逐个上传文件
  357. */
  358. const processUploadQueue = async () => {
  359. if (uploading.value || pendingUploadFiles.value.length === 0) {
  360. return;
  361. }
  362. // 每次只取一个文件进行上传
  363. const file = pendingUploadFiles.value.shift();
  364. if (file) {
  365. await uploadSingleFile(file);
  366. // 继续处理队列中的下一个文件
  367. processUploadQueue();
  368. }
  369. };
  370. /**
  371. * 单文件上传图片
  372. * @param file 待上传的文件
  373. */
  374. const uploadSingleFile = async (file: UploadFile) => {
  375. if (!file.raw) {
  376. return;
  377. }
  378. const rawFile = file.raw as File;
  379. const formData = new FormData();
  380. formData.append("file", rawFile);
  381. formData.append("user", "text");
  382. file.status = "uploading";
  383. file.percentage = 0;
  384. uploading.value = true;
  385. try {
  386. // 上传过程中保持进度为 0,避免接口异常时进度条误显示 100%
  387. const result: any = await uploadContractImage(formData);
  388. if (result?.code === 200 && result.data) {
  389. // 处理单个文件的上传结果
  390. let imageUrl = result.data[0];
  391. if (!imageUrl) {
  392. throw new Error("上传成功但未获取到图片URL");
  393. }
  394. file.status = "success";
  395. file.percentage = 100;
  396. // 保存图片URL到文件对象
  397. file.url = imageUrl;
  398. file.response = { url: imageUrl };
  399. // 保存图片URL
  400. if (!Array.isArray(imageUrlList.value)) {
  401. imageUrlList.value = [];
  402. }
  403. if (!imageUrlList.value.includes(imageUrl)) {
  404. imageUrlList.value.push(imageUrl);
  405. }
  406. } else {
  407. throw new Error(result?.msg || "图片上传失败");
  408. }
  409. } catch (error: any) {
  410. file.status = "fail";
  411. // 上传失败时保持进度条为 0
  412. file.percentage = 0;
  413. if (file.url && file.url.startsWith("blob:")) {
  414. URL.revokeObjectURL(file.url);
  415. }
  416. // 从文件列表中移除失败的文件
  417. const index = fileList.value.findIndex((f: any) => f.uid === file.uid);
  418. if (index > -1) {
  419. fileList.value.splice(index, 1);
  420. }
  421. // Error message handled by global upload method, except for specific business logic errors
  422. if (error?.message && error.message.includes("未获取到图片URL")) {
  423. ElMessage.error(error.message);
  424. }
  425. } finally {
  426. uploading.value = false;
  427. // 触发视图更新
  428. fileList.value = [...fileList.value];
  429. }
  430. };
  431. /**
  432. * 图片预览 - 使用 el-image-viewer 预览功能
  433. * @param file 上传文件对象
  434. */
  435. const handlePictureCardPreview = (file: any) => {
  436. // 如果文件在排队中(未上传),禁止预览
  437. if (isFilePending(file)) {
  438. ElMessage.warning("图片尚未上传,请等待上传完成后再预览");
  439. return;
  440. }
  441. // 如果文件正在上传中,允许预览(使用本地预览)
  442. if (file.status === "uploading" && file.url) {
  443. imageViewerUrlList.value = [file.url];
  444. imageViewerInitialIndex.value = 0;
  445. imageViewerVisible.value = true;
  446. return;
  447. }
  448. // 获取所有图片的 URL 列表(只包含已上传成功的图片)
  449. const urlList = fileList.value
  450. .filter((item: any) => item.status === "success" && (item.url || item.response?.data))
  451. .map((item: any) => item.url || item.response?.data);
  452. // 找到当前点击的图片索引
  453. const currentIndex = urlList.findIndex((url: string) => url === (file.url || file.response?.data));
  454. if (currentIndex < 0) {
  455. ElMessage.warning("图片尚未上传完成,无法预览");
  456. return;
  457. }
  458. imageViewerUrlList.value = urlList;
  459. imageViewerInitialIndex.value = currentIndex;
  460. imageViewerVisible.value = true;
  461. };
  462. const handleCancelReplace = async () => {
  463. // 如果有图片正在上传,阻止关闭
  464. if (hasUnuploadedImages.value) {
  465. ElMessage.warning("请等待图片上传完成后再关闭");
  466. return;
  467. }
  468. if (fileList.value.length > 0) {
  469. try {
  470. await ElMessageBox.confirm("确定要取消本次图片上传吗?已上传的图片将不保存", "提示", {
  471. confirmButtonText: "确定",
  472. cancelButtonText: "取消",
  473. type: "warning"
  474. });
  475. // 用户确认取消
  476. fileList.value = [];
  477. imageUrlList.value = [];
  478. pendingUploadFiles.value = [];
  479. uploading.value = false;
  480. replaceDialogVisible.value = false;
  481. } catch {
  482. // 用户取消操作,不做任何处理
  483. }
  484. } else {
  485. replaceDialogVisible.value = false;
  486. }
  487. };
  488. const handleReplaceDialogClose = async (done: () => void) => {
  489. // 如果有图片正在上传,阻止关闭
  490. if (hasUnuploadedImages.value) {
  491. ElMessage.warning("请等待图片上传完成后再关闭");
  492. return; // 不调用 done(),阻止关闭弹窗
  493. }
  494. if (fileList.value.length > 0) {
  495. try {
  496. await ElMessageBox.confirm("确定要取消本次图片上传吗?已上传的图片将不保存", "提示", {
  497. confirmButtonText: "确定",
  498. cancelButtonText: "取消",
  499. type: "warning"
  500. });
  501. // 用户确认取消,清空数据并关闭弹窗
  502. fileList.value = [];
  503. imageUrlList.value = [];
  504. pendingUploadFiles.value = [];
  505. uploading.value = false;
  506. done(); // 调用 done() 允许关闭弹窗
  507. } catch {
  508. // 用户取消操作,不调用 done(),阻止关闭弹窗
  509. }
  510. } else {
  511. // 没有文件,直接关闭
  512. done();
  513. }
  514. };
  515. const handleSubmitReplace = async () => {
  516. // 检查是否有未上传完成的图片
  517. if (hasUnuploadedImages.value) {
  518. ElMessage.warning("请等待图片上传完成后再提交");
  519. return;
  520. }
  521. if (fileList.value.length === 0) {
  522. ElMessage.warning("请先上传图片");
  523. return;
  524. }
  525. const uploadedFiles = fileList.value.filter(file => file.status === "success");
  526. if (uploadedFiles.length === 0) {
  527. ElMessage.warning("请先上传图片");
  528. return;
  529. }
  530. try {
  531. // 只提交单张图片,排序为0
  532. const imageDataWithSort = uploadedFiles.map((file, index) => ({
  533. imgUrl: file.url,
  534. imgSort: index,
  535. storeId: localGet("createdId")
  536. }));
  537. await submitFoodLicenseReview(imageDataWithSort[0]);
  538. ElMessage.success("提交审核成功");
  539. replaceDialogVisible.value = false;
  540. fileList.value = [];
  541. imageUrlList.value = [];
  542. pendingUploadFiles.value = [];
  543. uploading.value = false;
  544. await initData();
  545. } catch (error) {
  546. ElMessage.error("提交审核失败");
  547. }
  548. };
  549. const getStatusClass = (status: string) => {
  550. const statusInfo = statusMap[status];
  551. return statusInfo ? statusInfo.class : "";
  552. };
  553. const getStatusText = (status: string) => {
  554. const map: Record<string, string> = {
  555. pending: "审核中",
  556. success: "审核通过",
  557. failed: "审核拒绝"
  558. };
  559. return map[status] || "未知";
  560. };
  561. </script>
  562. <style lang="scss" scoped>
  563. .page-header {
  564. margin-bottom: 20px;
  565. }
  566. .store-title {
  567. margin: 0;
  568. font-size: 24px;
  569. font-weight: 600;
  570. color: var(--el-text-color-primary);
  571. }
  572. .content-section {
  573. display: flex;
  574. align-items: center;
  575. justify-content: space-between;
  576. width: 100%;
  577. margin-top: 20px;
  578. margin-bottom: 50px;
  579. }
  580. .tip-text {
  581. font-size: 18px;
  582. color: var(--el-text-color-regular);
  583. }
  584. .action-buttons {
  585. display: flex;
  586. flex-shrink: 0;
  587. gap: 10px;
  588. }
  589. .license-container {
  590. padding: 20px;
  591. background-color: var(--el-bg-color-page);
  592. border-radius: 8px;
  593. }
  594. .license-display {
  595. display: flex;
  596. align-items: center;
  597. justify-content: center;
  598. width: 700px;
  599. height: 500px;
  600. }
  601. .license-image {
  602. width: 100%;
  603. height: 100%;
  604. border-radius: 8px;
  605. box-shadow: 0 2px 12px rgb(0 0 0 / 10%);
  606. }
  607. .empty-image-box {
  608. display: flex;
  609. align-items: center;
  610. justify-content: center;
  611. width: 100%;
  612. height: 100%;
  613. background-color: var(--el-fill-color-lighter);
  614. border-radius: 8px;
  615. .empty-icon {
  616. font-size: 64px;
  617. color: var(--el-text-color-placeholder);
  618. }
  619. }
  620. .empty-license {
  621. display: flex;
  622. align-items: center;
  623. justify-content: center;
  624. min-height: 570px;
  625. padding: 40px 20px;
  626. }
  627. .replace-upload-area {
  628. .upload-tip {
  629. margin-bottom: 10px;
  630. }
  631. min-height: 300px;
  632. // padding: 20px;
  633. :deep(.el-upload-list--picture-card .el-upload-list__item:hover .el-upload-list__item-status-label) {
  634. display: inline-flex !important;
  635. opacity: 1 !important;
  636. }
  637. :deep(.el-upload-list__item.is-success:focus .el-upload-list__item-status-label) {
  638. display: inline-flex !important;
  639. opacity: 1 !important;
  640. }
  641. :deep(.el-upload-list--picture-card .el-icon--close-tip) {
  642. display: none !important;
  643. }
  644. &.upload-full {
  645. :deep(.el-upload--picture-card) {
  646. display: none !important;
  647. }
  648. }
  649. }
  650. .dialog-footer {
  651. display: flex;
  652. gap: 10px;
  653. justify-content: center;
  654. }
  655. /* el-upload 图片预览铺满容器 */
  656. :deep(.el-upload-list--picture-card) {
  657. .el-upload-list__item {
  658. overflow: hidden;
  659. .el-upload-list__item-thumbnail {
  660. width: 100%;
  661. height: 100%;
  662. object-fit: fill;
  663. }
  664. }
  665. /* 排队中(未上传)的图片禁用样式 */
  666. .el-upload-list__item[data-status="ready"],
  667. .el-upload-list__item.is-ready {
  668. position: relative;
  669. pointer-events: none;
  670. cursor: not-allowed;
  671. opacity: 0.6;
  672. &::after {
  673. position: absolute;
  674. inset: 0;
  675. z-index: 1;
  676. content: "";
  677. background-color: rgb(0 0 0 / 30%);
  678. }
  679. .el-upload-list__item-actions {
  680. pointer-events: none;
  681. opacity: 0.5;
  682. }
  683. }
  684. }
  685. .upload-trigger-card {
  686. display: flex;
  687. flex-direction: column;
  688. align-items: center;
  689. justify-content: center;
  690. width: 100%;
  691. height: 100%;
  692. font-size: 28px;
  693. color: #8c939d;
  694. .upload-tip {
  695. margin-top: 8px;
  696. font-size: 14px;
  697. color: #8c939d;
  698. }
  699. }
  700. .change-record-scrollbar {
  701. :deep(.el-scrollbar__wrap) {
  702. overflow-x: hidden;
  703. }
  704. }
  705. .change-record-content {
  706. .record-group {
  707. padding: 20px;
  708. margin-bottom: 30px;
  709. background-color: var(--el-fill-color-lighter);
  710. &:last-child {
  711. margin-bottom: 0;
  712. }
  713. .record-date {
  714. margin-bottom: 15px;
  715. font-size: 16px;
  716. font-weight: 500;
  717. color: var(--el-text-color-primary);
  718. }
  719. .record-items {
  720. display: flex;
  721. flex-wrap: wrap;
  722. gap: 15px;
  723. }
  724. .record-item {
  725. position: relative;
  726. width: 150px;
  727. height: 150px;
  728. overflow: hidden;
  729. border-radius: 8px;
  730. .record-status-badge {
  731. position: absolute;
  732. right: 0;
  733. bottom: 0;
  734. left: 0;
  735. z-index: 1;
  736. padding: 4px 8px;
  737. font-size: 12px;
  738. font-weight: 500;
  739. text-align: center;
  740. border-radius: 0 0 8px 8px;
  741. &.status-pending {
  742. color: #e6a23c;
  743. background-color: rgb(253 246 236 / 90%);
  744. border-top: 1px solid #e6a23c;
  745. }
  746. &.status-success {
  747. color: #67c23a;
  748. background-color: rgb(240 249 255 / 90%);
  749. border-top: 1px solid #67c23a;
  750. }
  751. &.status-failed {
  752. color: #f56c6c;
  753. background-color: rgb(254 240 240 / 90%);
  754. border-top: 1px solid #f56c6c;
  755. }
  756. }
  757. .record-image {
  758. width: 100%;
  759. height: 100%;
  760. .image-slot {
  761. display: flex;
  762. align-items: center;
  763. justify-content: center;
  764. width: 100%;
  765. height: 100%;
  766. font-size: 30px;
  767. color: var(--el-text-color-placeholder);
  768. background: var(--el-fill-color-light);
  769. }
  770. }
  771. }
  772. .rejection-reason {
  773. margin-top: 15px;
  774. font-size: 14px;
  775. font-weight: 500;
  776. color: var(--el-text-color-regular);
  777. border-radius: 8px;
  778. }
  779. }
  780. }
  781. .empty-record {
  782. display: flex;
  783. align-items: center;
  784. justify-content: center;
  785. min-height: 300px;
  786. padding: 40px 20px;
  787. }
  788. </style>