<template>
	<view class="materialReceiving">
		<view class="radio">
			<uni-data-checkbox v-model="type" :localdata="typeList"></uni-data-checkbox>
		</view>
		<ul>
			<li v-for="i in listData" :key="i.id" v-if="i.status == type || type == 0">
				<view class="text-content" style="padding: 0 20rpx;">
					<view class="">
						物料编码：{{i.materialCode}}
					</view>
					<view class="">
						物料名称：{{i.materialName}}
					</view>
					<view class="" style="overflow: hidden;">
						出库时间：{{i.submitTime}}
						<span class="right-text">数量 <e style="color: #EF0000;">{{i.quantity}}</e></span>
					</view>
					<view class="" style="border-bottom: 1px solid #979797;overflow: hidden;">
						出库人员：{{i.submitUserName}}
						<span class="right-text">接收人员: {{i.receiveUserName}}</span>
					</view>
				</view>
				<view class="list-btn-box">
					<span>
						待接收
					</span>
					<view class="canle" v-if="i.status == 4" @click="ignore(i.id)">
						忽略
					</view>
				</view>
			</li>
		</ul>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				type:0,
				typeList:[{
					text: '全部',
					value: 0
				},{
					text: '待接收',
					value: 2
				}, {
					text: '已驳回',
					value: 4
				}],
				listData:[],
				account:null,
			}
		},
		methods:{
			
			getList(account){
				const v =this
				v.$post('/materialReceiving/toBeReceivedList',{
					submitUserAccount:account
				}).then(res=>{
					v.listData = res.data
				})
			},
			ignore(id){
				const v = this
				v.$post('/materialReceiving/ignore',{
					id:id
				}).then(res=>{
					if(res.code == 200){
						uni.showToast({
							title: '操作成功'
						})
						this.getList(v.account)
					}
					
				})
			},
		},
		onLoad(){
			const v = this
			uni.getStorage({
				key: 'Authorization',
				success: function (res) {
					v.account = res.data.account
					v.getList(v.account)
				}
			});
			
		},
	}
</script>

<style lang="less">
	.materialReceiving{
		min-height: 100vh;
		background: #f2f2f2;
		.radio{
			
			padding: 20rpx 30rpx;
		}
		ul{
			padding: 0 20rpx;
			li{
				background: #fff;
				margin-bottom: 36rpx;
				line-height: 70rpx;
				font-size: 28rpx;
				.right-text{
					float: right;
					display: inline-block;
					width: 240rpx;
				}
				.list-btn-box{
					height: 80rpx;
					line-height: 80rpx;
					color: #EF0000;
					padding-left: 60rpx;
					
					.canle{
						float: right;
						margin: 10rpx 26rpx 10rpx 0;
						background-color: #EF0000;
						color: #fff;
						line-height: 60rpx;
						height: 60rpx;
						width: 170rpx;
						text-align: center;
						border-radius: 10rpx;
					}
				}
			}
		}
	}
</style>