From 32d4d92e4d8f3c4860ee96c1751469752784983b Mon Sep 17 00:00:00 2001 From: wtq <2394975549@qq.com> Date: Fri, 28 Nov 2025 14:59:34 +0800 Subject: [PATCH] '!' --- .../jxGoodManager/goodSet/goodSet.vue | 247 +++++++++++++++--- 1 file changed, 215 insertions(+), 32 deletions(-) diff --git a/src/components/goodmanager/jxGoodManager/goodSet/goodSet.vue b/src/components/goodmanager/jxGoodManager/goodSet/goodSet.vue index 6570cc6..0bdc2c3 100644 --- a/src/components/goodmanager/jxGoodManager/goodSet/goodSet.vue +++ b/src/components/goodmanager/jxGoodManager/goodSet/goodSet.vue @@ -302,6 +302,7 @@ @@ -311,7 +312,7 @@
-
美团属性列表
+
美团属性列表
-
抖店属性列表
@@ -385,7 +385,7 @@ :options="ddItem.options" :value="ddItem.selectedValue" clearable - @change="changeDDCategoryData($event,ddItem,ddIndex)" + @change="changeDDCategoryData($event,ddItem,ddIndex,'DD')" filterable style="width: 300px;" > @@ -394,6 +394,70 @@
+ + +
+
饿百属性列表
+
+ + + + + + + + + + + + + + +
+
@@ -758,9 +822,14 @@ export default { value: "value", label: "name" }, + propsCmpEB:{ + value: "ValueId", + label: "valueData" + }, reShowImg: true, // 是否显示图片上传框 mtwmCategoryData:[], // 分类属性 MT - ddCategoryData:[], // 分类属性 DD + ddCategoryData:[], // 分类属性 DD + ebCategoryData:[], // 分类属性 EB mtKeyword:'', // 美团 关键字 showSearchUpcByName: false, // 查询商品 dialog by UPC sellPointTimes:"", // 卖点展示期 @@ -771,13 +840,16 @@ export default { skus2:[], skuNameString2:"", productRule:"", - specialPictures:"" // 特殊图片,美团 + specialPictures:"", // 特殊图片,美团 + // 折叠面板---------------------activeNames + // activeNames:['1'] } }, async created() { // 清空数据 this.mtwmCategoryData = [] this.ddCategoryData = [] + this.ebCategoryData = [] // 获取服务信息 getServiceInfo((res) => { @@ -837,8 +909,12 @@ export default { await this.changeCategory('MT',[reqSkuName.mtwmCategoryID]) if(reqSkuName.mtAttribute && reqSkuName.mtAttribute !== 'null') this.categoryDataGet(reqSkuName.mtAttribute,'MT') } - - if(reqSkuName.ebaiCategoryID) this.getClass('EB') // 饿百 + + if(reqSkuName.ebaiCategoryID) { + await this.getClass('EB') // 饿百 + await this.changeCategory('EB',[reqSkuName.ebaiCategoryID]) + if(reqSkuName.ebaiAttribute) this.categoryDataGet(reqSkuName.ebaiAttribute,'EB') + } // 拷贝 props item 给 skuName for (let attr in this.skuName) { @@ -1068,11 +1144,6 @@ export default { ...mapGetters({ // isNewPriceDisplay: "isNewPriceDisplay", cityData:"jxStorePick/allCity", - jDCategoryData:"jDCategoryData", - jGCategoryData:"jGCategoryData", - mTCategoryData:"mTCategoryData", - dYCategoryData:"dYCategoryData", - eBCategoryData:"eBCategoryData", getDns:"getDns" }), // 是否全国可售转换 @@ -1129,7 +1200,7 @@ export default { } } }) - }else{ + }else if(type === 'DD'){ if(!this.ddCategoryData) return for(let i in JSON.parse(e)){ this.ddCategoryData.map((item,index)=>{ @@ -1138,6 +1209,38 @@ export default { } }) } + }else if(type === 'EB'){ + console.log(this.ebCategoryData,'JSON.parse(e)',JSON.parse(e)) + if(!this.ebCategoryData) return + JSON.parse(e).forEach(item => { + let findIndex = this.ebCategoryData.findIndex(i => i.propertyId === item.propertyId) + if(findIndex !== -1){ + console.log(item,'this.ebCategoryData[findIndex]',this.ebCategoryData[findIndex]) + if(item.propertyValues.length === 1 && !item.propertyValues[0].valueId) this.ebCategoryData[findIndex].selectedValue = item.propertyValues[0].valueData + else if(item.propertyValues.length === 1 && item.propertyValues[0].valueId){ + this.ebCategoryData[findIndex].selectedValue= { + ValueId:item.propertyValues[0].valueId, + valueData:item.propertyValues[0].valueData + } + }else{ + let arr = [] + item.propertyValues.forEach(i => { + arr.push({ + ValueId:i.valueId, + valueData:i.valueData + }) + }) + this.ebCategoryData[findIndex].selectedValue = arr + } + } + }) + // for(let i in JSON.parse(e)){ + // this.ebCategoryData.map((item,index)=>{ + // if(+i === item.propertyId){ + // this.ebCategoryData[index].selectedValue = JSON.parse(e)[i][0].value + // } + // }) + // } } }, // 修改商品************************ @@ -1161,26 +1264,39 @@ export default { this.$refs['goodManager'].validateField('MT' + item.attr_name + this.skuName.mtwmCategoryID) }else if(item.required && type === 'DD'){ this.$refs['goodManager'].validateField('DD' + item.property_name) + }else if(item.required && type === 'EB'){ + this.$refs['goodManager'].validateField('EB' + item.propertyName) } }, // 抖店 级联选择器赋值 - changeDDCategoryData(e,item,i){ - this.ddCategoryData[i].selectedValue = e - if(this.validNum) this.formPartValidate(item,'DD') // 校验选择器的值 + changeDDCategoryData(e,item,i,type){ + if(type === 'DD'){ + this.ddCategoryData[i].selectedValue = e + if(this.validNum) this.formPartValidate(item,'DD') // 校验选择器的值 + }else if(type === 'EB'){ + this.ebCategoryData[i].selectedValue = e + if(this.validNum) this.formPartValidate(item,'EB') // 校验选择器的值 + } + }, // 美团 品牌 / 产地 - async getMtAttr(item, index) { - if ((item.attr_id + '') == '1200000088' || (item.attr_id + '') == "1200000094") { - if (!this.mtKeyword) return this.$toast('请输入关键词') - let res = await api(`v2/sku/GetMTCategoryAttrValueList?attrId=${item.attr_id}&keyword=${this.mtKeyword}&appOrgCode=589`) - if (res && res.length > 0) { - this.mtwmCategoryData[index].value_list = res - } else { - this.mtwmCategoryData[index].value_list = [{ value_id: '-1', value:'其他'}] + async getMtAttr(item, index,type) { + if(type === 'MT'){ + if ((item.attr_id + '') == '1200000088' || (item.attr_id + '') == "1200000094") { + if (!this.mtKeyword) return this.$toast('请输入关键词') + let res = await api(`v2/sku/GetMTCategoryAttrValueList?attrId=${item.attr_id}&keyword=${this.mtKeyword}&appOrgCode=589`) + if (res && res.length > 0) { + this.mtwmCategoryData[index].value_list = res + } else { + this.mtwmCategoryData[index].value_list = [{ value_id: '-1', value:'其他'}] + } + hideLoad() } - hideLoad() + }else if(type === 'EB'){ + } + }, // 返回到初始化商品 btnPrev(){ @@ -1320,9 +1436,10 @@ export default { let categoryID = e[e.length - 1] if(type === 'MT') { this.mtwmCategoryData = [] + this.productRule = "" if(!categoryID) return // console.log('查询商品发布规则',categoryID) - let productRuleRes = await api(`v2/sku/GetMTProductRule?mtCategoryId=${+categoryID}`) // https://tscc.meituan.com/home/doc/market/10168 + let productRuleRes = await api(`v2/sku/GetMTProductRule?categoryId=${+categoryID}&vendorId=1`) // https://tscc.meituan.com/home/doc/market/10168 this.productRule = { ...productRuleRes, unstruct_rules:{ @@ -1390,7 +1507,7 @@ export default { }) } this.mtKeyword = this.skuName.name - }else{ + }else if(type === 'DD'){ this.ddCategoryData = [] if(!categoryID) return let res = await api(`v2/sku/GetTiktokCategoryValue?categoryId=${categoryID}&vendorOrgCode=${this.getDns === 'gblm' ? 68023619 : 57939570}`); @@ -1422,6 +1539,26 @@ export default { let newDesc = res.desc.includes('调整升级') ? '抖店类目' + res.desc.substring(3) : res.desc msgWarning(newDesc); } + }else if(type === 'EB'){ + this.ebCategoryData = [] + if(!categoryID) return + // https://open-retail.ele.me/#/apidoc/me.ele.retail:sku.category.property.list-3?aopApiCategory=item_cate&type=item_all + let productRuleRes = await api(`v2/sku/GetMTProductRule?categoryId=${+categoryID}&vendorId=3`) // https://tscc.meituan.com/home/doc/market/10168 + if(productRuleRes && productRuleRes.length){ + productRuleRes.forEach(item => { + this.ebCategoryData.push({ + ...item, + selectedValue:item.propertyValues && item.propertyValues.length>0 ? [] : '' + }) + + if(item.required) { + this.rules['EB' + item.propertyName ] = [ { validator:(rule, value, callback) => { + if(this.ebCategoryData[index].selectedValue.length === 0) callback(`${item.propertyName}必填`) + else callback() + }, trigger: 'blur'}] + } + }) + } } hideLoad() }, @@ -1451,6 +1588,7 @@ export default { if(this.skuName.mtwmCategoryID) data['mtAttribute'] = this.classList('MT') // 美团属性列表 if(this.skuName.ddCategoryID) data['tiktokAttribute'] = this.classList('DD') // 抖店属性列表 + if(this.skuName.ebaiCategoryID) data['ebaiAttribute'] = this.classList('EB') // 抖店属性列表 if (this.skuName.places.indexOf("") !== -1) { data["isGlobal"] = 1; @@ -1481,7 +1619,6 @@ export default { // 处理特殊图片 if(this.productRule){ - // data['specialPictures'] = '' // JSON 数组字符串 item:object let specialPictures = [] this.productRule.unstruct_rules.special_pictures_rules.forEach(i => { specialPictures.push({ @@ -1493,6 +1630,8 @@ export default { }) data['specialPictures'] = JSON.stringify(specialPictures) } + console.log('保存商品时的参数信息',data) + // return if(this.currentPage === 'createGood'){ AddSkuName(data, (res) => { if (res.code === "0") { @@ -1576,7 +1715,7 @@ export default { }) } }) - }else{ + }else if(type === 'DD'){ result = {} // 抖店 if(this.ddCategoryData && this.ddCategoryData.length>0){ @@ -1587,6 +1726,50 @@ export default { } }) } + }else if(type === 'EB'){ + // result = {} + // // 饿百 + // if(this.ebCategoryData && this.ebCategoryData.length>0){ + // this.ebCategoryData.forEach(item => { + // if((typeof item.selectedValue === 'string' && item.selectedValue.length>0) || typeof item.selectedValue === 'object') result[item.propertyId] = [{ value:item.selectedValue,name:item.propertyName }] + // }) + // } + result = [] + // 饿百 + if(this.ebCategoryData && this.ebCategoryData.length>0){ + this.ebCategoryData.forEach(item => { + if((typeof item.selectedValue === 'string' && item.selectedValue.length>0) || typeof item.selectedValue === 'object') { + // let propertyValues = Array.isArray(item.selectedValue) || (typeof item.selectedValue === 'string' && item.selectedValue.length>0) ? item.selectedValue : [item.selectedValue] + let propertyValues = "" + if(typeof item.selectedValue === 'string' && item.selectedValue.length>0) { + // propertyValues = item.selectedValue + propertyValues = [{ + valueId:"", + valueData:item.selectedValue + }] + }else if(!Array.isArray(item.selectedValue)) { + propertyValues = [{ + valueId:item.selectedValue.ValueId, + valueData:item.selectedValue.valueData + }] + }else { + propertyValues = [] + item.selectedValue.forEach(i => { + propertyValues.push({ + valueId:i.ValueId, + valueData:i.valueData + }) + }) + } + + result.push({ + propertyId:item.propertyId, + propertyName:item.propertyName, + propertyValues + }) + } + }) + } } return JSON.stringify(result)