自主产品,供应链食堂系统。将两个端拆开了。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

213 lines
5.2 KiB

<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="lf-font-28 lf-color-black lf-row-between">
<view>出库清单</view>
<view class="lf-icon" @click="$url('/pages/classification/warehouse')">
<u-icon name="plus-circle" size="42"></u-icon>
</view>
</view>
<view class="lf-font-24 lf-color-gray lf-m-t-5">添加物资后可以编辑数量</view>
</view>
<!-- 修饰条 -->
<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="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"
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>
</view>
<view class="fixed-bottom" v-else>
<button class="btn btn1" @click="save(0)">临时保存</button>
<button class="btn btn2" @click="save(1)">直接申请</button>
</view>
</view>
</template>
<script>
import wybTable from '@/components/wyb-table/wyb-table';
export default {
components: {
wybTable
},
data(){
return {
headers: [{
label: '物资名称',
key: 'material_name'
},{
label: '规格',
key: 'spec_name'
},{
key: 'brand',
label: '品牌'
},{
key: 'quality_level',
label: '品级'
},{
label: '编号',
key: 'm_sn'
},{
label: '供应商',
key: 'supplier_name'
},{
label: '批次',
key: 'purchase_id'
},{
key: 'delivery_number',
label: '出库数量'
}],
contents: [],
warehouse_list: {},
enter_type: '',
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)
})
},
onShow(e){
if(this.enter_type == 1 || this.enter_type == 2) {
this.getData()
}else {
let contents = [];
let warehouse_list = this.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
contents.push(warehouse_list[i]);
}
this.contents = contents;
}
},
methods: {
getData(){
this.$http(this.API.API_CANTEEN_OUTDETAIL, {
o_sn: this.o_sn
}).then(res => {
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,
purchase_id: item.purchase_id,
delivery_number: {edit: true, value: item.out_number},
order_id: item.material.id
}
})
console.log(contents)
this.contents = contents;
this.warehouse_list = contents
})
},
//编辑出库
editOrder() {
this.$http(this.API.API_EDITOUTORDER, {
data: list
}).then(res => {
console.log("save", res);
this.$msg('操作成功');
})
},
// todo table输入框
onInputChange(event){
console.log("检测到table input被更改", event);
// this.contents[event.contentIndex][event.key].value = event.detailValue;
},
// 保存,出库
save(_t){
console.log("dddddd", this.contents)
if(this.contents.length <= 0) {
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: '待确认'
}
});
this.contents = list;
console.log('==========',list)
// let state = ['', ''][_t]; // 传入状态
this.$http(this.API.API_CANTEEN_WAREHOUSEOUT, {
data: list
}).then(res => {
console.log("save", res);
this.$msg('操作成功');
})
}
}
}
</script>
<style lang="scss" scoped="scoped">
.lf-m-t-5{
margin-top: 5rpx;
}
.lf-icon{
padding: 2rpx 10rpx;
display: flex;
align-items: center;
justify-content: center;
}
.fixed-bottom{
position: fixed;
bottom: 0rpx;
left: 0rpx;
z-index: 99;
width: 750rpx;
height: 98rpx;
display: flex;
justify-content: center;
align-items: center;
border-top: 1rpx solid #E5E5E5;
.btn{
width: 320rpx;
height: 82rpx;
border-radius: 41rpx;
margin: 0;
padding: 0;
font-size: 32rpx;
display: flex;
justify-content: center;
align-items: center;
}
.btn1{
border: 2rpx solid #555555;
opacity: .5;
}
.btn2{
background: #11D189;
color: #FFFFFF;
margin-left: 50rpx;
}
}
</style>