<template>
	<view class="mainBox">
		<uni-nav-bar background-color="#157A2C" color="#fff" fixed="true" statusBar="true" left-icon="back" title="采购需求详情"
			@clickLeft="back">
		</uni-nav-bar>
		<myCard :item="form" :columns="columns"></myCard>
		<!-- <view class="item">
			<view class="card">

				<view>
					<view class="lable">预算</view>
					<view>{{form.budget||''}} 万元</view>
				</view>
				<view>
					<view class="lable">赢单率</view>
					<view>{{form.winRate||''}} %</view>
				</view>
				<view>
					<view class="lable">预计结单日期</view>
					<view>{{form.expectedClosingDate||''}}</view>
				</view>

			</view>
		</view> -->

		<!-- <u-sticky bgColor="#fff" :customNavHeight="88"> -->
		<u-tabs :list="list1" @change="change" :current="current"></u-tabs>
		<!-- </u-sticky> -->
		<info ref="infoRef" :isDrawer="true" v-show="current==0"></info>

		<produceList :pricingWay="form.pricingWay" ref="produceListRef" :isDrawer="true" v-show="current==1">
		</produceList>
	</view>
</template>

<script>
	import produceList from "../../components/produceList.vue"
	import info from "./info.vue"
	import {
		getDetail,
	} from '@/api/purchasingManage/purchaseNeedManage.js'

	import myCard from '../../components/myCard.vue'
	export default {
		components: {
			produceList,
			followList,
			info,
			myCard
		},
		data() {
			return {
				columns: [
					[{
						label: '名称：',
						prop: 'requirementName',
						type: 'title',
						className: 'perce100',
					}],
				],
				current: 0,
				list1: [{
					name: '基本信息',
				}, {
					name: '需求清单',
				}],
				form: {},
			}
		},

		onLoad(data) {
			getDetail(data.id).then(async res => {
				this.form = res
				setTimeout(() => {
					this.current = 0
					this.$nextTick(() => {
						this.$refs.infoRef.init(res)
						this.$refs.produceListRef.init(res.detailList)
						if (data.current) {
							this.current = +data.current
						}
					})
				}, 300)
			})
		},
		onUnload() {
	
		},
		methods: {
			change(data) {
				this.current = data.index
			},
		}
	}
</script>

<style lang="scss" scoped>
	.item {
		padding: 16rpx 32rpx;

		.card {
			padding: 16rpx 32rpx;
			margin-top: 32rpx;
			display: flex;
			flex-wrap: wrap;
			// height: 80rpx;
			border-radius: 12rpx;
			border: 1px solid #cbcbcb;

			>view {
				font-size: 26rpx;
				width: 33%;

				.lable {
					color: #999;
					margin-bottom: 10rpx;
				}
			}
		}
	}
</style>