|
|
|
@ -1,9 +1,9 @@ |
|
|
|
<template> |
|
|
|
<view> |
|
|
|
<view class="lf-p-32 lf-p-t-30 lf-p-b-30 lf-w-100 lf-h-maxcontent lf-border-box"> |
|
|
|
<view class="list" @click="$url('/pages/classification/warehouse')"> |
|
|
|
<view class="lf-font-28 lf-color-black lf-row-between"> |
|
|
|
<view>出库清单</view> |
|
|
|
<view class="lf-icon" @click="$url('/pages/classification/warehouse')"> |
|
|
|
<view class="lf-icon"> |
|
|
|
<u-icon name="plus-circle" size="42"></u-icon> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
@ -12,19 +12,20 @@ |
|
|
|
<!-- 修饰条 --> |
|
|
|
<self-line></self-line> |
|
|
|
<!-- 物料table --> |
|
|
|
<view class="lf-p-32 lf-p-t-30 lf-p-b-30 lf-w-100 lf-h-maxcontent lf-border-box"> |
|
|
|
<view class="list"> |
|
|
|
<view class="lf-font-32 lf-color-black lf-font-bold lf-m-b-20">物资明细</view> |
|
|
|
<wyb-table :headers="headers" :contents="contents" |
|
|
|
contentBgColor="#ecfaf5" |
|
|
|
:first-line-fixed="true" |
|
|
|
@onInputChange="onInputChange" |
|
|
|
width="max-content" height="800rpx" |
|
|
|
width="max-content" height="80vh" |
|
|
|
v-if="contents.length"></wyb-table> |
|
|
|
</view> |
|
|
|
<!-- 操作按钮 --> |
|
|
|
<view class="fixed-bottom lf-p-l-32 lf-p-r-32" style="justify-content: space-between;" v-if="enter_type == 1"> |
|
|
|
<view></view> |
|
|
|
<button class="btn btn2" @click="editOrder()">立即申请</button> |
|
|
|
<!-- <button class="btn btn2" @click="editOrder()">立即申请</button> --> |
|
|
|
<button class="btn btn2" @click="save(1)">立即申请</button> |
|
|
|
</view> |
|
|
|
<view class="fixed-bottom" v-else> |
|
|
|
<button class="btn btn1" @click="save(0)">临时保存</button> |
|
|
|
@ -62,79 +63,90 @@ |
|
|
|
key: 'supplier_name' |
|
|
|
},{ |
|
|
|
label: '批次', |
|
|
|
key: 'purchase_id' |
|
|
|
key: 'batch_sn' |
|
|
|
},{ |
|
|
|
key: 'delivery_number', |
|
|
|
label: '出库数量' |
|
|
|
}], |
|
|
|
contents: [], |
|
|
|
warehouse_list: {}, |
|
|
|
enter_type: '', |
|
|
|
enter_type: '', // 1 编辑,2 复用 |
|
|
|
o_sn: '' |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(e){ |
|
|
|
this.o_sn = e.o_sn |
|
|
|
this.enter_type = e.enter_type |
|
|
|
// 监听warehouse_list被操作 |
|
|
|
uni.$on('addWarehouseList', res => { |
|
|
|
this.warehouse_list = res; |
|
|
|
console.log(this.warehouse_list) |
|
|
|
}) |
|
|
|
if(e){ |
|
|
|
this.o_sn = e.o_sn |
|
|
|
this.enter_type = e.enter_type |
|
|
|
if(e.enter_type == 1 || e.enter_type == 2){ |
|
|
|
this.getData(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
onShow(){ |
|
|
|
this.transformList(); |
|
|
|
}, |
|
|
|
onShow(e){ |
|
|
|
if(this.enter_type == 1 || this.enter_type == 2) { |
|
|
|
this.getData() |
|
|
|
}else { |
|
|
|
methods: { |
|
|
|
transformList(){ |
|
|
|
let contents = []; |
|
|
|
let warehouse_list = this.warehouse_list; |
|
|
|
let warehouse_list = JSON.stringify(this.warehouse_list); |
|
|
|
warehouse_list = JSON.parse(warehouse_list); |
|
|
|
for(let i in warehouse_list){ |
|
|
|
|
|
|
|
warehouse_list[i].delivery_number = {edit: true, value: '1'} |
|
|
|
warehouse_list[i].brand = i.brand |
|
|
|
warehouse_list[i].quality_level = i.quality_level |
|
|
|
warehouse_list[i].delivery_number = {edit: true, value: warehouse_list[i].delivery_number || 1}; |
|
|
|
contents.push(warehouse_list[i]); |
|
|
|
} |
|
|
|
this.contents = contents; |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
console.log("show.warehouse_list...", this.warehouse_list) |
|
|
|
console.log("transformList...", contents); |
|
|
|
}, |
|
|
|
// 复用 & 编辑 |
|
|
|
getData(){ |
|
|
|
// TODO 此处应该调此接口 出库单复用 |
|
|
|
// this.$http(this.API.API_CANTEEN_WAREHOUSEOUTREUSE, { |
|
|
|
this.$http(this.API.API_CANTEEN_OUTDETAIL, { |
|
|
|
o_sn: this.o_sn |
|
|
|
}).then(res => { |
|
|
|
// let list = res.data || []; |
|
|
|
let list = res.data.sheet || []; |
|
|
|
let contents = list.map(item => { |
|
|
|
return { |
|
|
|
material_name: item.material.m_name, |
|
|
|
spec_name: item.spec.name, |
|
|
|
brand: item.material.brand, |
|
|
|
quality_level: item.material.quality_level, |
|
|
|
m_sn: item.material.m_sn, |
|
|
|
supplier_name: item.purchase.supplier.supplier_name, |
|
|
|
let warehouse_list = {}; |
|
|
|
list.map(item => { |
|
|
|
warehouse_list[item.id] = { |
|
|
|
batch_sn: item?.purchase?.batch_sn || '', |
|
|
|
brand: item?.material?.brand || '', |
|
|
|
checked: true, |
|
|
|
m_sn: item?.material?.m_sn || '', |
|
|
|
material_id: item?.material?.id || 0, |
|
|
|
material_name: item?.material?.m_name || '', |
|
|
|
order_id: item.id, |
|
|
|
purchase_id: item.purchase_id, |
|
|
|
delivery_number: {edit: true, value: item.out_number}, |
|
|
|
order_id: item.material.id |
|
|
|
} |
|
|
|
quality_level: item?.material?.quality_level || '', |
|
|
|
spec_id: item?.spec?.id || 0, |
|
|
|
spec_name: item?.spec?.name || '', |
|
|
|
supplier_name: item?.purchase?.supplier?.supplier_name || '', |
|
|
|
delivery_number: item.out_number || 1 |
|
|
|
}; |
|
|
|
}) |
|
|
|
console.log(contents) |
|
|
|
this.contents = contents; |
|
|
|
this.warehouse_list = contents |
|
|
|
this.warehouse_list = warehouse_list; |
|
|
|
this.transformList(); |
|
|
|
}) |
|
|
|
}, |
|
|
|
//编辑出库 |
|
|
|
//编辑出库 todo |
|
|
|
editOrder() { |
|
|
|
this.$http(this.API.API_EDITOUTORDER, { |
|
|
|
data: list |
|
|
|
}).then(res => { |
|
|
|
console.log("save", res); |
|
|
|
this.$msg('操作成功'); |
|
|
|
this.$msg('操作成功').then(() => this.$toBack()); |
|
|
|
}) |
|
|
|
}, |
|
|
|
// todo table输入框 |
|
|
|
// table输入框 |
|
|
|
onInputChange(event){ |
|
|
|
console.log("检测到table input被更改", event); |
|
|
|
// this.contents[event.contentIndex][event.key].value = event.detailValue; |
|
|
|
this.contents[event.contentIndex][event.key].value = event.detailValue; |
|
|
|
}, |
|
|
|
// 保存,出库 |
|
|
|
save(_t){ |
|
|
|
@ -143,25 +155,29 @@ |
|
|
|
return this.$msg('您未选择物资') |
|
|
|
} |
|
|
|
let list = this.contents.map(item => { |
|
|
|
console.log(item) |
|
|
|
return { |
|
|
|
m_id: item.material_id, |
|
|
|
m_spec_id: item.spec_id, |
|
|
|
tax_price: '', |
|
|
|
non_tax_price: '', |
|
|
|
purchase_id: item.purchase_id, |
|
|
|
out_number: '' , |
|
|
|
state: '待确认' |
|
|
|
out_number: Number(item.delivery_number.value) || 1, |
|
|
|
warehouse_id: item.order_id || 0, |
|
|
|
tax_price: item.tax_price || '', // TODO 添加物资页面未返回价格,默认空 |
|
|
|
non_tax_price: item.non_tax_price || '', |
|
|
|
m_unit_id: item.m_unit_id || 0 |
|
|
|
} |
|
|
|
}); |
|
|
|
this.contents = list; |
|
|
|
|
|
|
|
console.log('==========',list) |
|
|
|
// let state = ['', ''][_t]; // 传入状态 |
|
|
|
this.$http(this.API.API_CANTEEN_WAREHOUSEOUT, { |
|
|
|
data: list |
|
|
|
let _api = this.API.API_CANTEEN_WAREHOUSEOUT; |
|
|
|
if(this.enter_type == 1){ |
|
|
|
_api = this.API.API_EDITOUTORDER; |
|
|
|
} |
|
|
|
let state = ['待确认', '已确认'][_t]; // 传入状态 |
|
|
|
this.$http(_api, { |
|
|
|
data: list, |
|
|
|
state: state |
|
|
|
}).then(res => { |
|
|
|
console.log("save", res); |
|
|
|
this.$msg('操作成功'); |
|
|
|
this.$msg('操作成功').then(() => this.$toBack()); |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
@ -178,6 +194,12 @@ |
|
|
|
align-items: center; |
|
|
|
justify-content: center; |
|
|
|
} |
|
|
|
.list{ |
|
|
|
padding: 30rpx 32rpx; |
|
|
|
width: 100%; |
|
|
|
height: max-content; |
|
|
|
box-sizing: border-box; |
|
|
|
} |
|
|
|
.fixed-bottom{ |
|
|
|
position: fixed; |
|
|
|
bottom: 0rpx; |
|
|
|
|