hurx 1 өдөр өмнө
parent
commit
aa67a34fc7

+ 21 - 11
src/views/enterprisePurchase/index.vue

@@ -3100,15 +3100,25 @@ const submitAdForm = async () => {
     sortOrder: currentAdIdx.value,
     adModuleItemList: adForm.items
       .filter((item: any) => item.name || item.image)
-      .map((item: any) => ({
-        productId: item.productId || item.id,
-        productName: item.name || '',
-        imageUrl: item.image || '',
-        price: item.price || 0,
-        tagText: item.tag || '',
-        tagLink: item.tagLink || item.link || '',
-        salesCount: item.sales || ''
-      }))
+      .map((item: any) => {
+        // 企采榜单、品牌好店:不上传 productId,仅保存图片/标签/跳转等自定义字段
+        if (currentAdIdx.value === 1 || currentAdIdx.value === 2) {
+          return {
+            productName: '',
+            imageUrl: item.image || '',
+            tagText: item.tag || '',
+            tagLink: item.link || '',
+            salesCount: item.sales || ''
+          };
+        }
+        // 其他模块:保存商品关联信息
+        return {
+          productId: item.id || '',
+          productName: item.name || '',
+          imageUrl: item.image || '',
+          price: item.price || 0
+        };
+      })
   };
 
   try {
@@ -3158,7 +3168,7 @@ const getAdModuleList = async () => {
           tag: sub.tagText || sub.tag || '',
           sales: sub.sales || sub.salesCount || '',
           price: sub.price || 0,
-          link: sub.linkUrl || sub.link || ''
+          link: sub.linkUrl || sub.tagLink || sub.link || ''
         }))
       }));
       // 确保始终有 5 个模块(模板固定访问 adModules[0]~[4])
@@ -3581,7 +3591,7 @@ const getProductList = async () => {
   try {
     if (selectDialogVisible.value && currentAdIdx.value === 2) {
       // 品牌好店:查询品牌
-      brandQueryParams.brandName = productQueryParams.itemName;
+      // brandQueryParams.brandName = productQueryParams.itemName;
       brandQueryParams.pageNum = productQueryParams.pageNum;
       brandQueryParams.pageSize = productQueryParams.pageSize;
       const res = await listBrand(brandQueryParams);