<template>
<div class="bargainTeam" :style="styleData[keyData.bargainTeam]"  ref="bargainTeam"
    @click="styleClick('click', 'bargainTeam')"
    @mousemove="styleClick('mousemove', 'bargainTeam')"
    @mouseout="styleClick('mouseout')">
  <div class="shopNameLable" :style="styleData[keyData.shopNameLable]"><div>{{shopName}}</div>
  </div>
  <div class="goShop" :style="styleData[keyData.goShop]" v-lz-click="'4'" @click="goToShop()">进店逛逛</div>
  <div  class="tac" :style="styleData[keyData.tac]" style="margin-top: -8rem;" >
    <div class="skuDetail" :style="styleData[keyData.skuDetail]">
      <div class="ib" :style="styleData[keyData.ib]" style="width: 2rem;">
        <img :src="goodsImage" alt="" style="width: 100%; height: 100%">
      </div>
      <div class="ibTal" :style="styleData[keyData.ibTal]" style="width: 3.1rem; margin-left: 0.1rem;">
        <div class="goodsName" :style="styleData[keyData.goodsName]">{{goodsName}}
        </div>
        <div class="price" :style="styleData[keyData.price]">京东价：{{price}}元
        </div>
        <div class="discountPrice" :style="styleData[keyData.discountPrice]">当前价：{{discountPrice}}元
        </div>
        <div style="margin-top: 0.05rem;">
          <a  class="ib"  :style="styleData[keyData.ib]" v-lz-click="'9'" @click="goBuy()" style="width: 1.36rem; height: 0.48rem; text-align: center; border-radius: 0.06rem; line-height: 0.48rem;font-size: 0.24rem;background-color: rgb(235, 248, 218);">立即购买</a>
        </div>
      </div>
    </div>
  </div>
  <div class="tacType1" :style="styleData[keyData.tacType1]" v-if="type==1">
    <div class="tacType2" :style="styleData[keyData.tacType2]">
      <div class="tacType3" :style="styleData[keyData.tacType3]">
      </div>
      <div class="tacType4" :style="styleData[keyData.tacType4]" >
        <div>开始</div>
        <div class="ibTacGo" :style="styleData[keyData.ibTacGo]">
          GO
        </div>
      </div>
      <div class="ibTac" :style="styleData[keyData.ibTac]"
           style="width: 1.1rem; margin-right: 0.6rem; position: relative; z-index: 5; color: rgb(97, 169, 233);">
        <div style="white-space: nowrap;" v-if="displayPrice == 0">￥{{firstPrice}}元</div>
        <div style="white-space: nowrap;" v-if="displayPrice == 1">{{firstPrice}}折</div>
        <div style="white-space: nowrap;" v-if="displayPrice == 2">砍{{firstPrice}}元</div>

        <div v-if="reallyLevelId1 == 1" class="ibFuHao1" :style="styleData[keyData.ibFuHao1]">
          <span style="font-size: 0.4rem;">✔</span>
        </div>
        <div v-else-if=" condition1Empty == false" class="ibFuHao1" :style="styleData[keyData.ibFuHao1]">
          <span style="font-size: 0.4rem;">X</span>
        </div>
        <div v-else class="ibFuHao1" :style="styleData[keyData.ibFuHao1]">
          {{ inviteFirst }}人
        </div>
      </div>

      <div class="ibTac" :style="styleData[keyData.ibTac]"
           style="width: 1.1rem; margin-right: 0.65rem; position: relative; z-index: 5; color: rgb(255, 112, 111);">
        <div style="white-space: nowrap;" v-if="displayPrice == 0">￥{{secondPrice}}元</div>
        <div style="white-space: nowrap;" v-if="displayPrice == 1">{{secondPrice}}折</div>
        <div style="white-space: nowrap;" v-if="displayPrice == 2">砍{{secondPrice}}元</div>

        <div v-if="reallyLevelId2 == 1" class="ibFuHao2" :style="styleData[keyData.ibFuHao2]" >
          <span style="font-size: 0.4rem;">✔</span>
        </div>
        <div v-else-if=" condition2Empty == false" class="ibFuHao2" :style="styleData[keyData.ibFuHao2]" >
          <span style="font-size: 0.4rem;">X</span>
        </div>
        <div v-else class="ibFuHao2" :style="styleData[keyData.ibFuHao2]" >
          {{ inviteSecond }}人
        </div>
      </div>
      <div class="ibTac" :style="styleData[keyData.ibTac]" style="width: 1.1rem; position: relative; z-index: 5; color: rgb(91, 179, 119);">
        <div style="white-space: nowrap;" v-if="displayPrice == 0">￥{{thirdPrice}}元</div>
        <div style="white-space: nowrap;" v-if="displayPrice == 1">{{thirdPrice}}折</div>
        <div style="white-space: nowrap;" v-if="displayPrice == 2">砍{{thirdPrice}}元</div>

        <div v-if="reallyLevelId3 == 1" class="ibFuHao3" :style="styleData[keyData.ibFuHao3]">
          <span style="font-size: 0.4rem;vertical-align: middle;">✔</span>
          <div>最低价</div>
        </div>
        <div v-else-if=" condition3Empty == false" class="ibFuHao3" :style="styleData[keyData.ibFuHao3]">
          <span style="font-size: 0.6rem;position: absolute;top: 27px;right: 17px;">X</span>
        </div>
        <div v-else class="ibFuHao3" :style="styleData[keyData.ibFuHao3]">
          <div style="margin-top: 0.2rem;">{{ inviteThird }}人</div>
          <div>最低价</div>
        </div>
      </div>
    </div>
    <div style="margin-top: 0.1rem;">
      <div class="ibTal" :style="styleData[keyData.ibTal]" style="width: 1.6rem; position: relative; z-index: 5;">
      </div>
      <div class="ibTac" :style="styleData[keyData.ibTac]" style="width: 1.5rem; margin-right: 0.15rem; position: relative; z-index: 5;">
        <span class="piecesLeft1" :style="styleData[keyData.piecesLeft1]" v-if="piecesLeft1 > 0">剩余{{ piecesLeft1 }}件</span>
        <span class="piecesLeft1" :style="styleData[keyData.piecesLeft1]" v-else>已抢光</span>
      </div>
      <div class="ibTac" :style="styleData[keyData.ibTac]" style="width: 1.5rem; margin-right: 0.3rem; position: relative; z-index: 5;">
        <div>
          <span class="piecesLeft1" :style="styleData[keyData.piecesLeft1]" v-if="piecesLeft2 > 0">剩余{{ piecesLeft2 }}件</span>
          <span class="piecesLeft1" :style="styleData[keyData.piecesLeft1]" v-else>已抢光</span>
        </div>
      </div>
      <div class="ibTac" :style="styleData[keyData.ibTac]" style="width: 1.6rem; margin-right: 0.4rem; position: relative; z-index: 5;">
        <div>
          <span class="piecesLeft1" :style="styleData[keyData.piecesLeft1]" v-if="piecesLeft3 > 0">剩余{{ piecesLeft3 }}件</span>
          <span class="piecesLeft1" :style="styleData[keyData.piecesLeft1]" v-else>已抢光</span>
        </div>
      </div>
    </div>
  </div>

  <div v-if="helpStatus == 4" class="drawKsqg" :style="styleData[keyData.drawKsqg]">
    <div v-if="needFollowShop == 0" class="drawUnpackingBtn1" :style="styleData[keyData.drawUnpackingBtn1]" v-lz-click="'2'" @click="clickShare()"></div>
    <div v-else class="drawUnpackingBtn3" :style="styleData[keyData.drawUnpackingBtn3]" v-lz-click="'2'" @click="clickShare()"></div>
  </div>
  <div v-if="type==0">
    <div v-if="helpStatus == 0" class="drawKsqgss" :style="styleData[keyData.drawKsqgss]">
      <div v-if="needFollowShop == 0" class="drawUnpackingBtn2" :style="styleData[keyData.drawUnpackingBtn2]" @click="joinTeam()"></div>
      <div v-else class="drawUnpackingBtn4" :style="styleData[keyData.drawUnpackingBtn4]" @click="joinTeam()"></div>
    </div>
    <div v-if="helpStatus == 1" class="fTac" :style="styleData[keyData.fTac]" style="position: relative;">
      <div v-if="preferentialWay == 0">已经帮这位好友砍过价了。</div>
      <div v-else-if="preferentialWay == 1">您已经为其他好友砍过价。</div>
      <div style="margin-top: 0.2rem">活动期间只能为一位好友砍价。</div>
      <div style="margin-top: 0.2rem" v-if="preferentialWay == 1">参与砍价人均可享受优惠</div>
    </div>
    <div style="color: #51a86b;position: relative;" v-else-if="helpStatus == 3">
      <div>您已经为其他好友砍过价。</div>
      <div style="margin-top: 0.2rem">活动期间只能为一位好友砍价。</div>
    </div>

    <div v-if="helpStatus == 1 || helpStatus == 3" style="margin-top: .2rem;position: relative;">
      <div style="margin-top: 0.05rem;" v-if="preferentialWay == 0">
        <a class="ib" :style="styleData[keyData.ib]" v-lz-click="'25'"
           style="width: 1.5rem; height: 0.5rem; text-align: center; border-radius: 0.06rem; line-height: 0.48rem; color: rgb(83, 153, 101); background:yellow; font-size: 0.24rem;"
           @click="goToActive()">我也要参加</a>
      </div>
      <div style="margin-top: 0.05rem;" v-else>
        <a class="ib" :style="styleData[keyData.ib]" v-lz-click="'25'"
           style="width: 1.75rem; height: 0.5rem; text-align: center; border-radius: 0.06rem; line-height: 0.48rem; color: rgb(83, 153, 101); background:yellow; font-size: 0.24rem;"
           @click="clickShare()">邀请朋友帮忙砍</a>
      </div>
    </div>
  </div>
  <div v-if="type==0 && helpStatus == 0" class="cbYaoQing" :style="styleData[keyData.cbYaoQing]">
    <div class="ib" :style="styleData[keyData.ib]">
      <img :src="initiatorImage" alt="" class="yaoQingImg" :style="styleData[keyData.yaoQingImg]" >
    </div>
    <div class="ib" :style="styleData[keyData.ib]" style="margin-left: .2rem; font-size: .25rem;color: #51a86b">
      <div>{{initiatorName | twostar}} 邀请您帮忙砍价</div>
    </div>
  </div>
</div>
</template>

<script>
  import apis1 from "../../../util/apis1.js";
  import store from "../../../store/store";
  import { goToSkuPage, goToShopPage } from "../../../util/tools.js";
  import { allShare } from "../../../js/share.js";
  import dateUtil from "../../../util/dateUtil";
  import { joinVipService1,BargainMemberPopComService1 } from '../../../util/comCreate.js';
  let { taskBargaining ,barginFollowShop ,barginToBargain , getToken} = apis1;

  export default {

    props:["isTemplate", "datas", "keyData", "styleData", "templateData", "isWebClick",
    "modifyContent",],
    data() {

      return {
        bargainRule:'',// 0 打折优惠 1 减钱优惠
        inviteFirst:'',//门槛邀请人数
        discountFirst:'',// 门槛1折扣
        totalFirst:'',// 门槛1优惠件数
        inviteSecond:'',// 门槛2邀请人数
        discountSecond:'',
        totalSecond:'',
        inviteThird:'',
        discountThird:'',
        totalThird:'',
        ifLimit:'',//0不限购 1限购
        limitMin:'',
        limitMax:'',
        displayPrice:'',//0 优惠价 1优惠折扣 2砍掉价格
        preferentialWay:'',//0独享 1共享
        id:'id',
        skuInfo:'',
        price:'price', //商品价格
        firstPrice:'',
        secondPrice:'',
        thirdPrice:'',
        discountPrice:'',//优惠价格
        goodsImage:'',
        goodsName:'',
        showTeamList:false,
        type:'',
        initiatorName:'',
        initiatorImage:'',
        discount:'',
        piecesLeft1:'',
        piecesLeft2:'',
        piecesLeft3:'',
        followShopFlag:'',
        needFollowShop:'',
        shopName:'',
        condition1Empty:true,
        condition2Empty:true,
        condition3Empty:true,
        reallyLevelId:0,
        reallyLevelId1:0,
        reallyLevelId2:0,
        reallyLevelId3:0,
        helpStatus:0,
        joinVipList:[],
        styleDataOld: {},
      isCustomSwitching: "", //有tab切换时
    };
    },
    created() {
      this.initData();
      //深拷贝重置需要
    this.styleDataOld = JSON.parse(JSON.stringify(this.styleData));
    },
    filters: {
      twostar: function(value) {
        if (!value) {
          return ""
        }
        return value.substr(0, 1) + "**" + value.substr(-1, 1)
      },
    },

    methods: {
      styleClick(type, refName) {
      if (this.isWebClick) {
        //传值给B端
        let byValue = {
          modifyContent: this.modifyContent,
          refName: refName,
          styleData: this.styleData,
          isCustomSwitching: this.isCustomSwitching, //有tab切换时
          c_this: this,
          styleDataOld: this.styleDataOld,
        };
        this.$emit("opertaionCom", type, byValue);
      }
    },
      goToActive(){
        this.type = 1;
        this.helpStatus = 4;
        taskBargaining(bargain => {
          this.bargainRule = bargain.data.rule.bargainRule;
          this.inviteFirst = bargain.data.rule.inviteFirst;
          this.discountFirst = bargain.data.discountFirst;
          this.totalFirst = bargain.data.rule.totalFirst;
          this.inviteSecond = bargain.data.rule.inviteSecond;
          this.discountSecond = bargain.data.discountSecond;
          this.totalSecond =bargain.data.rule.totalSecond;
          this.inviteThird = bargain.data.rule.inviteThird;
          this.discountThird = bargain.data.discountThird;
          this.totalThird = bargain.data.rule.totalThird;
          this.ifLimit = bargain.data.rule.ifLimit;
          this.limitMin = bargain.data.rule.limitMin;
          this.limitMax = bargain.data.rule.limitMax;
          this.displayPrice = bargain.data.rule.displayPrice;
          this.preferentialWay = bargain.data.rule.preferentialWay;
          this.skuInfo = bargain.data.skuInfo;
          this.price =  bargain.data.skuInfo.skuPrice;
          this.discountPrice = bargain.data.skuInfo.skuPrice;
          this.goodsName = bargain.data.skuInfo.skuName;
          this.goodsImage = bargain.data.skuInfo.skuImg;
          this.piecesLeft1= bargain.data.piecesLeft1;
          this.piecesLeft2=  bargain.data.piecesLeft2;
          this.piecesLeft3=  bargain.data.piecesLeft3;
          this.followShopFlag = bargain.data.followShopFlag;
          this.needFollowShop = bargain.data.needFollowShop;
          this.discount = bargain.data.discount;

          this.firstPrice = this.discountFirst;
          this.secondPrice = this.discountSecond;
          this.thirdPrice = this.discountThird;

          if (this.bargainRule == 0 ){
            this.discountPrice = parseFloat(this.price*this.discount/10).toFixed(2);
          }else {
            this.discountPrice = parseFloat(this.price-this.discount).toFixed(2);
          }

          if (this.followShopFlag == false && this.needFollowShop == 1){
            barginFollowShop(data => {
            });
          }
        });
        this.publicData.$emit('bargainTeamJoin', false);
      },
      initData() {
        var datasAll = this.templateData;
        console.log(datasAll)
        if (this.isTemplate == true) {
          this.$toast("活动预览，仅供查看");
          if (datasAll) {
            this.price =  datasAll.bargain.skuInfo.price;
            this.discountPrice = datasAll.bargain.skuInfo.price;
            this.goodsName = datasAll.bargain.skuInfo.name;
            this.goodsImage = datasAll.bargain.skuInfo.imagePath;
            this.helpStatus = 4;
            this.condition1Empty = true;
            this.condition2Empty = true;
            this.condition3Empty = true;
            this.reallyLevelId = 0;
            this.bargainRule = datasAll.bargain.bargainRule;
            this.inviteFirst = datasAll.bargain.inviteFirst;
            this.discountFirst = datasAll.bargain.discountFirst;
            this.totalFirst = datasAll.bargain.totalFirst;
            this.inviteSecond = datasAll.bargain.inviteSecond;
            this.discountSecond = datasAll.bargain.discountSecond;
            this.totalSecond = datasAll.bargain.totalSecond;
            this.inviteThird = datasAll.bargain.inviteThird;
            this.discountThird = datasAll.bargain.discountThird;
            this.totalThird = datasAll.bargain.totalThird;
            this.ifLimit = datasAll.bargain.ifLimit;
            this.limitMin = datasAll.bargain.limitMin;
            this.limitMax = datasAll.bargain.limitMax;
            this.displayPrice = datasAll.bargain.displayPrice;
            this.preferentialWay = datasAll.bargain.preferentialWay;
            this.piecesLeft1 = datasAll.bargain.totalFirst;
            this.piecesLeft2 = datasAll.bargain.totalSecond;
            this.piecesLeft3 = datasAll.bargain.totalThird;
            this.shopName = datasAll.activity.shopName;
            this.type = 1;
            this.discount = 10;
            this.needFollowShop = datasAll.activeConditions.involvementFlag;

            if (this.bargainRule == 0 ){
              if (this.displayPrice == 0){
                this.firstPrice = parseFloat(this.price * this.discountFirst / 10).toFixed(2);
                this.secondPrice = parseFloat(this.price * this.discountSecond / 10).toFixed(2);
                this.thirdPrice = parseFloat(this.price * this.discountThird / 10).toFixed(2);
                this.discountPrice = parseFloat(this.price * this.discount / 10).toFixed(2);
              }else if (this.displayPrice == 1){
                this.firstPrice = this.discountFirst;
                this.secondPrice = this.discountSecond;
                this.thirdPrice = this.discountThird;
                this.discountPrice = parseFloat(this.price * this.discount / 10).toFixed(2);
              }else if (this.displayPrice == 2){
                this.firstPrice = parseFloat(this.price - (this.price * this.discountFirst / 10)).toFixed(2);
                this.secondPrice = parseFloat(this.price - (this.price * this.discountSecond / 10)).toFixed(2);
                this.thirdPrice = parseFloat(this.price - (this.price * this.discountThird / 10)).toFixed(2);
                this.discountPrice = parseFloat(this.price * this.discount / 10).toFixed(2);
              }
            }else {
              if (this.displayPrice == 0){
                this.firstPrice = parseFloat(this.price - this.discountFirst).toFixed(2);
                this.secondPrice = parseFloat(this.price - this.discountSecond).toFixed(2);
                this.thirdPrice = parseFloat(this.price - this.discountThird).toFixed(2);
                this.discountPrice = parseFloat(this.price).toFixed(2);
              }else if (this.displayPrice == 1){
                this.firstPrice = parseFloat((this.price - this.discountFirst)/this.price*10).toFixed(1);
                this.secondPrice = parseFloat((this.price - this.discountSecond)/this.price*10).toFixed(1);
                this.thirdPrice = parseFloat((this.price - this.discountThird)/this.price*10).toFixed(1);
                this.discountPrice = parseFloat(this.price).toFixed(2);
              }else if (this.displayPrice == 2){
                this.firstPrice = parseFloat(this.discountFirst).toFixed(2);
                this.secondPrice = parseFloat(this.discountSecond).toFixed(2);
                this.thirdPrice = parseFloat(this.discountThird).toFixed(2);
                this.discountPrice = parseFloat(this.price).toFixed(2);
              }
            }
          }else{
            this.price =  100;
            this.discountPrice = 100;
            this.goodsName = "本儿夹子";
            this.goodsImage = 'http://img12.360buyimg.com/n0/jfs/t1/163350/35/7270/371414/6034cdefEfba59493/98a23d8b2ba8cc92.jpg';
            this.helpStatus = 4;
            this.condition1Empty = true;
            this.condition2Empty = true;
            this.condition3Empty = true;
            this.reallyLevelId = 0;
            this.bargainRule = 0;
            this.inviteFirst = 1;
            this.discountFirst = 5;
            this.totalFirst = 10;
            this.inviteSecond = 5;
            this.discountSecond = 10;
            this.totalSecond = 5;
            this.inviteThird = 10;
            this.discountThird = 15;
            this.totalThird = 2;
            this.ifLimit = 0;
            this.limitMin = 0;
            this.limitMax = 0;
            this.displayPrice = 0;
            this.preferentialWay = 0;
            this.piecesLeft1 = 1;
            this.piecesLeft2 = 1;
            this.piecesLeft3 = 1;
            this.shopName = "xxx京东自营官方旗舰店";
            this.type = 1;
            this.discount = 10;
            this.needFollowShop = 0;

            if (this.bargainRule == 0 ){
              this.firstPrice = parseFloat(this.price * this.discountFirst / 10).toFixed(2);
              this.secondPrice = parseFloat(this.price * this.discountSecond / 10).toFixed(2);
              this.thirdPrice = parseFloat(this.price * this.discountThird / 10).toFixed(2);
              this.discountPrice = parseFloat(this.price * this.discount / 10).toFixed(2);
            }else {
              this.firstPrice = parseFloat(this.price - this.discountFirst).toFixed(2);
              this.secondPrice = parseFloat(this.price - this.discountSecond).toFixed(2);
              this.thirdPrice = parseFloat(this.price - this.discountThird).toFixed(2);
              this.discountPrice = parseFloat(this.price).toFixed(2);
            }
          }
        }else{
          this.type = store.state.shareUserId ? '0' : '1'; // 1 主端 0 客端
          taskBargaining(bargain => {
            if (bargain.data.isMemberOk == 1){
                joinVipService1.create(bargain.data, submit => {
                  joinVipService1.close();
                  return;
                });
            }else if (bargain.data.isMemberOk == 2){
              BargainMemberPopComService1.create(submit => {
                BargainMemberPopComService1.close();
                return;
              });
            }
            this.bargainRule = bargain.data.rule.bargainRule;
            this.inviteFirst = bargain.data.rule.inviteFirst;
            this.discountFirst = bargain.data.discountFirst;
            this.totalFirst = bargain.data.rule.totalFirst;
            this.inviteSecond = bargain.data.rule.inviteSecond;
            this.discountSecond = bargain.data.discountSecond;
            this.totalSecond =bargain.data.rule.totalSecond;
            this.inviteThird = bargain.data.rule.inviteThird;
            this.discountThird = bargain.data.discountThird;
            this.totalThird = bargain.data.rule.totalThird;
            this.ifLimit = bargain.data.rule.ifLimit;
            this.limitMin = bargain.data.rule.limitMin;
            this.limitMax = bargain.data.rule.limitMax;
            this.displayPrice = bargain.data.rule.displayPrice;
            this.preferentialWay = bargain.data.rule.preferentialWay;
            this.skuInfo = bargain.data.skuInfo;
            this.price =  bargain.data.skuInfo.skuPrice;
            this.discountPrice = bargain.data.skuInfo.skuPrice;
            this.goodsName = bargain.data.skuInfo.skuName;
            this.goodsImage = bargain.data.skuInfo.skuImg;
            this.piecesLeft1= bargain.data.piecesLeft1;
            this.piecesLeft2=  bargain.data.piecesLeft2;
            this.piecesLeft3=  bargain.data.piecesLeft3;
            this.followShopFlag = bargain.data.followShopFlag;
            this.needFollowShop = bargain.data.needFollowShop;
            this.discount = bargain.data.discount;
            this.shopName = bargain.data.shopName;
            this.condition1Empty = bargain.data.condition1Empty;
            this.condition2Empty = bargain.data.condition2Empty;
            this.condition3Empty = bargain.data.condition3Empty;
            this.reallyLevelId1 = bargain.data.reallyLevelId1;
            this.reallyLevelId2 = bargain.data.reallyLevelId2;
            this.reallyLevelId3 = bargain.data.reallyLevelId3;
            this.helpStatus = bargain.data.helpStatus;

            this.firstPrice = this.discountFirst;
            this.secondPrice = this.discountSecond;
            this.thirdPrice = this.discountThird;

            if (this.bargainRule == 0 ){
              this.discountPrice = parseFloat(this.price*this.discount/10).toFixed(2);
              console.log(this.discountPrice,"00000000")
            }else {
              this.discountPrice = parseFloat(this.price-this.discount).toFixed(2);
              console.log(this.discountPrice)
            }
            if (this.type == 0){
              this.initiatorName = bargain.data.inviteUser.nickName;
              this.initiatorImage = bargain.data.inviteUser.userImg;
            }
            this.publicData.$emit('bargainTeamHelpStatus', this.helpStatus);
          });
        }
      },

      clickShare() {
        if (this.isTemplate == true) {
          this.$toast("活动预览，仅供查看");
          return;
        }
        if (this.followShopFlag == false && this.needFollowShop == 1){
          barginFollowShop(data=>{
          })
        }
        allShare(this.isTemplate, this,(callBackData)=>{
          console.log(callBackData,'callBackData');
        });
      },
      goToShop(){
        if (this.isTemplate == true) {
          this.$toast("活动预览，仅供查看");
          return;
        }
        let shopId = store.state.shopId;
        goToShopPage(shopId);
      },
      goBuy() {
        if (this.isTemplate == true) {
          this.$toast("活动预览，仅供查看");
          return;
        }
        goToSkuPage(this.skuInfo.skuId);
      },
      //我也要参加
      joinTeam(){
        // 判断关注店铺 - sgx
        if (this.followShopFlag == false && this.needFollowShop == 1){
          barginFollowShop(data=>{
          })
        }
        barginToBargain(store.state.shareUserId,data =>{
          this.helpStatus = data.data.helpStatus;
          if (this.helpStatus == 3) {
            setTimeout(() => {
              this.$toast("您已经为其他好友砍过价了");
            }, 200);
          } else if (this.helpStatus == 1) {
            setTimeout(() => {
              this.$toast("恭喜您成功帮他砍价");
            }, 200);
            return;
          }
        });
      },
    },
    filters: {
      twostar: function(value) {
        if (!value) {
          return ""
        }
        return value.substr(0, 1) + "**" + value.substr(-1, 1)
      },
      //时间转换
      dateTime(val) {
        if (val) {
          return dateUtil.formatTime(val, 'yyyy-MM-dd hh:mm');
        }
        return val;
      }
    }
  };
</script>

<style lang="scss">

  .cb, .cbli li {
    zoom: 1;
  }
  .fl {
    float: left;
  }

  .fr {
    float: right;
  }

</style>
