|
|
@@ -11,7 +11,7 @@
|
|
|
@clear="productData(param.content.pageNumber = 1)"
|
|
|
clearable>
|
|
|
</el-input>
|
|
|
- <product_table style="float: right" :id="id" @checkForm="checkForm" ref="quoterPrice" @productAdd="productData"></product_table>
|
|
|
+ <product_table style="float: right" :id="id" @checkForm="checkForm" ref="quoterPrice" @productAdd="productInitialization"></product_table>
|
|
|
</div>
|
|
|
<div class="produtMag-panel">
|
|
|
<el-table
|
|
|
@@ -211,13 +211,40 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods:{
|
|
|
+ /*产品配置信息新增初始化*/
|
|
|
+ async productInitialization(id){
|
|
|
+ this.param.content.sa_quotedpriceid = id
|
|
|
+ const res = await this.$api.requested(this.param)
|
|
|
+ this.list = res.data
|
|
|
+ this.total = res.total
|
|
|
+ for (var i=0 ;i<this.list.length;i++){
|
|
|
+
|
|
|
+ this.list[i].discountrate = this.list[i].discountrate * 100
|
|
|
+
|
|
|
+ }
|
|
|
+ console.log(this.list,'产品配置信息')
|
|
|
+ },
|
|
|
/*产品配置信息*/
|
|
|
async productData(id){
|
|
|
this.param.content.sa_quotedpriceid = id
|
|
|
const res = await this.$api.requested(this.param)
|
|
|
this.list = res.data
|
|
|
this.total = res.total
|
|
|
- console.log(res,'产品配置信息')
|
|
|
+ for (var i=0 ;i<this.list.length;i++){
|
|
|
+ this.list[i].discountrate = this.list[i].discountrate * 100
|
|
|
+ }
|
|
|
+ console.log(this.list,'产品配置信息')
|
|
|
+ },
|
|
|
+ /*修改折扣或单价的时候刷新*/
|
|
|
+ async productDiscountrateData(id){
|
|
|
+ this.param.content.sa_quotedpriceid = id
|
|
|
+ const res = await this.$api.requested(this.param)
|
|
|
+ this.list = res.data
|
|
|
+ this.total = res.total
|
|
|
+ for (var i=0 ;i<this.list.length;i++){
|
|
|
+ this.list[i].discountrate = this.list[i].discountrate * 100
|
|
|
+ }
|
|
|
+ console.log(this.list,'产品配置信息')
|
|
|
},
|
|
|
handleSizeChange(val) {
|
|
|
// console.log(`每页 ${val} 条`);
|
|
|
@@ -252,23 +279,43 @@ export default {
|
|
|
},
|
|
|
onChangeNum (val,data,index) {
|
|
|
console.log(val,data,index)
|
|
|
- data.amount = data.qty * data.price
|
|
|
+ /* data.amount = data.qty * data.price*/
|
|
|
this.$set(this.list,index,data)
|
|
|
this.$nextTick(()=>{
|
|
|
- this.objSet(this.list)
|
|
|
+ let obj = this.list.map(e=>{
|
|
|
+ return {
|
|
|
+ sa_quotedprice_itemsid:e.sa_quotedprice_itemsid,
|
|
|
+ itemid:e.itemid,
|
|
|
+ oldprice:e.marketprice,
|
|
|
+ price:e.price,
|
|
|
+ discountrate:e.discountrate,
|
|
|
+ qty:e.qty
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.changeData(obj)
|
|
|
})
|
|
|
},
|
|
|
onChangeDiscountrate(val,data,index) {
|
|
|
- data.price = data.marketprice * (data.discountrate / 100)
|
|
|
- data.amount = data.qty * data.price
|
|
|
+ /* data.price = data.marketprice * (data.discountrate / 100)
|
|
|
+ data.amount = (data.qty * data.price).toFixed(2)*/
|
|
|
this.$set(this.list,index,data)
|
|
|
this.$nextTick(()=>{
|
|
|
- this.objSet(this.list)
|
|
|
+ let obj = this.list.map(e=>{
|
|
|
+ return {
|
|
|
+ sa_quotedprice_itemsid:e.sa_quotedprice_itemsid,
|
|
|
+ itemid:e.itemid,
|
|
|
+ oldprice:e.marketprice,
|
|
|
+ price:0,
|
|
|
+ discountrate:e.discountrate/100,
|
|
|
+ qty:e.qty
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.changeDiscountrateData(obj)
|
|
|
})
|
|
|
},
|
|
|
onChangePrice(val,data,index){
|
|
|
- data.discountrate = ((data.price / data.marketprice) * 100).toFixed(2)
|
|
|
- data.amount = data.qty * data.price
|
|
|
+ /*data.discountrate = ((data.price / data.marketprice) * 100).toFixed(2)
|
|
|
+ data.amount = data.qty * data.price*/
|
|
|
this.$set(this.list,index,data)
|
|
|
this.$nextTick(()=>{
|
|
|
this.objSet(this.list)
|
|
|
@@ -279,13 +326,13 @@ export default {
|
|
|
return {
|
|
|
sa_quotedprice_itemsid:e.sa_quotedprice_itemsid,
|
|
|
itemid:e.itemid,
|
|
|
- oldprice:0,
|
|
|
+ oldprice:e.marketprice,
|
|
|
price:e.price,
|
|
|
- discountrate:e.discountrate,
|
|
|
+ discountrate:0,
|
|
|
qty:e.qty
|
|
|
}
|
|
|
})
|
|
|
- this.changeData(obj)
|
|
|
+ this.changeDiscountrateData(obj)
|
|
|
},
|
|
|
async changeData(obj){
|
|
|
console.log(this.list,"数据")
|
|
|
@@ -298,6 +345,20 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
console.log(res)
|
|
|
+ this.productData(res.data[0].sa_quotedpriceid)
|
|
|
+ },
|
|
|
+ async changeDiscountrateData(obj){
|
|
|
+ console.log(this.list,"数据")
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": 20221021095403,
|
|
|
+ "version":1,
|
|
|
+ "content": {
|
|
|
+ "sa_quotedpriceid":this.list[0].sa_quotedpriceid, //sat_notice_classid<=0时 为新增
|
|
|
+ "items":obj
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log(res)
|
|
|
+ this.productDiscountrateData(res.data[0].sa_quotedpriceid)
|
|
|
},
|
|
|
async deleteProduct(val){
|
|
|
console.log(val)
|