<template>
	<view class="page">
		<!-- 订单状态 -->
		<view class="order-status">
			<image :src="info.cover[0]==null?'../../static/img/head.jpg':(BASE_URL+info.cover[0].url)" mode="widthFix">
			</image>
			<view class="shipping-address">
				<view class="name">
					<view>
						<view class="name-one-omit">{{info.name}}</view>
						<view class="name-price">￥{{info.price}}</view>
					</view>
					<view>
						<view>
							<view class="cart-box-btn" @click="freeTell">
								<image src="../../static/kefu.png"></image>联系客服
							</view>
						</view>
						<view class="name-num">{{info.browse}}人浏览</view>
					</view>
				</view>
				<view class="content two-omit" v-html="info.content">
				</view>
			</view>
		</view>

		<!-- <view class="sex-list">
			<view class="title">
				<text>产品类型</text>
			</view>
			<view class="more-content">
				<text class="content">{{sexText}}</text>
				<text class="iconfont icon-more more"></text>
			</view>
			<view class="picker">
				<picker @change="sexPickerChange" :value="sexIndex" :range="sexArray">
					<view class="uni-input" style="height: 100rpx;">{{sexText}}</view>
				</picker>
			</view>
		</view> -->
		<!-- 商品 -->
		<view class="order-goods">
			<image v-for="item in info.images" :src="BASE_URL+item.url" mode="widthFix"></image>
		</view>
		<!-- 底部按钮 -->
		<view class="footer-btn">
			<view class="del" @click="freeTell">
				<text>联系电话</text>
				<image src="../../static/phone.png"></image>
			</view>
			<view class="btn" @click="freeTell">
				<text class="action">立即咨询</text>
			</view>
		</view>
	</view>
</template>

<script>
	import BASE_URL from '@/common/config.js'
	export default {
		data() {
			return {
				BASE_URL,
				sexText: '请选择产品类型',
				sexArray: ['类型1', '类型2', '类型3'],
				sexIndex: 0,
				id: 0,
				info: {},
				phone: ""
			};
		},
		onLoad(e) {
			this.id = e.id;
			this.phone = e.phone;
			this.GettbgoodscompanyById();
		},
		methods: {
			freeTell() {
				wx.makePhoneCall({
					phoneNumber: this.phone , //仅为示例，并非真实的电话号码
					success: function() {
						console.log("拨打电话成功！")
					},
					fail: function() {
						console.log("拨打电话失败！")
					}
				})
			},
			sexPickerChange(e) {
				this.sexIndex = e.detail.value;
				this.sexText = this.sexArray[this.sexIndex];
			},
			GettbgoodscompanyById() {
				this.API.GettbgoodscompanyById(this.id).then(res => {
					this.info = res.data;
				});
			},
			/**
			 * 售后点击
			 */
			onApplyAftersales() {
				uni.navigateTo({
					url: '/pages/AfterSaleType/AfterSaleType',
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	@import 'OrderDetails.scss';
</style>
