<template>
  <div class="myOrderDivC" v-if="show">
    <basicPop :pop="pop" @closeClick="closeClick">
      <div class="orderListDivAll">
        <div class="itemTitleDiv">
          <div class="titelDiv">订单编号</div>
          <div class="titelDiv1">订单状态</div>
          <div class="titelDiv1" style="flex: 0.8;">订单金额</div>
          <div class="titelDiv">订单完成时间</div>
        </div>
        <div class="orderItemDivAll" v-if="orderList.length > 0">
          <div class="orderItemDiv" v-for="(item, index) in orderList" :key="index">
            <div class="itemDiv1 reser-itemDiv-item parentOrderCell">
              <div>{{item.orderId}}
                <span v-if="item.refundStatus == 1" class="refundText">(已退款)</span>
              </div>
              <div class="refundText" v-if="item.isConform == 0">订单金额不符合</div>
            </div>
            <div class="itemDiv2 reser-itemDiv-item parentOrderCell">
              <span class="orderStatusText">{{item.status}}</span>
              <!-- <span v-if="item.orderStatus == '进行中'" style="color: #23a771;">{{item.orderStatus}}</span> -->
            </div>
            <div class="itemDiv2 reser-itemDiv-item parentOrderCell orderPriceCell">
              <div v-if="item.priceType=='0'">京东价：￥{{item.orderPrice}}</div>
              <div v-if="item.priceType=='1'">实付价：￥{{item.orderPrice}}</div> 
            </div>
            <div class="itemDiv1 reser-itemDiv-item parentOrderCell">{{item.orderEndTime | filterDate}}</div>
            <div class="sonBox" v-if="item.leafNodeOrderList && item.leafNodeOrderList.length > 0">
              <div class="sonHeader">
                <div class="sonHeaderCell">子订单号</div>
                <div class="sonHeaderCell">子订单状态</div>
                <div class="sonHeaderCell">子订单金额</div>
              </div>
              <div class="sonRow" v-for="(sonItem, sonIndex) in item.leafNodeOrderList" :key="sonIndex">
                <div class="sonCell">{{ sonItem.orderId }}
                  <span v-if="sonItem.refundStatus == 1" class="refundText">(已退款)</span>
                </div>
                <div class="sonCell">{{ sonItem.status }}</div>
                <div class="sonCell">{{ sonItem.orderPrice }}</div>
              </div>
            </div>
          </div>
        </div>
        <div class="orderItemDivAll" v-else>
          <div class="a">
            暂无订单记录哦~
          </div>
        </div>

      </div>
    </basicPop>
  </div>
</template>

<script>
import basicPop from './hdzxtbasicPop.vue';
import apis from '../../../util/apis1.js';
let { breakThroughOrdList } = apis;
export default {
  props: [],
  components: {
    basicPop
  },
  data() {
    return {
      pop: {
        title: '我的订单',
        titlepop: ''
      },
      orderList: []
    };
  },
  created() {
    console.log(this.styleDataNew, 'this.styleDataNew');
    this.pop.titlepop = this.styleDataNew.titlepop
      ? this.styleDataNew.titlepop
      : { backgroundImage: 'url(//img10.360buyimg.com/imgzone/jfs/t1/141588/29/18217/44025/5fd571b9Ef55329ec/42dba91b188b9dce.png)' };
    this.pop.leftLineDiv = this.styleDataNew.leftLineDiv;
    this.pop.rightLineDiv = this.styleDataNew.rightLineDiv;

    this.initData();
  },
  methods: {
    initData() {
      breakThroughOrdList(responseData => {
        // console.log(responseData, 'responseData');
        this.orderList = responseData.data;
        this.$forceUpdate();
      });
    },
    closeClick() {
      this.submit();
    }
  }
};
</script>

<style lang="scss">
.myOrderDivC {
  .orderListDivAll {
    .itemTitleDiv {
      display: flex;
      color: #303030;
      font-size: 0.22rem;
      justify-content: center;
      align-items: center;
      margin-top: 0.54rem;
      .titelDiv {
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
      }
      .titelDiv1{
        flex: 0.5;
        display: flex;
        justify-content: center;
        align-items: center;
      }
    }
    .orderItemDivAll {
      height: 5.3rem;
      overflow-y: scroll;
      margin-top: 0.42rem;
      padding: 0 0.18rem 0.2rem;
      box-sizing: border-box;
      background: #f5f5f5;
      .orderItemDiv {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        margin-bottom: 0.16rem;
        background: #fff;
        border-radius: 0.08rem;
        overflow: hidden;
        .sonBox{
          width: 100%;
          padding: 0 0.24rem 0.12rem;
          box-sizing: border-box;
          font-size: 0.16rem;
        }
        .sonHeader {
          display: flex;
          align-items: center;
          min-height: 0.48rem;
          color: #666;
          font-size: 0.18rem;
          border-bottom: 1px solid #d9d9d9;
        }
        .sonHeaderCell,
        .sonCell {
          flex: 1;
          text-align: center;
        }
        .sonRow {
          display: flex;
          align-items: center;
          min-height: 0.56rem;
          color: #666;
          border-bottom: 1px dashed #d9d9d9;
        }
        .sonRow:last-child {
          border-bottom: none;
        }
        .itemDiv1 {
          color: #000000;
          font-size: 0.18rem;
          flex: 1;
          display: flex;
          justify-content: center;
        }
        .itemDiv2 {
          color: #000000;
          font-size: 0.2rem;
          flex: 0.5;
          display: flex;
          justify-content: center;
        }
        .parentOrderCell {
          border-bottom: 1px solid #e5e5e5;
        }
        .orderPriceCell {
          flex: 0.8;
        }
      }
    }
  }
  .a{
        height: 100%;
    font-size: 0.24rem;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    color: #8c8c8c;
  }
}
.reser-itemDiv-item{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 0.8rem;
}
.refundText{
  color: #ff4d4f;
}
.orderStatusText{
  color: #666;
}
</style>
