Prechádzať zdrojové kódy

新增商品:必须上传商品规格图片

Xiao_123 8 mesiacov pred
rodič
commit
320c2ed6ce
1 zmenil súbory, kde vykonal 5 pridanie a 0 odobranie
  1. 5 0
      src/views/mall/product/spu/form/index.vue

+ 5 - 0
src/views/mall/product/spu/form/index.vue

@@ -175,6 +175,11 @@ const submitForm = async () => {
       typeof item === 'object' ? newSliderPicUrls.push(item.url) : newSliderPicUrls.push(item)
     })
     deepCopyFormData.sliderPicUrls = newSliderPicUrls
+
+    // 判断sku图片是否有上传
+    const hasPicUrl = deepCopyFormData.skus?.every(e => e.picUrl)
+    if (!hasPicUrl) return message.warning('请将规格列表中的图片上传完整')
+    
     // 校验都通过后提交表单
     const data = deepCopyFormData as ProductSpuApi.Spu
     const id = params.id as unknown as number