<template>
	<view class="center">
		<view class="introduce-section">
			<view class="informations" @click="details" v-for="(item , index) in procurementPlanInfos" :Key="index">
				<view class="labels">{{item.goodsName}}</view>
				<view class="labels">{{item.weight}}</view>
				<view class="labels">{{item.unitPrice}}</view>
				<view class="title">{{item.receivePrivate}}{{item.receiveCity}}{{item.receiveArea}}</view>
			    <view class='cu-tag radius line-pink'>删除</view>
				<view class='cu-tag radius line-pink put'>{{item.status}}</view>
			</view>
		</view>
		<!-- <button type="default" class="fabuBut" @change="releaseChange">发布 -->
		<view class="c-row b-b">
			
			<!-- <view class="con-list"> -->
			<picker @change="releaseChange" :value="releaseIndex" :range="releaseType" class="con-list">
				<view class="picker " >
					{{releaseIndex>-1?releaseType[releaseIndex]:'请选择发布内容'}}
				</view>
			</picker>
			<!-- </view> -->
		</view>
		<!-- </button> -->
		<view class="page-bottom">
			<view class="action-btn-group">
				<button type="primary" class=" action-btn no-border add-cart-btn" @click="tradeNow">发布</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				releaseType:["我要卖粮","我要买粮"],
				release:'',
				procurementPlanInfo:{
					pageSize:10,
					currentPage:1
				},
				releaseIndex:"",
				pageSize:10,
				currentPage:1,
				procurementPlanInfos:[],


			}
		},
		onLoad(){
			this.getList()
		},
		methods: {
			releaseChange(e){
					this.releaseIndex = e.detail.value
					this.release = this.releaseType[this.releaseIndex];
						if(this.release == "我要卖粮"){
							uni.navigateTo({
								url: `/pageD/myRelease/sellGrain`
							})
						}else if(this.release == "我要买粮"){
							uni.navigateTo({
								url: `/pageD/myRelease/buyGrain`
							})
						}
			},
			details(){
				uni.navigateTo({
					url: `/pageD/myRelease/buydetails`
				})
			},
			getList(){
				
				this.$api.doRequest('get','/procurementPlanInfo/selectProcurementPlanInfo',this.procurementPlanInfo).then(res => {
					
					this.procurementPlanInfos = res.data.data.records
					console.log(this.procurementPlanInfos,"对象")
					
				})
				.catch(res => {
					uni.showToast({
						title: res.errmsg,
						icon:'none',
						duration: 2000
					})
				});
			}

		}
	}
</script>

<style>
	.center {
		padding: 10px 20px;
	}

	.informations {
		/* display: inline-flex; */
	}

	.labels {
		display: inline-flex;
		line-height: 20px;
		margin-right: 40px;
	}
	.put{
		float: right;
	}
	.fabuBut{
		margin-bottom: 0px;
	}


</style>
