<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-font-bold lf-color-black">报价清单</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">
			<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">
			<button class="btn btn1">临时保存</button>
			<button class="btn btn2">直接报价</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: 'preTax'
				},{
					label: '税后价',
					key: 'afterTax'
				}],
				contents: [{
					name: '黄瓜',
					spec: '一打/500g',
					preTax: {edit: true, value: ''},
					afterTax: {edit: true, value: ''}
				},{
					name: '黄豆',
					spec: '5kg',
					preTax: {edit: true, value: ''},
					afterTax: {edit: true, value: ''}
				},{
					name: '黄豆',
					spec: '5kg',
					preTax: {edit: true, value: ''},
					afterTax: {edit: true, value: ''}
				},{
					name: '黄豆',
					spec: '5kg',
					preTax: {edit: true, value: ''},
					afterTax: {edit: true, value: ''}
				},{
					name: '黄豆',
					spec: '5kg',
					preTax: {edit: true, value: ''},
					afterTax: {edit: true, value: ''}
				},{
					name: '黄豆',
					spec: '5kg',
					preTax: {edit: true, value: ''},
					afterTax: {edit: true, value: ''}
				},{
					name: '黄豆',
					spec: '5kg',
					preTax: {edit: true, value: ''},
					afterTax: {edit: true, value: ''}
				},{
					name: '黄豆',
					spec: '5kg',
					preTax: {edit: true, value: ''},
					afterTax: {edit: true, value: ''}
				},{
					name: '黄豆',
					spec: '5kg',
					preTax: {edit: true, value: ''},
					afterTax: {edit: true, value: ''}
				},{
					name: '黄豆',
					spec: '5kg',
					preTax: {edit: true, value: ''},
					afterTax: {edit: true, value: ''}
				},{
					name: '黄豆',
					spec: '5kg',
					preTax: {edit: true, value: ''},
					afterTax: {edit: true, value: ''}
				},{
					name: '黄豆',
					spec: '5kg',
					preTax: {edit: true, value: ''},
					afterTax: {edit: true, value: ''}
				}]
			}
		},
		onLoad(){
			
		},
		methods: {
			onInputChange(event){
				console.log("检测到table input被更改", event);
				this.contents[event.contentIndex][event.key].value = event.detailValue;
			}
		}
	}
</script>

<style lang="scss" scoped="scoped">
	.lf-m-t-5{
		margin-top: 5rpx;
	}
	.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: 260rpx;
			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: #1833F2;
			color: #FFFFFF;
			margin-left: 50rpx;
		}
	}
</style>
