自主项目,食堂系统,前端uniapp
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.
 
 
 
 

142 lines
3.4 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/canteen/classification/index?type=3')">
<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" contentBgColor="#ecfaf5" :first-line-fixed="true" :contents="contents" @onInputChange="onInputChange" width="max-content" height="800rpx"></wyb-table>
</view>
<!-- 操作按钮 -->
<view class="fixed-bottom">
<button class="btn btn1" @click="save(1)">临时保存</button>
<button class="btn btn2" @click="save(2)">直接申请</button>
</view>
</view>
</template>
<script>
import wybTable from '@/components/wyb-table/wyb-table';
export default {
components: {
wybTable
},
data(){
return {
headers: [{
label: '菜品名称',
key: 'name'
},{
label: '规格',
key: 'spec'
},{
label: '税前价',
key: 'pre_tax_price'
},{
label: '税后价',
key: 'after_tax_price'
}],
contents: []
}
},
onLoad(){
this.getMaterialList();
},
methods: {
getMaterialList(){
this.$http(this.API.API_CANTEEN_MATERIALLIST, {
// category_id: 1 // 分类id 不传则显示默认分类
}).then(res => {
let list = res.data.material || [];
let contents = list.map(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;
})
},
onInputChange(event){
console.log("检测到table input被更改", event);
this.contents[event.contentIndex][event.key].value = event.detailValue;
},
save(_t){
// todo
console.log("dddddd", this.contents)
let list = this.contents.map(item => {
return {
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
}
});
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>