Explorar o código

修复:编辑页批量设置SKU会把图片清空

Martin %!s(int64=5) %!d(string=hai) anos
pai
achega
559832c84e
Modificáronse 1 ficheiros con 8 adicións e 4 borrados
  1. 8 4
      src/common/model/goods/MultiSpec.js

+ 8 - 4
src/common/model/goods/MultiSpec.js

@@ -283,9 +283,9 @@ export default class MultiSpec {
   handleSkuBatch () {
     const skuBatchForm = this.getFilterObject(this.multiSpecData.skuBatchForm)
     const skuList = this.multiSpecData.skuList
-    if (!skuBatchForm.image_id) {
-      delete skuBatchForm.image
-    }
+    // if (!skuBatchForm.image_id) {
+    //   delete skuBatchForm.image
+    // }
     console.log('skuBatchForm', skuBatchForm)
     for (const index in skuList) {
       skuList[index] = { ...skuList[index], ...skuBatchForm }
@@ -303,7 +303,11 @@ export default class MultiSpec {
     const newObj = {}
     for (const key in object) {
       const value = object[key]
-      if (!isEmpty(value) || value === 0) {
+      // value === 0 可以不过滤image_id为0的情况
+      // if (!isEmpty(value) || value === 0) {
+      //   newObj[key] = value
+      // }
+      if (!isEmpty(value)) {
         newObj[key] = value
       }
     }