<template>
	<view>
		<view class="product_detail">
			<image src="../../../static/news.jpg" mode="widthFix" class="pic"></image>
			<view class="box">
				<view class="title">{{ item.goodsName }}</view>
				<view class="clear"></view>
				<u-divider text="规格参数"></u-divider>
				<view class="item">
					<text class="desc">商品量：</text>
					<text>{{ item.goodsQuantity }}</text>
					<view class="clear"></view>
				</view>
				<view class="item">
					<text class="desc">计量单位：</text>
					<text>{{ item.goodsUnit }}</text>
					<view class="clear"></view>
				</view>
				<view class="item">
					<text class="desc">商户：</text>
					<text>{{ item.createName }}</text>
					<view class="clear"></view>
				</view>
				<view class="item">
					<text class="desc">互市区：</text>
					<text>{{ item.tradeAreaName }}</text>
					<view class="clear"></view>
				</view>
				<view class="item">
					<text class="desc">发布时间：</text>
					<text>{{ item.createTime }}</text>
					<view class="clear"></view>
				</view>
			</view>
		</view>
		<view class="mfooter">
			<view class="flex">
				<view class="f">
					<button class="btn" v-if="user.userType == 2" @click="pay()">立即接单</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			user: this.getUser(),
			item: {}
		};
	},
	onLoad(e) {
		if (e.id) {
			this.http.request({
				url: '/level-two-server/app/TbGoodsDemand/getById?id=' + e.id,
				success: res => {
					this.item = res.data.data;
				}
			});
		}
	},
	methods: {
		pay() {
			uni.navigateTo({ url: '/pages/market/two/leader/confirm?item=' + JSON.stringify(this.item) });
		}
	}
};
</script>

<style lang="scss">
page {
	background-color: $pg;
}
</style>
