define({ template: `
规格信息
添加
排序大的显示在前面,图片建议尺寸:请上传,或正方形图片,文字最多显示12个
注意:如是发布商品,请先保存商品后才能进行关联规格,关联规格时注意规格有大的整体变动(例:删除某些规格项),如有也请先保存商品信息后再进行关联,否则可能关联到失效规格
`, props: { form: { default() { return {}; }, }, formKey: { type: String, }, }, data() { return { showSelectMaterialPopup: false, formFieldName: "", materialType: "", selNum: "one", select:"open", goods_options:[], spec_info:[], img_index:"", }; }, created() { this.goods_options = this.form.options; this.spec_info = this.form.specs_info; // console.log(this.goods_options,this.spec_info,'规格信息123') }, methods: { extraDate(){ return { 'extraContent':"商品描述" } }, displaySelectMaterialPopup(fieldName = "thumb",index,type = 1) { if(fieldName == 'other'){ this.selNum = 'more' }else{ this.selNum = 'one' } this.img_index = index; this.formFieldName = fieldName; this.showSelectMaterialPopup = !this.showSelectMaterialPopup; this.materialType = String(type); }, selectedMaterial(name, image, imageUrl) { let originalImageUrl = JSON.parse(JSON.stringify(imageUrl)) if (Array.isArray(imageUrl)) { imageUrl = imageUrl.map((item) => { return item.url; }); } console.log(originalImageUrl[0],this.img_index,this.formFieldName); this.spec_info[this.img_index][this.formFieldName] = originalImageUrl[0].attachment; this.spec_info[this.img_index][this.formFieldName+'_src'] = originalImageUrl[0].url; this.spec_info.push({}); this.spec_info.splice(this.spec_info.length-1,1) this.$forceUpdate(); }, changeGoodsImage(index,val) { this.goodsImagesChangeIndex = index; this.displayUploadImagePopup("images"); }, addSpecInfo() { this.spec_info.push({ goods_option_id:"", info_img:"", info_img_src:"", sort:"", content: [{content:""},{content:""},{content:""},{content:""},{content:""},{content:""}] }); }, delSpecInfo(index) { this.spec_info.splice(index,1); }, validate() { return { spec_info:this.spec_info ? this.spec_info : [] } }, }, });