<template>
	<view class="product-detail pr">
		<view class="product-pic">
			<swiper class="swiper" indicator-active-color="#ffffff" indicator-color="rgba(255,255,255,.3)"
				indicator-dots autoplay :interval="2000" :duration="500">
				<swiper-item v-if="detail.picture">
					<image :src="detail.picture" mode="aspectFit"></image>
				</swiper-item>
			</swiper>
		</view>
		<view class="product-content">
			<view class="product-info">
				<view class="text-ellipsis-2 mb23">
					<!-- <text class="type-tips">爆款</text> -->
					<text class="f32 gray3">{{ detail.titleName }}</text>
				</view>
				<view class="f28 mb23">
					<text class="gray9">{{ detail.twoLevelTitle }}</text>
				</view>
			</view>
			<view class="secend-info">
				<view class="d-b-c sec-info-item">
					<view class="sec-info-label">{{$t("w_0122")}}</view>
					<view class="flex-1"></view>
				</view>
			</view>
			<view class="thi-info">
				<view class="thi-nav">
					<view class="thi-nav-item" :class="{ active: thiType == 0 }">{{$t("w_0124")}}</view>
				</view>
				<view v-if="thiType == 0"><u-parse :content="detail.content"></u-parse></view>
			</view>
		</view>
		<view class="btns-wrap">
			<view class="d-a-c flex-1">
				<view class="icon-box d-c-c" @click="gotoPage('/pages/index/index')">
					<button class="d-c-c d-c bg-white">
						<image style="width: 33rpx;height: 33rpx;margin-bottom: 10rpx;"
							src="/static/icon/product/home.png" mode=""></image>
						<text class="f20" style="height: 20rpx;line-height: 20rpx;color: #FB3024;">{{$t("ENU_MENU_10")}}</text>
					</button>
				</view>
				<view class="icon-box d-c-c">
					<button class="d-c-c d-c bg-white">
						<image style="width: 33rpx;height: 33rpx;margin-bottom: 10rpx;"
							src="/static/icon/product/service.png" mode=""></image>
						<text class="f20 gray3" style="height: 20rpx;line-height: 20rpx;">{{$t("w_0259")}}</text>
					</button>
				</view>
				<view class="icon-box d-c-c" @click="gotoPage('/pages/cart/cart')">
					<button class="pr d-c-c d-c bg-white">
						<image style="width: 33rpx;height: 33rpx;margin-bottom: 10rpx;"
							src="/static/icon/product/cart.png" mode=""></image>
						<text class="f20 gray3" style="height: 20rpx;line-height: 20rpx;">{{$t("N_I_194")}}</text>
					</button>
				</view>
			</view>
			<template>
				<button type="primary" class="buy one" @click="openSpec">{{$t("N_I_192")}}</button>
			</template>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pkId: 0,
				waresCode: '',
				title: '',
				productModel: null,
				isPopup: false,
				isTablePopup: false,
				isPreview: false,
				isVideoPlay: false,
				detail: {},
				thiType: 0,
				alreadyChioce: '',
				isFirst: true,
				productParams: []
			};
		},
		onLoad(e) {
			this.pkId = e.pkId;
			this.getData();
		},
		methods: {
			getData() {
				let self = this;
				uni.request({
					url: 'http://p1.hzs413.com/inter-api/home/api/ho-product-details/getHoWaresDetails/' +
						self.pkId,
					method: 'GET',
					success: result => {
						console.log(result);
						var data = result.data;
						self.detail = data.data;
						console.log(self.detail)
					},
					error: error => {
						console.log('----------------error');
						console.log(error);
					}
				});
			}
		}
	};
</script>

<style lang="scss">
	.product-detail {
		padding-bottom: 150rpx;
	}

	.product-detail .product-pic,
	.product-detail .product-pic .swiper,
	.product-detail .product-pic image {
		width: 750rpx;
		height: 750rpx;
	}

	.product-detail .product-pic .swiper .icon-bofang {
		position: absolute;
		top: 0;
		bottom: 0;
		left: 0;
		right: 0;
		margin: auto;
		font-size: 48rpx;
		color: #ffffff;
		border-radius: 50%;
		border: 4rpx solid #ffffff;
		width: 120rpx;
		height: 120rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		background-color: #00000080;
		padding-left: 16rpx;
		box-sizing: border-box;
		z-index: 10;
	}

	.video {
		width: 100%;
		height: 100%;
	}

	.product-content {
		padding: 22rpx 23rpx;
	}

	.preview-box {
		width: 100%;
		height: 134rpx;
		padding: 0 20rpx;
		box-sizing: border-box;
		margin-bottom: -10rpx;

		.preview-bg {
			width: 704rpx;
			height: 134rpx;
			position: absolute;
			left: 0;
			top: 0;
			z-index: 0;
		}
	}

	.product-info {
		width: 704rpx;
		background: #ffffff;
		border-radius: 15rpx;
		position: relative;
		z-index: 2;
		padding: 42rpx 20rpx 30rpx 20rpx;
		box-sizing: border-box;
		margin-bottom: 22rpx;
	}

	.type-tips {
		font-size: 22rpx;
		padding: 0 17rpx;
		line-height: 37rpx;
		background-color: #fb3024;
		border-radius: 19rpx;
		color: #ffffff;
		margin-right: 8rpx;
	}

	.sellingPoints {
		background: #fb3024;
		border-radius: 10rpx;
		padding: 13rpx 38rpx;
		font-size: 22rpx;
		color: #ffffff;
		word-break: break-all;
	}

	.secend-info {
		width: 704rpx;
		padding: 0 15rpx 0 19rpx;
		background: #ffffff;
		border-radius: 15rpx;
		box-sizing: border-box;
		margin-bottom: 25rpx;

		.sec-info-item {
			padding: 20rpx 0;
			box-sizing: border-box;
			min-height: 90rpx;
			border-bottom: 1rpx solid #eee;
			font-size: 28rpx;

			.sec-info-label {
				max-width: 125rpx;
				min-width: 105rpx;
				flex-shrink: 0;
				word-break: break-all;
				color: #999999;
				margin-right: 20rpx;
			}
		}

		.sec-info-item:last-child {
			border: none;
		}
	}

	.thi-info {
		width: 702rpx;
		background: #ffffff;
		border-radius: 20rpx;
		padding: 0 15rpx 15rpx 15rpx;
		box-sizing: border-box;
	}

	.thi-nav {
		display: flex;
		justify-content: flex-start;
		align-items: center;
		overflow-x: auto;
		width: 100%;
		padding-left: 20rpx;
		box-sizing: border-box;
		border-bottom: 1rpx solid #eee;
		margin-bottom: 22rpx;

		.thi-nav-item {
			font-size: 30rpx;
			color: #333;
			padding: 0 30rpx;
			height: 92rpx;
			line-height: 92rpx;
			white-space: nowrap;
			flex-shrink: 0;
			position: relative;
		}

		.thi-nav-item.active::after {
			position: absolute;
			content: '';
			left: 0;
			right: 0;
			margin: auto;
			bottom: 0;
			width: 30%;
			height: 6rpx;
			border-radius: 4rpx;
			z-index: 1;
			background-color: #fb3024;
		}
	}

	.btns-wrap {
		position: fixed;
		height: 100rpx;
		right: 0;
		bottom: 0;
		left: 0;
		display: flex;
		background: #ffffff;
		align-items: center;
		z-index: 97;
		border-top: 1rpx solid #eee;
	}

	.btns-wrap .icon-box {
		width: 92rpx;
		height: 100rpx;
	}

	.btns-wrap .icon-box .iconfont {
		font-size: 40rpx;
		color: #888888;
	}

	.btns-wrap .icon-box .iconfont .num {
		position: absolute;
		top: 10rpx;
		left: 50%;
		height: 30rpx;
		min-width: 30rpx;
		overflow: hidden;
		line-height: 32rpx;
		border-radius: 15rpx;
		font-size: 20rpx;
		color: #ffffff;
		background: red;
	}

	.btns-wrap button,
	.btns-wrap button:after {
		height: 100rpx;
		line-height: 100rpx;
		margin: 0;
		padding: 0;
		border-radius: 0;
		border: 0;
	}

	.btns-wrap button.add-cart {
		background: $dominant-color;
		font-size: 28rpx;
		width: 214rpx;
		height: 75rpx;
		line-height: 75rpx;
		margin-left: 17rpx;
		border-radius: 40rpx 0 0 40rpx;
	}

	.btns-wrap button.buy {
		background: #fb3024;
		font-size: 28rpx;
		width: 214rpx;
		height: 75rpx;
		line-height: 75rpx;
		border-radius: 0 40rpx 40rpx 0;
		margin-right: 25rpx;
	}

	.btns-wrap button.buy.one {
		border-radius: 40rpx;
		width: 428rpx;
		margin-left: 30rpx;
	}

	.share-icon {}
</style>