提交 0061122d authored 作者: huaxinzhu's avatar huaxinzhu

优化

上级 c7255ddf
......@@ -318,7 +318,7 @@
<!-- </template>-->
<template slot-scope="scope">
<el-input size="mini" v-for="(iten,inde) in scope.row.ladder" :key="inde" style="width:90%"
v-model="scope.row.ladder[inde].quantity" placeholder="请输入" @input="upChange"
v-model="scope.row.ladder[inde].quantity" placeholder="请输入"
class="custom-el-input-con"></el-input>
</template>
</el-table-column>
......@@ -333,7 +333,7 @@
<!-- </template>-->
<template slot-scope="scope">
<el-input size="mini" v-for="(iten,inde) in scope.row.ladder" :key="inde" style="width:90%"
v-model="scope.row.ladder[inde].money" placeholder="请输入" @input="upChange"
v-model="scope.row.ladder[inde].money" placeholder="请输入"
class="custom-el-input-con"></el-input>
</template>
</el-table-column>
......@@ -342,7 +342,7 @@
<template slot-scope="scope">
<div class="options-price-con">
<div>
<div v-for="(iten,inde) in scope.row.ladder">
<div v-for="(iten,inde) in scope.row.ladder" :key="inde">
<el-button @click="delTieredPrice1(scope.$index,inde)" v-if="scope.row.ladder.length > 1" size="mini" type="text" class="custom-button-danger">删除</el-button>
<el-divider v-if="scope.row.ladder.length > 1" direction="vertical"></el-divider>
</div>
......@@ -427,43 +427,57 @@ export default {
this.singleSpecTable = this.parameterdata.singleSpecTable
}
// console.log(439,this.parameterdata)
// 接受 多规格是否启用阶梯定价
this.$bus.$on("customPriceSpec",(data)=> {
this.parameterdata.is_ladder_spec = data
// 兼容数据处理,如果规格中ladder字段没默认值,则给他拼好
if(this.parameterdata.is_ladder_spec && Array.isArray(this.parameterdata.specs_group) && this.parameterdata.specs_group.length > 0) {
for (let i = 0; i < this.parameterdata.specs_group.length; i++) {
let ladderItem = {quantity: 1,money: 0}
let specItem = this.parameterdata.specs_group[i]
if (specItem.ladder.length === 0) {
specItem.ladder.push(ladderItem)
}
}
}
this.keyvalue++
console.log("完整数据",this.parameterdata)
})
// 编辑时候/初始化,如果已经开启了阶梯定价,则把值传过去
if (this.parameterdata.is_ladder_spec) {
this.$bus.$emit("initSpecIsLadderVal",this.parameterdata.is_ladder_spec)
}
console.log("编辑刚加载:",this.parameterdata)
},
beforeDestroy () {
this.$bus.$off('customPriceSpec')
},
methods: {
upChange() {
this.keyvalue++
// this.$forceUpdate()
},
/** 初始化 商品售价 数据 */
initInfo() {
this.orgGoodsPam = {};
},
// 添加阶梯 -- 多规格
addTieredPrice1(index){
let priceItem = {quantity: 1,money: 0}
// this.parameterdata.specs_group[index].ladder.push(priceItem)
this.$set(this.parameterdata.specs_group[index].ladder,this.parameterdata.specs_group[index].ladder.length,priceItem);
this.keyvalue++
},
// 删除阶梯 -- 多规格
delTieredPrice1(index,inde) {
this.parameterdata.specs_group[index].ladder.splice(inde,1)
this.keyvalue++
},
// 添加阶梯
// 添加阶梯 -- 单规格
addTieredPrice() {
let ladderItem = {quantity: 1,money: 0}
this.parameterdata.ladder.push(ladderItem)
},
// 删除阶梯
// 删除阶梯 -- 但规格
delTieredPrice(index) {
this.parameterdata.ladder.splice(index,1);
},
......
......@@ -125,6 +125,13 @@ export default {
this.speData = this.specificationsdata;
this.$forceUpdate()
}
this.$bus.$on("initSpecIsLadderVal",(data)=> {
this.isCustomPriceSpec = data
})
},
beforeDestroy () {
this.$bus.$off('initSpecIsLadderVal')
},
watch:{
// 'specificationsdata': {
......@@ -137,9 +144,6 @@ export default {
methods: {
switchCustomPriceSpec() {
this.$bus.$emit("customPriceSpec",this.isCustomPriceSpec)
if (!this.isCustomPriceSpec) {
console.log(151,this.specificationsdata)
}
},
/** 初始化 商品规格数据 */
initInfo() {
......@@ -327,6 +331,7 @@ export default {
/** 规格参数 变化时,对数据进行处理后,再进行笛卡尔积算法,最终计算出商品售价的数据 */
specCalcResult() {
debugger
// 商品规格原始数据
let specs_group = []
let orgSpeData = this.deepClone(this.speData);
......@@ -370,7 +375,7 @@ export default {
// debugger
for (let index = 0; index < goodsParametersList.length; index++) {
var listobj = {};
let listobj = {};
listobj["sc_price"] = "";
listobj["price"] = "";
listobj["js_price"] = "";
......@@ -400,7 +405,6 @@ export default {
this.tableData7['specs'] = this.speData
this.tableData7['shopTypes'] = this.cartesian(proSpeData)
this.tableData7['isradioguide'] = 2
if(this.isCustomPriceSpec) {
this.tableData7.specs_group.forEach((item,index)=> {
item['ladder'] = []
let obj = {
......@@ -408,14 +412,10 @@ export default {
}
item['ladder'].push(obj)
})
}
this.$emit('calcSpeTable',this.tableData7);
// this.switchCustomPriceSpec()
// if (this.tableData7.is_ladder_spec !== undefined) {
// this.tableData7.is_ladder_spec = this.isCustomPriceSpec
// }
console.log(399,this.tableData7)
console.log("新生成多数据:",this.tableData7)
}
},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论