提交 3bba680a authored 作者: huaxinzhu's avatar huaxinzhu

商品模块,bug修复02

上级 99c7beac
......@@ -80,12 +80,16 @@
mounted() {
this.getFreightData();
//debugger
console.log('售后数据:',this.goodsaftersale);
//console.log('售后数据:',this.goodsaftersale);
if(this.goodsaftersale && this.goodsaftersale.stags.length > 0) {
this.goodsAfterSaleForm = this.goodsaftersale;
}
},
methods: {
/** 售后服务数据 初始化 */
initInfo() {
this.$refs.goodsAfterSaleForm.resetFields();
},
// 运费模板
getFreightData() {
// let query = { page: 1, limit: 50 };
......
......@@ -77,11 +77,15 @@
components: {},
mounted() {
this.goodsDeForm = this.imgdata;
console.log("详情:",this.imgdata);
//console.log("详情:",this.imgdata);
},
watch: {},
methods: {
/** 初始化 商品详情 */
initInfo() {
this.goodsDeForm.description = '';
this.goodsDetailsImgFileList = [];
},
// 通过原生 input上传 图片
fileChange() {
const list = this.$refs.file.files;
......
......@@ -207,34 +207,8 @@
} // return end
},
components: {},
watch: {
// 'goodsImgFileList': {
// handler(val, oldVal) {
// if(val.length > 0) {
// this.goodsInfoForm.imgs = '';
// let imgArr = [];
// val.forEach(item => {
// imgArr.push(item.url);
// })
// this.goodsInfoForm.imgs = imgArr.toString();
// }else if(val.length === 0){
// this.goodsInfoForm.imgs = '';
// }
// //console.log(123,this.goodsInfoForm.imgs);
// },
// deep: true
// }
// serviceagsTags: {
// handler(val, oldVal) {
// this.$set(this.goodsInfoForm, 'serviceagsTags', val)
// },
// deep: true
// },
},
created() {
},
watch: {},
created() {},
mounted() {
//debugger
//深拷贝一份最开始的数据,为初始化准备
......@@ -259,6 +233,11 @@
this.getBrands();
},
methods: {
// 数据初始化
initInfo() {
this.$refs.goodsInfoForm.resetFields();
this.goodsImgFileList = [];
},
// 获取 省
getArea() {
let limboNode = {
......
......@@ -213,7 +213,7 @@ export default {
},
watch:{
'parameterdata': function(val) {
//debugger
debugger
this.orgGoodsPam = val;
//console.log("监听",this.orgGoodsPam);
},
......@@ -222,14 +222,21 @@ export default {
//this.orgGoodsPam = this.parameterdata;
},
mounted() {
//console.log("加载后,",this.parameterdata);
console.log("加载后,",this.parameterdata);
if(this.parameterdata.pamTableList && this.parameterdata.pamTableList.length > 0) {
this.orgGoodsPam = this.parameterdata;
}else {
if( this.parameterdata.singleSpecTable.length === 1 ) {
this.singleSpecTable = this.parameterdata.singleSpecTable
}
}
},
methods: {
/** 初始化 商品售价 数据 */
initInfo() {
this.orgGoodsPam = {};
//this.singleSpecTable =
},
// 查看各类价格说明
viewPriceExp() {
this.isViewPriceExp = true;
......
......@@ -127,14 +127,14 @@ export default {
this.$forceUpdate()
}
},
watch:{
// "speData.specsGroup": {
// handle: function(val) {
// console.log(22222,val);
// }
// }
},
watch:{},
methods: {
/** 初始化 商品规格数据 */
initInfo() {
this.$set(this.specsGroup.spec_value,this.specsGroup.spec_value.length,this.speParamName);
this.speData = [];
this.$set(this.speData,this.speData.length,this.specsGroup);
},
/** 添加规格*/
addSpe() {
let specsGroup = {
......
......@@ -45,7 +45,7 @@
<GoodsParameter ref="goodsparameter" :parameterdata="parameterdata" />
</div>
</div>
<!-- 商品详情 -->
<div class="floor-item">
<div class="floor-item-box">
<p class="card-header-title floor-item-box-title"><span class="blue-block-goods blue-block-goods-title"></span>商品详情</p>
......@@ -201,7 +201,6 @@
this.parameterdata.pamTableList = [];
this.parameterdata.pamDataList = [];
res.data.specs_group.forEach((item)=> {
//
item.js_price = item.js_price / 100;
item.sl_price = item.js_price / 100;
item.price = item.price / 100;
......@@ -212,7 +211,6 @@
prePriceArr.push(item);
this.parameterdata.pamTableList.push( prePriceArr );
this.parameterdata.pamDataList.push(item.spec_values);
})
this.parameterdata.pamNameList = res.data.specs;
}else {
......@@ -237,9 +235,6 @@
// 商品详情
this.imgdata.description = res.data.description;
//this.goodsinfodata = res.data;
//this.imgdata = res.data.description;
//this.goodsaftersale = res.data;
// 售后服务
this.goodsaftersale.freight_id = res.data.freight_id;
......@@ -261,9 +256,7 @@
}else {
this.goodsaftersale.stags = [];
}
}
});
}
},
......@@ -335,10 +328,6 @@
}
if (level === 1) {
//result = res.data
// res.data.forEach((item,index)=> {
// result = (item.id === limboNode.id) ? item.children : [];
// });
for(let i = 0; i < res.data.length; i++) {
if( limboNode.id === res.data[i].id ) {
result = res.data[i].children;
......@@ -355,7 +344,6 @@
}
if (level === 2) {
for(let i = 0; i < res.data.length; i++) {
if( res.data[i].children.length > 0) {
for(let j = 0; j < res.data[i].children.length; j++) {
......@@ -374,7 +362,6 @@
})
}
// result = []
resolve(result)
this.loading = false;
});
......@@ -389,17 +376,10 @@
// console.log(232,this.goodsinfodata.categoryStr,this.goodsinfodata.categoryList);
},
// 保存/提交
save() {
// let spxxDataId = this.$refs.goodsInfo.goodsInfoForm.goods_id;
//
// if(!spxxDataId) {
//
// }
debugger
// 此处变量 有顺序 校验时,电梯至某处
// 商品信息 是否填写完整
let isGoodsInfoMsg = this.$refs['goodsInfo'].validateGoodsInfoForm();
......@@ -410,7 +390,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++) {
......@@ -428,7 +407,6 @@
}
isGoodsPrice = true;
}
// ---------------
}
if (!isGoodsPrice) {
......@@ -458,9 +436,6 @@
// 售后服务 是否填写完整
let isGoodsAfterSaleMsg = this.$refs['goodsaftersale'].validateGoodsAfterSaleForm();
// 商品售价,由商品规格决定,
// 如果 没有填写商品规格,那么商品售价应该获取
if(!isGoodsInfoMsg) {
this.$message({type:'error',message:'商品信息未填写完整'});
this.setFloorNavMountClick(0);
......@@ -491,10 +466,9 @@
// 商品规格
let spggData = this.$refs.goodsspecifications.speData;
// this.goodsAllData.specs = spggData;
// 商品售价,上面已经获取,
let spsjData = {}; // specs_group
let spsjData = {};
if( spsjData2.pamTableList && spsjData2.pamTableList.length > 0 ) {
this.goodsAllData['specs_group'] = [];
this.goodsAllData['specs'] = spggData;
......@@ -511,37 +485,72 @@
// 售后服务 数据
let ssffData = this.$refs.goodsaftersale.goodsAfterSaleForm;
console.log("商品信息:",spxxData);
console.log("商品规格:",spggData);
console.log("商品售价:",spsjData);
console.log("商品详情:",spxqData);
console.log("商品售后:",ssffData);
Object.assign( this.goodsAllData, spxxData, spsjData, spxqData, ssffData);
// spxxData.categoryList = []
// 经营类目,服务标签,需要单独处理数据格式
this.goodsAllData.category_id = spxxData.categoryList.slice(-1)[0] ? spxxData.categoryList.slice(-1)[0] : '';
if(this.goodsAllData.stags) {
this.goodsAllData.stags = this.goodsAllData.stags.toString();
}
console.log('最终数据:',this.goodsAllData);
// let msg = res.data.Apply.content;
// this.$router.push({
// name: 'reviewFail',
// params: { msg: msg }
// });
if(this.goodsAllData.goods_id) {
// if(this.$route.params.msg) {
// this.msg = this.$route.params.msg;
// }
// freight
let routerParam = { fuck: "hxz" };
// 商品id 不为 0 是修改
if( this.goodsAllData.goods_id ) {
updateGoodsNew(this.goodsAllData).then(res=> {
console.log("修改结果:",res);
if( res.code === 1 ) {
this.$message({type: 'success', message:'编辑成功'});
this.initAllGoodsInfo();
this.$emit("closeEditDialog");
}
if(res.code === 0) {
let msg = res.message ? res.message : '编辑失败'
this.$message({type: 'error', message: msg});
}
});
}else {
// 商品id 为 0 是新增
addGoods( this.goodsAllData ).then( res=> {
console.log("返回结果",res);
if( res.code === 1 ) {
this.$message({type: 'success', message:'新增成功'});
this.initAllGoodsInfo();
//this.$router.push({ name: 'system/goodsimport/goodsgement',params: routerParam }); //management
//this.$router.push({ path: '/system/goodsimport/management' });
this.$router.push({ path: '/system/goods/management' });
}
if(res.code === 0) {
let msg = res.message ? res.message : '新增失败'
this.$message({type: 'error', message: msg});
}
});
}
},
/*-----------------------*/
// 初始化 商品所有数据
initAllGoodsInfo() {
// 初始化 商品信息 数据
this.$refs.goodsInfo.initInfo();
// 初始化 商品规格 数据
this.$refs.goodsspecifications.initInfo();
// 初始化 商品售价 数据
this.$refs.goodsparameter.initInfo();
// 初始化 商品详情 数据
this.$refs.goodsdetailsimg.initInfo();
// 初始化 商品售后 数据
this.$refs.goodsaftersale.initInfo();
},
/* 添加商品详细 */
/* 设置楼层导航事件驱动方法* @params Number index 楼层下标 */
......
......@@ -217,11 +217,11 @@
/>
<!-- 商品编辑-->
<el-dialog title="编辑商品" :visible.sync="editisOpen" v-if="editisOpen" width="70%" class="freightTemplate-add">
<editGood :option="goodsid" @closeIndexbtn="closeDialog"></editGood>
<editGood :option="goodsid" @closeEditDialog="closeEditGoods"></editGood>
</el-dialog>
<el-dialog title="商品详情" :visible.sync="isOpen" center v-if="isOpen" width="70%" class="freightTemplate-add"
:close-on-click-modal="false">
<goodDetail :goods-id="goodDetails" @closeIndexbtn="closeDialog"></goodDetail>
<goodDetail :goods-id="goodDetails"></goodDetail>
</el-dialog>
</el-card>
</div>
......@@ -243,7 +243,7 @@
downsale_count: '',//仓库数量
onsale_count: '',//上架数量
del_count: '',//删除数量
radiomodel: '1',
radiomodel: 1,
formInline: {
page: 1,
limit: 20,
......@@ -310,6 +310,8 @@
this.fullHeight = document.getElementsByClassName('box-card')[0].clientHeight - headerHeight
})
console.log("come on");
},
watch: {
fullHeight(val) {
......@@ -436,7 +438,7 @@
});
},
handleUpsale(row, status, isall) { //上下架
debugger
//debugger
let good_id, is_onsale, title, message
if (isall == 'one') {
good_id = [row.goods_id]
......@@ -516,8 +518,8 @@
}
this.getList()
},
closeDialog(val) {
this.isOpen = val;
closeEditGoods(val) {
this.editisOpen = false;
this.getList();
},
//格式化状态
......@@ -542,6 +544,7 @@
},
/** 查询freight列表 */
getList() {
//debugger
let data = {
page: this.formInline.page,
limit: this.formInline.limit,
......@@ -579,6 +582,9 @@
data['price_min'] = this.formInline.price_min
data['price_max'] = this.formInline.price_max
}
//console.log("查询list的参数:", data);
getlistGoods(data).then(res => {
if (res.data) {
this.freightList = res.data.list;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论