<template>
	<view>
		<lf-nav title="会员服务" :showIcon="true"></lf-nav>
		<view class="content">
			<view class="head">
				<image mode="aspectFill" src="https://picsum.photos/seed/picsum/200/300"></image>
			</view>
			<view class="main">
				<view class="item" v-for="(item, index) in serviceList" :key="index">
					<image class="img" :src="item.image" mode="aspectFill"></image>
					<view class="title">{{item.name}}</view>
					<view class="desc">{{item.remark}}</view>
				</view>
			</view>
			<view style="height: 120rpx;"></view>
			<view class="fixed">
				<button class="btn1 lf-m-r-25" open-type="contact">在线客服</button>
				<!-- <view class="btn1 lf-m-r-25" hover-class="lf-opacity" @click="$url('/pages/user/my/chatonline')">在线客服</view> -->
				<view class="btn2" hover-class="lf-opacity" @click="makePhonecall()">拨打客服电话</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data(){
			return {
				serviceList: []
			}
		},
		onLoad(){
			this.getService()
		},
		methods: {
			makePhonecall() {
				wx.makePhoneCall({
				  phoneNumber: '1340000' //仅为示例，并非真实的电话号码
				})
			},
			getService() {
				this.$http
				    .get({
				        api: 'api/service'
				    })
				    .then(res => {
				        if (res.data.code == 200) {
				            if (res.data.status) {
				        		this.serviceList = res.data.data
				               console.log('数组列表',this.serviceList)
				            } else {
				                wx.showModal({
				                    content: res.message || '请下拉页面刷新重试',
				                    showCancel: false
				                });
				            }
				        } else {
				            wx.showModal({
				                content: '请下拉页面刷新重试',
				                showCancel: false
				            });
				        }
				        wx.hideLoading();
				    })
				    .catch(() => {
				        wx.hideLoading();
				        wx.showModal({
				            content: '请求失败',
				            showCancel: false
				        });
				    });
			}
		}
	}
</script>

<style lang="scss" scoped="scoped">
	.content{
		padding: 30rpx 32rpx;
		.head{
			width: 686rpx;
			height: 300rpx;
			border-radius: 20rpx;
			overflow: hidden;
			&>image{
				width: 100%;
				height: 100%;
			}
		}
		.main{
			width: 100%;
			display: flex;
			flex-wrap: wrap;
			.item{
				width: 200rpx;
				height: max-content;
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;
				margin-top: 40rpx;
				margin-right: 43rpx;
				&:nth-child(3n){
					margin-right: 0rpx;
				}
				.img{
					width: 200rpx;
					height: 200rpx;
					background-color: #D8D8D8;
					border-radius: 20rpx;
				}
				.title{
					font-size: 28rpx;
					color: #222222;
					margin-top: 20rpx;
				}
				.desc{
					font-size: 24rpx;
					color: #777777;
					margin-top: 10rpx;
				}
			}
		}
		.fixed{
			height: 120rpx;
			width: 750rpx;
			position: fixed;
			bottom: 0;
			left: 0;
			z-index: 2;
			background-color: #FFFFFF;
			border-top: 1rpx solid #e5e5e5;
			box-sizing: border-box;
			padding: 0 32rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			.btn1{
				width: 300rpx;
				height: 100rpx;
				border-radius: 50rpx;
				border: 2rpx solid #15716E;
				display: flex;
				justify-content: center;
				align-items: center;
				color: #15716E;
				font-size: 32rpx;
			}
			.btn2{
				// width: 423rpx;
				width: 686rpx;
				height: 100rpx;
				background: #15716E;
				border-radius: 50rpx;
				color: #FFFFFF;
				display: flex;
				justify-content: center;
				align-items: center;
			}
		}
	}
</style>
