<template>
  <div class="page_shop">
      <van-tabs v-model="active">
        <van-sticky>
          <div class="iconBox">
            <i class="iconfont icon-zuojiantou jiantou" @click="$router.go(-1)"></i>
          </div>
        </van-sticky>
        <van-tab title="商品"><iframe :src= this.url></iframe></van-tab>
        <van-tab title="分销"><iframe :src= this.fenxiao></iframe></van-tab>
        <van-tab title="推广"><iframe :src= this.tuiguang></iframe></van-tab>
      </van-tabs>
  </div>
</template>

<script>
import { setRem } from "@/libs/functionRem";
import { getCurrentOrg } from "@/api/patient/patient";
export default {
  data() {
    return {
      fxtoken: "",
      fxorgid: "",
      timestamp: "",
      fxadmin: "",
      url: "",
      fenxiao:'',
      tuiguang:''
    };
  },
  methods: {
    getCurrentOrg() {
      getCurrentOrg().then(response => {
        if (response.data.state === 1) {
          var org = response.data.data.org;
          // console.log(org)
          // console.log("name", name);
          this.fxorgid = org.id;
          this.fxadmin = org.creator;
          var nowTime = response.data.data.nowTime;
          this.timestamp = nowTime;
          // console.log("nowTime", nowTime);
          var signToken = response.data.data.signToken;
          // console.log("signToken", signToken);
          this.fxtoken = signToken;
          http://shop.kuyicloud.com/app/index.php?i=2&c=entry&m=ewei_shopv2&do=mobile&fxtoken=c470967ab77e022a7007a2c7b133b322&fxorgid=3877&timestamp=1587447659&fxadmin=185
          this.url =
            "http://shop.kuyicloud.com/app/index.php?i=2&c=entry&m=ewei_shopv2&do=mobile" +
            "&fxtoken=" +
            this.fxtoken +
            "&fxorgid=" +
            this.fxorgid +
            "&timestamp=" +
            this.timestamp +
            "&fxadmin=" +
            this.fxadmin;
        }
        this.fenxiao = "http://shop.kuyicloud.com/app/index.php?i=2&c=entry&m=ewei_shopv2&do=mobile" +
        "&r=commission" +
        "&fxtoken=" +
        this.fxtoken +
        "&fxorgid=" +
        this.fxorgid +
        "&timestamp=" +
        this.timestamp +
        "&fxadmin=" +
        this.fxadmin;
        this.tuiguang = "http://shop.kuyicloud.com/app/index.php?i=2&c=entry&m=ewei_shopv2&do=mobile" +
        "&r=commission.qrcode" +
        "&fxtoken=" +
        this.fxtoken +
        "&fxorgid=" +
        this.fxorgid +
        "&timestamp=" +
        this.timestamp +
        "&fxadmin" + this.fxadmin;
      });

    }
  },
  created() {
    setRem();
    // 获取当前机构ID
    this.getCurrentOrg();
  }
};
</script>

<style lang="scss" scoped>
.page_shop {
  height: 100%;
  overflow-y: auto;
  iframe {
    height: 100%;
    width: 100%;
  }
  .iconBox{
    position: absolute;
    z-index: 2;
    left: 0;
    top: 0;
    width: 2.625rem;
    height: 2.75rem;
    display: flex;
    align-items: center;
  }
  .shopTitle {
    width: 100%;
    background: #fff;
    padding: 0 1.125rem;
    height: 3.125rem;
    display: flex;
    align-items: center;
    position: fixed;
    top: 0;
    .iconBox{
      position:fixed;
      z-index: 9;
    }
  }
  .jiantou {
    font-size: 1.5rem;
    font-weight: 600;
    margin-right: 8rem;
  }
  .titleName {
    font-size: 1.125rem;
    font-weight: 600;
  }
}
</style>
<style lang="scss">
.page_shop{
  .van-tabs{
    height: 100%;
    .van-tabs__content{
      height: 93%;
    }
    .van-tab__pane{
      height: 100%;
    }
    .van-tabs__line{
      background: #5b98ff;
    }
  }
}
</style>
