提交 b8634220 编写于 作者: yi.li's avatar yi.li

新建编辑商品

上级 cf602577
...@@ -635,7 +635,7 @@ ...@@ -635,7 +635,7 @@
const {id, storeId} = this.$route.query const {id, storeId} = this.$route.query
this.title = id == 'add' ? '新增商品' : '编辑商品' this.title = id == 'add' ? '新增商品' : '编辑商品'
this.formData.storeId = storeId || 0; this.formData.storeId = Number(storeId) || 0;
this.getLever(0,1) this.getLever(0,1)
dosageAll().then((res)=>{ dosageAll().then((res)=>{
this.doseAll = res.data this.doseAll = res.data
...@@ -695,7 +695,13 @@ ...@@ -695,7 +695,13 @@
let a = []; let a = [];
if(d.length > 0){ if(d.length > 0){
for(let i=0;i<d.length;i++){ for(let i=0;i<d.length;i++){
a.push({url:d[i].goodsImgUrl,imageUrl:d[i].goodsImgUrl}) a.push({
url:d[i].goodsImgUrl,
imageUrl:d[i].goodsImgUrl,
id: d[i].id,
imageSort: d[i].imageSort,
imageType: d[i].id,imageType,
})
} }
} }
return a; return a;
...@@ -820,8 +826,14 @@ ...@@ -820,8 +826,14 @@
complete() { complete() {
let formName = "formData"; let formName = "formData";
this.formData.goodsImages = this.fileGoodsList let goodsImgList = this.fileGoodsList.map((item, index) => {
this.formData.specificationImages = this.fileIntrList item.imageSort = index+1;
})
let specificationImgList = this.fileIntrList.map((item, index) => {
item.imageSort = index+1;
})
this.formData.goodsImages = goodsImgList;
this.formData.specificationImages = specificationImgList;
this.isgoodsImages = this.formData.goodsImages.length == 0 ? false :true; this.isgoodsImages = this.formData.goodsImages.length == 0 ? false :true;
this.isSpecification_url = this.formData.specificationImages.length == 0 ? false : true this.isSpecification_url = this.formData.specificationImages.length == 0 ? false : true
this.formData.categoryId = this.formData.goodsType this.formData.categoryId = this.formData.goodsType
...@@ -853,6 +865,7 @@ ...@@ -853,6 +865,7 @@
//this.formData.incrStock = 1000 //this.formData.incrStock = 1000
this.formData.costPrice = this.formData.optPrice*100 this.formData.costPrice = this.formData.optPrice*100
this.formData.hasChanged = true; this.formData.hasChanged = true;
console.log('提交值',this.formData);
updateGoods(this.formData).then((res)=>{ updateGoods(this.formData).then((res)=>{
if (res.code !== '000000') { if (res.code !== '000000') {
// return this.$message.error(res.message); // return this.$message.error(res.message);
...@@ -870,7 +883,7 @@ ...@@ -870,7 +883,7 @@
}) })
}) })
}, },
//上传商品头图
beforeUploadPic(file) { beforeUploadPic(file) {
if(this.fileGoodsList.length > 10){ if(this.fileGoodsList.length > 10){
return ; return ;
...@@ -909,7 +922,7 @@ ...@@ -909,7 +922,7 @@
// vm.uploadImgMessage2 = false; // vm.uploadImgMessage2 = false;
// } // }
let len = vm.fileGoodsList.length; let len = vm.fileGoodsList.length;
vm.fileGoodsList.push({url:path.fullPath,imageUrl:path.fullPath,imageName:'',imageSort: len+1}) vm.fileGoodsList.push({url:path.fullPath,imageUrl:path.fullPath,imageName:'',imageSort: len+1,imageType: 2,id: null,})
//vm.formData.goodsImages = path.fullPath //vm.formData.goodsImages = path.fullPath
vm.$message.success("上传成功"); vm.$message.success("上传成功");
}); });
...@@ -931,7 +944,7 @@ ...@@ -931,7 +944,7 @@
}, },
//上传店铺logo //上传药品说明
beforeUploadPic1(file,type) { beforeUploadPic1(file,type) {
this.currentOption.aspectRatio = 1/1; this.currentOption.aspectRatio = 1/1;
this.currentOption.cropBoxResizable = true; this.currentOption.cropBoxResizable = true;
...@@ -983,8 +996,8 @@ ...@@ -983,8 +996,8 @@
openLoading(vm); openLoading(vm);
doUpload(vm, file, getFilePath(file, null), "preview4", "progress1", 1).then(function (path) { doUpload(vm, file, getFilePath(file, null), "preview4", "progress1", 1).then(function (path) {
closeLoading(vm); closeLoading(vm);
let len = vm.fileIntrList.length;
vm.fileIntrList.push({url:path.fullPath,imageUrl:path.fullPath}) vm.fileIntrList.push({url:path.fullPath,imageUrl:path.fullPath,imageSort: len+1,imageType: 1,id: null})
vm.$message.success("上传成功"); vm.$message.success("上传成功");
}); });
//} //}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册