|
|
|
@ -27,7 +27,12 @@ |
|
|
|
<self-line></self-line> |
|
|
|
<!-- 物料table --> |
|
|
|
<view class="box"> |
|
|
|
<wyb-table :first-line-fixed="true" contentBgColor="#eef6fe" :headers="headers" :contents="contents" @onInputChange="onInputChange" width="max-content" height="800rpx"></wyb-table> |
|
|
|
<wyb-table :first-line-fixed="true" |
|
|
|
contentBgColor="#eef6fe" |
|
|
|
:headers="headers" |
|
|
|
:contents="contents" |
|
|
|
@onInputChange="onInputChange" |
|
|
|
width="100%" height="800rpx"></wyb-table> |
|
|
|
</view> |
|
|
|
<!-- 操作按钮 --> |
|
|
|
<view class="fixed-bottom"> |
|
|
|
@ -54,17 +59,24 @@ |
|
|
|
label: '规格', |
|
|
|
key: 'spec' |
|
|
|
},{ |
|
|
|
label: '税前价', |
|
|
|
key: 'pre_tax_price' |
|
|
|
label: '单位', |
|
|
|
key: 'unit' |
|
|
|
},{ |
|
|
|
label: '税后价', |
|
|
|
key: 'after_tax_price' |
|
|
|
label: '品牌', |
|
|
|
key: 'brand' |
|
|
|
},{ |
|
|
|
label: '品质', |
|
|
|
key: 'quality_level' |
|
|
|
},{ |
|
|
|
label: '报价', |
|
|
|
key: 'offer' |
|
|
|
}], |
|
|
|
contents: [], |
|
|
|
is_show: false, |
|
|
|
relation_list: [], |
|
|
|
relation_list: [], // 关联食堂列表 |
|
|
|
node_top: 0, |
|
|
|
q_sn: '' // 订单号,如果有 |
|
|
|
code: '', // 订单号,批次号,如果有 |
|
|
|
type: 0 |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
@ -83,10 +95,21 @@ |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(options){ |
|
|
|
this.q_sn = options.q_sn || ''; |
|
|
|
// todo 临时保存的数据,下次进来再请求一个接口,页面显示出来 |
|
|
|
this.getMaterialList(); |
|
|
|
// this.getCanteenList(); |
|
|
|
this.code = options.code || ''; |
|
|
|
this.type = options.type || 0; |
|
|
|
if(options.type == 1){ |
|
|
|
// 编辑,不可更换食堂 |
|
|
|
this.editMaterialList(); |
|
|
|
}else if(options.type == 2){ |
|
|
|
// 复用订单号 |
|
|
|
this.materialListByOrder(); |
|
|
|
}else if(options.type == 3){ |
|
|
|
// 复用批次号 |
|
|
|
this.materialListByBatch(); |
|
|
|
}else{ |
|
|
|
// 单纯发起报价 |
|
|
|
this.getMaterialList(); |
|
|
|
} |
|
|
|
}, |
|
|
|
onReady(){ |
|
|
|
let that = this; |
|
|
|
@ -101,45 +124,80 @@ |
|
|
|
methods: { |
|
|
|
// 获取物资列表 |
|
|
|
getMaterialList(){ |
|
|
|
this.$http(this.API.API_SUPPLIER_TEMPORARYQUOTATION, { |
|
|
|
supplier_id: getApp().globalData.supplier_id, |
|
|
|
// q_sn: this.q_sn // 传入订单号 |
|
|
|
this.$http(this.API.API_SUPPLIER_MATERIALLIST).then(res => { |
|
|
|
let list = res.data.spec || []; |
|
|
|
let contents = list.map(item => { |
|
|
|
return { |
|
|
|
name: item?.material?.m_name || '', |
|
|
|
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: ''} |
|
|
|
} |
|
|
|
}) |
|
|
|
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 |
|
|
|
}).then(res => { |
|
|
|
console.log("materialListByOrder", res); |
|
|
|
let list = res.data.order || []; |
|
|
|
let canteen = res.data.canteen || []; |
|
|
|
let contents = list.map(item => { |
|
|
|
let obj = { |
|
|
|
name: item.material?.m_name, |
|
|
|
material_id: item.material?.id, |
|
|
|
return { |
|
|
|
name: item?.material?.m_name || '', |
|
|
|
material_id: item?.material?.id || 0, |
|
|
|
spec: item.name, |
|
|
|
spec_id: item.id, |
|
|
|
pre_tax_price: {edit: true, value: ''}, |
|
|
|
after_tax_price: {edit: true, value: ''} |
|
|
|
unit: item?.material?.unit?.unit_name || '', |
|
|
|
brand: item?.material?.brand || '', |
|
|
|
quality_level: item?.material?.quality_level || '', |
|
|
|
offer: {edit: true, value: ''} |
|
|
|
} |
|
|
|
if(item.quotation && Object.keys(item.quotation).length){ |
|
|
|
obj.pre_tax_price.value = item.quotation.tax_price; |
|
|
|
obj.after_tax_price.value = item.quotation.non_tax_price; |
|
|
|
}) |
|
|
|
this.contents = contents; |
|
|
|
this.getCanteenList(canteen); |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 复用批次号 |
|
|
|
materialListByBatch(){ |
|
|
|
this.$http(this.API.API_SUPPLIER_QUOTATIONREUSEBYBATCH, { |
|
|
|
batch_sn: this.code |
|
|
|
}).then(res => { |
|
|
|
console.log("materialListByBatch", res); |
|
|
|
let list = res.data.order || []; |
|
|
|
let canteen = res.data.canteen || []; |
|
|
|
let contents = list.map(item => { |
|
|
|
return { |
|
|
|
name: item?.material?.m_name || '', |
|
|
|
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: ''} |
|
|
|
} |
|
|
|
return obj; |
|
|
|
}); |
|
|
|
}) |
|
|
|
this.contents = contents; |
|
|
|
this.getCanteenList(res.data.canteen || []); |
|
|
|
// let list = res.data.material || []; |
|
|
|
// let contents = list.map(item => { |
|
|
|
// console.log("item", item) |
|
|
|
// return { |
|
|
|
// name: item.material?.m_name, |
|
|
|
// spec: item.name, |
|
|
|
// pre_tax_price: {edit: true, value: item.tax_standard_price}, |
|
|
|
// after_tax_price: {edit: true, value: item.non_tax_standard_price}, |
|
|
|
// spec_id: item.id, |
|
|
|
// material_id: item.material?.id |
|
|
|
// } |
|
|
|
// }) |
|
|
|
// this.contents = contents; |
|
|
|
this.getCanteenList(canteen); |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 关联食堂列表 |
|
|
|
getCanteenList(canteen){ |
|
|
|
getCanteenList(canteen = []){ |
|
|
|
this.$http(this.API.API_SUPPLIER_CANTEENLIST).then(res => { |
|
|
|
let list = res.data.list.map(item => { |
|
|
|
item.checked = false; |
|
|
|
@ -170,12 +228,11 @@ |
|
|
|
// 物资列表 |
|
|
|
let list = []; |
|
|
|
this.contents.map(item => { |
|
|
|
if(item.pre_tax_price.value || item.after_tax_price.value){ |
|
|
|
if(item.offer.value){ |
|
|
|
list.push({ |
|
|
|
m_id: item.material_id, |
|
|
|
m_spec_id: item.spec_id, |
|
|
|
tax_price: item.pre_tax_price.value, |
|
|
|
non_tax_price: item.after_tax_price.value |
|
|
|
offer: item.offer.value |
|
|
|
}) |
|
|
|
} |
|
|
|
}); |
|
|
|
@ -189,8 +246,11 @@ |
|
|
|
if(canteen_ids.length <= 0){ |
|
|
|
return this.$msg('您未选择关联食堂哦') |
|
|
|
} |
|
|
|
if(list.length <= 0){ |
|
|
|
return this.$msg('没有需要报价的物资') |
|
|
|
} |
|
|
|
// 操作状态,是保存还是直接发起 |
|
|
|
let state = ['待发单', '待审核'][_t]; |
|
|
|
let state = ['待发起', '待审核'][_t]; |
|
|
|
this.$http(this.API.API_SUPPLIER_QUOTATIONAPPLY, { |
|
|
|
data: list, |
|
|
|
state: state, |
|
|
|
|