<template>
	<view class="container">
		<view class="list" v-if="data&&data.goodsName">
			<view class="item u-flex u-col-center u-row-between">
				<view class="l">
					商品名称
				</view>
				<view class="r">
					{{data.goodsName}}
				</view>
			</view>
			<view class="item u-flex u-col-center u-row-between">
				<view class="l">
					{{type == 0 ? '销售' : '求购'}}商品数量
				</view>
				<view class="r">
					{{data.quantity}}
				</view>
			</view>
			<view class="item u-flex u-col-center u-row-between">
				<view class="l">
					单位规格
				</view>
				<view class="r">
					{{data.measureUnit}}
				</view>
			</view>
			<view class="item u-flex u-col-center u-row-between">
				<view class="l">
					商品类型
				</view>
				<view class="r">
					{{data.goodsType}}
				</view>
			</view>
			<view class="item u-flex u-col-center u-row-between">
				<view class="l">
					地区
				</view>
				<view class="r">
					{{data.address}}
				</view>
			</view>
			
			<view class="item u-flex u-col-center u-row-between">
				<view class="l">
					经营主体名称
				</view>
				<view class="r">
					{{data.companyname}}
				</view>
			</view>
			<view class="item u-flex u-col-center u-row-between">
				<view class="l">
					联系人
				</view>
				<view class="r">
					{{data.contact}}
				</view>
			</view>
			<view class="item u-flex u-col-center u-row-between">
				<view class="l">
					联系人电话
				</view>
				<view class="r">
					{{data.contactPhone}}
				</view>
			</view>
			<view class="item u-flex u-col-center u-row-between">
				<view class="l">
					备注
				</view>
				<view class="r">
					{{data.remark||''}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: '',
				data: {

				},
				type: 0

			}
		},
		onLoad(o) {
			this.id = o.id
			this.type = o.type
			this.getData()

		},
		onReady() {
			uni.setNavigationBarTitle({
				title: this.type == 0 ? '销售需求详情' : '求购需求详情'
			});
		},
		methods: {
			getData() {
				let url = this.type == 0 ? `/managelef/demandManage/getSalesDemand/${this.id}` :
					`/managelef/demandManage/getPurchaseDemand/${this.id}`

				this.$http.get(url, {

				}).then(res => {
					if (res.code == 200) {
						console.log(res)
						this.data = res.data
					} else {
						uni.showToast({
							title: res.msg,
							icon: "none",
							duration: 1500
						});
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	$color: #4892FD;

	.container {


		padding: 30rpx;

		.list {
			background-color: #fff;
			border-radius: 20rpx;
			padding: 10rpx 30rpx;

			.item {
				padding: 15rpx 0;
				border-bottom: 1rpx solid #eee;

				&:last-child {
					border-bottom: 0;
				}

				.l {
					font-size: 30rpx;
					font-weight: bold;
					color: #333333;
					line-height: 60rpx;
					height: 60rpx;
					width: 200rpx;
				}

				.r {
					flex: 1;
					width: 1rpx;
					font-size: 28rpx;
					color: #333333;
					line-height: 40rpx;
					text-align: right;

				}
			}
		}

	}
</style>