<template>
	<view class="p-content">
		<view class="p-body">
			<uni-forms-item label-width="100" label="产品条码:">
				<u-text type="info" :text="formData.qrCode||'--'"></u-text>
			</uni-forms-item>
			<uni-forms-item label-width="100" label="产品编码:">
				<u-text type="info" :text="formData.productCode||'--'"></u-text>
			</uni-forms-item>
			<uni-forms-item label-width="100" label="产品名称:">
				<u-text type="info" :text="formData.productName||'--'"></u-text>
			</uni-forms-item>
			<uni-forms-item label-width="100" label="原厂编码:">
				<u-text type="info" :text="formData.productOrigCode||'--'"></u-text>
			</uni-forms-item>
			<uni-forms-item label-width="100" label="产品品牌:">
				<u-text type="info" :text="formData.brandName||'--'"></u-text>
			</uni-forms-item>
			<uni-forms-item label-width="100" label="单位:">
				<u-text type="info" :text="formData.productUnit||'--'"></u-text>
			</uni-forms-item>
			<uni-forms-item label-width="100" label="成本价:">
				<u-text type="error" mode="price" :text="formData.putCost"></u-text>
			</uni-forms-item>
			<uni-forms-item label-width="100" label="数量:">
				<u-text type="info" :text="formData.putQty"></u-text>
			</uni-forms-item>
			<uni-forms-item label-width="100" label="成本小计:">
				<u-text type="error" mode="price" :text="formData.putCost*formData.putQty"></u-text>
			</uni-forms-item>
			<uni-forms-item label-width="100" label="仓库仓位:">
				<u-text type="info" :text="formData.warehouseName+'>'+formData.warehouseLocationName"></u-text>
			</uni-forms-item>
			<u-modal 
			:show="showModal" 
			title="提示" 
			showCancelButton 
			content='删除后不可恢复，确定要进行删除吗？'
			 @confirm="delRow" 
			 @cancel="showModal=false"
			 @close="showModal=false"
			 ></u-modal>
		</view>
		<view class="p-footer" v-if="state == 'WAIT_SUBMIT'">
			<button size="mini" type="warn" @tap="openCon">删除</button>
		</view>
	</view>
</template>

<script>
	import { sparePartsPurDetailDel } from "@/config/api.js"
	export default {
		data() {
			return {
				formData: null,
				showModal: false,
				state: null
			};
		},
		onLoad(opts) {
			this.formData = this.$store.state.vuex_tempData
			this.state = opts.state
		},
		methods: {
			openCon(){
				this.showModal = true
			},
			delRow() {
			   sparePartsPurDetailDel({ sn: this.formData.id }).then(res => {
				 if (res.status == 200) {
				   uni.$u.toast(res.message)
				   uni.navigateBack()
				 }
			   })
			}
		}
	}
</script>

<style lang="scss">
.p-content{
	padding: 0 40rpx;
	.p-body{
		flex-grow: 1;
		height: 50%;
		overflow: auto;
		.input{
			font-size: 30upx;
			height: 36px;
			line-height: 36px;
		}
		.uni-forms-item{
			margin-bottom: 0;
			padding: 25upx 0;
			border-bottom: 1px solid #eee;
		}
	}
	/deep/ .uni-forms-item__label{
		height: auto;
		width: 180rpx;
		align-items: flex-start;
	}
	.p-footer{
		padding: 20upx;
		text-align: center;
		button{
			width: 60%;
			padding: 10upx 0;
		}
	}
}
</style>
