提交 7ad35de0 authored 作者: huaxinzhu's avatar huaxinzhu

1、商品规格-库存不能一键应用bug修复;商品编辑,数据格式修改;

上级 7cb6808a
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
name: "goodsimg", name: "goodsimg",
props: { props: {
imgdata: { imgdata: {
type: Array, type: Object,
required: true required: true
} }
}, },
...@@ -81,11 +81,16 @@ ...@@ -81,11 +81,16 @@
}, },
watch: { watch: {
imgdata(curVal, oldVal) { imgdata(curVal, oldVal) {
console.log(84,curVal);
if (curVal) { if (curVal) {
curVal.ruleFormdialogImageUrl.forEach((itemName, nindex) => { if(curVal.ruleFormdialogImageUrl) {
this.ruleFormdialogImageUrl.push({'url': itemName.thumbnailM}) curVal.ruleFormdialogImageUrl.forEach((itemName, nindex) => {
}) this.ruleFormdialogImageUrl.push({'url': itemName.thumbnailM})
this.ruleFormdialogImageUrlplus.push({'url': curVal.ruleFormdialogImageUrlplus}) })
}
if(this.ruleFormdialogImageUrlplus) {
this.ruleFormdialogImageUrlplus.push({'url': curVal.ruleFormdialogImageUrlplus});
}
} }
}, },
picall: { picall: {
......
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
deep: true deep: true
}, },
infomationdatas(curVal, oldVal) { infomationdatas(curVal, oldVal) {
console.log("商品信息子组件:",curVal); //console.log("商品信息子组件:",curVal);
if (curVal) { if (curVal) {
this.ruleForm = curVal; this.ruleForm = curVal;
if(curVal.freightId == 0) { if(curVal.freightId == 0) {
...@@ -254,17 +254,17 @@ ...@@ -254,17 +254,17 @@
}else { }else {
this.ruleForm.resource = '1'; this.ruleForm.resource = '1';
} }
this.content = this.ruleForm.description; this.content = this.ruleForm.description;
// 初始化 // 初始化
this.serviceagsTags = []; this.serviceagsTags = [];
this.ruleForm.serviceagsTags.forEach((val) => { if(this.ruleForm.serviceagsTags) {
if (val) { this.ruleForm.serviceagsTags.forEach((val) => {
let nid = parseInt(val); if (val) {
this.serviceagsTags.push(nid); let nid = parseInt(val);
} this.serviceagsTags.push(nid);
}) }
})
}
} }
} }
}, },
...@@ -291,8 +291,6 @@ ...@@ -291,8 +291,6 @@
this.serviceagsTags.splice(index3,1) this.serviceagsTags.splice(index3,1)
} }
} }
console.log(307,this.ruleForm);
}, },
// 运费模板类型,change事件 // 运费模板类型,change事件
freightIdTypeChange(val) { freightIdTypeChange(val) {
......
...@@ -206,8 +206,8 @@ ...@@ -206,8 +206,8 @@
<el-input placeholder="" v-model="scope.row.jsPrice"></el-input> <el-input placeholder="" v-model="scope.row.jsPrice"></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="kucun" label="库存"> <el-table-column prop="kucun" label="库存" align="center">
<template slot="header" slot-scope="scope" align="center"> <template slot="header" slot-scope="scope">
<p class="table_p">库存</p> <p class="table_p">库存</p>
<el-input placeholder="" v-model="goodsNowStock" <el-input placeholder="" v-model="goodsNowStock"
><el-button ><el-button
...@@ -241,7 +241,6 @@ ...@@ -241,7 +241,6 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- <el-button type="primary" @click="handleinfomationclick('ruleForm')">下一步</el-button>-->
<el-button >重置</el-button> <el-button >重置</el-button>
</div> </div>
</div> </div>
...@@ -305,7 +304,6 @@ export default { ...@@ -305,7 +304,6 @@ export default {
// this.driver = new Driver() // this.driver = new Driver()
this.$dragging.$on("dragged", (value) => { this.$dragging.$on("dragged", (value) => {
//因为我这在排序的时候不需要做处理,所以空着就行 //因为我这在排序的时候不需要做处理,所以空着就行
// debugger;
}); });
}, },
watch:{ watch:{
...@@ -320,83 +318,80 @@ export default { ...@@ -320,83 +318,80 @@ export default {
}, },
deep:true deep:true
}, },
guidedata(curVal,oldVal){ guidedata(curVal,oldVal){
if(curVal){ if(curVal){
if(curVal.goodsSpec){ if(curVal.goodsSpec){
this.checked = true this.checked = true
} }
// 规格 // 规格
this.shopType = curVal.specName?curVal.specName:[], this.shopType = curVal.specName;
this.shopType.forEach((item, index) => {
this.shopType[index]['specValue'] = [] if(this.shopType) {
curVal.specValue.forEach((itemName, nindex) => { this.shopType.forEach((item, index) => {
if(itemName.specNameId == item.id){ this.shopType[index]['specValue'] = []
this.shopType[index]['specValue'].push(itemName)
if(curVal.specValue) {
curVal.specValue.forEach((itemName, nindex) => {
if(itemName.specNameId == item.id){
this.shopType[index]['specValue'].push(itemName)
}
})
} }
})
})
//笛卡尔乘积title })
this.clgoodspace(curVal) }
//笛卡尔积值
this.tableData7 = curVal.specOption
this.tableData7.forEach((element, index) => {
this.tableData7[index]["goodsNowStock"] = element.stock
});
} this.clgoodspace(curVal);
}, //笛卡尔积值
this.tableData7 = curVal.specOption;
}
},
}, },
methods: { methods: {
guidInput(val){ guidInput(val){
this.$forceUpdate() this.$forceUpdate()
}, },
// 处理回显数据 // 处理回显数据
clgoodspace(goodsspace){ clgoodspace(goodsspace){
this.shopTypes = JSON.parse(JSON.stringify(this.shopType)); this.shopTypes = JSON.parse(JSON.stringify(this.shopType));
let specName = goodsspace.specName let specName = goodsspace.specName;
let specValue = goodsspace.specValue let specValue = goodsspace.specValue;
let specOption = goodsspace.specOption let specOption = goodsspace.specOption;
specName.forEach((item)=>{
this.tablearr.push(item.specName) if(specName) {
specValue.forEach((itemchild)=>{ specName.forEach((item)=>{
this.tablearr.push(item.specName)
specValue.forEach((itemchild)=>{
if(item.id ==itemchild.specNameId){ if(item.id ==itemchild.specNameId){
itemchild['specName'] =item.specName itemchild['specName'] =item.specName
} }
}) })
}) })
specOption.forEach(item=>{ }
let goodsarr = item.specValueIds.split('_')
goodsarr.forEach(itemchild=>{ if(specOption) {
specValue.forEach(itemgoodschild=>{ specOption.forEach(item=>{
if(itemchild == itemgoodschild.id){ let goodsarr = item.specValueIds.split('_')
item[itemgoodschild.specName] = itemgoodschild.value goodsarr.forEach(itemchild=>{
} specValue.forEach(itemgoodschild=>{
}) if(itemchild == itemgoodschild.id){
item[itemgoodschild.specName] = itemgoodschild.value
}
})
})
}) })
this.tableData7 = specOption })
this.getSpanArr(this.tableData7); }
},
this.tableData7 = specOption;
this.getSpanArr(this.tableData7);
},
// 不能删
descartes, descartes,
handleinfomationclick(formName) {
let arrlist = JSON.stringify(this.tableData7); //可以将json对象转换成json对符串
let listarr = JSON.parse(arrlist); //可以将json字符串转换成json对象
this.processguidelist(listarr);
this.$emit('guideclicks',this.arrtdall,this.shopType)
},
processguidelist(obj) { processguidelist(obj) {
// listobj["goodsNowStock"] = ""; let arrtdall = []
// listobj["jsPrice"] = "";
// listobj["price"] = "";
// listobj["scPrice"] = "";
// listobj["wlPrice"] = "";
// listobj["pywlPrice"] = "";
// listobj["weight"] = "";
let arrtdall = []
obj.forEach((item, index) => { obj.forEach((item, index) => {
let objtd = {} let objtd = {}
let arrtd = [] let arrtd = []
...@@ -416,11 +411,6 @@ export default { ...@@ -416,11 +411,6 @@ export default {
deletearrinput(index) { deletearrinput(index) {
this.shopType.splice(index, 1); this.shopType.splice(index, 1);
}, },
weightall() {
this.tableData7.forEach((element, index) => {
this.tableData7[index].weight = this.weight;
});
},
jsPriceall() { jsPriceall() {
this.tableData7.forEach((element, index) => { this.tableData7.forEach((element, index) => {
this.tableData7[index].jsPrice = this.jsPrice; this.tableData7[index].jsPrice = this.jsPrice;
...@@ -436,11 +426,18 @@ export default { ...@@ -436,11 +426,18 @@ export default {
this.tableData7[index].scPrice = this.scPrice; this.tableData7[index].scPrice = this.scPrice;
}); });
}, },
// 一键 库存
goodsNowStockall() { goodsNowStockall() {
this.tableData7.forEach((element, index) => { this.tableData7.forEach((element, index) => {
this.tableData7[index].goodsNowStock = this.goodsNowStock; this.tableData7[index].goodsNowStock = this.goodsNowStock;
}); });
}, },
// 一键 重量
weightall() {
this.tableData7.forEach((element, index) => {
this.tableData7[index].weight = this.weight;
});
},
//删除规格项 //删除规格项
deleteinput(index, indexs) { deleteinput(index, indexs) {
this.shopType[index].specValue.splice(indexs, 1); this.shopType[index].specValue.splice(indexs, 1);
...@@ -625,7 +622,6 @@ export default { ...@@ -625,7 +622,6 @@ export default {
}, },
//计算位置的方法 //计算位置的方法
getSpanArr(data) { getSpanArr(data) {
// debugger
this.spanArrS = {}; this.spanArrS = {};
this.spanArr = []; this.spanArr = [];
this.pos = ""; this.pos = "";
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
loading: false, loading: false,
applyStatus: '', applyStatus: '',
title: "添加新商品", title: "添加新商品",
imgdate: [], imgdate: {},
guidedate: {}, guidedate: {},
parameterdate: {}, parameterdate: {},
params: { params: {
...@@ -67,8 +67,8 @@ ...@@ -67,8 +67,8 @@
methods: { methods: {
// 运费模板 // 运费模板
getFreight() { getFreight() {
GetFreight(this.queryParams).then(response => { GetFreight(this.queryParams).then(res => {
this.expressTemplateList = response.data; this.expressTemplateList = res.data;
this.expressTemplateIdList = this.expressTemplateList.filter(function(item) { this.expressTemplateIdList = this.expressTemplateList.filter(function(item) {
return item.Id; return item.Id;
}) })
...@@ -85,64 +85,75 @@ ...@@ -85,64 +85,75 @@
genGoodsInfo(goodsId) { genGoodsInfo(goodsId) {
this.loading = true; this.loading = true;
const goods_id = goodsId; const goods_id = goodsId;
getGoods(goods_id).then(response => { getGoods(goods_id).then(res => {
//console.log(89,response); console.log(9999,res);
if(response.data.code === 1 && response.data.data) { if(res.code === 1 && res.data) {
this.goodsOnsale = response.data.data.isOnsale; this.goodsOnsale = res.data.isOnsale;
// 对发货时效单独处理 // 对发货时效单独处理
if(response.data.data.Delayompensate == 0) { if(res.data.Delayompensate == 0) {
response.data.data.Delayompensate = ''; res.data.Delayompensate = '';
} }
//response.data.data.freightId 返回的值类型有 0(string/number)|| ‘全国包邮通用模板’(string)|| 310(number) //res.data.freightId 返回的值类型有 0(string/number)|| ‘全国包邮通用模板’(string)|| 310(number)
let resourceType = '1'; // 为了单元框正常显示,先给一个默认值,// 字符串 ‘0’,代表 数据为单独运费 let resourceType = '1'; // 为了单元框正常显示,先给一个默认值,// 字符串 ‘0’,代表 数据为单独运费
let serviceagsTagsVal = []; let serviceagsTagsVal = [];
if(response.data.data.ServiceagsTags) { if(res.data.ServiceagsTags) {
serviceagsTagsVal = JSON.parse(response.data.data.ServiceagsTags); serviceagsTagsVal = JSON.parse(res.data.ServiceagsTags);
} }
// 库存,后台返回字段更换,提前处理 specOption
if( res.data.goodsSpecs.specOption && res.data.goodsSpecs.specOption.length > 0) {
res.data.goodsSpecs.specOption.forEach(function(item){
if(item.stock) {
item['goodsNowStock'] = item.stock;
}
});
}
this.infomationdata = { this.infomationdata = {
goodsId: response.data.data.goodsId, goodsId: res.data.goodsId,
goodsName: response.data.data.goodsName, goodsName: res.data.goodsName,
categoryId: response.data.data.categoryId, categoryId: res.data.categoryId,
scPrice: response.data.data.scPrice / 100, scPrice: res.data.scPrice / 100,
price: response.data.data.price / 100, price: res.data.price / 100,
jsPrice: response.data.data.jsPrice / 100, jsPrice: res.data.jsPrice / 100,
goodsNowStock: response.data.data.goodsNowStock, goodsNowStock: res.data.goodsNowStock,
producingArea: response.data.data.producingArea, producingArea: res.data.producingArea,
weight: response.data.data.weight, weight: res.data.weight,
unit: response.data.data.unit, unit: res.data.unit,
goodsBrand: response.data.data.goodsBrand, goodsBrand: res.data.goodsBrand,
wlPrice: response.data.data.wlPrice, wlPrice: res.data.wlPrice,
pywlPrice: response.data.data.pywlPrice, pywlPrice: res.data.pywlPrice,
resource: resourceType, resource: resourceType,
Delayompensate: response.data.data.Delayompensate, Delayompensate: res.data.Delayompensate,
aftersaleTime: response.data.data.aftersaleTime, aftersaleTime: res.data.aftersaleTime,
mark: response.data.data.mark, mark: res.data.mark,
serviceagsTags: serviceagsTagsVal, serviceagsTags: serviceagsTagsVal,
description: response.data.data.description, description: res.data.description,
freightId: response.data.data.freightId, freightId: res.data.freightId,
outGoodsId: response.data.data.outGoodsId, outGoodsId: res.data.outGoodsId,
}; };
this.guidedate = response.data.data.goodsSpecs; this.guidedate = res.data.goodsSpecs;
this.guidedate["goodsSpec"] = response.data.data.goodsSpec; this.guidedate["goodsSpec"] = res.data.goodsSpec;
this.parameterdata = response.data.data.Params; this.parameterdata = res.data.Params ? res.data.Params : {};
this.imgdate = { this.imgdate = {
"ruleFormdialogImageUrl": response.data.data.image, "ruleFormdialogImageUrl": res.data.image,
"ruleFormdialogImageUrlplus": response.data.data.defaultImage "ruleFormdialogImageUrlplus": res.data.defaultImage
}; };
}else if(response.data.code === 0) { }else if(res.code === 0) {
if(response.data.msg) { if(res.msg) {
this.$message({type:'error',message: response.data.msg}); this.$message({type:'error',message: res.msg});
}else { }else {
this.$message({type:'error',message: '数据出错啦'}); this.$message({type:'error',message: '数据出错啦'});
} }
} }
this.loading = false; this.loading = false;
}); });
}, },
info() { info() {
addgoods(this.listQuery).then(response => { addgoods(this.listQuery).then(res => {
this.list = response.data.items this.list = res.data.items
this.total = response.data.total this.total = res.data.total
this.listLoading = false this.listLoading = false
}) })
}, },
...@@ -166,6 +177,20 @@ ...@@ -166,6 +177,20 @@
guideclick(type, specsGroup) { guideclick(type, specsGroup) {
this.params["specs"] = type; this.params["specs"] = type;
this.params["specsGroup"] = specsGroup; this.params["specsGroup"] = specsGroup;
// 浮点处理
if(this.params.specs && this.params.specs.length > 0) {
for(let i = 0; i < this.params.specs.length; i++) {
if(this.params.specs[i].jsPrice ) {
this.params.specs[i].jsPrice = this.params.specs[i].jsPrice * 100;
}
if(this.params.specs[i].price ) {
this.params.specs[i].price = this.params.specs[i].price * 100;
}
if(this.params.specs[i].scPrice ) {
this.params.specs[i].scPrice = this.params.specs[i].scPrice * 100;
}
}
}
}, },
//参数 //参数
parameterclick(type) { parameterclick(type) {
...@@ -265,10 +290,10 @@ ...@@ -265,10 +290,10 @@
} }
} }
this.loading = true; this.loading = true;
addGoods(this.params).then(response => { addGoods(this.params).then(res => {
if (response.code === 1) { if (res.code === 1) {
this.$message({ this.$message({
message: response.msg, message: res.msg,
type: 'success' type: 'success'
}); });
this.$emit('closeDialog',false); this.$emit('closeDialog',false);
...@@ -280,9 +305,9 @@ ...@@ -280,9 +305,9 @@
this.$router.push({ this.$router.push({
path: redUrl path: redUrl
}); });
} else if(response.code === 0) { } else if(res.code === 0) {
if(response.msg) { if(res.msg) {
this.$message.error(response.msg); this.$message.error(res.msg);
}else { }else {
this.$message.error("操作失败!"); this.$message.error("操作失败!");
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论