<template>
	<view class="center">
		<view class="buyup">
			<view class="c-row b-b">
				<text class="title">基本信息</text>
			</view>
			<view class="c-row b-b">
				<text class="tit">名头</text>
				<view class="con-list">
					{{deptList.seller}}
				</view>
			</view>
			<view class="c-row b-b">
				<text class="tit">标题</text>
				<view class="con-list">
					{{deptList.title}}
				</view>
			</view>
			<view class="c-row b-b">
				<text class="tit">货名</text>
				<view class="con-list">
					{{deptList.goodsName}}
				</view>
			</view>
			<view class="c-row b-b">
				<text class="tit">出货量（吨）</text>
				<view class="con-list">
					{{deptList.plannedSaleVolume}}
				</view>
			</view>
			<view class="c-row b-b">
				<text class="tit">最小成交量（吨）</text>
				<view class="con-list">
					{{deptList.minimumVolume}}
				</view>
			</view>
			<view class="c-row b-b">
				<text class="tit">类型</text>
				<view class="con-list">
					{{deptList.salePlanType}}
				</view>
			</view>
			<view class="c-row b-b">
				<text class="tit">价格类型</text>
				<view class="con-list">
					{{deptList.priceType}}
				</view>
			</view>
			<view class="c-row b-b" v-if="deptList.salePlanType == '现货'">
				<text class="tit">单价（元/吨）</text>
				<view class="con-list">
					{{deptList.salePrice}}
				</view>
			</view>
			<view class="c-row b-b" v-if="deptList.salePlanType == '期货'">
				<text class="tit">基差（元/吨）</text>
				<view class="con-list">
					{{deptList.basisPrice}}
				</view>
			</view>
			<view class="c-row b-b">
				<text class="tit">产地</text>
				<view class="con-list">
					{{deptList.outputPrivate}}{{deptList.outputCity}}
				</view>
			</view>
			<view class="c-row b-b">
				<text class="tit">发货地区</text>
				<view class="con-list">
					{{deptList.sendPrivate}}{{deptList.sendCity}}{{deptList.sendArea}}
				</view>
			</view>
			<view class="c-row ">
				<text class="tit">卖方手机号</text>
				<view class="con-list">
					{{deptList.sellerPhone}}
				</view>
			</view>
		</view>
		<view class="buylow">
			<view class="c-row b-b">
				<text class="title">货物要求</text>
			</view>
			<view class="c-row b-b">
				<text class="tit">水分（%）<= </text>
						<view class="con-list">
							{{deptList.waterContent}}
						</view>
			</view>
			<view class="c-row b-b">
				<text class="tit">容重（g/L）<= </text>
						<view class="con-list">
							{{deptList.bulkDensity}}
						</view>
			</view>
			<view class="c-row b-b">
				<text class="tit">热损伤（%）<= </text>
						<view class="con-list">
							{{deptList.jiaorenli}}
						</view>
			</view>
			<view class="c-row b-b">
				<text class="tit">杂质（%）<= </text>
						<view class="con-list">
							{{deptList.impurity}}
						</view>
			</view>
			<view class="c-row b-b">
				<text class="tit">霉变粒（%）<= </text>
						<view class="con-list">
							{{deptList.mildewGrain}}
						</view>
			</view>
			<view class="c-row b-b">
				<text class="tit">不完整粒（%）<= </text>
						<view class="con-list">
							{{deptList.imperfectGrain}}
						</view>
			</view>
			<view class="c-row b-b">
				<text class="tit">蛋白（%）<= </text>
						<view class="con-list">
							{{deptList.protein}}
						</view>
			</view>
			<view class="c-row b-b">
				<text class="tit">粒型 </text>
				<view class="con-list">
					{{deptList.grain}}
				</view>
			</view>
			<view class="c-row b-b">
				<text class="tit">品级 </text>
				<view class="con-list">
					{{deptList.grade}}
				</view>
			</view>

			<view class="c-row b-b">
				<text class="tit">产出年份</text>
				<view class="con-list">
					{{deptList.outputYear}}
				</view>
			</view>
			<view class="c-row b-b">
				<text class="tit">包装方式</text>
				<view class="con-list">
					{{deptList.packingType}}
				</view>
			</view>
			<view v-if="deptList.packingType == '大袋' || deptList.packingType == '小袋'" class="c-row b-b">
				<text class="tit">袋装备注</text>
				<view class="con-list">
					{{deptList.baggingNotes}}
				</view>
			</view>
			<view class="c-row">
				<text class="tit">运费承担方</text>
				<view class="con-list">
					{{deptList.freightPayer == null || deptList.freightPayer == "" ? "暂无信息":deptList.freightPayer }}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex';
	export default {
		data() {
			return {
				types: '',
				goods: {},
				typesType: ["现货", "期货"],
				typesIndex: 0,
				deptList: {
					priceType: "定价采购",
					procurementPlanType: "现货",
					grain: "塔粮",
					grade: "不限（默认）",
					outputYear: "2020",
					packingType: "不限（默认）",
					freightPayer: "",
				},
				params: {
					province: true,
					city: true,
					area: true,
				},
				params1: {
					province: true,
					city: true,
				},
				checked: true,
				insertProcurementPlanInfo: {},
				liIndex: 0,
				liType: ['塔粮', '筛粮', '中粒', '大粒'],
				pinIndex: 0,
				pinType: ['不限（默认）', '一等品', '二等品', '三等品', '等外'],
				nianIndex: 3,
				nianType: ['2023', '2022', '2021', '2020', '2019', '2018', '2017', '2016', '2015', '2014', '2013', '2012',
					'2011'
				],
				show: false,
				show1: false,
				region: '请选择收货地区',
				region1: '请选择产地',
				baoIndex: 0,
				baoType: ['不限（默认）', '散装', '大袋', '小袋'],
				chengIndex: -1,
				chengType: ['可议', '买方承担', '卖方承担']
			}
		},
		computed: {
			...mapState(['hasLogin', 'userInfo'])
		},
		onLoad(options) {
			this.getList(options)
		},
		methods: {
			getList(options) {
				this.$api.doRequest('get', '/salePlanInfo/getSalePlanInfo', {
						id: options.id
					}).then(res => {
						if (res.data.code == 200) {
							this.deptList = res.data.data
						} else {
							uni.showToast({
								title: res.data.message,
								icon: 'none',
								duration: 2000
							})
						}
					})
					.catch(res => {
						uni.showToast({
							title: res.errmsg,
							icon: 'none',
							duration: 2000
						})
					});
			},
			regionpicker(e) {
				this.deptList.sendPrivate = e.province.label
				this.deptList.sendCity = e.city.label
				this.deptList.sendArea = e.area.label
				this.region = e.province.label + '-' + e.city.label + '-' + e.area.label
			},
			regionchange() {
				this.show = true
			},
			regionpicker1(e) {
				this.deptList.outputPrivate = e.province.label
				this.deptList.outputCity = e.city.label
				this.region1 = e.province.label + '-' + e.city.label
			},
			regionchange1() {
				this.show1 = true
			},
			checkedbox(e) {
				this.checked = !this.checked
			},
			typeChange(e) {
				this.typesIndex = e.detail.value
				this.types = this.typesType[this.typesIndex];
				this.deptList.procurementPlanType = this.typesType[this.typesIndex];
				if (this.typesIndex == 0) {
					this.deptList.priceType = '定价采购'
				} else {
					this.deptList.priceType = '期货盘面价+基差'
				}
			},
			navToDetailPage() {
				// if (index == 1) {
				uni.navigateTo({
					url: `/pageD/myRelease/Identity_switching`
				})
			},
			// liChange(e) {
			// 	this.liIndex = e.detail.value
			// 	this.litypes = this.liType[this.liIndex];
			// 	this.deptList.grain = this.liType[this.liIndex]
			// },
			// pinChange(e) {
			// 	this.pinIndex = e.detail.value
			// 	this.pintypes = this.pinType[this.pinIndex];
			// 	this.deptList.grade = this.pinType[this.pinIndex]
			// },
			// nianChange(e) {
			// 	this.nianIndex = e.detail.value
			// 	this.niantypes = this.nianType[this.nianIndex];
			// 	this.deptList.outputYear = this.baoType[this.baoIndex]
			// },

			// baoChange(e) {
			// 	this.baoIndex = e.detail.value
			// 	this.baotypes = this.baoType[this.baoIndex];
			// 	this.deptList.packingType = this.chengType[this.chengIndex];
			// },
			// chengChange(e) {
			// 	this.chengIndex = e.detail.value
			// 	this.chengtypes = this.chengType[this.chengIndex];
			// 	this.deptList.freightPayer = this.chengType[this.chengIndex];
			// }
		}
	}
</script>

<style>
	.center {
		padding: 10px 20px;
		background-color: #F5F6FA;
	}

	.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: #AFB3BF;
		line-height: 40rpx;
		text-align: right;
		padding-right: 20rpx;
		font-size: 14px;
	}

	.buyup {
		background-color: #FFFFFF;
		border-radius: 20px;
		margin-top: 10px;
	}

	.buylow {
		background-color: #FFFFFF;
		border-radius: 20px;
		margin-top: 10px;
	}

	.btn {
		border-radius: 20px;
		margin-top: 10px;
		background-color: #22C572;
		color: #FFFFFF;
	}

	.validate {
		width: 100px;
		height: 32px;
		background-color: #F5F6F9;
		color: #AFB3BF;
		border-radius: 10px;
		border: none;
		text-align: center;
		line-height: 30px;
	}

	.title {
		color: #333333;
		font-size: 16px;
		font-weight: 600;
	}
</style>
