<template>
	<view>
		<view class="sm-box">
			<!-- <view class="card">
				<view class="title">注:</view>
				<view class="content">1.量化的需填写真实测量数据；</view>
				<view class="content">2.无量化检查项填写检查结果，结果判定：合格的填写“OK”，不合格的填“NG”；</view>
			</view> -->
			<view class="content-box-card">
				<view class="content-box-card-ul-two">
					<view class="content-box-card-list">
						<view class="content-box-card-title">物料名称:</view>
						<text>{{  cyInfo.name }}</text>
					</view>
				</view>
				<view class="content-box-card-ul-two">
					<view class="content-box-card-list">
						<view class="content-box-card-title">物料编号:</view>
						<text>{{ cyInfo.number }}</text>
					</view>
				</view>
				<view class="content-box-card-ul-two">
					<view class="content-box-card-list">
						<view class="content-box-card-title">提交日期:</view>
						<text>{{ cyInfo.create_time }}</text>
					</view>
				</view>
				<view class="content-box-card-ul-two">	
					<view class="content-box-card-list">
						<view class="content-box-card-title">提交人员:</view>
						<view class="lin-div">
							<text>{{ cyInfo.staff }}</text>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view>
			<view class="add-img">
				<image v-if="form.photos" :src="form.photos" class="crde-img" mode=""></image>
				<image v-if="!form.photos" class="add-img" @tap="updateAvatar(2)" src="../../static/add.png"></image>
				<view v-if="!form.photos" class="title">图片</view>
			</view>
		</view>
		
		<view style="width: 100%;height: 250upx;background: white;padding-top: 1upx;">
			<textarea style="width: 690upx;margin: auto;border: 2upx solid #999999;height: 200upx;margin-top: 25upx;" v-model="form.remake" placeholder="请输入备注"></textarea>
		</view>
		<view class="submit-btn"><button :disabled="buttonState==false?true:false" @tap="submit"
				type="primary">审核</button></view>
	</view>
</template>

<script>
	import {upload,repairRecordExamine} from "../../api/user.js"
	import uploads from "../../utils/uploads.js";
	export default {
		data() {
			return {
				host: "http://erp.ilechuan.com/",
				cyInfo:{},
				form:{
					id:'',
					photos:'',
					remake:''
				},
				buttonState: true
			};
		},onLoad(e) {
			this.cyInfo = JSON.parse(decodeURIComponent(e.planInfo));
		},methods:{
			updateAvatar(num) {
				uploads().then(res => {
					this.form.photos=this.host+res
					console.log("图片",this.form.photos);
				});
			},
			submit(){
				this.form.id=this.cyInfo.id;
				this.buttonState = false;
					this.$functions.confirm("是否进行此操作?").then(() => {
							repairRecordExamine(this.form
							).then(res => {
							this.$functions.success('提交成功').then(() => {
								uni.navigateBack();
							})
						}).catch(res => {
							this.buttonState = true;
						});
					}).catch(res => {
					this.buttonState = true;
				});
			}
		}
	}
</script>

<style lang="scss">
@import "./index.scss"
</style>
