<template>
  <uv-popup 
    ref="popup"
    :overlayOpacity="0"
    mode="center"
    bgColor="none"
  >
    <view class="popup__view">
      <image class="bg" src="@/pages_order/static/service/bg-popup-phone.png" mode="widthFix"></image>
      <view class="flex flex-column content">
        <text class="title">电话咨询</text>
        <view class="flex phone">
          <!-- todo: check key -->
          <view class="flex icon" @click="onCall(13256541235)">
            <image class="img" src="@/pages_order/static/service/icon-phone.png" mode="widthFix"></image>
          </view>
          <!-- todo: check key -->
          <view>13256541235</view>
        </view>
        <button class="btn" @click="onCopy">复制手机号</button>
      </view>
    </view>
  </uv-popup>
</template>

<script>
  import { mapState } from 'vuex'

  import utils from '@/utils/utils.js'

	export default {
    props: {
      src: {
        type: String,
        default: null
      }
    },
		data() {
			return {
      }
    },
    computed : {
      ...mapState(['configList'])
    },
    methods: {
      open() {
        this.$refs.popup.open();
      },
      close() {
        this.$refs.popup.close();
      },
      onCall(phoneNumber) {
        uni.makePhoneCall({
          phoneNumber,
          success() {
            console.log('安卓拨打成功');
          },
          fail() {
            console.log('安卓拨打失败');
          }
        })
      },
      onCopy(phone) {
        utils.copyText(phone)
      },
    },
  }
</script>

<style scoped lang="scss">
  .popup__view {
    position: relative;
    width: 684rpx;
    min-height: 701rpx;
    background: #FFFFFF;
    border-radius: 16rpx;
  }

  .bg {
    width: 100%;
    height: auto;
  }

  .content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 69rpx 0;
    box-sizing: border-box;
    justify-content: space-between;
  }

  .title {
    font-size: 32rpx;
    font-weight: 600;
    color: #000000;
  }

  .phone {
    margin: 238rpx 0 122rpx 0;
    column-gap: 21rpx;
    font-size: 32rpx;
    font-weight: 600;
    color: #000000;

    .icon {
      width: 60rpx;
      height: 60rpx;
      .img {
        width: 100%;
        height: 100%;
      }
    }
  }

  .btn {
    padding: 29rpx 202rpx;
    font-size: 30rpx;
    color: #FFFFFF;
    background: #014FA2;
    border-radius: 50rpx;
  }
</style>