huangmp 1 năm trước cách đây
mục cha
commit
3025cae7ef
1 tập tin đã thay đổi với 23 bổ sung9 xóa
  1. 23 9
      src/views/modules/prod/sku-tag.vue

+ 23 - 9
src/views/modules/prod/sku-tag.vue

@@ -185,6 +185,7 @@
 import { validNoEmptySpace } from '@/utils/validate'
 import { getUUID } from '@/utils'
 import ImgUpload from '@/components/img-upload'
+import prod from "../../../store/modules/prod";
 export default {
   components: {
     ImgUpload
@@ -445,15 +446,28 @@ export default {
           }
           let tagItemNameIndex = skuTags[j].tagItems.findIndex((tagItemName) => tagItemName.propValue === cnProperties[1])
           if (tagItemNameIndex === -1) {
-            const extarlInfo = +j === propertiesArray.length - 1 ? { pic: picMapArr[j] } : {}
-            // const extarlInfo = +j === 0 ? { pic: imgSrc } : {}
-            skuTags[j].tagItems.push({
-              pic: picMapArr[j],
-              propValue: cnProperties[1],
-              propValueEn: cnPropertiesEn[1],
-              ...extarlInfo
-              // pic: imgSrc
-            })
+            let extarlInfo = undefined
+            if(picMapArr.length > 0){
+              extarlInfo = +j === propertiesArray.length - 1 ? { pic: picMapArr[j] } : {}
+            }else{
+              extarlInfo = +j === 0 ? { pic: imgSrc } : {}
+            }
+            if(picMapArr.length > 0){
+              skuTags[j].tagItems.push({
+                pic: picMapArr[j],
+                propValue: cnProperties[1],
+                propValueEn: cnPropertiesEn[1],
+                ...extarlInfo
+                // pic: imgSrc
+              })
+            }else{
+              skuTags[j].tagItems.push({
+                propValue: cnProperties[1],
+                propValueEn: cnPropertiesEn[1],
+                ...extarlInfo
+                // pic: imgSrc
+              })
+            }
           }
         }
       }