<template>
	<view class="mainBox">
		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="登记入库" @clickLeft="back"></uni-nav-bar>
		
		<u-cell-group>
			<u-cell title="入库单" value="W2091992838811"></u-cell>
			<u-cell title="仓库" value="5001混炼料库"></u-cell>
			<u-cell title="送货人" value="李四"></u-cell>
		</u-cell-group>
		
	
		<u-collapse class="cLine" :value="['detail']">
			
			<u-collapse-item title="描述" name="">
			  <text class="u-collapse-content">涵盖uniapp各个方面，给开发者方向指导和设计理念，让您茅塞顿开，一马平川</text>
			</u-collapse-item>
			
			<u-collapse-item title="明细" name="detail">
				
		      <view class="listBox" v-for="(item, index) in listData" :key="index"  @click="cleanchecked(index)">
		      	<view class="listTit">
		      	   <view style="display:inline-block;"><u-tag :text="item.normName" size="mini" shape="circle" :type="item.type"></u-tag></view> 
		      	   <view class="name">{{item.title}}</view>	
		      	   <view class="weight">{{item.weight}}KG</view>
				   <view class="choose">
					   <uni-icons :type="choose===index?'checkbox-filled':'circle'" size="28" :color="choose===index?'#19be6b':'#eee'"></uni-icons>
				   </view>
		      	</view>
		      	<view class="listCont">
		      		<view class="item"><text>编码：</text>{{item.codeNum}}</view>
		      		<view class="item"><text>批次号：</text>{{item.batchNum}}</view>
		      		<view class="item"><text>有效期：</text>{{item.datetime}}</view>
		      		<view class="item"><text>牌号：</text>{{item.grade}}</view>
		      		<view class="item"><text>型号：</text>{{item.model}}</view>
		      		<view class="item"><text>包装单位：</text>{{item.unit}}</view>
		      		<view class="item"><text>存放货位：</text>{{item.cargoSpace?item.cargoSpace:'未登记'}}</view>
		      	</view>
		      </view>
			  
			</u-collapse-item>
		  </u-collapse>
		
		<view class="footBox">
			<view class="reg" style="width:100%;"  @click="getsure">确 定</view>
		</view>
		
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				choose:'',
				src:'../../../static/logo.png',
				listData:[
					{
					   norm:0,
					   title:'混炼料391',
					   weight:'60',
					   codeNum:'W03912838881',
					   batchNum:'102882381',
					   datetime:'2010-08-19',
					   grade:'E388287',
					   model:'BΦ3.0*100',
					   unit:'60KG/桶',
					   cargoSpace:'',
				    },
					{
					   norm:0,
					   title:'混炼料391',
					   weight:'60',
					   codeNum:'W03912838881',
					   batchNum:'102882381',
					   datetime:'2010-08-19',
					   grade:'E388287',
					   model:'BΦ3.0*100',
					   unit:'60KG/桶',
					   cargoSpace:'',
					},
					{
					   norm:1,
					   title:'混炼料391',
					   weight:'60',
					   codeNum:'W03912838881',
					   batchNum:'102882381',
					   datetime:'2010-08-19',
					   grade:'E388287',
					   model:'BΦ3.0*100',
					   unit:'60KG/桶',
					   cargoSpace:'',
					},
					{
					   norm:0,
					   title:'混炼料391',
					   weight:'60',
					   codeNum:'W03912838881',
					   batchNum:'102882381',
					   datetime:'2010-08-19',
					   grade:'E388287',
					   model:'BΦ3.0*100',
					   unit:'60KG/桶',
					   cargoSpace:'',
					},
					{
					   norm:1,
					   title:'混炼料391',
					   weight:'60',
					   codeNum:'W03912838881',
					   batchNum:'102882381',
					   datetime:'2010-08-19',
					   grade:'E388287',
					   model:'BΦ3.0*100',
					   unit:'60KG/桶',
					   cargoSpace:'',
					},
				]
			}
		},
		onShow(){
			//添加属性
			let newListData = this.listData;
			newListData.forEach(function(res, key) {
				if(res.norm == 0){
					newListData[key].normName = '按件'
					newListData[key].type = 'success'
				}else if(res.norm == 1){
					newListData[key].normName = '按量'
					newListData[key].type = 'primary'
				}
			})
			this.listData = newListData;
			
		},
		methods: {
			//查看附件
			viewImage(){
				uni.previewImage({
					current:0,
					urls: [this.src],
				});
			},
			//选中列表
			cleanchecked(e){
				this.choose = e;
			},
			//确定
			getsure(){
				
			},
		}
	}
</script>

<style  lang="scss" scoped>
	.mainBox{
		padding-bottom: 120rpx;
	}
	.picList{
		display: flex;
		align-items: center;
		justify-items: flex-start;
		flex-wrap: wrap;
	}
	/deep/.picList .u-image{
		margin-right:10rpx;
		margin-bottom: 10rpx;
	}
	
	/deep/.cLine .u-line:nth-child(1){
		border-bottom: none !important;
	}
	.footBox{
		position: fixed;
		left:0px;
		bottom: 0px;
		height: 100rpx;
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;
		view{
			width:50%;
			height: 100%;
			text-align: center;
			color: #fff;
			display: flex;
			align-items: center;
			justify-content: center;
		}
		.reg{
			background: $u-success-dark;
		}
		.uni-icons{margin-right: 8rpx !important;}
	}
	
	.listBox{
		 padding: 20rpx 0;
		 border-bottom:1px #f2f2f2 solid;
		.listTit{
			display: flex;
			align-items: center;
			.name{
				margin-left: 10px;
			}
			.weight {
				font-size: $uni-font-size-base;
				margin-left: auto;
				margin-right: 60rpx;
				position: relative;
			}
			.weight::after{
				 position: absolute;
				 right:-30rpx;
				 top:50%;
				 content: '';
				 background: #eee;
				 width: 1px;
				 height: 28rpx;
				 margin-top: -14rpx;
			}
			.delete{
				color: #999;
			}
		}
		.listCont{
			display: flex;
			align-items: center;
			flex-wrap: wrap;
			margin-top: 15px;
			.item{
				width:50%;
				font-size: $uni-font-size-sm;
				line-height: 48rpx;
				overflow: hidden;
				white-space: nowrap;
				text-overflow: ellipsis;
	            -o-text-overflow:ellipsis;
				color: #000;
			}
			.item text{color: #666;}
		}
	 }
	 .listBox:last-child{
		 border:none !important;
	 }
	 .saveBtn{
		 width:50%;
		 margin:40rpx auto;
	}
</style>
