Selaa lähdekoodia

```
feat(store): 优化门店审核与头图展示逻辑

- 调整 AI 审核提示信息,使用接口返回的 msg 字段提升提示准确性
- 修改门店地址字段提交逻辑,统一使用 storeAddress 并修正赋值来源
- 优化门店头图组件中 OCR 识别逻辑,绑定商户名称并改进错误处理
- 增加获取门店详情方法,用于初始化 imgMode 和 storeName 数据
- 在图片上传组件中新增 on-success 回调以触发 OCR 识别
- 修复头图模式切换逻辑,确保根据接口返回值正确设置默认模式
- 清理冗余代码,移除无效的 storeDetailAddress 提交字段
```

zhuli 1 viikko sitten
vanhempi
commit
425846b663

+ 5 - 4
src/views/home/components/go-flow.vue

@@ -1293,8 +1293,8 @@ const handleAi = async () => {
     userId: userInfo.id
   };
   const res: any = await getAiapprovestoreInfo(params);
-  if (res && res.code == 200) {
-    ElMessage.success("AI智能审核通过");
+  if (res.code == 200) {
+    ElMessage.success(res.msg || "AI智能审核成功");
   } else {
     ElMessage.error(res?.msg || "AI智能审核失败");
   }
@@ -1407,7 +1407,8 @@ const handleSubmit = async () => {
         storeCapacity: step2Form.storeCapacity,
         storeArea: storeAreaNum,
         isChain: step2Form.isChain,
-        storeDetailAddress: step2Form.storeDetailAddress,
+        // storeDetailAddress: step2Form.storeDetailAddress,
+        storeAddress: step2Form.storeDetailAddress,
         storeBlurb: step2Form.storeBlurb,
         businessSection: step2Form.businessSection,
         businessTypesList: finalBusinessTypes,
@@ -1418,7 +1419,7 @@ const handleSubmit = async () => {
         contractImageList: contractImageUrls,
         foodLicenceImgList: foodLicenceUrls,
         disportLicenceUrls: disportLicenceUrls,
-        storeAddress: fullStoreAddress,
+        // storeAddress: fullStoreAddress,
         whereAddress: whereAddress,
         updatedTime: null,
         queryAddress: queryAddress.value,

+ 30 - 4
src/views/storeDecoration/storeHeadMap/index.vue

@@ -146,12 +146,16 @@ import UploadImg from "@/components/Upload/Img.vue";
 import UploadImgs from "@/components/Upload/Imgs.vue";
 import { uploadImg, getStoreOcrData } from "@/api/modules/newLoginApi";
 import { getStoreHeadImg, saveStoreHeadImg } from "@/api/modules/storeDecoration";
+import { getDetail } from "@/api/modules/homeEntry";
 import { localGet } from "@/utils";
 
 const loading = ref(false);
 const singleFormRef = ref<FormInstance>();
 const multipleFormRef = ref<FormInstance>();
 const sortableInstance = ref<Sortable | null>(null);
+
+const imgModeActive = ref(null);
+const storeName = ref("");
 const handleStoreOcrAfterUploadMore = async (imageUrl: string) => {
   try {
     await handleStoreOcr({ imageUrl });
@@ -173,11 +177,11 @@ const handleStoreOcrAfterUpload = async (imageUrl: string) => {
 
 const handleStoreOcr = async (params: { imageUrl: string }) => {
   try {
-    const res: any = await getStoreOcrData({ imageUrl: params.imageUrl, storeUserId: localGet("geeker-user")?.userInfo.storeId });
-    if (res && (res.code === 200 || res.code === "200") && res.data) {
+    const res: any = await getStoreOcrData({ imageUrl: params.imageUrl, merchantName: storeName.value });
+    if (res.code === 200) {
       ElNotification({
         title: "OCR识别成功",
-        message: `识别结果: ${res.data.recognizedText || "无"}`,
+        message: `识别结果: ${res.msg || "无"}`,
         type: "success",
         duration: 5000
       });
@@ -464,9 +468,23 @@ const getStoreHeadImgData = async () => {
     console.error("获取头图失败:", error);
   }
 };
-
+const handleDetail = async () => {
+  try {
+    let param = {
+      id: localGet("geeker-user")?.userInfo.storeId
+    };
+    const res: any = await getDetail(param as any);
+    if (res.code == 200) {
+      imgModeActive.value = res.data.imgMode;
+      storeName.value = res.data.storeName;
+    }
+  } catch (error) {
+    console.error("未找到用户信息:", error);
+  }
+};
 // 页面初始化时获取数据
 onMounted(async () => {
+  await handleDetail();
   await getStoreHeadImgData();
 
   // 标记初始化完成
@@ -549,6 +567,14 @@ const handleSave = async () => {
         type: "success",
         duration: 3000
       });
+
+      // 根据返回的imgModeActive值设置当前模式
+      // 0表示单图模式,其他值表示多图模式
+      if (result.data && result.data.imgMode !== undefined) {
+        mode.value = result.data.imgMode === 0 ? "single" : "multiple";
+      } else if (imgModeActive.value !== null) {
+        mode.value = imgModeActive.value === 0 ? "single" : "multiple";
+      }
     } else {
       ElMessage.error(result?.msg || "保存失败");
     }