<style scoped>
hr {
  margin: 0;
  border: 0.17rem solid #e6e6e9;
}
.comp-scoreinfo {
  background-color: #e6e6e9;
  height: 100%;
  height: 100vh;
}
.comp-scoreinfo .scoreTitle {
  padding-left: 3%;
  background-color: #fff;
}
.comp-scoreinfo .scoreTitle span{
  font-size: 1rem;
  line-height: 3rem;
  height: 3rem;
  display: block;
  color: #d70101;
  padding-left: 2.6rem;
  background: url(http://image.supercarrier8.com/h5_shop/积分详情.png) no-repeat 0.2rem center;
  background-size: 2.2rem 2rem;
  font-weight: 600;
}
.comp-scoreinfo .scoredes-modul{
  padding: 0.2rem 3%;
  background-color: #ffffff;
}
.comp-scoreinfo .scoredesc {
  border-bottom: 0.1rem solid #e6e6e9;
  display: flex;
}
.comp-scoreinfo .scoredesc:nth-last-of-type(1){
  border-bottom-width: 0;
}
.comp-scoreinfo .leftdetail {
  flex: 0.8;
}
.comp-scoreinfo .rightdetail {
  flex: 0.2;
  line-height: 3rem;color:#c03546;
  text-align: right;
}
.nodata{width:12rem;height:12rem;background: url(https://release-sup8-images.oss-cn-shanghai.aliyuncs.com/h5_shop/empty_score.png) no-repeat center center;position: absolute;top:45%;margin-top:-6rem;left:50%;margin-left: -6rem;background-size: 12rem 12rem;}
</style>
<template>
  <div class="container comp-scoreinfo jfBaseSize" v-cloak v-bind:style="vh?'height:100vh':'height: 100%;'">
    <div class="scoreTitle">
      <span>积分详情</span>
    </div>
    <hr v-if="!nodatashow" />
    <div class="scoredes-modul">
      <div class="scoredesc" v-for="item in DataList" :key="item.Id">
        <div class="leftdetail">
          <p v-html="item.FromSourceDesc"></p>
          <p v-html="item.ROW_CREATE_DATE"></p>
        </div>
        <div class="rightdetail" v-html="item.Remark+item.ScoreNum"></div>
      </div>
    </div>
    <div class="nodata" v-show="nodatashow"></div>
  </div>
</template>
<script>
import { Toast } from "mint-ui";
import JfapiHelper from "../assets/js/JfapiHelper.js";
import { base64 } from "../assets/js/cryptoHelper";
import { debug } from "util";
import "../assets/js/libs/js.cookie";
import utils from "../assets/js/utils.js";
import { Indicator } from "mint-ui";
export default {
  name: "JfCompReg",
  props: ["comp", "cfg", "selectedPage"],
  data() {
    //检查登录状态
    var loginUserInfo = null;
    var tempLoginInfo = localStorage.getItem("loginInfo");
    if ($.trim(tempLoginInfo) != "") {
      loginUserInfo = eval("(" + tempLoginInfo + ")");
    }

    return {
      nodatashow:false,
      loginUserInfo: loginUserInfo,
      DataList:[],
      vh:false,
    };
    //return { loginUserInfo: loginUserInfo ,DataList:[]};
  },
  methods: {},
  watch: {},
  created: function() {
    var that = this;
    var url = "/integral/GetScoreRecordList";
    var dataParams = {
      EnterpriseNo: that.loginUserInfo.EnterpriseNo,
      UserToken: that.loginUserInfo.UserToken,
      LanguageType:JfapiHelper.GetLanguageType(),
      Offset: 0,
      Limit: 5
    };
     var cbBeforeSend = function(){
            Indicator.open();
      };
      var cbComplete = function(){
          Indicator.close();
      };
    var cbSuccess = function(res) {
      if (res.flag) {
        if(res.data.Rows==null)
        { 
          that.nodatashow=true;
        }else
        {
          $.each(res.data.Rows,function(m,n){
             if(n.ScoreNum){
              res.data.Rows[m].ScoreNum=parseInt(n.ScoreNum);
             }
             res.data.Rows[m]["ROW_CREATE_DATE"]=utils.formatDate("yyyy.MM.dd hh.mm.ss",res.data.Rows[m]["ROW_CREATE_DATE"]);
            //  if (res.data.Rows[m]["FromSourceDesc"]&&res.data.Rows[m]["FromSourceDesc"].length>10) {
            //    res.data.Rows[m]["FromSourceDesc"]=res.data.Rows[m]["FromSourceDesc"].substring(0,10)+'...';
            //  }
          });
          that.DataList = res.data.Rows;
        }
      }else{
        that.nodatashow=true;
      }
    };
   var cbError = function(jqXHR, textStatus, errorThrown){
            Toast(jqXHR.responseText);
        };
    JfapiHelper.CommonCallService(
      url,
      dataParams,
      cbSuccess,
      cbError,
      cbBeforeSend,
      cbComplete
    );
  },
  mounted: function() {
    var that=this;
    var isDesign = location.pathname.indexOf('design');
    if (!(isDesign>-1)) {
        that.$set(that,'vh',true);
    }else{
        that.$set(that,'vh',false);
    }
  }
};
</script>

