|
|
|
@ -72,7 +72,7 @@ |
|
|
|
key: 'tax_price' |
|
|
|
},{ |
|
|
|
label: '非含税价', |
|
|
|
key: 'no_tax_price' |
|
|
|
key: 'non_tax_price' |
|
|
|
}], |
|
|
|
contents: [], |
|
|
|
is_show: false, |
|
|
|
@ -98,11 +98,12 @@ |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(options){ |
|
|
|
// todo 编辑的处理 |
|
|
|
this.code = options.code || ''; |
|
|
|
this.type = options.type || 0; |
|
|
|
if(options.type == 1){ |
|
|
|
// 编辑,不可更换食堂 |
|
|
|
this.editMaterialList(); |
|
|
|
this.materialListByOrder(); |
|
|
|
}else if(options.type == 2){ |
|
|
|
// 复用订单号 |
|
|
|
this.materialListByOrder(); |
|
|
|
@ -128,7 +129,6 @@ |
|
|
|
// 获取物资列表 |
|
|
|
getMaterialList(){ |
|
|
|
this.$http(this.API.API_SUPPLIER_MATERIALLIST).then(res => { |
|
|
|
|
|
|
|
let list = res.data.spec || []; |
|
|
|
let contents = list.map(item => { |
|
|
|
return { |
|
|
|
@ -140,20 +140,14 @@ |
|
|
|
quality_level: item?.material?.quality_level || '', |
|
|
|
number: item?.material?.m_sn || '', |
|
|
|
tax_price: {edit: true, value: ''}, |
|
|
|
no_tax_price: {edit: true, value: ''} |
|
|
|
non_tax_price: {edit: true, value: ''} |
|
|
|
} |
|
|
|
}) |
|
|
|
this.contents = contents; |
|
|
|
this.getCanteenList(); |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 编辑物资列表 |
|
|
|
editMaterialList(){ |
|
|
|
// this.$http(this.API.).then(res => { |
|
|
|
// console.log("editMaterialList", res); |
|
|
|
// }) |
|
|
|
}, |
|
|
|
// 复用报价订单号 |
|
|
|
// 复用报价订单号 & 编辑共用 |
|
|
|
materialListByOrder(){ |
|
|
|
this.$http(this.API.API_SUPPLIER_QUOTATIONREUSEBYORDER, { |
|
|
|
q_sn: this.code |
|
|
|
@ -167,10 +161,12 @@ |
|
|
|
material_id: item?.material?.id || 0, |
|
|
|
spec: item.name, |
|
|
|
spec_id: item.id, |
|
|
|
unit: item?.material?.unit?.unit_name || '', |
|
|
|
brand: item?.material?.brand || '', |
|
|
|
quality_level: item?.material?.quality_level || '', |
|
|
|
offer: {edit: true, value: ''} |
|
|
|
number: item?.material?.m_sn || '', |
|
|
|
tax_price: {edit: true, value: item?.quotation?.tax_price || ''}, |
|
|
|
non_tax_price: {edit: true, value: item?.quotation?.non_tax_price || ''}, |
|
|
|
quotation_id: item?.quotation?.id || 0 |
|
|
|
} |
|
|
|
}) |
|
|
|
this.contents = contents; |
|
|
|
@ -191,10 +187,11 @@ |
|
|
|
material_id: item?.material?.id || 0, |
|
|
|
spec: item.name, |
|
|
|
spec_id: item.id, |
|
|
|
unit: item?.material?.unit?.unit_name || '', |
|
|
|
brand: item?.material?.brand || '', |
|
|
|
quality_level: item?.material?.quality_level || '', |
|
|
|
offer: {edit: true, value: ''} |
|
|
|
number: item?.material?.m_sn || '', |
|
|
|
tax_price: {edit: true, value: item?.quotation?.tax_price || ''}, |
|
|
|
non_tax_price: {edit: true, value: item?.quotation?.non_tax_price || ''} |
|
|
|
} |
|
|
|
}) |
|
|
|
this.contents = contents; |
|
|
|
@ -222,22 +219,51 @@ |
|
|
|
}, |
|
|
|
// 切换显示关联食堂modal |
|
|
|
switchRelation(){ |
|
|
|
if(this.type == 1) return this.$msg('编辑不可更换关联食堂哦'); |
|
|
|
this.is_show = !this.is_show; |
|
|
|
}, |
|
|
|
// 选择食堂 |
|
|
|
selectItem(index){ |
|
|
|
this.relation_list[index].checked = !this.relation_list[index].checked; |
|
|
|
}, |
|
|
|
// 报价订单编辑时保存 |
|
|
|
editMaterial(_t){ |
|
|
|
// 物资列表 |
|
|
|
let list = []; |
|
|
|
this.contents.map(item => { |
|
|
|
list.push({ |
|
|
|
id: item.quotation_id, |
|
|
|
tax_price: item.tax_price.value, |
|
|
|
non_tax_price: item.non_tax_price.value |
|
|
|
}) |
|
|
|
}); |
|
|
|
// 操作状态,是保存还是直接发起 |
|
|
|
let state = ['待发起', '待审核'][_t]; |
|
|
|
this.$http(this.API.API_SUPPLIER_QUOTATIONSAVE, { |
|
|
|
data: list, |
|
|
|
state: state |
|
|
|
}).then(res => { |
|
|
|
this.$msg(res.data).then(result => { |
|
|
|
this.$toBack(); |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 保存 |
|
|
|
save(_t){ |
|
|
|
// 拦截是编辑的情况 |
|
|
|
if(this.type == 1){ |
|
|
|
this.editMaterial(_t); |
|
|
|
return; |
|
|
|
} |
|
|
|
// 物资列表 |
|
|
|
let list = []; |
|
|
|
this.contents.map(item => { |
|
|
|
if(item.offer.value){ |
|
|
|
if(item.tax_price.value && item.non_tax_price.value){ |
|
|
|
list.push({ |
|
|
|
m_id: item.material_id, |
|
|
|
m_spec_id: item.spec_id, |
|
|
|
offer: item.offer.value |
|
|
|
tax_price: item.tax_price.value, |
|
|
|
non_tax_price: item.non_tax_price.value |
|
|
|
}) |
|
|
|
} |
|
|
|
}); |
|
|
|
@ -261,8 +287,9 @@ |
|
|
|
state: state, |
|
|
|
canteen_ids: canteen_ids |
|
|
|
}).then(res => { |
|
|
|
console.log("save", res); |
|
|
|
this.$msg('操作成功'); |
|
|
|
this.$msg(res.data).then(result => { |
|
|
|
this.$toBack(); |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|