
<style scoped>  
.jfBaseSize {background-color:#F3F6FF;height:100%;height:100vh;padding:0;margin:0; position: relative;}
.StoreTask{width: 90%;margin: 0 auto;}
.StoreTask .StoreName{
  background: #fff;height: 2.5rem;line-height: 2.5rem;
  border-radius: 0.5rem; text-indent: 5%;
}
.StoreTask .StoreName span{  
  width: 90%; display:inline-block;
  background: url('http://image.supercarrier8.com/h5_key/storecheck/icon-arrowDown.png');
  background-repeat: repeat;
  background-size: auto;
  background-position: right 1rem;
  background-repeat: no-repeat;
  background-size: auto 0.5rem;}
.StoreTask .TaskInfo{margin-top: 0.5rem;}
.StoreTask .TaskInfo .TaskList{
  height: 2rem;
  background: #fff;line-height: 2rem;
  text-indent: 5%;color: #828282;
}
.StoreTask .TaskInfo  .line{border-bottom: 0.1rem solid #E5E5E5; margin:0 3%;}
.StoreTask .TaskInfo  ul{ list-style-type: none;padding: 0; margin: 0;}
.StoreTask .TaskInfo  ul li {margin-bottom: 0.5rem;}
.StoreTask .TaskInfo  ul li div.checktask{background: #fff; line-height: 2rem; display: flex; }
.StoreTask .TaskInfo  ul li div.checktask span.Inspection{width:65%; display: inline-block;
 text-indent: 6%; font-weight: bold; color:#5B5B5B;}
.StoreTask .TaskInfo  ul li div.checktask span.competestate{
  border: 0.1rem solid #6CA5FC;border-radius: 0.6rem;
  width: 20%;display: inline-block;
  height: 1.2rem;line-height: 1.2rem;
  text-align: center;color: #6CA5FC;margin-top:0.5rem;
} 
.StoreTask .TaskInfo  ul li div.checktask span.icon{
  background: url('http://image.supercarrier8.com/h5_key/storecheck/icon-arrowUp.png');
  background-repeat: repeat;
  background-size: auto;
  background-position: right 1rem;
  background-repeat: no-repeat;
  background-size: auto 0.4rem;
  width:10%;;
}
.StoreTask .TaskInfo  ul li div.checktask span.arrowUp{background-image: url('http://image.supercarrier8.com/h5_key/storecheck/icon-arrowDown.png');}

.StoreTask .TaskInfo  ul li .taskdesc{
  padding-left: 4%;background: #fff;padding-right: 28%;padding-bottom: 8%;
}
.DetailInfo{background: #fff;padding-left: 4%; padding-bottom: 1rem;}
.DetailInfo p{margin: 0;}
.DetailInfo p.info{margin-bottom: 0.5rem;margin-top: 1rem;}
.DetailInfo div.SupplyInfo textarea{width:95%; border:0.1rem solid #E3E3E3;background: #FAFAFA;
border-radius: 0.6rem; text-indent: 3%; height: 4rem;}

.mint-button{width:94%;font-weight: bold; margin:0 auto;margin-top:0.4rem;background-color:#3A8AFB;border-radius: 0.2rem;}
.btnContent{height:3.4rem;background-color:#F3F6FF;position: absolute;bottom:0;width: 100%;}
</style>
<style>
.DetailInfo .avatar-uploader .el-upload{width:3rem;height: 3rem;border-radius:0.375rem;cursor: pointer;position: relative;overflow: hidden;}
.DetailInfo .avatar-uploader .el-upload .el-icon-plus{position: absolute;top: 50%;left: 50%;margin-top: -0.875rem;margin-left: -0.875rem;}
.DetailInfo .avatar-uploader .el-upload-list--picture-card .el-upload-list__item{width:3rem;height: 3rem;}
</style>
<template>     
  <div class="container  jfBaseSize" v-cloak v-bind:style="vh?'height:100vh':'height: 100%;'"> 
       <div class="StoreTask" style="overflow-x:auto;height:100%;margin-botton:3rem;">
            <div class="StoreName">
                 <span>上海浦江一分店</span>
            </div>
            <div class="TaskInfo">
              <div class="TaskList">
                  任务清单 
              </div>
              <div class="line"></div>
              <ul>
                <li>
                      <div class="checktask"><span class="Inspection">陈列检查</span> <span class="competestate">去完成</span> <span class="icon" @click="ShowHideDetail($event)"></span></div>
                      <div class="taskdesc">任务描述</div>
                      <div class="DetailInfo" v-show="IsShowDetail">
                        <p><span>门头照片</span></p>
                        <div class="UploadImg">
                          <el-upload
                            class="avatar-uploader"
                            :action="uploadurl"
                            list-type="picture-card"
                            :on-success="handleAvatarSuccess"
                            :before-upload="beforeAvatarUpload"
                            :on-remove="handleAvatarRemove"
                            :limit="3">
                            <i class="el-icon-plus"></i>
                          </el-upload>
                        </div>
                         <p class="info"><span>补充说明</span></p>
                         <div class="SupplyInfo">
                             <textarea placeholder="请输入补充说明"></textarea>
                         </div>
                      </div>
                </li>
                <li>
                      <div class="checktask"><span  class="Inspection">竞品上报</span> <span class="competestate">去完成</span><span class="icon"></span></div>
                      <div class="taskdesc">任务描述详情任务描述详情任务描述详情任务描述</div>
                </li>
                <li>
                      <div class="checktask"><span  class="Inspection">铺货上报</span> <span class="competestate">去完成</span><span class="icon"></span></div>
                      <div class="taskdesc">任务描述详情任务描述详情任务描述详情任务描述详情任务描述详情任务描述</div>
                </li>
                <li>
                      <div class="checktask"><span  class="Inspection">促销检查</span> <span class="competestate">已完成</span><span class="icon"></span></div>
                      <div class="taskdesc">任务描述详情任务描述详情任务描述详情任务描述详情任务描述详情任务描述</div>
                </li>
               <li>
                      <div class="checktask"><span  class="Inspection">进销存填报</span> <span class="competestate">去完成</span><span class="icon"></span></div>
                      <div class="taskdesc">任务描述详情任务描述详情任务描述详情任务描述详情任务描述详情任务描述</div>
                </li>
                <li>
                      <div class="checktask"><span  class="Inspection">拜访总结</span> <span class="competestate">去完成</span><span class="icon"></span></div>
                      <div class="taskdesc">任务描述详情任务描述详情任务描述详情任务描述详情任务描述详情任务描述</div>
                </li>
                <li style="height:3rem;"></li>
              </ul>
            </div>
       </div>

        <div class="btnContent">
          <mt-button  type="danger" size="large" @click="Save()">保存</mt-button>
        </div>
        <ReturnHome ref="returnhome"></ReturnHome>
  </div>
</template>
<script>
import { Toast } from 'mint-ui';
import channelHelper from "@/assets/js/channelHelper.js";
import { base64 } from "@/assets/js/cryptoHelper";
import { debug } from 'util';
import ReturnHome from "@/components/channel/temp001/ReturnHome";
import '@/assets/js/libs/js.cookie';
import { Indicator } from 'mint-ui';
export default {
  name: "Key_CashEnter",
  components: {ReturnHome},
  provide(){       
     return{           
        goPage:this.goPage       
     }   
  },
  props: ["comp", "cfg", "selectedPage"],
  data() {
    return {
        IsShowDetail:false
    };
  },
  methods: {
    goPage(pagetype){
        this.$parent.changeSelectedPage(pagetype);
    },
    ShowHideDetail(e){
      var that=this;
      if(!that.IsShowDetail)
      {
          that.IsShowDetail=true;
           $(e.target).addClass('arrowUp');
      }
      else{
          that.IsShowDetail=false;
          $(e.target).removeClass('arrowUp');
      }
    },
    CloseTip(){
      this.isShow.IsshowMask=false;
      this.isShow.IsshowCashOk=false;
    },
    LoadBaseCount(){
        var that=this;
        var eno=that.sup8.context.enterpriseno;
        var url = "/channel/GetMyRewardsCount";
        var dataParams = {
            UserToken:channelHelper.GetUserToken(),
            EnterpriseNo: eno,
            LanguageType:channelHelper.GetLanguageType()
        };
        var cbError=function(){Indicator.close();}
        var cbSuccess = function(res){
            Indicator.close();
            if (res.flag){
                that.BaseTotalCount=res.data;
                var MoneyCount=parseFloat(that.BaseTotalCount.MoneyCount);
                var UseMoneyCount=parseFloat(that.BaseTotalCount.UseMoneyCount);
                sessionStorage.setItem("CashOutMoney",(MoneyCount*1000-UseMoneyCount*1000)/1000);
                that.CashOutMoney=sessionStorage.getItem("CashOutMoney");
            }
      }
       //请求后端
        channelHelper.CommonCallService(url,dataParams,cbSuccess,cbError,null,null);
    },
    SureCashOut(){
        var that=this;
        var CashOutMoney=parseFloat(that.CashOutMoney);
        var InputCashMoney=$("#InputCashMoney").val();
        var regParam=/((^[1-9]\d*)|^0)(\.\d{0,2}){0,1}$/
        if(!regParam.test(InputCashMoney))
        {
           Toast('请输入正确的金额!');return false;
        }
        var OpenId="";
        var wxUserInfo=this.sup8.context.wxUser;
        if(wxUserInfo)
        {
          OpenId=wxUserInfo.openid;
        }
        Indicator.open();
        var eno=that.sup8.context.enterpriseno;
        var url = "/channel/CashExtract";
        var dataParams = {
            Amount:InputCashMoney,
            UserToken:channelHelper.GetUserToken(),
            EnterpriseNo: eno,
            LanguageType:channelHelper.GetLanguageType(),
            OpenId:OpenId
        };
        var cbError=function(){Indicator.close();}
        var cbSuccess = function(res){
            Indicator.close();
            if (res.flag){
              that.isShow.IsshowMask=true;
              that.isShow.IsshowCashOk=true;
              if(res.data&&res.data==1){
                that.$set(that.isShow,'IsshowAudit',false);
              }else{
                that.$set(that.isShow,'IsshowAudit',true);
              }
              if(that.CashOutMoney)
              {
                  var CashOutMoney=parseFloat(CashOutMoney);
                  CashOutMoney=CashOutMoney-parseFloat(InputCashMoney);
                  sessionStorage.setItem("CashOutMoney",CashOutMoney);
              }
            }else
            {
              Toast(res.msg);return false;
            }
        };
        //请求后端
        channelHelper.CommonCallService(url,dataParams,cbSuccess,cbError,null,null);
    },Save:function(){
       localStorage.setItem("ShowFlow",2);
       this.goPage("K_CheckS");
    }
  },
  watch: {
  },
  created: function() {
     Indicator.close(); 
     localStorage.setItem("ShowFlow",2);
  },
  mounted: function() {
     var that=this;
     that.LoadBaseCount();
      var isDesign = location.pathname.indexOf('design');
      if (!(isDesign>-1)) {
          that.$set(that,'vh',true);
      }else{
          that.$set(that,'vh',false);
      }
      setTimeout(()=>{
        let offsetHeight = document.body.offsetHeight;
        let scrollHeight = document.body.scrollHeight;
        this.height = scrollHeight>offsetHeight?scrollHeight+"px":offsetHeight+"px";
      },1000);
  }
};
</script>

