| | |
| | | </template> |
| | | </div> |
| | | </vuedraggable> |
| | | <!-- todo 3--> |
| | | <Upload ref="uploadSku" action="-" |
| | | <!-- todo 3--> |
| | | <Upload ref="uploadSku" :action="uploadFileUrl" |
| | | v-if="val.images < 1" |
| | | :before-upload="handleBeforeUpload" |
| | | :format="['jpg', 'jpeg', 'png', 'webp']" |
| | | :max-size="2048" |
| | | :headers="{ ...accessToken }" |
| | | :on-error="() => { $Spin.hide(); }" |
| | | :on-exceeded-size="handleMaxSize" |
| | | :on-format-error="handleFormatError" |
| | |
| | | overflow-x: hidden; |
| | | } |
| | | "> |
| | | <template slot="sn" slot-scope="{ row }"> |
| | | <Input v-model="row.sn" clearable placeholder="请输入货号" |
| | | @on-change="updateSkuTable(row, 'sn')"/> |
| | | <template slot="sn" slot-scope="{ row, index }"> |
| | | <Input v-model="row.sn" placeholder="请输入货号" disabled |
| | | @on-change="updateSkuTable(row, 'sn')" /> |
| | | </template> |
| | | <div v-if="baseInfoForm.goodsType !== 'VIRTUAL_GOODS'" slot="weight" slot-scope="{ row }"> |
| | | <Input v-model="row.weight" clearable placeholder="请输入重量" |
| | |
| | | </div> |
| | | <FormItem class="form-item-view-el" label="PC商品描述" prop="intro" style="width: 100%"> |
| | | <editor |
| | | :show-upload="false" |
| | | :show-upload="true" |
| | | ref="editor" |
| | | v-model="baseInfoForm.intro" |
| | | height="800px" |
| | |
| | | |
| | | <FormItem class="form-item-view-el" label="移动端描述" prop="skuList" style="width: 100%"> |
| | | <editor |
| | | :show-upload="false" |
| | | :show-upload="true" |
| | | ref="introEditor" |
| | | v-model="baseInfoForm.mobileIntro" |
| | | height="800px" |
| | |
| | | } |
| | | }, |
| | | // sku图片上传前钩子 |
| | | // async handleBeforeUpload(file) { |
| | | // const check = |
| | | // this.selectedSku.images !== undefined && |
| | | // this.selectedSku.images.length > 5; |
| | | // if (check) { |
| | | // this.$Notice.warning({title: "图片数量不能大于五张"}); |
| | | // return false; |
| | | // } |
| | | // }, |
| | | // sku图片上传前钩子 |
| | | async handleBeforeUpload(file) { |
| | | const check = |
| | | this.selectedSku.images !== undefined && |
| | |
| | | this.$Message.error("已存在相同规格项!"); |
| | | return; |
| | | } |
| | | if (this.zz(0, val) > 20) { |
| | | this.$Message.error("规格值最多十个字符长度!"); |
| | | if (this.zz(0, val) > 30) { |
| | | this.$Message.error("规格值最多十五个字符长度!"); |
| | | // val = val.toString().slice(0, 4); |
| | | this.skuInfo[index].name = this.countCharacters(val, 10); |
| | | this.$forceUpdate();// 调用该方法会触发组件的重新渲染 |
| | |
| | | if (val.value === '') { |
| | | return; |
| | | } |
| | | if (this.zz(0, val.value) > 20) { |
| | | this.$Message.error("规格值最多十个字符长度!"); |
| | | if (this.zz(0, val.value) > 30) { |
| | | this.$Message.error("规格值最多十五个字符长度!"); |
| | | // val.value = val.value.toString().slice(0, 4); |
| | | this.skuInfo[$index].spec_values[index].value = this.countCharacters(val.value, 10); |
| | | this.$forceUpdate();// 调用该方法会触发组件的重新渲染 |
| | |
| | | this.baseInfoForm.regeneratorSkuFlag = true; |
| | | this.newSkuValues[$index] = ""; |
| | | } |
| | | this.renderTableData(this.skuTableData); |
| | | }, |
| | | handleClearSku() { |
| | | this.skuInfo = []; |
| | |
| | | * 渲染table所需要的column 和 data |
| | | */ |
| | | renderTableData(skus) { |
| | | console.log('-------------->销售类型',skus) |
| | | console.log('-------------->销售类型', skus) |
| | | this.skuTableColumn = []; |
| | | let pushData = []; |
| | | // 渲染头部 |
| | |
| | | ); |
| | | } |
| | | // 预售模式 |
| | | if (this.baseInfoForm.salesModel !== "PRESALE") { |
| | | pushData.push( |
| | | { |
| | | title: "预售时间", |
| | | slot: "price", |
| | | } |
| | | ); |
| | | } |
| | | // if (this.baseInfoForm.salesModel !== "PRESALE") { |
| | | // pushData.push( |
| | | // { |
| | | // title: "预售时间", |
| | | // slot: "price", |
| | | // } |
| | | // ); |
| | | // } |
| | | if (this.baseInfoForm.salesModel === "WHOLESALE" && this.wholesaleData) { |
| | | this.wholesaleData.forEach((item, index) => { |
| | | pushData.push({ |
| | |
| | | * array spec数据 |
| | | */ |
| | | specIterator(result, spec, skus) { |
| | | |
| | | let table = result; |
| | | if (spec.length > 0) { |
| | | //清除当前循环的分组 |
| | |
| | | } else { |
| | | this.skuIndex++; |
| | | } |
| | | |
| | | table.forEach((item,index) =>{ |
| | | console.log("元素:" + item +"index:" + (index +1)) |
| | | item.sn = index + 1; |
| | | }) |
| | | return table; |
| | | }, |
| | | /** 根据分类id获取系统设置规格信息*/ |
| | |
| | | return; |
| | | } |
| | | } |
| | | |
| | | // else if (item === "alertQuantity") { |
| | | // if ( |
| | | // !/^[0-9]\d*$/.test(row[item]) || |
| | |
| | | } |
| | | this.baseInfoForm.goodsId = this.goodsId; |
| | | let submit = JSON.parse(JSON.stringify(this.baseInfoForm)); |
| | | console.log('----------------->提交',submit); |
| | | console.log('----------------->提交', submit); |
| | | if ( |
| | | submit.goodsGalleryFiles && |
| | | submit.goodsGalleryFiles.length <= 0 |
| | | submit.goodsGalleryFiles.length <= 0 |
| | | ) { |
| | | this.submitLoading = false; |
| | | this.$Message.error("请上传商品图片"); |
| | | return; |
| | | } |
| | | if (!submit.goodsVideo){ |
| | | this.submitLoading = false; |
| | | this.$Message.error("请上传商品视频"); |
| | | return; |
| | | } |
| | | // if (!submit.goodsVideo){ |
| | | // this.submitLoading = false; |
| | | // this.$Message.error("请上传商品视频"); |
| | | // return; |
| | | // } |
| | | if (submit.templateId === "") submit.templateId = 0; |
| | | let flag = false; |
| | | let paramValue = ""; |
| | |
| | | this.$Message.error("刷新失败,请重试"); |
| | | } |
| | | }).catch(reason => { |
| | | console.log("获取模板失败",reason) |
| | | console.log("获取模板失败", reason) |
| | | }); |
| | | }, |
| | | removeVideo(){ |
| | | removeVideo() { |
| | | this.baseInfoForm.showGoodsVideo = null; |
| | | this.baseInfoForm.goodsVideo = null; |
| | | }, |
| | | // todo 文件上传 |
| | | async upLoadImg(file) { |
| | | console.log(file,this.count++); |
| | | console.log(file, this.count++); |
| | | if (this.listImages.length >= 5) { |
| | | this.$Message.error("图片上传不能超过5个"); |
| | | return; |
| | |
| | | this.baseInfoForm.goodsType = this.firstData.goodsType; |
| | | |
| | | |
| | | |
| | | |
| | | if (this.categoryId!=null && this.categoryId!=='') { |
| | | if (this.categoryId != null && this.categoryId !== '') { |
| | | /** 获取该商城分类下 商品参数信息 */ |
| | | this.GET_GoodsParams(); |
| | | console.log('分类id------------------>',this.categoryId); |
| | | console.log('分类id------------------>', this.categoryId); |
| | | /** 查询分类绑定的规格信息 */ |
| | | this.Get_SkuInfoByCategory(this.categoryId); |
| | | /** 查询品牌列表 */ |