<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>


		<!-- <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,
			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>