提交 0a38c105 authored 作者: huaxinzhu's avatar huaxinzhu

商品 bug修复

上级 5f3e90ea
......@@ -3,7 +3,6 @@
<el-form :model="goodsInfoForm" :rules="goodsInfoRules" ref="goodsInfoForm" label-width="150px" class="demo-goodsInfoForm" size="small">
<el-form-item label="商品分类:" prop="categoryStr">
<el-input style="width:420px;" v-model="goodsInfoForm.categoryStr" :disabled="true"></el-input>
<!-- <span class="type-text-span">{{ goodsInfoForm.categoryStr }}</span>-->
<el-link class="edit-type-span el-icon-edit" type="primary" :underline="false" @click="editType">修改所在类目</el-link>
<span class="tip-span">该商品所在类目须支持七天无理由退货</span>
</el-form-item>
......@@ -99,12 +98,11 @@
title="修改商品分类"
:visible.sync="editGoodsTypeDialog"
:before-close="cancelType"
destroy-on-close
width="60%"
center
>
<!-- <p>当前所选类目:<span></span></p>-->
<!-- <el-cascader-panel v-show="editGoodsTypeDialog" v-model="SSQGoodsList" :props='goodsprops' @change="SSQGoodsChange" ref="ssqGoodsCascader"></el-cascader-panel>-->
<el-cascader-panel v-show="editGoodsTypeDialog" v-model="SSQGoodsList" :props='goodsprops' :options="fuckoptions" @change="SSQGoodsChange" ref="ssqGoodsCascader"></el-cascader-panel>
<el-cascader-panel v-show="editGoodsTypeDialog" v-model="SSQGoodsList" :props='goodsprops' :options="fuckoptions" @active-item-change="SSQGoodsChange" ref="ssqGoodsCascader"></el-cascader-panel>
<span slot="footer" class="dialog-footer">
<el-button @click="cancelType" size="mini">取 消</el-button>
<el-button type="primary" @click="saveType" size="mini">确 定</el-button>
......@@ -194,7 +192,7 @@
/* 修改 商品分类 */
loadingSSQ: false,
editGoodsTypeDialog: false,
SSQGoodsList: [], // 省市区 子组件goods的
SSQGoodsList: [], // 经营类目
goodsprops: {
expandTrigger: 'click',
// lazy: true,
......@@ -223,10 +221,8 @@
this.getArea();
// 获取 商品品牌
this.getBrands();
// 获取类目
this.getSSQArea();
// fuckoptions
},
mounted() {
//深拷贝一份最开始的数据,为初始化准备
......@@ -267,17 +263,14 @@
// 获取 商品品牌
getBrands() {
getBrandsInf().then( res => {
// debugger
// console.log(297,this.goodsInfoForm.goods_brand);
if(res.data) {
this.brandOptions = res.data.data;
}else {
this.brandOptions = [];
}
//
//console.log(308,this.goodsInfoForm.goods_brand);
let num_goods_brand = Number(this.goodsInfoForm.goods_brand);
//debugger
if( this.goodsInfoForm.goods_brand !== '') {
let result = this.brandOptions.find( item => {
return item.id === num_goods_brand;
......@@ -294,101 +287,35 @@
this.SSQGoodsList = [];
this.editGoodsTypeDialog = true;
this.SSQGoodsList = this.goodsInfoForm.categoryList
//this.options = this.goodsInfoForm.categoryList
// this.options = [{
// id: 175,
// lable: '电脑附件',
// children: [{
// id: 192,
// lable: '各种线缆',
// children: [{
// id: 304,
// lable: '音视频线',
// children: []
// }]
// }]
// }];
console.log('点击修改类目数据:',this.SSQGoodsList);
//console.log('点击修改类目数据:',this.SSQGoodsList);
},
// lazyLoad(node, resolve) {
// // debugger
// this.getSSQArea(node, resolve);
// },
getSSQArea(node, resolve) {
let limboNode = {id: 0};
NewGetCategory(limboNode).then(res => {
this.fuckoptions = res.data;
let result = {};
//debugger
if (level === 0) {
result = res.data
result.forEach(item => {
item.value = item.id;
item.label = item.label;
item.children = [];
item.leaf = 0; // 可以控制 是否有下级 值为true都不行,必须等于0
})
}
// if (level === 1) {
// for(let i = 0; i < res.data.length; i++) {
// if( limboNode.id === res.data[i].id ) {
// result = res.data[i].children;
// break;
// }
// }
// result.forEach(item => {
// item.value = item.id;
// item.label = item.label
// item.children=[];
// //这句代码表示当点击最后一级的时候 label后面不会转圈圈 并把相关值赋值到选择器上
// item.leaf = 0
// })
// }
//
// 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++) {
// if( limboNode.id === res.data[i].children[j].id ) {
// result = res.data[i].children[j].children;
// break;
// }
// }
// }
// }
// result.forEach(item => {
// item.value = item.id;
// item.label = item.label;
// //item.children = [];
// item.leaf = 0;
// })
// }
//
// if( level === 3 ) {
// result = [{
// id: 34444,
// label: '测试',
// leaf: 1
// }]
//
// }
//
// console.log(357,result);
resolve(result)
//this.loading = false;
});
},
// 类目修改
SSQGoodsChange(value) {
//this.SSQGoodsList = value;
this.SSQGoodsList = value;
},
// 确认 修改 商品分类
saveType() {
if(this.SSQGoodsList && this.SSQGoodsList.length === 3) {
let ssqLabelList = this.$refs['ssqGoodsCascader'].getCheckedNodes()[0].pathLabels;
this.goodsInfoForm.categoryList = this.SSQGoodsList;
this.goodsInfoForm.categoryStr = ssqLabelList[0] + '/' + ssqLabelList[1] + '/' + ssqLabelList[2];
this.editGoodsTypeDialog = false;
this.$message({type:'success',message:'修改成功'});
}else {
this.$message({type: 'warning',message: '请选择完整三级类目'});
}
},
// 取消 修改 商品分类
cancelType() {
this.editGoodsTypeDialog = false;
this.SSQGoodsList = [];
},
......@@ -551,7 +478,7 @@
margin-bottom: 20px;
}
/deep/.el-cascader-menu {
height:600px;
}
/*/deep/.el-cascader-menu {*/
/* height:600px;*/
/*}*/
</style>
......@@ -266,16 +266,7 @@
this.isShowGoodsDetails = false;
}
},
mounted() {
// let floor_cont = document.getElementsByClassName('floor-cont')[0];
// let floor_item = document.getElementsByClassName('floor-item')[0].scrollTop;
// console.log(270,floor_cont,floor_item);
// if(this.isShowGoodsDetails) {
// this.$nextTick(()=> {
// console.log(266,this.$refs.scrollview.scrollTop);
// })
// }
},
mounted() {},
methods: {
// 规格子组件,传给父组件的数据
calcSpeTable(data) {
......@@ -389,7 +380,6 @@
// 保存/提交
save() {
//this.goodsLoading = true;
//debugger
// 此处变量 有顺序 校验时,电梯至某处
......@@ -418,6 +408,9 @@
if ( itemKey === 'js_price' || itemKey === 'sl_price' || itemKey === 'price' || itemKey === 'sc_price') {
itemObj[itemKey] = itemObj[itemKey] * 100;
}
if( itemKey === 'stock') {
itemObj[itemKey] = Number(itemObj[itemKey]);
}
isGoodsPrice = true;
}
// ---------------
......@@ -430,7 +423,7 @@
// 无规格组合数据
let slingleSpeObj = spsjData1[0];
for (let key in slingleSpeObj) {
if ( !slingleSpeObj[key] ) {
if ( (slingleSpeObj['js_price'] === '') || (slingleSpeObj['sl_price'] === '') || (slingleSpeObj['price'] === '') || (slingleSpeObj['sc_price'] === '') || (slingleSpeObj['stock'] === '') || (slingleSpeObj['weight'] === '') ) {
isGoodsPrice = false;
break
} else {
......@@ -438,6 +431,9 @@
if ( key === 'js_price' || key === 'sl_price' || key === 'price' || key === 'sc_price') {
slingleSpeObj[key] = slingleSpeObj[key] * 100;
}
if ( key === 'stock') {
slingleSpeObj[key] = Number(slingleSpeObj[key]);
}
isGoodsPrice = true;
}
}
......@@ -523,15 +519,24 @@
// }
// freight
let routerParam = { fuck: "hxz" };
// 商品id 不为 0 是修改
if( this.goodsAllData.goods_id ) {
// 商品id 为 0 是新增
let goodsStatus = 1;
if ( this.goodsAllData.submit === 0 ) {
goodsStatus = 2;
}else if(this.goodsAllData.submit === 1) {
goodsStatus = 3;
}
updateGoodsNew(this.goodsAllData).then(res=> {
//this.goodsLoading = false;
if( res.code === 1 ) {
this.$message({type: 'success', message:'编辑成功'});
this.initAllGoodsInfo();
this.$emit("closeEditDialog");
this.$router.push({
path: '/system/goods/management',
query: { goodsStatus: goodsStatus }
});
}
if(res.code === 0) {
let msg = res.message ? res.message : '编辑失败'
......@@ -540,14 +545,21 @@
});
}else {
// 商品id 为 0 是新增
let goodsStatus = 1;
if ( this.goodsAllData.submit === 0 ) {
goodsStatus = 2;
}else if(this.goodsAllData.submit === 1) {
goodsStatus = 3;
}
addGoods( this.goodsAllData ).then( res=> {
// this.goodsLoading = false;
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' });
this.$router.push({
path: '/system/goods/management',
query: { goodsStatus: goodsStatus }
});
}
if(res.code === 0) {
let msg = res.message ? res.message : '新增失败'
......
......@@ -63,6 +63,7 @@
>
<div class="shoop_brand_tutorial">{{goodsinfor.goods_name}}</div>
<!-- 价格start -->
<!-- 协议 [指导] 0 -->
<div class="test">
<div class="shoop_brand_price">
<div>
......@@ -77,7 +78,7 @@
<span class="shoop_brand_price_marketing">营销价</span>
<span
class="shoop_brand_marketing_text"
>{{ jdactivity_price/100 }}</span>
>{{ 0 }}</span>
</div>
</div>
<div class="shoop_brand_evaluation">
......@@ -192,7 +193,6 @@
</div>
<!-- 商品详情 content-->
<div v-html='goodsinfor.description' style='text-align: center;'>
</div>
</div>
</div>
......@@ -203,6 +203,8 @@
<script>
import {getgoodsdetail} from '@/api/module/goodsgement'
import Magnifying from '@/components/Magnifying'
import { getBrandsInf } from '@/api/module/brand/brand'
import { getAreaList } from '@/api/module/retreat/address'
export default {
components: {
......@@ -235,8 +237,8 @@
default1: '',
default2: '',
picture: '',
goods: '有货',
price: '', // 选中规格的价钱
//goods: '有货',
//price: '', // 选中规格的价钱
shopItemInfo: {}, // 存放要和选中的值进行匹配的数据
selectArr: [], // 存放被选中的值
subIndex: [], // 是否选中 因为不确定是多规格还是单规格,所以这里定义数组来判断
......@@ -289,13 +291,11 @@
arr: true,
tip: true,
arr2: true,
cart_num: 0,
optionsmg: [],
hovers: false,
hovers1: false,
hovers2: false,
hovers3: false,
cart_num: '0',
user: '测试',
adsp: false,
stock: 1,
......@@ -316,12 +316,12 @@
shopinfor: '', //店铺信息
goodsinforlist: '', //全部信息列表
commentLists: [], //评论列表
goodsprice: '', //商品价格
scprice: '', //市场价格
goodsprice: '', //商品协议价格
scprice: '', //商品 指导价格
goodsinfor: '', //商品基础信息
checked: true,
valueStarNums: 5, // 显示点亮星星的数量
price: 200 * 100,
// price: 200 * 100,
dataList: "1",
show: false, // 抵扣和赠送的弹出层
tulesTitle: '', // 抵扣和赠送的弹出层的标题
......@@ -345,28 +345,55 @@
},
goods_id: '',
goods: {
title: '测试商品',
picture: '',
price: 1,
origin: '',
},
// goods: {
// title: '测试商品',
// picture: '',
// price: 1,
// origin: '',
// },
specs_goods: {},
iscollection: ''
iscollection: '',
brandOptions: [], // 品牌列表
areaOptions: [] // 产地列表
}
},
created() {
this.getdetail()
// 获取品牌列表
this.getBrandData();
// 获取产地列表
this.getAreaData();
// this.el_value = [1,72]
// this.goodsonly()
},
mounted() {
this.getdetail()
// let fuck = '-1';
// console.log(111,Number(fuck));
},
methods: {
// 获取产地列表
getAreaData() {
let limboNode = { pid: 0 };
getAreaList(limboNode).then(res=> {
if( res.data && res.data.length > 0) {
this.areaOptions = res.data;
}else {
this.areaOptions = [];
}
});
},
// 获取品牌列表
getBrandData() {
getBrandsInf().then(res=> {
if(res.data) {
this.brandOptions = res.data.data;
}else {
this.brandOptions = [];
}
});
},
elvalueclick() {
// this.goodsonly()
},
......@@ -522,27 +549,45 @@
const date = {
goodsId: this.goodsId.goods_id
}
console.log(date)
//console.log(date)
getgoodsdetail(date).then(response => {
console.log(response)
console.log(551,response)
if (response.code === 1) {
// this.detailData = res.data
//debugger
this.goodsinfor = response.data
this.goodsprice = response.data.price
this.jdactivity_price = response.data.js_price
this.scprice = response.data.sc_price
this.goodsprice = response.data.js_price
//this.jdactivity_price = response.data.js_price
this.scprice = response.data.price
this.stock = Number(response.data.stock)
this.lunimg = response.data.imgs
this.source = 1
this.specs = response.data.specs //规格
this.optionsmg = response.data.specs_group
this.specsitem = response.data.specs
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.areaOptions && this.areaOptions.length > 0) {
let numAreaId = Number(this.goodsinfor.producing_area)
let areaObj = this.areaOptions.find((item)=> {
return numAreaId === item.id
});
console.log('产地',areaObj);
this.goodsinfor.producing_area = areaObj.name ? areaObj.name : '';
}else {
this.goodsinfor.producing_area = '' //producing_area
}
// // 判断是否有规格
if (response.data.specs.length > 0) {
......@@ -575,7 +620,6 @@
var _timer
if (this.goodsinfor.description) {
var str = this.goodsinfor.description
// $(".infor-div-detail").html(str);
}
}
......@@ -644,9 +688,9 @@
//debugger
for (var i = 0; i < arrsow.length; i++) {
this.goodsprice = this.optionsmg[arrsow[i].index].price
this.jdactivity_price = this.optionsmg[arrsow[i].index].js_price
this.scprice = this.optionsmg[arrsow[i].index].sc_price
this.goodsprice = this.optionsmg[arrsow[i].index].js_price
//this.jdactivity_price = this.optionsmg[arrsow[i].index].js_price
this.scprice = this.optionsmg[arrsow[i].index].price
this.stock = this.optionsmg[arrsow[i].index].stock
this.optionsmg[arrsow[i].index]['title'] = this.goodsinfor.goods_name
this.optionsmg[arrsow[i].index]['img'] = this.goodsinfor.cover
......
......@@ -298,6 +298,9 @@
editGood
},
created() {
if( this.$route.query.goodsStatus ) {
this.radiomodel = Number(this.$route.query.goodsStatus);
}
this.getList();
this.$nextTick(() => {
let headerHeight = document.getElementsByClassName('queryFormInline')[0].clientHeight
......
......@@ -84,12 +84,12 @@ export default {
},
watch: {},
methods: {
info(){
getShopInf().then(res=>{
if(res.code==1){
this.collect_num = res.data.collect_num
}
})
info() {
getShopInf().then(res => {
if (res.code == 1) {
this.collect_num = res.data.collect_num
}
})
},
onSubmit() {
if (this.collect_num <= 0) {
......@@ -156,11 +156,12 @@ export default {
this.el_value = []
this.$refs.cascaderDom.$refs.panel.activePath = []
this.form.desc = ''
this.info()
} else {
msg = res.message ? res.message : '导入失败'
this.$message({ type:'error', message: msg })
}
this.info()
})
},
// 自定义高精度浮点数运算
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论