提交 4584436b authored 作者: huaxinzhu's avatar huaxinzhu

bug修复

上级 45560afb
...@@ -268,18 +268,19 @@ ...@@ -268,18 +268,19 @@
}else { }else {
this.brandOptions = []; this.brandOptions = [];
} }
// let num_goods_brand = Number(this.goodsInfoForm.goods_brand);
// //
let num_goods_brand = Number(this.goodsInfoForm.goods_brand); // if( this.goodsInfoForm.goods_brand !== '') {
// let result = this.brandOptions.find( item => {
// return item.id === num_goods_brand;
// });
// //console.log(315,result)
// if( result == undefined) {
// this.goodsInfoForm.goods_brand = '';
// }
// }
if( this.goodsInfoForm.goods_brand !== '') {
let result = this.brandOptions.find( item => {
return item.id === num_goods_brand;
});
//console.log(315,result)
if( result == undefined) {
this.goodsInfoForm.goods_brand = '';
}
}
}); });
}, },
/* 修改 商品分类 类目 */ /* 修改 商品分类 类目 */
......
...@@ -320,19 +320,20 @@ export default { ...@@ -320,19 +320,20 @@ export default {
}, },
// 如果保存失败,将乘以100的价格还原 // 如果保存失败,将乘以100的价格还原
priceReduce() { priceReduce() {
debugger
if(this.parameterdata.pamTableList && this.parameterdata.pamTableList.length > 0) { if(this.parameterdata.pamTableList && this.parameterdata.pamTableList.length > 0) {
this.parameterdata.pamTableList.forEach((item)=> { this.parameterdata.pamTableList.forEach((item)=> {
if(item.js_price) { if(item[0].js_price) {
item.js_price = item.js_price / 100; item[0].js_price = item[0].js_price / 100;
} }
if(item.price) { if(item[0].price) {
item.price = item.price / 100; item[0].price = item[0].price / 100;
} }
if(item.sc_price) { if(item[0].sc_price) {
item.sc_price = item.sc_price / 100; item[0].sc_price = item[0].sc_price / 100;
} }
if(item.sl_price) { if(item[0].sl_price) {
item.sl_price = item.sl_price / 100; item[0].sl_price = item[0].sl_price / 100;
} }
}) })
}else { }else {
......
...@@ -127,10 +127,18 @@ export default { ...@@ -127,10 +127,18 @@ export default {
this.$forceUpdate() this.$forceUpdate()
} }
}, },
watch:{}, watch:{
// 'specificationsdata': {
// handler(newValue) {
// console.log(133,newValue);
// },
// deep: true
// }
},
methods: { methods: {
/** 初始化 商品规格数据 */ /** 初始化 商品规格数据 */
initInfo() { initInfo() {
// debugger
this.$set(this.specsGroup.spec_value,this.specsGroup.spec_value.length,this.speParamName); this.$set(this.specsGroup.spec_value,this.specsGroup.spec_value.length,this.speParamName);
this.speData = []; this.speData = [];
this.$set(this.speData,this.speData.length,this.specsGroup); this.$set(this.speData,this.speData.length,this.specsGroup);
...@@ -304,9 +312,6 @@ export default { ...@@ -304,9 +312,6 @@ export default {
// 商品规格原始数据 // 商品规格原始数据
let orgSpeData = this.deepClone(this.speData); let orgSpeData = this.deepClone(this.speData);
// let hhxz = this.$
//
// console.log(333333,this.speData);
// 进行数据处理后的数据, // 进行数据处理后的数据,
let proSpeData = this.processData(orgSpeData); let proSpeData = this.processData(orgSpeData);
// 需要将 所有规格名称,提出一个数组集合, // 需要将 所有规格名称,提出一个数组集合,
...@@ -326,8 +331,6 @@ export default { ...@@ -326,8 +331,6 @@ export default {
} }
} }
}) })
// console.log("处理后的数据",proSpeData);
// console.log("处理后的nameList",this.speNameList);
// 当处理后的数据,是一个空数组,则不需要再进行 笛卡尔积 计算,可以直接给出计算结果 // 当处理后的数据,是一个空数组,则不需要再进行 笛卡尔积 计算,可以直接给出计算结果
if (proSpeData.length === 0) { if (proSpeData.length === 0) {
...@@ -380,6 +383,43 @@ export default { ...@@ -380,6 +383,43 @@ export default {
} }
return result; return result;
}, },
/** 在保存时,同步更新界面dom */
upDateDom() {
if(this.speData.length === 1) {
if(this.speData[0].spec_name === '' ) {
this.speData[0].spec_value = [{ value: ''}]
}else {
for(let i = 0; i < this.speData[0].spec_value.length; i++) {
if(this.speData[0].spec_value[i].value === '') {
this.speData[0].spec_value.splice(i,1)
i = i - 1;
}
}
if(this.speData[0].spec_value.length === 0) {
this.speData[0].spec_value = [{ value: '' }];
}
}
}else if( this.speData.length > 1 ) {
for(let i=0; i<this.speData.length; i++){
if( this.speData[i].spec_name === '' || this.speData[i].spec_value.length === 0) {
this.speData.splice(i,1);
} else if( this.speData[i].spec_name !== '' ) {
// for( let j = 0; j < this.speData[i].spec_value.length; j++) {
//
// }
}
}
}
//console.log(404,this.speData);
},
/** 笛卡尔积算法 */ /** 笛卡尔积算法 */
cartesian(arr) { cartesian(arr) {
if(arr.length < 2) { if(arr.length < 2) {
......
...@@ -177,7 +177,7 @@ ...@@ -177,7 +177,7 @@
producing_area: Number(res.data.producing_area), // 产地 producing_area: Number(res.data.producing_area), // 产地
deliver_area: Number(res.data.deliver_area), // 发货地 deliver_area: Number(res.data.deliver_area), // 发货地
unit: res.data.unit, // 单位 unit: res.data.unit, // 单位
goods_brand: Number(res.data.goods_brand), // 品牌 goods_brand: res.data.goods_brand, // 品牌
web_url: res.data.web_url, // 外部链接 web_url: res.data.web_url, // 外部链接
out_goods_id: res.data.out_goods_id, // 商品编码 out_goods_id: res.data.out_goods_id, // 商品编码
imgs: res.data.imgs // 商品图片 imgs: res.data.imgs // 商品图片
...@@ -186,8 +186,7 @@ ...@@ -186,8 +186,7 @@
// 产地 和 发货地 需要 处理 // 产地 和 发货地 需要 处理
this.goodsinfodata.producing_area = this.goodsinfodata.producing_area === 0 ? '' : this.goodsinfodata.producing_area; this.goodsinfodata.producing_area = this.goodsinfodata.producing_area === 0 ? '' : this.goodsinfodata.producing_area;
this.goodsinfodata.deliver_area = this.goodsinfodata.deliver_area === 0 ? '' : this.goodsinfodata.deliver_area; this.goodsinfodata.deliver_area = this.goodsinfodata.deliver_area === 0 ? '' : this.goodsinfodata.deliver_area;
// 品牌需要 单独处理
// debugger
let arr = []; let arr = [];
arr[0] = res.data.category_first_id; arr[0] = res.data.category_first_id;
arr[1] = res.data.category_second_id; arr[1] = res.data.category_second_id;
...@@ -269,6 +268,7 @@ ...@@ -269,6 +268,7 @@
methods: { methods: {
// 规格子组件,传给父组件的数据 // 规格子组件,传给父组件的数据
calcSpeTable(data) { calcSpeTable(data) {
console.log('原始值',data);
// 第一步,获取原来的值 // 第一步,获取原来的值
let spsjData2 = this.$refs.goodsparameter.orgGoodsPam; let spsjData2 = this.$refs.goodsparameter.orgGoodsPam;
let spsjData2Clone = this.deepClone(spsjData2); let spsjData2Clone = this.deepClone(spsjData2);
...@@ -399,6 +399,10 @@ ...@@ -399,6 +399,10 @@
let isGoodsInfoMsg = this.$refs['goodsInfo'].validateGoodsInfoForm(); let isGoodsInfoMsg = this.$refs['goodsInfo'].validateGoodsInfoForm();
// 商品规格 无需校验 // 商品规格 无需校验
let spggRef = this.$refs.goodsspecifications;
let spggData = spggRef.speData;
spggRef.upDateDom();
// return;
// 商品售价,通过获取的数据,分别进行判断 // 商品售价,通过获取的数据,分别进行判断
let isGoodsPrice = true; let isGoodsPrice = true;
...@@ -406,7 +410,6 @@ ...@@ -406,7 +410,6 @@
let spsjData1 = this.$refs.goodsparameter.singleSpecTable; let spsjData1 = this.$refs.goodsparameter.singleSpecTable;
let spsjData2 = this.$refs.goodsparameter.orgGoodsPam; let spsjData2 = this.$refs.goodsparameter.orgGoodsPam;
//debugger
// 如果有,则说明有规格组合数据 // 如果有,则说明有规格组合数据
if ( spsjData2.pamTableList && spsjData2.pamTableList.length > 0 ) { if ( spsjData2.pamTableList && spsjData2.pamTableList.length > 0 ) {
for(let i = 0; i < spsjData2.pamTableList.length; i++) { for(let i = 0; i < spsjData2.pamTableList.length; i++) {
...@@ -493,7 +496,17 @@ ...@@ -493,7 +496,17 @@
// 所有校验通过,整理数据 // 所有校验通过,整理数据
// 获取 商品信息数据 // 获取 商品信息数据
let spxxData = this.$refs.goodsInfo.goodsInfoForm; let spxxData = this.$refs.goodsInfo.goodsInfoForm;
// 品牌处理 goods_brand
let brandOptions = this.$refs.goodsInfo.brandOptions
for(let bi = 0; bi < brandOptions.length; bi++) {
if( Number(spxxData.goods_brand) === Number(brandOptions[bi].id) ) {
spxxData.goods_brand = brandOptions[bi].brand_cn;
break;
}
}
// console.log(500,spxxData);
if( spxxData.imgs.length > 5 ) { if( spxxData.imgs.length > 5 ) {
this.$message({ type: 'warning',message: '商品信息中,商品图片最大数量为5张,请检查' }); this.$message({ type: 'warning',message: '商品信息中,商品图片最大数量为5张,请检查' });
this.setFloorNavMountClick(0); this.setFloorNavMountClick(0);
...@@ -501,8 +514,8 @@ ...@@ -501,8 +514,8 @@
} }
// 商品规格 // 商品规格
let spggData = this.$refs.goodsspecifications.speData; // let spggData = this.$refs.goodsspecifications.speData;
//
// 商品售价,上面已经获取, // 商品售价,上面已经获取,
let spsjData = {}; let spsjData = {};
if( spsjData2.pamTableList && spsjData2.pamTableList.length > 0 ) { if( spsjData2.pamTableList && spsjData2.pamTableList.length > 0 ) {
...@@ -515,6 +528,7 @@ ...@@ -515,6 +528,7 @@
spsjData = spsjData1[0]; spsjData = spsjData1[0];
} }
// 商品详情 数据 // 商品详情 数据
let spxqData = this.$refs.goodsdetailsimg.goodsDeForm; let spxqData = this.$refs.goodsdetailsimg.goodsDeForm;
......
...@@ -567,18 +567,19 @@ ...@@ -567,18 +567,19 @@
this.tmthird_id = response.data.goods_id this.tmthird_id = response.data.goods_id
this.picture = response.data.imgs this.picture = response.data.imgs
// 品牌 数据处理 // 品牌 数据处理
if(this.brandOptions && this.brandOptions.length > 0) { // if(this.brandOptions && this.brandOptions.length > 0) {
let numBrandId = Number(this.goodsinfor.goods_brand) // let numBrandId = Number(this.goodsinfor.goods_brand)
let brandObj = this.brandOptions.find((item)=> { // let brandObj = this.brandOptions.find((item)=> {
return numBrandId === item.id // return numBrandId === item.id
}); // });
this.goodsinfor.goods_brand = brandObj.brand_cn ? brandObj.brand_cn : ''; // this.goodsinfor.goods_brand = brandObj.brand_cn ? brandObj.brand_cn : '';
}else { // }else {
this.goodsinfor.goods_brand = '' // this.goodsinfor.goods_brand = ''
} // }
// 产地 数据处理 // 产地 数据处理
if(this.areaOptions && this.areaOptions.length > 0) { if(this.areaOptions && this.areaOptions.length > 0) {
//debugger
let numAreaId = Number(this.goodsinfor.producing_area) let numAreaId = Number(this.goodsinfor.producing_area)
let areaObj = this.areaOptions.find((item)=> { let areaObj = this.areaOptions.find((item)=> {
return numAreaId === item.id return numAreaId === item.id
...@@ -683,7 +684,7 @@ ...@@ -683,7 +684,7 @@
} }
} }
console.log(arrsow, 'jump') //console.log(arrsow, 'jump')
if (arrsow.length > 0) { if (arrsow.length > 0) {
//debugger //debugger
for (var i = 0; i < arrsow.length; i++) { for (var i = 0; i < arrsow.length; i++) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论