提交 177e870c authored 作者: huaxinzhu's avatar huaxinzhu

Merge branch 'dev_hxz' into test

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