<template>
	<view class="page">
		<navBar title="售后联系" :back="true" color="black" background="white" />
		<view class="content">
			<image :src="picUrl+'/static/my/conBg.png'" mode="" style="width: 100%;height: 384rpx;"></image>

			<view class="box">
				<view class="item">
					<view class="part1">
						<view class="left">
							<image :src="picUrl+'/static/my/phone.png'" mode="heightFix"
								style="width: 26rpx;height: 26rpx;">
							</image>
						</view>
						<view class="cen">
							<view class="water">
								PHONE
							</view>
							<view class="top">
								手机号
							</view>
							<view class="bot">
								<view class="num">
									{{con.phone}}
								</view>
								<view class="call" @click="call(con.phone)">
									拨号
								</view>
							</view>
						</view>
					</view>
					<view class="right">
						<!-- 拨号 -->
					</view>
				</view>

				<view class="item">
					<view class="part1">
						<view class="left">
							<image :src="picUrl+'/static/my/wechat.png'" mode="heightFix"
								style="width: 26rpx;height: 26rpx;">
							</image>
						</view>
						<view class="cen">
							<view class="water">
								WECHAT </view>
							<view class="top">
								微信号
							</view>
							<view class="bot">
								<view class="num">
									{{con.wxNumber}}
								</view>
								<view class="call" @click="copy(con.wxNumber)">
									复制
								</view>
							</view>
						</view>
					</view>
					<view class="right">
						<!-- 拨号 -->
					</view>
				</view>

				<view class="item" style="height: auto;padding-top: 34rpx;box-sizing: border-box;">
					<view class="part1">
						<view class="left">
							<image :src="picUrl+'/static/my/code.png'" mode="heightFix"
								style="width: 26rpx;height: 26rpx;">
							</image>
						</view>
						<view class="cen">
							<view class="water">
								QR CODE
							</view>
							<view class="top">
								微信二维码
							</view>
							<view class="bot1">
								<view class="top">
									扫码了解
								</view>
								<image class="code" :src="picBase+con.wxCode" mode=""
									style="width: 100%;height: 250rpx;" @click="previewImg()">
								</image>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getSerBackConReq,
	} from '@/api/test/index.js'
	export default {
		components: {

		},
		data() {
			return {
				picUrl: this.$picUrl,
				picBase: this.$picBase,

				con: null
			}
		},
		async onLoad(options) {
			let res = await getSerBackConReq()
			if (res.code == 0) {
				console.log('获取我的售后联系返回值: ', res);

				this.con = res.data.content[0]
			} else {
				uni.showToast({
					title: res.message,
					icon: 'none'
				})
			}
		},
		methods: {
			copy(data) {
				let _this = this
				uni.setClipboardData({
					data,
					success: function() {
						_this.$toast('复制成功', 'success')
					}
				});
			},
			call(phone) {
				uni.makePhoneCall({
					phoneNumber: phone,
				})
			},
			//点击预览图片 
			previewImg() {
				uni.previewImage({
					current: this.picBase + this.con.wxCode,
					urls: [this.picBase + this.con.wxCode], //存放图片的数组
					loop: true,
					indicator: 'default'
				})
			},
		}
	}
</script>

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