提交 7d280236 authored 作者: huaxinzhu's avatar huaxinzhu

bug修复

上级 0a38c105
......@@ -69,7 +69,25 @@ Vue.component('Pagination', Pagination)
Vue.use(permission)
//
const preventReClick = Vue.directive('preventReClick', {
inserted: function (el, binding) {
el.addEventListener('click', () => {
if (!el.disabled) {
el.disabled = true
setTimeout(() => {
el.disabled = false
}, binding.value || 3000)
}
console.log(el.disabled)
})
}
});
export {
preventReClick
}
/**
* If you don't want to use mock-server
......
......@@ -68,10 +68,10 @@
}
}
},
// 禁止粘贴图片
// clipboard: {
// //matchers: [[Node.ELEMENT_NODE, this.handleCustomMatcher]]
// }
// // 禁止粘贴图片
clipboard: {
matchers: [[Node.ELEMENT_NODE, this.handleCustomMatcher]]
}
}
},
index: 0,
......@@ -88,22 +88,32 @@
this.goodsDeForm = this.imgdata;
}
},
watch: {},
watch: {
'goodsDeForm.description': {
handler: function() {
// console.log(99,this.goodsDetailsImgFileList);
// console.log(100,this.goodsDeForm.description);
},
deep: true
}
},
methods: {
// handleCustomMatcher(node, Delta) {
// let ops = []
// console.log(123);
// debugger
// Delta.ops.forEach(op => {
// if (op.insert && typeof op.insert === 'string') {// 如果粘贴了图片,这里会是一个对象,所以可以这样处理
// ops.push({
// insert: op.insert,
// })
// }
// })
// Delta.ops = ops
// return Delta
// },
handleCustomMatcher(node, Delta) {
let ops = []
Delta.ops.forEach(op => {
// 如果粘贴了图片,这里会是一个对象,所以可以这样处理
if (op.insert && typeof op.insert === 'object' && op.insert.image.indexOf('base64') > -1) {
ops.push({
insert: ''
})
Delta.ops = ops;
// console.log('我是粘贴的');
}
})
//
//console.log(113,Delta);
return Delta
},
/** 初始化 商品详情 */
initInfo() {
......
......@@ -214,14 +214,21 @@ export default {
'parameterdata': function(val) {
//debugger
this.orgGoodsPam = val;
//console.log("监听",this.orgGoodsPam);
console.log("监听",this.orgGoodsPam);
},
// "orgGoodsPam": {
// handler: function(val) {
// console.log(222,val);
//
// },
// deep: true
// }
},
created() {
//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 {
......
......@@ -303,6 +303,10 @@ export default {
specCalcResult() {
// 商品规格原始数据
let orgSpeData = this.deepClone(this.speData);
// let hhxz = this.$
//
// console.log(333333,this.speData);
// 进行数据处理后的数据,
let proSpeData = this.processData(orgSpeData);
// 需要将 所有规格名称,提出一个数组集合,
......@@ -342,6 +346,7 @@ export default {
};
goodsPam.pamNameList = this.speNameList;
goodsPam.pamDataList = goodsParametersList;
goodsParametersList.forEach((item)=> {
let prePamTable = [
{ js_price:'', sl_price:'', price:'', sc_price:'', stock:'', weight:'', thumb:'',spec_values: [] }
......
......@@ -42,7 +42,9 @@
<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>
<GoodsParameter ref="goodsparameter" :parameterdata="parameterdata" />
<!-- <keep-alive>-->
<GoodsParameter ref="goodsparameter" :parameterdata="parameterdata" />
<!-- </keep-alive>-->
</div>
</div>
<!-- 商品详情 -->
......@@ -68,7 +70,7 @@
</div>
<div class="submit-cont">
<el-button type="primary" style="padding: 10px 30px;" @click="save">提 交</el-button>
<el-button type="primary" style="padding: 10px 30px;" @click="save" v-preventReClick>提 交</el-button>
</div>
</el-card>
<!-- 添加商品 end -->
......@@ -270,6 +272,10 @@
methods: {
// 规格子组件,传给父组件的数据
calcSpeTable(data) {
// 第一步,获取原来的值
let spsjData2 = this.$refs.goodsparameter.orgGoodsPam;
// 第二步,重新渲染dom
if(data.pamTableList.length > 0) {
data.pamTableList.forEach((item, index) => {
if( Array.isArray(data.pamDataList[index]) ) {
......@@ -279,8 +285,22 @@
}
})
}
// console.log(153,data);
// console.log(222,spsjData2);
// 第三步,重新赋值
if(data.pamTableList.length > 0 && spsjData2.pamTableList.length > 0) {
for(let i = 0; i < data.pamTableList.length; i++) {
for(let j = 0; j < spsjData2.pamTableList.length; j++) {
if( data.pamTableList[i][0].spec_values[0] === spsjData2.pamTableList[j][0].spec_values[0] ) {
data.pamTableList[i] = spsjData2.pamTableList[j];
}
}
}
}
this.parameterdata = data;
//console.log(153,this.parameterdata);
},
// 只有点击完最后一级,才会有值
SSQChange() {
......@@ -404,13 +424,13 @@
isGoodsPrice = false;
break
} else {
// 所有校验通过,对价格进行处理,*100
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]);
}
// // 所有校验通过,对价格进行处理,*100
// 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;
}
// ---------------
......@@ -428,12 +448,12 @@
break
} else {
// 所有校验通过,对价格进行处理,*100
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]);
}
// 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;
}
}
......@@ -508,17 +528,37 @@
this.goodsAllData.stags = this.goodsAllData.stags.toString();
}
// let msg = res.data.Apply.content;
// this.$router.push({
// name: 'reviewFail',
// params: { msg: msg }
// });
// if(this.$route.params.msg) {
// this.msg = this.$route.params.msg;
// }
// freight
debugger
// 价格数字需要 乘以100
if(this.goodsAllData.specs_group && this.goodsAllData.specs_group.length > 0) {
this.goodsAllData.specs_group.forEach((item)=> {
item.js_price = Number(item.js_price) * 100;
item.price = Number(item.price) * 100;
item.sc_price = Number(item.sc_price) * 100;
item.sl_price = Number(item.sl_price) * 100;
item.stock = Number(item.stock);
})
delete this.goodsAllData.js_price;
delete this.goodsAllData.price;
delete this.goodsAllData.sc_price;
delete this.goodsAllData.sl_price;
delete this.goodsAllData.stock;
delete this.goodsAllData.weight;
}else {
this.goodsAllData.js_price = Number(this.goodsAllData.js_price) * 100
this.goodsAllData.price = Number(this.goodsAllData.price) * 100
this.goodsAllData.sc_price = Number(this.goodsAllData.sc_price) * 100
this.goodsAllData.sl_price = Number(this.goodsAllData.sl_price) * 100
this.goodsAllData.stock = Number(this.goodsAllData.stock);
delete this.goodsAllData.specs;
delete this.goodsAllData.specs_group;
}
// stock 库存需要转为 int
// console.log(531,this.goodsAllData)
// return
// 商品id 不为 0 是修改
if( this.goodsAllData.goods_id ) {
// 商品id 为 0 是新增
......@@ -701,9 +741,9 @@
.blue-block-goods {
width: 5px;
height: 24px;
background: #3A84FF;
margin: 0 7px 0 0;
border-radius: 2px;
/*background: #3A84FF;*/
/*margin: 0 7px 0 0;*/
/*border-radius: 2px;*/
}
/* el-card title hxz 样式统一 end */
.goods-type-tip {
......@@ -807,6 +847,7 @@
.submit-type-con {
width: 236px;
margin: 0 auto 20px;
padding: 0 0 20px;
}
.submit-cont {
width: calc(100% + 40px);
......@@ -817,6 +858,6 @@
justify-content: center;
align-items: center;
/*align-content: center;*/
box-shadow: 0px -8px 9px 1px rgba(51, 51, 51, 0.06);
box-shadow: 0 -8px 9px 1px rgba(51, 51, 51, 0.06);
}
</style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论