Explorar el Código

fix: 瀑布流不传brand,只传brandId

jinx hace 1 año
padre
commit
8a07e4594e

+ 3 - 1
packages/app-cdfg/src/components/Tags/tag-info.vue

@@ -164,9 +164,11 @@ const content = computed({
 })
 //删除品牌信息
 const delBrand = () => {
-    if (hotData.value.brand && hotData.value.brandId) {
+    // if (hotData.value.brand && hotData.value.brandId) {
+    if (hotData.value.brand) {
         delete hotData.value.brand
         delete hotData.value.brandId
+        // console.error(hotData.value)
     }
 }
 const closeLink = () => {

+ 43 - 33
packages/app-cdfg/src/store/modules/tag.js

@@ -764,7 +764,7 @@ export default {
         },
         async save({ state, commit, dispatch }, payload) {
             if (state.hotData) {
-                if (state.hotData.type == 'waterfall' && !state.hotData.brandId) {
+                if (state.hotData.type == 'waterfall' && !state.hotData.brand) {
                     return Promise.reject({ type: 'toast', tips: 'warn', msg: 'tag.toolbox.chooseBrand' })
                 }
                 if (state.hotData.title.trim() == '') {
@@ -946,11 +946,18 @@ export default {
 
                 let addparams = {}
                 addparams['hotType'] = customized[type].hotType
-
+                let newBrand = null
                 //处理商品关联id
                 if (type != 'waterfall') {
                     delete hotData.brandId
                     delete hotData.brand
+                } else {
+                    if (hotData.brandId && hotData.brand) {
+                        addparams['brandId'] = hotData.brandId
+                        newBrand = hotData.brand
+                        delete hotData.brandId
+                        delete hotData.brand
+                    }
                 }
                 if (type === 'commodity' || type === 'waterfall' || type === 'exhibits') {
                     addparams['relationIds'] = hotData.products.map(item => item.id)
@@ -988,18 +995,18 @@ export default {
                                     delete hotData.visiblePanos
                                 }
                                 let data = null
-                                if (hotData.brandId) {
-                                    data = {
-                                        sid: hotData.sid,
-                                        brandId: hotData.brandId,
-                                        hotData: JSON.stringify(hotData),
-                                    }
-                                } else {
-                                    data = {
-                                        sid: hotData.sid,
-                                        hotData: JSON.stringify(hotData),
-                                    }
+                                // if (hotData.brandId) {
+                                //     data = {
+                                //         sid: hotData.sid,
+                                //         brandId: hotData.brandId,
+                                //         hotData: JSON.stringify(hotData),
+                                //     }
+                                // } else {
+                                data = {
+                                    sid: hotData.sid,
+                                    hotData: JSON.stringify(hotData),
                                 }
+                                // }
                                 tagList.push(data)
                             }
                         }
@@ -1007,26 +1014,26 @@ export default {
 
                     // state.changeTagsList = []
                 } else {
-                    if (hotData.brandId) {
-                        tagList.push({
-                            sid: hotData.sid,
-                            brandId: hotData.brandId,
-                            hotData: JSON.stringify({
-                                ...hotData,
-                                products: [],
-                            }),
-                            ...addparams,
-                        })
-                    } else {
-                        tagList.push({
-                            sid: hotData.sid,
-                            hotData: JSON.stringify({
-                                ...hotData,
-                                products: [],
-                            }),
-                            ...addparams,
-                        })
-                    }
+                    // if (hotData.brandId) {
+                    //     tagList.push({
+                    //         sid: hotData.sid,
+                    //         brandId: hotData.brandId,
+                    //         hotData: JSON.stringify({
+                    //             ...hotData,
+                    //             products: [],
+                    //         }),
+                    //         ...addparams,
+                    //     })
+                    // } else {
+                    tagList.push({
+                        sid: hotData.sid,
+                        hotData: JSON.stringify({
+                            ...hotData,
+                            products: [],
+                        }),
+                        ...addparams,
+                    })
+                    // }
                 }
 
                 console.error(hotData)
@@ -1046,6 +1053,9 @@ export default {
                 }
                 let data = await dispatch('svaeTag', params)
                 if (data.success) {
+                    if (newBrand) {
+                        hotData.brand = newBrand
+                    }
                     commit('save', hotData)
                 }
                 return data