<template>
	<view class="page flex-col">
		<view class="section_1 flex-col align-center">
			<view class="group_1 flex-col"></view>
			<view class="swiper">
				<u-swiper height="306rpx" :list="images" :indicator="true" :autoplay="true" circular
					radius="20"></u-swiper>
			</view>
			<view class="w700 flex-col text-lg margin-bottom">
				<text>{{insuranceGoodsInfo.title}}</text>
			</view>
		</view>
		<view class="w750 padding bg-white margin-top">
			<view class="">
				<text class="text-bold">保障详情</text>
			</view>
			<!-- 	<view class="margin-top">
				<u--image :showLoading="true" radius="20" :src="baseUrl+insuranceGoodsInfo.image" width="700rpx"
					height="300rpx" @click="click"></u--image>
			</view> -->
			<view class="margin-top">

				<u-parse :content="insuranceGoodsInfo.goodsDesc" :tagStyle="style"></u-parse>
			</view>
		</view>
		<view
			class="w750 padding-left padding-right padding-top-sm padding-bottom-sm bg-white margin-top flex-row justify-between align-center btnrow">
			<view class="text-orange">
				<!-- <text style="font-size: 40rpx;">{{insuranceGoodsInfo.price}}</text><text
					style="font-size: 26rpx;">元</text> -->
			</view>
			<view class="">
				<u-button text="我要投保" shape="circle"
					color="linear-gradient(to bottom, rgb(66, 130, 216), rgb(33, 101, 202))" @click="call"></u-button>
			</view>
		</view>

	</view>
</template>
<script>
	export default {
		data() {
			return {
				imagesUrl: getApp().globalData.config.imagesUrl,
				baseUrl: getApp().globalData.config.baseUrl,
				images: [],
				insuranceGoodsInfo: {},
				constants: {},
				insuranceTel: ''
			};
		},
		onLoad(option) {
			this.getInsuranceGoodsInfo(option.id)
			this.getConfig()
		},
		methods: {
			async getInsuranceGoodsInfo(id) {
				const res = await this.$request({
					url: '/system/insuranceGoods/getInfoWx/' + id,
				})
				console.log(res);
				this.insuranceGoodsInfo = res.data

				let images = res.data.images.split(",");
				for (let i = 0; i < images.length; i++) {
					images[i] = this.baseUrl + images[i]
				}
				this.images = images
			},
			// 获取配置:电话与位置、坐标
			async getConfig() {
				const res = await this.$request({
					url: '/system/shopconfig/listWx'
				})
				console.log(res);
				this.insuranceTel = res.rows[0].insuranceTel;
			},
			call() {
				uni.makePhoneCall({
					phoneNumber: this.insuranceTel.toString(), //电话号码
					success: function(e) {
						console.log(e);
					},
					fail: function(e) {
						console.log(e);

					}
				})
			}
		},
	};
</script>
<style>
	@import './index.rpx.css';

	.swiper {
		width: 700rpx;
		margin: 0 auto;
		position: relative;
		top: -60rpx
	}

	.btnrow {
		position: fixed;
		bottom: 0;
	}
</style>