<template>
	<view class="weddingCelebration">
		<uni-nav-bar dark :fixed="true" background-color="#00aaff" :border="false" status-bar title="婚庆服务" @clickLeft="back" left-icon="left"/>
		<uni-section title="婚庆服务" type="line" titleFontSize="34rpx">
			<uni-card :is-shadow="false">
				<view class="weixin-top">
					<view class="title">微信号:</view>
					<view @click="copy(configList.wx.keyCentent)" class="copy icon">
						<image src="@/static/weddingCelebration/copy.png" mode="widthFix"></image>
					</view>
				</view>
				<view class="number">{{ configList.wx.keyCentent }}</view>
			</uni-card>
			
			<uni-card :is-shadow="false">
				<view class="weixin-top">
					<view class="title">手机号:</view>
					<view @click="clickService(configList.phone.keyCentent)" class="copy icon">
						<image src="@/static/weddingCelebration/phone.png" mode="widthFix"></image>
					</view>
				</view>
				<view class="number">{{ configList.phone.keyCentent }}</view>
			</uni-card>
		</uni-section>
	</view>
</template>

<script>
	import { mapState } from 'vuex'
	export default {
		name : 'weddingCelebration',
		data(){
			return {
				wx : {},
				phone : {},
			}
		},
		computed : {
			...mapState(['configList']),
		},
		onShow(){
			// this.getData()
		},
		methods : {
			back(){
				uni.switchTab({
					url: '/pages/payment/payment'
				})
			},
			
			//获取微信号,手机号
			getWxPhoneNumber(keyValue){
				this.$api('getConfig',{ keyValue }, res => {
					this[keyValue] = res.result
				})
			},
			
			//获取数据
			getData(){
				let dataList = [ 'wx' , 'phone' ]
				dataList.forEach(item => {
					this.getWxPhoneNumber(item)
				})
			},
			
			//复制内容
			copy(content) {
				uni.setClipboardData({
					data: content,
					success: () => {
						uni.showToast({
							title: '复制成功',
							icon: 'none'
						})
					}
				})
			},
			
			//拨打电话
			clickService(phoneNumber) {
				uni.makePhoneCall({
					phoneNumber,
					success: () => {},
					fail: () => {}
				});
			},
			
		}
	}
</script>

<style lang="scss" scoped>
	.weddingCelebration{
		min-height: 100vh;
		width: 750rpx;
		margin: 0rpx auto;
		
		.weixin-top{
			display: flex;
			justify-content: space-between;
			
			.title{
				font-size: 34rpx;
			}
			
			image{
				width: 45rpx;
			}
		}
	}
</style>