<template>
  <div class="main">
    <!-- 物流查询 -->
    <div class="lOgisticsquery">
      <div class="customer">
        <img src="../assets/images/IntegralOrder/toux.png" alt />
        <span>{{statusTips[shopDate.orderState]}}</span>
        <p v-if="shopDate.orderState == 2">客服审核订单后，将会安排给您发送领取信息。届时请注意流程公众号消息。</p>
        <p v-if="shopDate.orderState == 5">订单已完成。如有疑问，请咨询客服。</p>
        <p v-if="shopDate.orderState == 6">订单已取消。</p>
      </div>
    </div>
    <!-- 商品信息 -->
    <div class="commodity">
      <div>
        <i>
          <img :src="shopDate.memIngProduct.pics[0].picUrl" class="img" />
        </i>
        <div>
          <h3 class="ellips2">{{shopDate.memIngProduct.ProductName}}</h3>
          <h4>{{shopDate.memIngOrdersPay.integral}}积分+￥{{shopDate.memIngOrdersPay.payPirce}}元</h4>
        </div>

        <span>x{{shopDate.amount}}</span>
      </div>
    </div>

    <!-- 物流信息 -->
    <div class="logistics-x">
      <ul>
        <li>
          订单号
          <span>{{shopDate.ordersCode}}</span>
        </li>
        <li>
          支付时间
          <span>{{shopDate.memIngOrdersPay.payTime.split('T')[0]+' '+shopDate.memIngOrdersPay.payTime.split('T')[1].split('.')[0]}}</span>
        </li>
        <li>
          买家留言
          <span class="ellips">{{shopDate.buyRemark}}</span>
        </li>
      </ul>
    </div>
    <!-- 费用总和 -->
    <div class="cost">
      <ul>
        <li>
          <div>商品费用</div>
          <div>{{shopDate.memIngOrdersPay.integral}}积分</div>
          <div>￥{{shopDate.memIngOrdersPay.payPirce}}</div>
          <!-- <h3>商品费用</h3>

          <span class="s-1">{{shopDate.memIngOrdersPay.integral}}积分</span>
          <span>￥<span>{{shopDate.memIngOrdersPay.payPirce}}</span></span>-->
        </li>
        <li>
          <div>物流费用</div>
          <div>0积分</div>
          <div>￥0</div>
        </li>
        <li>
          <div>合计</div>
          <div style="color:red">{{shopDate.memIngOrdersPay.integral*shopDate.amount}}积分</div>
          <div style="color:red">￥{{shopDate.memIngOrdersPay.payPirce*shopDate.amount}}</div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import Vue from "vue";
import { List } from "vant";
Vue.use(List);
export default {
  name: "Integralinfo",
  data() {
    return {
      active: 0,
      ordersCode: "",
      shopDate: {
        memIngOrdersPay: {
          payTime: "T"
        },
        memIngProduct: {
          pics: [
            {
              picUrl: ""
            }
          ]
        }
      },
      statusTips: {
        1: "待支付",
        2: "待审核",
        3: "待发货",
        5: "已完成",
        6: "取消订单"
      }
    };
  },
  created() {
    this.ordersCode = this.$route.query.ordersCode;
    this.getorderinfo();
  },
  methods: {
    getorderinfo() {
      var obj = {
        ordersCode: this.ordersCode
      };
      this.$http.orderinfo(obj).then(res => {
        this.shopDate = res.data.data;
        //  console.log(this.shopDate.memIngOrdersPay.payTime);
      });
    }
    // parseTime(time, cFormat) {
    //   if (arguments.length === 0) {
    //     return null;
    //   }
    //   const format = cFormat || "{y}-{m}-{d} {h}:{i}:{s}";
    //   let date;
    //   if (typeof time === "object") {
    //     date = time;
    //   } else {
    //     if (("" + time).length === 10) time = parseInt(time) * 1000;
    //     date = new Date(time);
    //   }
    //   const formatObj = {
    //     y: date.getFullYear(),
    //     m: date.getMonth() + 1,
    //     d: date.getDate(),
    //     h: date.getHours(),
    //     i: date.getMinutes(),
    //     s: date.getSeconds(),
    //     a: date.getDay()
    //   };
    //   const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
    //     let value = formatObj[key];
    //     if (key === "a")
    //       return ["一", "二", "三", "四", "五", "六", "日"][value - 1];
    //     if (result.length > 0 && value < 10) {
    //       value = "0" + value;
    //     }
    //     return value || 0;
    //   });
    //   return time_str;
    // }
  },
  mounted() {
    // document.querySelector(".main").style.minHeight =
    //   window.screen.height + "px";
  }
};
</script>

<style lang="less">
.main {
  min-height: 100vh;
  background: #f4f4f6;
  //   物流查询
  .lOgisticsquery {
    width: 6.9rem;
    height: 2.54rem;
    border-radius: 0.1rem;
    margin: 0 auto;
    top: 0.2rem;
    background: #fff;
    position: relative;
    .customer {
      width: 1.4rem;
      height: 1.8rem;
      position: absolute;
      left: 0;
      top: 0;
      right: 0;
      bottom: 0;
      margin: auto;
      text-align: center;
      img {
        width: 0.9rem;
        height: 0.9rem;
        margin: 0 auto;
        object-fit: contain;
      }
      span {
        color: #3b3b3b;
        font-size: 0.2rem;
      }
      button {
        width: 1.4rem;
        height: 0.4rem;
        border-radius: 0.2rem;
        background: #4799ff;
        font-size: 0.24rem;
        color: #fff;
        margin-top: 0.2rem;
      }
      p {
        width: 5.07rem;
        height: 0.43rem;
        text-align: center;
        position: relative;
        left: -1.8rem;
        font-size: 0.2rem;
        color: #666666;
      }
    }
  }
  //   地址信息
  .address {
    width: 6.9rem;
    height: 1.34rem;
    background: #ffffff;
    border-radius: 0.1rem;
    position: relative;
    margin: 0 auto;
    top: 0.4rem;
    p {
      height: 0.67rem;
      line-height: 0.67rem;
      padding-left: 0.19rem;
      color: #222222;
      font-size: 0.28rem;
    }
    p:nth-child(1) {
      span {
        margin-right: 0.1rem;
      }
    }
  }
  //   商品信息
  .commodity {
    width: 6.9rem;
    height: 2.2rem;
    background: #ffffff;
    border-radius: 0.2rem;
    position: relative;
    margin: 0 auto;
    top: 0.6rem;

    > div {
      width: 6.48rem;
      height: 1.6rem;
      position: absolute;
      left: 0;
      top: 0;
      right: 0;
      bottom: 0;
      margin: auto;
      display: flex;
      justify-content: space-between;
      flex-flow: row nowrap;
      > div {
        width:4rem;
        display: flex;
        flex-flow: column nowrap;
      }
      i {
        width: 1.6rem;
        height: 1.6rem;
      }
      .img {
        width: 1.6rem;
        height: 1.6rem;
        box-shadow: 0rem 0rem 0.18rem 0rem #eaeaea;
        float: left;
        // background: url(../assets/images/IntegralOrder/j-1.jpg) no-repeat center/100%;
      }
      h3 {
        color: #333333;
        font-size: 0.3rem;
        max-height: 1.2rem;
        float: left;
        width: 4rem;
        margin: 0 0.15rem;
      }
      h4 {
        float: left;
        font-size: 0.3rem;
        height: 0.8rem;
        line-height: 0.8rem;
        padding-left: 0.2rem;
        color: red;
      }
      span {
        color: #333;
        font-size: 0.28rem;
        float: right;
        margin: auto;
        width: 0.69rem;
        height: 0.42rem;
        display: inline-block;
        text-align: right;
      }
    }
  }
  //   物流信息
  .logistics {
    width: 6.9rem;
    height: 2.4rem;
    border-radius: 0.1rem;
    margin: 0 auto;
    top: 0.8rem;
    background: #fff;
    position: relative;
    li {
      padding-left: 0.2rem;
      padding-right: 0.2rem;
      height: 0.6rem;
      line-height: 0.6rem;
      font-size: 0.28rem;
      color: #222222;
      span {
        float: right;
        color: #666666;
        font-size: 0.28rem;
      }
    }
  }
  .logistics-x {
    width: 6.9rem;
    background: #ffffff;
    border-radius: 0.1rem;
    margin: 0 auto;
    top: 0.8rem;
    background: #fff;
    position: relative;
    li {
      padding-left: 0.2rem;
      padding-right: 0.2rem;
      height: 0.72rem;
      line-height: 0.72rem;
      font-size: 0.28rem;
      color: #222222;
      display: flex;
      flex-flow: row nowrap;
      justify-content: space-between;
      span {
        float: right;
        color: #666666;
        font-size: 0.28rem;
      }
    }
  }
  //   费用总和
  .cost {
    width: 6.9rem;
    height: 2.1rem;
    background: #ffffff;
    border-radius: 0.1rem;
    margin: 0 auto;
    top: 1rem;
    position: relative;
    ul {
      position: absolute;
      left: 0;
      top: 0;
      right: 0;
      bottom: 0;
      margin: auto;
      width: 6.52rem;
      li {
        height: 0.7rem;
        line-height: 0.7rem;
        display: flex;
        flex-flow: row nowrap;
        justify-content: space-between;
        width: 100%;
        > div {
          text-align: left;
        }
        > div:first-child {
          width: 55%;
        }
        > div:nth-child(2) {
          width: 22.5%;
        }
        > div:nth-child(3) {
          width: 22.5%;
          text-align: right;
        }
      }
      li:nth-child(2) {
        border-bottom: 1px solid #e0e0e0;
      }
    }
  }
}
</style>
