<template>
	<view>
		<view class="top">
			<image :src="ip + item.pic" class="pic"></image>
			<view class="title">{{ item.title }}</view>
		</view>
		<view class="contents">
			<view class="xq">商品详情</view>
			<view><u-parse :html="item.details"></u-parse></view>
		</view>
		<view class="lfooter">
			<view class="lfx">
				<view class="f price">¥{{ item.price }}</view>
				<view class="f buy" @click="buy()">购买</view>
			</view>
		</view>
	</view>
</template>
<script>
export default {
	data() {
		return {
			ip: this.$http.urls.ip,
			item: {}
		};
	},
	onLoad(e) {
		this.$http.request({
			url: this.$http.urls.goods_detail + e.id,
			success: res => {
				this.item = res.data.data;
				this.item.goodsType=e.goodsType;
			}
		});
	},
	methods: {
		//购买服务
		buy() {
			let item=this.item;	
			delete item.details;
			uni.navigateTo({
				url:'buy?item='+JSON.stringify(this.item)
			})
		}
	},
};
</script>
<style lang="scss">
.top {
	background-color: white;
	.pic {
		width: 100%;
		height: 350px;
	}
	.title {
		font-size: 15px;
		font-weight: 500;
		padding: 10px 15px 12px 15px;
	}
}
.contents {
	margin-top: 10px;
	padding: 10px 20px 70px 20px;
	background-color: white;
	.xq {
		text-align: center;
		font-size: 14px;
		margin-bottom: 12px;
	}
}
.lfooter {
	font-size: 17px;
	.price {
		line-height: 52px;
		color: $theme-color;
	}
	.buy {
		background-color: $theme-color;
		text-align: center;
		color: white;
		height: 52px;
		line-height: 52px;
	}
}
</style>
