<template>
	<view class="order view">
		<view class="top">
			<text class="title-no">要货单号：{{newsItem.wantCode}}</text>
		</view>
		<view class="middle view">
			<view class="text-block">
				<text class="middle-date-des">客户名称</text>
				<text class="middle-date">{{newsItem.customerName}}</text>
			</view>
			<view class="text-block">
				<text class="middle-date-des">产品</text>
				<text class="middle-date">{{newsItem.productDesc}}</text>
			</view>
			<view class="text-block-box">
				<view class="text-block text-block-last">
					<text class="middle-date-des">过期时间</text>
					<text class="middle-date">{{newsItem.expireDate}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	// #ifdef APP-NVUE
	const dom = weex.requireModule('dom')
	// #endif

	export default {
		props: {
			newsItem: {
				type: Object,
				default: function(e) {
					return {}
				}
			}
		},
		data() {
			return {
				ishowDetail: true,
				ishowReceiveDetail: false,
				receiveInfoHeight: '132',
				receiveInfoDetailSize: {},
			}
		},
		// watch:{
		// 	ishowReceiveDetail(val){
		// 		if(val === true){
		// 			this.receiveInfoHeight = `${this.$refs.receiveInfo.$el.clientHeight}px`
		// 		}else{
		// 			this.receiveInfoHeight = '24px'
		// 		}
		// 	}	
		// },
		computed: {
			receiveInfoHeightComputed() {
				console.log(this.receiveInfoHeight - 0,'[][]')
				if(this.receiveInfoHeight - 0 === 0){
					return { "minHeight": "385px" }
				}else{
					return {
						"height": `${this.receiveInfoHeight}px`
					}
				}
			}
		},
		mounted() {
			// setTimeout(() => {
			// 	const result = dom.getComponentRect(this.$refs.receiveInfo, option => {
			// 		console.log('getComponentRect:', option)
			// 		this.receiveInfoDetailSize = option.size
			// 	})
			// 	console.log('return value2:', result)
			// 	console.log('viewport:', dom.getComponentRect('viewport'))
			// }, 100);
		},
		methods: {
			click() {
				this.$emit('click');
			},
			close(e) {
				e.stopPropagation();
				this.$emit('close');
			},
			handleShowDetail() {
				this.ishowDetail = !this.ishowDetail
			},
			handleShowReceiveDetail() {
				this.ishowReceiveDetail = !this.ishowReceiveDetail
				if (this.ishowReceiveDetail === true) {
					this.receiveInfoHeight = '0'
				} else {
					this.receiveInfoHeight = '132'
				}
			},
			checkLogistics() {
				const num = 'dfb0ebae8103034ccb863d3702e22eb6'
				uni.navigateTo({
					url: `/pages/logistics/logistics?logisticno=${num}`
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.view {
		flex-direction: column;
	}

	.order {
		flex: 1;
		background: #ffffff;
		border-radius: 16rpx 100rpx 16rpx 16rpx;
		box-shadow: 0px 2px 4px 0px #dbe4ee;
		margin-bottom: 60rpx;
		margin-top: 28rpx;
		padding-top: 30rpx;
	}

	.top {
		height: 72rpx;
		align-items: center;
		justify-content: space-between;
		padding: 0 32rpx;
	}

	.title-no {
		font-size: 24rpx;
		color: #555555;
	}

	.title-info {
		align-items: center;
		margin-right: 26rpx;
	}

	.title-info__status {
		width: 130rpx;
		height: 48rpx;
		line-height: 48rpx;
		background: #f61d30;
		border-radius: 80rpx 200rpx 200rpx 80rpx;
		font-size: 12px;
		color: #fff;
		text-align: center;
	}

	.item-block-btn__text {
		font-size: 12px;
		color: #fff;
	}

	.middle {
		// position: relative;
		padding: 26rpx 32rpx;
	}

	.middle-title {
		display: flex;
		align-items: center;
		margin-bottom: 32rpx;
	}

	.middle-title__text {
		font-weight: 500;
		font-size: 32rpx;
		color: $text-base-color;
		font-family: PingFangSC, PingFangSC-Medium;
	}

	.icon-car {
		width: 13px;
		height: 13px;
		margin-left: 16rpx;
	}

	.text-block {
		flex: 1;
		flex-direction: column;
		margin-bottom: 16rpx;
	}

	.text-block-last {
		margin-bottom: 0;
	}

	.middle-date {
		font-size: 28rpx;
		color: $text-base-color;
		margin-top: 8rpx;
	}

	.middle-date-des {
		font-size: 24rpx;
		color: #999;
	}

	.text-block-box {
		display: flex;
		// height: 120rpx;
		margin-bottom: 16rpx;
		justify-content: space-between;
	}

	.middle-date-right {
		display: flex;
		align-items: center;
		justify-content: flex-end;
		text-align: right;
	}

	.dot {
		width: 5px;
		height: 5px;
		background: #3bdc88;
		border-radius: 50%;
		margin-top: -4px;
		margin-right: 7px;
	}

	.bottom {
		padding: 0 50rpx 48rpx;
	}

	.bottom-nav {
		height: 40rpx;
		justify-content: flex-end;
		align-items: center;
	}

	.bottom-nav-arrow {
		align-items: center;
	}

	.arrow-des {
		font-size: 24rpx;
		color: #999;
	}

	.icon-arrow {
		width: 7px;
		height: 4px;
		margin-left: 16rpx;
		margin-top: 2px;
		transition-property: transform;
		transition-duration: 0.15s;
		transform: rotate(0deg);
	}

	.icon-arrow-rotate {
		transform: rotate(180deg);
	}

	.bottom-content {
		flex-direction: column;
		margin-top: 24rpx;
	}

	.block-detal {
		display: flex;
		flex-direction: column;
		background: #f8f8f8;
		border-radius: 20rpx;
		padding: 28rpx 32rpx;
		margin-bottom: 16rpx;
	}

	.block-detal-last {
		margin-bottom: 32rpx;
	}

	.block-detal-item {
		display: flex;
		margin-bottom: 32rpx;
		justify-content: space-between;
	}

	.block-detal-item-last {
		margin-bottom: 0;
	}

	.detal-item-label {
		color: #999;
		font-size: 24rpx;
	}

	.detal-item-value {
		// flex: 1;
		color: #333;
		font-size: 28rpx;
	}

	.detal-item-value2 {
		font-size: 24rpx;
		// width: 200%;
		// flex: 2;
		// text-align: left;
	}
	.detal-item-value3{
		padding-left: 60rpx;
		font-size: 24rpx;
		width: 300%;
		flex: 2;
		text-align: right;
	}
	.receive-info {
		position: relative;
		display: flex;
		flex-direction: column;
		margin-top: 40rpx;
		height: 240rpx;
		overflow: hidden;
		// padding-bottom: 96rpx;
	}

	.receive-info-auto {
		// height: auto;
	}

	.detal-item-title {
		color: #333;
		font-size: 28rpx;
		font-weight: 600;
	}

	.attach-block {
		flex-direction: column;
	}

	.attach-file {
		width: 94px;
		height: 94px;
		margin: 20rpx 20rpx 0 0;
	}

	.float-btn-block {
		position: absolute;
		left: 0;
		bottom: -2rpx;
		z-index: 10;
		width: 620rpx;
		height: 120rpx;
		background-color: #fff;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.float-btn {
		padding: 0 20px;
		height: 60rpx;
		border: 0.5px solid #d8d8d9;
		border-radius: 32rpx;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.float-btn__text {
		font-size: 24rpx;
	}
	.cell-list {
		flex-direction: column;
	}
</style>
