<template>
	<view>		
		<view style="margin:10px 100px;position: fixed;z-index: 50;opacity:0.7;" v-show="isShow">
			<button type="primary" style="border-radius: 5px;" class="mini-btn" size="mini" @click="modify">修改</button>
		</view>
		<uni-list>
			<uni-list-item v-if="listData.entity">
				<view slot="body" class="slot-box">
					<view class="row">
						<view class="column-left">入库编号：</view>
						<view class="column-right">{{listData.entity.materialInCode}}</view>
					</view>
					<view class="row">
						<view class="column-left">状态：</view>
						<view class="column-right">{{listData.entity.statusName}}</view>
					</view>
					<view class="row">
						<view class="column-left">入库类型：</view>
						<view class="column-right">{{listData.entity.groupName}}</view>
					</view>
					<view class="row">
						<view class="column-left">采购人：</view>
						<view class="column-right">{{listData.entity.purUserName}}</view>
					</view>
					<view class="row">
						<view class="column-left">入库时间：</view>
						<view class="column-right">{{listData.entity.inDate}}</view>
					</view>
					<view class="row">
						<view class="column-left">材料合同：</view>
						<view class="column-right">{{listData.entity.contractName}}</view>
					</view>
					<view class="row">
						<view class="column-left">供应单位：</view>
						<view class="column-right">{{listData.entity.supplierName}}</view>
					</view>
					<view class="row">
						<view class="column-left">第三方：</view>
						<view class="column-right">{{listData.entity.threeSupplierName}}</view>
					</view>
					<view class="row">
						<view class="column-left">制单人：</view>
						<view class="column-right">{{listData.entity.zhiDanRen}}</view>
					</view>
					<view class="row">
						<view class="column-left">制单日期：</view>
						<view class="column-right">{{listData.entity.inputDate}}</view>
					</view>
					<view class="row">
						<view class="column-left">审核人：</view>
						<view class="column-right">{{listData.entity.checkRen}}</view>
					</view>
					<view class="row">
						<view class="column-left">审核日期：</view>
						<view class="column-right">{{listData.entity.checkDate}}</view>
					</view>
					<view class="row">
						<view class="column-left">附件：</view>
						<view class="column-right">
							<view v-for="(item,index) in listData.attachments" :key="index">								
								<a :href="'/api/common/ShowImg?code='+item.attachMentCode">{{item.fileName}}</a>
							</view>
						</view>
					</view>
				</view>
			</uni-list-item>
		</uni-list>
		<uni-section title="入库明细" type="line"></uni-section>
		<uni-list>
			<uni-list-item v-if="listData.inList"  v-for="(item, index) in listData.inList"  :key="index">
				<view slot="body" class="slot-box">
					<view class="row">
						<view class="column-left">材料名称：</view>
						<view class="column-right">{{item.materialName}}</view>
					</view>
					<view class="row">
						<view class="column-left">规格：</view>
						<view class="column-right">{{item.spec}}</view>
					</view>
					<view class="row">
						<view class="column-left">单位：</view>
						<view class="column-right">{{item.unit}}</view>
					</view>
					<view class="row">
						<view class="column-left">入库数量：</view>
						<view class="column-right">{{item.inQty}}</view>
					</view>
					<view class="row">
						<view class="column-left">不合格数量：</view>
						<view class="column-right">{{item.noPassQty}}</view>
					</view>
					<view class="row">
						<view class="column-left">入库单价：</view>
						<view class="column-right">{{item.inPrice}}</view>
					</view>
					<view class="row">
						<view class="column-left">入库总价：</view>
						<view class="column-right">{{item.inMoney}}</view>
					</view>
					<view class="row">
						<view class="column-left">开票数量：</view>
						<view class="column-right">{{item.invoQty}}</view>
					</view>
					
				</view>
			</uni-list-item>
		</uni-list>
		
		 
	</view>
</template>

<script>
	import {
		GetInStore
	} from "@/common/api/MaterialInOut.js";
	export default {
		data() {
			return {
				listData: [],
				isShow:false
			}
		},
		onLoad() {
			//console.info("当前登录状态:" + this.$store.state.isLogin);
			//console.info(this);
			this.$util.persistLogin(this);
		},
		created: function() {
			this.getDetail(this.$util.getQuery("id"));
		},
		methods: {
			getDetail(id) {
				let that = this;
				GetInStore(id).then((res) => {
					console.info('GetInStore',res);
					that.listData=res;
					if(res.entity.status==0){
						that.isShow=true;
					}
					else{
						that.isShow=false;
					}
					//console.info(that.listData);
				});
			},
			modify: function() { //跳转到修改页面
				let id = this.$util.getQuery("id");
				uni.navigateTo({
					url: '/pages/template/InStoreEdit/InStoreEdit?id=' + id
				});
			}
		}
	}
</script>

<style>
  /deep/ .uni-section__content-title{
	  font-size:15px;
	  font-weight: 600;
  }
  
 /deep/ .uni-list-item{
	  background-color: #f8f8f8;
  }
  .slot-box{
	  background-color: #fff;
	  padding: 5px 8px;
  }
</style>
