<template>
	<view>
		<view class='wrap'>
			<view class='title_b'>基本信息</view>
			<view v-if='gridList.managementType==1' class="c-row ">
				<view class="title">入库类型</view>
				<view v-if='gridList.serviceManagementType==1' class="con-list">
					贸易入库
				</view>
				<view v-if='gridList.serviceManagementType==3' class="con-list">
					收购入库
				</view>
			</view>
			<view v-if='gridList.managementType==3' class="c-row ">
				<view class="title">出库类型</view>
				<view class="con-list">
				{{gridList.inOutType}}
				</view>
			</view>
			<view class="c-row ">
				<view class="title">仓库</view>
				<view class="con-list">
					{{gridList.warehouseName}}
				</view>
			</view>
			<view v-if='gridList.serviceManagementType==1' class="c-row">
				<view class="title">任务编号</view>
				<view class="con-list">
					{{gridList.inOutTaskNo}}
				</view>
			</view>
			<view class="c-row ">
				<view class="title">业务编号</view>
				<view class="con-list">
					{{gridList.qualityNo}}
				</view>
			</view>
			<view v-if='gridList.serviceManagementType==1' class="c-row ">
				<view v-if='gridList.inOutType=="移库入库"' class="title">移库编号</view>
				<view v-else class="title">合同编号</view>
				<view class="con-list">
					{{gridList.contractNo}}
				</view>
			</view>
			<view  v-if='gridList.serviceManagementType==3' class="c-row">
				<view class="title">客户</view>
				<view v-if='gridList.customerName' class="con-list">
					{{gridList.customerName}}({{gridList.customerPhone}})
				</view>
				<view v-else class="con-list">
					{{gridList.compName}}
				</view>
			</view>
			<view class="c-row ">
				<view class="title">货名</view>
				<view class="con-list">
					{{gridList.goodsName}}
				</view>
			</view>
			<view class="c-row ">
				<view class="title">车牌号</view>
				<view class="con-list">
					{{gridList.carNumber}}
				</view>
			</view>
			<view v-if="gridList.paramType != '1'" class="c-row ">
				<view class="title">扣重比</view>
				<view class="con-list">
					{{gridList.buckleWeightRatio}}
				</view>
			</view>
			<view v-else class="c-row ">
				<view class="title">扣杂</view>
				<view class="con-list">
					<view>{{gridList.buckleMiscellaneous}}</view>
					<view>{{gridList.reBuckleMiscellaneous}}</view>
					
				</view>
			</view>
			<view v-else class="c-row">
				<view class="title">扣杂</view>
				<view class="con-list">
					<input v-model='gridList.buckleMiscellaneous' placeholder="初检扣杂" @input=""
						name="input"></input>
					<input v-model='gridList.reBuckleMiscellaneous' placeholder="复检扣杂" @input=""
						name="input"></input>
				</view>
			</view>
			<view v-if='gridList.serviceManagementType==3' class="c-row ">
				<view class="title">购粮性质</view>
				<view class="con-list">
					{{gridList.natureOfGrainPurchase}}
				</view>
			</view>
			<view class="c-row ">
				<view class="title">仓位号</view>
				<view class="con-list">
					{{gridList.binNumber}}
				</view>
			</view>
			<view class="c-row ">
				<view class="title">囤位号</view>
				<view class="con-list">
					{{gridList.storageTagNo}}
				</view>
			</view>
			<view class="c-row ">
				<view class="title">类型</view>
				<view class="con-list">
					{{gridList.type}}
				</view>
			</view>
			
			<view v-if="gridList.type == '潮粮'" class="c-row">
				<view class="title">净重单价（元/公斤）</view>
				<view class="con-list">
					{{gridList.tidalGrainPrice}}
				</view>
			</view>
			<view v-if="gridList.type == '干粮'" class="c-row">
				<view class="title">干粮单价（元/公斤）</view>
				<view class="con-list">
					{{gridList.dryGrainPrice}}
				</view>
			</view>
			<view class="c-row ">
				<view class="title">运输方式</view>
				<view class="con-list">
					<view>{{gridList.outType}}</view>
				</view>
			</view>
			
			<view class="c-row ">
				<view class="title">车队</view>
				<view class="con-list">
					<view>{{gridList.fleet}}</view>
				</view>
			</view>
			<view v-if="gridList.outType=='汽运'||gridList.outType == '集装箱船'" class="c-row ">
				<view class="title">箱号-1</view>
				<view class="con-list">
					{{gridList.boxNo}}
				</view>
			</view>
			<view v-if="gridList.outType== '汽运'||gridList.outType == '集装箱船'" class="c-row ">
				<view class="title">封号-1</view>
				<view class="con-list">
					{{gridList.titleNo}}
				</view>
			</view>
			<view v-if="gridList.outType=='汽运'||gridList.outType == '集装箱船'" class="c-row ">
				<view class="title">箱号-2</view>
				<view class="con-list">
					{{gridList.boxNoOther}}
				</view>
			</view>
			<view v-if="gridList.outType== '汽运'||gridList.outType == '集装箱船'" class="c-row ">
				<view class="title">封号-2</view>
				<view class="con-list">
					{{gridList.titleNoOther}}
				</view>
			</view>
			<view class="c-row-fj" v-if="statusShow == '已复检'">
				<view style="margin: 0px 0px 30rpx 10rpx;">复检备注</view>
					<textarea class='textarea-style' v-model='gridList.reMemo' placeholder="暂无复检备注信息!" maxlength="300" disabled ></textarea>
			</view>
		</view>
		<view style='margin-bottom:300rpx;'>
			<view class='wrap'>
				<view class='title_b'>化验信息</view>

				<view class="c-row ">
					<view class="title">等级</view>
					<view class="con-list">
						<view>{{gridList.grade}}</view>
						<view>{{gridList.reGrade}}</view>
					</view>
				</view>
				<view class="c-row ">
					<view class="title">水分（%）</view>
					<view class="con-list">
						<input v-model='gridList.waterContent' placeholder="初检水分" @input=""
							name="input"></input>
						<input v-model='gridList.reWaterContent' placeholder="复检水分" @input=""
							name="input"></input>
					</view>
					<!-- <view class="con-list">
						{{gridList.rewaterContent}}
					</view> -->

				</view>
				<view class="c-row ">
					<view class="title">容重（克/升）</view>
					<view class="con-list">
						<view>{{gridList.bulkDensity}}</view>
						<view>{{gridList.reBulkDensity}}</view>
						
					</view>
				</view>
				<view class="c-row ">
					<view class="title">不完善粒（%）</view>
					<view class="con-list">
						<view>{{gridList.imperfectGrain}}</view>
						<view>{{gridList.reImperfectGrain}}</view>
					</view>
				</view>
				<view class="c-row ">
					<view class="title">杂质（%）</view>
					<view class="con-list">
						<view>{{gridList.impurity}}</view>
						<view>{{gridList.reImpurity}}</view>
					</view>
				</view>
				<view class="c-row ">
					<view class="title">霉变粒（%）</view>
					<view class="con-list">
						<view>{{gridList.mildewGrain}}</view>
						<view>{{gridList.reMildewGrain}}</view>
					</view>
				</view>
				<view class="c-row ">
					<view class="title">热损伤（%）</view>
					<view class="con-list">
						<view>{{gridList.jiaorenli}}</view>
						<view>{{gridList.reJiaorenli}}</view>
					</view>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	import dragButton from "@/components/drag-button/drag-button.vue";
	import {
		mapState
	} from 'vuex';
	let startY = 0,
		moveY = 0,
		pageAtTop = true;
	export default {
		components: {
			dragButton
		},
		data() {
			return {
				inputShow: false,
				modalName: '',
				mycarStyle: '',
				feild: undefined,
				id: 0,
				show: false,
				selector: [],
				show1: false,
				inputContent: '',
				coverTransform: 'translateY(0px)',
				coverTransition: '0s',
				moving: false,
				footprintList: [],
				searchKeyWord: '',
				isVip: false,
				userInfoTmp: [],
				inputStatus: 'none',
				carInfo: [],
				gridCol: 4,
				pageSize: 10,
				currentPage: 1,
				gridBorder: false,
				headUrl: "../../static/img/myimg/YongHu@3x.png",
				userphone: "",
				username: "请更改昵称",
				gridList: {
					type: '潮粮'
				},
				managementType: '',
				warehouseName: '',
				warehouseList: [],
				showTran: true,
				companyId: 1,
				current: 4,
				gradeList: [{
						key: 1,
						value: '一等品'
					},
					{
						key: 2,
						value: '二等品'
					},
					{
						key: 3,
						value: '三等品'
					},
					{
						key: 4,
						value: '等外'
					},
				],
				cangid: '',
				statusShow:"",
			}
		},
		// #ifndef MP
		onNavigationBarButtonTap(e) {
			const index = e.index;
			if (index === 0) {
				this.navTo('/pages/set/set');
			} else if (index === 1) {
				// #ifdef APP-PLUS
				const pages = getCurrentPages();
				const page = pages[pages.length - 1];
				const currentWebview = page.$getAppWebview();
				currentWebview.hideTitleNViewButtonRedDot({
					index
				});
				// #endif
				uni.navigateTo({
					url: '/pages/notice/notice'
				})
			}
		},
		// #endif
		computed: {
			...mapState(['hasLogin', 'userInfo']),
			// 手机号中间4位加*
			starUserphone() {
				let reg = /^(\d{3})\d{4}(\d{4})$/;
				if (this.userphone) {
					return this.userphone.replace(reg, "$1****$2");
				}
			}
		},
		onLoad(options) {
			this.id = options.id
			this.cangid = options.cangid
			this.managementType = options.managementType
			this.statusShow = options.statusShow
			console.log(this.statusShow)
		},
		onShow() {
			var that = this
			this.$api.doRequest('get', '/qualityInspectionManagement/api/getQualityInspection', {
				id: this.id
			}).then(res => {
				if (res.data.data) {
					let data = res.data.data
					that.gridList = data
					that.$api.doRequest('get', '/warehouseBaseInfo/getWarehouse', {
						id: this.cangid
					}).then(res => {
						that.warehouseList = res.data.data.warehousePositionInfoList
					})
				}
			})
		},
		methods: {
			gradepicker(e) {
				console.log(e)
				// this.$set(this.gradeList,'grade',this.gradeList[e[0]].value)
				this.gridList.grade = this.gradeList[e[0]].value
				this.gridList.gradeKey = this.gradeList[e[0]].key
			},
			binNumberpicker(e) {
				this.gridList.binNumber = this.warehouseList[e[0]].binNumber
			},
			del(item) {
				this.$api.doRequest('get', '/qualityInspectionManagement/api/deleteQualityInspection', {
					id: item.id
				}).then(res => {
					if (res.data.code == 200) {
						this.$api.msg('删除成功')
					} else {
						this.$api.msg('系统异常，请联系管理员')
					}
				})
			},
			fankui() {
				uni.navigateTo({
					url: `/pages/user/fankui`
				})
			},
			zhibo() {
				uni.navigateTo({
					url: `/pageB/video/broadcast`
				})
			},
			look() {
				uni.navigateTo({
					url: `/pageB/video/look`
				})
			},
			contactUs() {
				const that = this
				uni.makePhoneCall({
					// 手机号
					phoneNumber: '18241771147',
					// 成功回调
					success: (res) => {},
					// 失败回调
					fail: (res) => {}
				});
			},
			loadData() {
				// const that = this
				// if(uni.getStorageSync("PageCur")){
				// 	that.PageCur = uni.getStorageSync("PageCur");
				// }
				// that.userInfoTmp = uni.getStorageSync("userInfo")
				// uni.showLoading({
				// 	title: '正在加载',
				// 	mask:true
				// })
				// that.$api.request('integral', 'getIndexData', failres => {
				// 	that.$api.msg(failres.errmsg)
				// 	uni.hideLoading()
				// }).then(res => {
				// 	let data = res.data
				// 	uni.setStorageSync("message", data.message);
				// 	uni.setStorageSync("task", data.task);
				// 	uni.setStorageSync("contract", data.contract);
				// 	uni.setStorageSync('showTran', data.showTran);
				// 	that.showTran = data.showTran
				// 	that.gridList[4].tips = data.task
				// 	that.gridList[2].tips = data.contract
				// 	that.companyId = data.companyId
				// 	uni.hideLoading()
				// })
			},

			confirm() {
				const that = this
				if (!that.inputContent) {
					that.$api.msg('输入不能为空')
					return
				}
				let obj = {}
				obj[that.feild] = that.inputContent
				that.$api.request('user', 'syncUserInfo', obj).then(res => {
					that.userInfo.nickname = that.inputContent
					that.inputContent = ''
					that.$store.commit('login', that.userInfo)
				})
			},
			cancel() {
				this.inputShow = false
				this.inputStatus = 'none'
				this.genderShow = false
			},
			myAccount() {
				uni.navigateTo({
					url: `/pageA/pages/contract`
				})
			},
			/**
			 * 统一跳转接口,拦截未登录路由
			 * navigator标签现在默认没有转场动画，所以用view
			 */
			navTo(url) {
				if (!this.hasLogin) {
					url = '/pages/public/login';
				}
				uni.navigateTo({
					url
				})
			},
			mycarClick(carNo) {
				this.modalName = null
				uni.navigateTo({
					url: `/pageB/car/mycar_detail?carNo=${carNo}`
				})
			},
			scanCode() {
				uni.scanCode({
					success: function(res) {
						uni.navigateTo({
							url: res.result
						})
					}
				})
			},
			hideModal(e) {
				this.modalName = null
			},
		}
	}
</script>
<style lang='scss' scoped>
	page {
		background: #F5F6FA;
	}

	.title_b {
		margin: 20rpx 20rpx 0rpx 20rpx;
		padding: 20rpx 10rpx 20rpx 10rpx;
		font-size: 18px;
		font-weight: 550;
	}

	.c-row {
		display: -webkit-box;
		display: -webkit-flex;
		display: flex;
		-webkit-box-align: center;
		-webkit-align-items: center;
		align-items: center;
		padding: 20rpx 30rpx;
		position: relative;
	}

	.con-list {
		-webkit-box-flex: 1;
		-webkit-flex: 1;
		flex: 1;
		display: -webkit-box;
		display: -webkit-flex;
		display: flex;
		-webkit-box-orient: vertical;
		-webkit-box-direction: normal;
		-webkit-flex-direction: column;
		flex-direction: column;
		color: #303133;
		line-height: 40rpx;
		text-align: right;
		padding-right: 20rpx;
	}

	.wrap {
		padding-bottom: 10px;
		font-size: 14px;
		background: #fff;
		margin: 10px;
		border-radius: 10px;

		input {
			font-size: 14px;
		}

		>.title {
			padding: 10px 16px;
		}

		.b-b:after {
			border-bottom: 1px solid #eee;
		}
	}

	.footer {
		background: #fff;
		position: fixed;
		bottom: 0;
		width: 100%;
		padding: 20px 10px;
		z-index: 10;

		.button {
			background: #22C572;
			width: 90%;
			margin: 0 auto;
			padding: 10px;
			color: #fff;
			text-align: center;
			border-radius: 30px;
		}
	}
	.textarea-style{
		border: 1px solid #EEEEEE;
		width: 100%;
		padding:20rpx;
		border-radius: 20rpx;
	}
	.c-row-fj{
		padding:20rpx
	}
</style>
