提交 5f3e90ea authored 作者: huaxinzhu's avatar huaxinzhu

商品,bug修复04

上级 bd48310b
......@@ -27,13 +27,6 @@ export function NewGetCategory(query) {
})
}
// 查询运费模板
// export function GetFreight(query) {
// return request({
// url: '/system/goods/getFreight',
// method: 'get',
// params: query
// })
// }
export function GetFreight(query) {
return request({
url: '/system/freightNew/getFreight',
......
......@@ -10,7 +10,7 @@
<el-form-item label="邮费模板:" prop="freight_id">
<el-select v-model="goodsAfterSaleForm.freight_id" placeholder="请选择邮费模板" style="width:400px;">
<el-option v-for="item in freightOptions" :key="item.Id" :label="item.Name" :value="item.Id"></el-option>
<el-option v-for="item in freightOptions" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>
......@@ -30,8 +30,6 @@
</el-select>
</el-form-item>
<!-- <div style="width: 100%;height: 1000px;">我很高</div>-->
</el-form>
</div>
</template>
......@@ -92,7 +90,6 @@
},
// 运费模板
getFreightData() {
// let query = { page: 1, limit: 50 };
GetFreight().then(res => {
if(res.data) {
this.freightOptions = res.data;
......
......@@ -80,8 +80,13 @@
},
components: {},
mounted() {
this.$refs.myTextEditor.quill.enable(false);
setTimeout(() => {
this.$refs.myTextEditor.quill.enable(true) //两秒后点击可获取焦点
}, 1000)
if( this.imgdata ) {
this.goodsDeForm = this.imgdata;
//console.log("详情:",this.imgdata);
}
},
watch: {},
methods: {
......
......@@ -92,19 +92,19 @@
</el-form>
<!-- 修改 商品分类目录 -->
<!-- <el-cascader-panel v-model="SSQList" :props='props' @change="SSQChange" ref="ssqCascader"></el-cascader-panel>-->
<el-dialog
v-loading="loadingSSQ"
class="add-workorder-dialog"
title="修改商品分类"
:visible.sync="editGoodsTypeDialog"
:destroy-on-close="true"
:before-close="cancelType"
width="60%"
append-to-body
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' @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>
<span slot="footer" class="dialog-footer">
<el-button @click="cancelType" size="mini">取 消</el-button>
<el-button type="primary" @click="saveType" size="mini">确 定</el-button>
......@@ -197,18 +197,37 @@
SSQGoodsList: [], // 省市区 子组件goods的
goodsprops: {
expandTrigger: 'click',
lazy: true,
lazyLoad: this.lazyLoad,
// lazy: true,
// lazyLoad: this.lazyLoad,
value: "id",
label: 'label',
leaf: 'leaf'
// leaf: 'leaf',
children: 'children',
// checkStrictly: true
},
fuckoptions: [],
} // return end
},
components: {},
watch: {},
created() {},
watch: {
// selectCity(arr){
// //处理回显问题
// setTimeout(()=>{
// this.$refs.ssqGoodsCascader.presentText = arr[0] +"/" + arr[1];// 首次手动复制
// },1000)
// }
},
created() {
// 获取 省
this.getArea();
// 获取 商品品牌
this.getBrands();
this.getSSQArea();
// fuckoptions
},
mounted() {
//深拷贝一份最开始的数据,为初始化准备
//this.goodsInfoDataClone = this.deepClone(this.goodsinfodata);
......@@ -225,10 +244,6 @@
this.goodsInfoForm.categoryStr = this.goodsinfodata.categoryStr;
this.goodsInfoForm.categoryList = this.goodsinfodata.categoryList;
}
// 获取 省
this.getArea();
// 获取 商品品牌
this.getBrands();
},
methods: {
// 数据初始化
......@@ -252,11 +267,26 @@
// 获取 商品品牌
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;
});
//console.log(315,result)
if( result == undefined) {
this.goodsInfoForm.goods_brand = '';
}
}
});
},
/* 修改 商品分类 类目 */
......@@ -264,27 +294,30 @@
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);
},
lazyLoad(node, resolve) {
//debugger
this.getSSQArea(node, resolve);
},
// lazyLoad(node, resolve) {
// // debugger
// this.getSSQArea(node, resolve);
// },
getSSQArea(node, resolve) {
const level = node.level;
let limboNode = {};
if(level === 0) {
limboNode = {id: 0}
}
if(level === 1) {
limboNode = { id: node.value };
}
if(level === 2) {
limboNode = { id: node.value };
}
//this.loading = true;
let limboNode = {id: 0};
NewGetCategory(limboNode).then(res => {
this.fuckoptions = res.data;
let result = {};
//debugger
if (level === 0) {
......@@ -297,41 +330,51 @@
})
}
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.leaf = 1;
})
}
// 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;
});
......@@ -507,4 +550,8 @@
/deep/.el-form-item {
margin-bottom: 20px;
}
/deep/.el-cascader-menu {
height:600px;
}
</style>
......@@ -17,7 +17,7 @@
</el-card>
<!-- 选择商品类目 end -->
<!-- 添加商品 start -->
<el-card class="box-card good-details-body" v-if="isShowGoodsDetails">
<el-card class="box-card good-details-body" v-if="isShowGoodsDetails" v-loading="goodsLoading">
<div class="floor-nav" id="floorNavList">
<ul class="nav-list">
<li class="nav-list-item" :class="{'floor-item-active': isFIActive === index}" v-for="(item, index) in floorNav" :key="item.id" @click="setFloorNavMountClick(index)">{{ item.name }}</li>
......@@ -100,7 +100,7 @@
},
data() {
return {
loading: false,
goodsLoading: false,
SSQList: [], // 省市区
SSQStr: '', // 省市区 拼接
props: {
......@@ -152,6 +152,7 @@
submit: 0,
}, // 商品所有数据
TIMER: null,
hehe: 0,
} // return end
},
......@@ -175,7 +176,7 @@
producing_area: Number(res.data.producing_area), // 产地
deliver_area: Number(res.data.deliver_area), // 发货地
unit: res.data.unit, // 单位
goods_brand: res.data.goods_brand, // 品牌
goods_brand: Number(res.data.goods_brand), // 品牌
web_url: res.data.web_url, // 外部链接
out_goods_id: res.data.out_goods_id, // 商品编码
imgs: res.data.imgs // 商品图片
......@@ -184,10 +185,12 @@
// 产地 和 发货地 需要 处理
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[0] = res.data.category_second_id;
arr[0] = res.data.category_three_id;
arr[1] = res.data.category_second_id;
arr[2] = res.data.category_three_id;
this.goodsinfodata.categoryList = arr;
// 商品规格, 售价由规格决定
......@@ -196,7 +199,6 @@
}
// 商品售价
// debugger
if(res.data.specs_group && res.data.specs_group.length > 0) {
//this.parameterdata
let prePriceArr = [];
......@@ -260,12 +262,20 @@
}
}
});
}else {
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);
// })
// }
},
methods: {
// 规格子组件,传给父组件的数据
calcSpeTable(data) {
......@@ -379,6 +389,7 @@
// 保存/提交
save() {
//this.goodsLoading = true;
//debugger
// 此处变量 有顺序 校验时,电梯至某处
......@@ -516,6 +527,7 @@
// 商品id 不为 0 是修改
if( this.goodsAllData.goods_id ) {
updateGoodsNew(this.goodsAllData).then(res=> {
//this.goodsLoading = false;
if( res.code === 1 ) {
this.$message({type: 'success', message:'编辑成功'});
this.initAllGoodsInfo();
......@@ -529,6 +541,7 @@
}else {
// 商品id 为 0 是新增
addGoods( this.goodsAllData ).then( res=> {
// this.goodsLoading = false;
if( res.code === 1 ) {
this.$message({type: 'success', message:'新增成功'});
this.initAllGoodsInfo();
......@@ -574,7 +587,7 @@
floor_offsetTop = floor_item[index].offsetTop - floor_item[0].offsetTop,
window_scrollTop = _this.$refs.scrollview.scrollTop,
// 基本滚动动画配置
timer = { step: 45, times: 20, FLOOR_OFFSETTOP: 0 };
timer = { step: 60, times: 15, FLOOR_OFFSETTOP: 0 };
// floor_cont 可是窗口的 高
let hxz = 0;
......
<template>
<div class="eidt-goods">
<editGood :option="goodsid"></editGood>
</div>
</template>
<script>
import editGood from '@/views/system/goods/add/index'
export default {
name: "EditGoods",
data() {
return {
goodsid: 0,
}
},
components: {
editGood
},
created() {
this.goodsid = Number(this.$route.query.goods_id);
},
mounted() {
},
methods: {
}
}
</script>
<style lang="scss" type="text/stylus" scoped>
.eidt-goods {
height: 100%;
}
.add-workorder-dialog {
height: 100%;
}
/deep/.add-workorder-dialog el-dialog {
height: calc(100% - 15vh);
}
</style>
......@@ -210,9 +210,9 @@
@pagination="getList"
/>
<!-- 商品编辑-->
<el-dialog title="编辑商品" :visible.sync="editisOpen" v-if="editisOpen" width="70%" class="freightTemplate-add">
<editGood :option="goodsid" @closeEditDialog="closeEditGoods"></editGood>
</el-dialog>
<!-- <el-dialog title="编辑商品" :visible.sync="editisOpen" v-if="editisOpen" width="70%" class="freightTemplate-add">-->
<!-- <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"></goodDetail>
......@@ -233,7 +233,7 @@
goodDetails: {
goods_id: ''
},
editisOpen: false,//编辑
// editisOpen: false,//编辑
downsale_count: '',//仓库数量
onsale_count: '',//上架数量
del_count: '',//删除数量
......@@ -527,8 +527,17 @@
//cancelOnsale().then();
},
editgoods(row) {//商品编辑
this.editisOpen = true
this.goodsid = Number(row.goods_id);
// this.editisOpen = true
let goodsId = Number(row.goods_id);
// let goodsParam = {
// goods_id: Number(row.goods_id)
// };
this.$router.push({
path: '/system/goods/editgoods',
query: { goods_id : goodsId }
});
//this.$router.push({ path: '/system/goods/editgoods' });
},
lookdetail(row) {//预览商品详情
this.isOpen = true
......
......@@ -34,6 +34,7 @@
</el-form-item>
<el-form-item label="商品分类:">
<el-cascader
ref="cascaderDom"
v-model="el_value"
v-if="el_valuestatus"
@change="elvalueclick"
......@@ -153,6 +154,7 @@ export default {
}
this.el_value = []
this.$refs.cascaderDom.$refs.panel.activePath = []
this.form.desc = ''
this.info()
} else {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论