<template>
<div>
  <div class="boxs">
    <section class="dui-footer__wrap">
        <div class="dui-footer__btn" @click="onSend">转发</div>
    </section>
    <section class="dui-share__methods" v-if="showMask">
        <div class="mask" @click="onClose"></div>
        <!-- <div class="share-wrap">
            <div class="close" @click="onClose"></div>
            <h5>分享到微信</h5>
            <ul>
              <li class="J_weixin" @click="onGroup"> <div>微信群</div> </li>
              <li class="J_pengyouquan" @click="onFriend"> <div>朋友圈</div> </li>
            </ul>
        </div> -->
        <div class="gudide-des">从菜单中点击转发分享</div>
        <div class="share-yindao">
          <img src="//yun.dui88.com/h5/miniprogram/kejiji/images/guide.png" alt="">
        </div>
    </section>
  </div>
    <div class="intercept__modal" v-if="showInterceptModal">
      <div class="modal_main">
        <div class="J_close close" @click="closeModal"></div>
        <div class="banner-top"></div>
        <div class="tip_wrap">
          <p class="tip1">完善名片信息</p>
          <p class="tip2">让客户主动联系你</p>
        </div>
        <div class="J_complete btn" @click="goCardEditPage">去完善</div>
      </div>
    </div>  
</div>

</template>

<script>
import { get, post } from "@js/request";
import { getUrlParameter, isWeChatApplet } from "@js/tooler";
import share from "@js/share";

const SCID = getUrlParameter('scid');
const API = {
  h5info: '/kjy/mp/content/getInitDaily',
  info: '/kjy/mp/content/h5info'
}

const inMiniprogram = isWeChatApplet();

export default {
  data() {
    return {
      showMask: false,
      showGuider: false,
      showInterceptModal: false,
      sellerId: null,
      wechatQrCode: null
    };
  },
  props: {
    // scid: {
    //     type: Number,
    //     default: 0
    // }
    wxqrcode: {
      type: String,
      default: ''
    },
    push: {
      type: Boolean,
      default: false
    },
    sellerid: {
      type: Number,
      default: null      
    }
  },
  methods: {
    initData(){

    },
    closeModal() {
      this.showInterceptModal = false;
    },
    goCardEditPage() {
      if (this.sellerId) {
        this.showInterceptModal = false;
        wx.miniProgram.navigateTo({url: '/pages/sellercard/card_edit/main?sellerId=' + this.sellerId});
      }
    },
    async onSend() {
      if(this.push){
        this.showMask = true;
        return;
      }
      let res = await get(API.info, { scid: SCID });
      //暂时去掉信息拦截
      // if (res.success) {
      //   let seller = res.data.sellerCardVO;
      //   this.sellerId = seller.id;
      //   this.wechatQrCode = seller.wechatQrCode;
      //   if (this.wechatQrCode) {
      //     wx.miniProgram.navigateTo({url: '/pages/share/main?scid=' + SCID});
      //   } else {
      //     this.showInterceptModal = true;
      //   }
      // } else {
      //   wx.miniProgram.navigateTo({url: '/pages/share/main?scid=' + SCID});
      // }

      let url = '/pages/share/main?scid=' + SCID;
      if (getUrlParameter('shareGuide') === 'true') url += '&shareGuide=true';
      wx.miniProgram.navigateTo({ url });
    },
    onClose(){
        this.showMask = false;
        this.showGuider = false;
    },
    onGroup(){
        this.showGuider = true;
    },
    onFriend(){
        // console.log(this.scid);
        wx.miniProgram.navigateTo({url: '/pages/share/main?scid=' + SCID});
    }
  },
  created() {
    this.initData();
  }
};
</script>

<style lang="less" scoped>
.boxs{
  position: relative;
  z-index: 3;
}
.dui-footer__wrap {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 24px 0 30px;
    background-color: #FFF;
    font-size: 0;
    z-index: 4;
    .dui-footer__btn{
      width: 480px;
      font-size: 36px;
      line-height: 90/36;
      background: #486EFF;
      border-radius: 48.5px;
      color: #FFFFFF;
      letter-spacing: 0.4px;
      text-align: center;
      margin: 0 auto;
      &::before{
        content: '';
        background-image: url('//yun.duiba.com.cn/h5/miniprogram/kejiji/images/repost.png');
        width:31px;
        height: 31px;
        background-repeat: no-repeat;
        display: inline-block;
        background-size: 100%;
        margin-right: 20px;
      }
    }
}
.dui-share__methods {
    box-sizing: border-box;
    display: block;
    width: 100%;
    height: 100%;
    position: fixed;
    left: 0;
    z-index: 10;
    top: 0;
    .mask{
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.7);
    }
    .share-wrap{
      position: absolute;
      height: 320px;
      left: 0;
      bottom: 0;
      width: 100%;
      background-color: #fff;
      box-sizing: border-box;
      z-index: 1;
    }
    h5{
      font-size: 36px;
      font-weight: normal;
      text-align: center;
      margin: 30px 0 40px 0;
      box-sizing: border-box;
    }
    .close{
      background-image: url('//yun.duiba.com.cn/h5/bonus-account/images/close.png');
      width: 30px;
      height: 30px;
      position: absolute;
      top: 10px;
      right: 10px;
      background-size: 100%;
      background-repeat: no-repeat;
      z-index: 9999;
    }
    .gudide-des{
      display: block;
      font-size: 32px;
      color: #fff;
      position: absolute;
      top: 35%;
      transform:translateY(-50%);
      left: 50%;
      transform: translateX(-50%)
    }
    .share-yindao{
      display: block;
      position: absolute;
      right: 150px;
      top: 30px;
      width: 350px;
      height: 385px;
      img{
        width: 100%;
        height: 100%;
      }
    }
    ul{
      width: 100%;
      margin: 0;
      display: flex;
      padding: 0;
      justify-content: center;
      align-items: center;
      li{
        list-style: none;
        font-size: 28px;
        margin: 0 75px;
      }
      .J_weixin{
        position: relative;
        height: 300px;
        display: flex;
        flex-direction: column;
        align-items: center;
        &::before{
          content: '';
          width:100px;
          height: 100px;
          background-image: url('//yun.duiba.com.cn/h5/miniprogram/kejiji/images/weiixn.png');
          background-size: 100%;
          background-repeat: no-repeat;  
          margin-bottom: 20px;        
        }

      }
      .J_pengyouquan{
        position: relative;
        height: 300px;
        display: flex;
        flex-direction: column;
        align-items: center;
        &::before{
          content: '';
          width:100px;
          height: 100px;
          background-image: url('//yun.duiba.com.cn/h5/miniprogram/kejiji/images/pengyouquan.png');
          background-size: 100%;
          background-repeat: no-repeat;  
          margin-bottom: 20px;        
        }

      }      
    }
}

.intercept__modal{
  // display: none;
  z-index: 500;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background-color:rgba(0, 0, 0, 0.5);
  .modal_main{
    width: 618px;
    height: 723px;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
    background-color: #fff;
    border-radius: 25px;
    box-sizing: border-box;
    padding: 50px;
    .close{
      position: absolute;
      width: 25px;
      height: 25px;
      background-image: url('//yun.dui88.com/h5/miniprogram/kejiji/images/icon_close_.png');
      background-size: 100%;
      background-repeat: no-repeat;
      right: 25px;
      top: 25px;
    }
    .banner-top{
      width: 520px;
      height: 304px;
      background-image: url('//yun.dui88.com/h5/miniprogram/kejiji/images/bg_wsmp.png');
      background-size: 100%;
      background-repeat: no-repeat;
    }
    .btn{
      width: 380px;
      height: 93px;
      background: #365FFF;
      border-radius: 46.5px;
      font-size: 36px;
      color: #FFFFFF;
      text-align: center;
      line-height: 93px;
      margin: 0 auto;
      margin-top: 57px;
      &::after{
        content: '';
        display: inline-block;
        width: 36px;
        height: 20px;
        background-size: 100%;
        background-repeat: no-repeat;
        margin-left: 10px;
        background-image: url('//yun.dui88.com/h5/miniprogram/kejiji/images/Fill_Copy.png');
      }
    }    
    .tip_wrap{
      margin-top: 24px;
      p{
        margin: 0;
      }
      .tip1{
        font-size: 44px;
        color: #333333;
        text-align: center;
        font-weight: 500;
      }
      .tip2{
        font-size: 32px;
        color: #333333;
        margin-top: 10px;
        font-weight: normal;
        text-align: center;
      }
    }
  }
}
</style>