<!--
  @description: 账单明细-订单详情 弹框
  @Modifier：dijia
  @routerPath:
  @date：2022-1-4
-->
<template>
  <div>
    <el-dialog
      :visible.sync="data.dialog"
      title="订单详情"
      modal-append-to-body
      append-to-body
      width="920px"
      custom-class="shop_mall_dialog"
    >
      <div v-if="allOrderList.length" style="height:100%;">
        <h4 style="margin-bottom:10px;" class="pd15">
          订单信息
        </h4>
        <div class="receiverInfo">
          <div>
            <span>供应商：</span>
            <div :title="allOrderList[0].supplierDepartName">
              {{ allOrderList[0].supplierDepartName }}
            </div>
          </div>
          <div>
            <span>采购人：</span>
            <div :title="allOrderList[0].receiverName">
              {{ allOrderList[0].receiverName }}
            </div>
          </div>
          <div>
            <span>采购部门：</span>
            <div :title="allOrderList[0].buyerDepartName">
              {{ allOrderList[0].buyerDepartName }}
            </div>
          </div>
        </div>
        <h4 class="card-title pd15">
          发票信息
        </h4>
        <div class="receiverInfo flex_wrap">
          <div>
            <span>发票类型：</span>
            <div :title="allOrderList[0].invoiceType === '00' ? '普通类型发票' : '增值税专用票'">
              {{ allOrderList[0].invoiceType === '00' ? '普通类型发票' : '增值税专用票' }}
            </div>
          </div>
          <div>
            <span>发票抬头：</span>
            <div :title="allOrderList[0].invoiceTitle">
              {{ allOrderList[0].invoiceTitle }}
            </div>
          </div>
          <div>
            <span>纳税识别号：</span>
            <div :title="allOrderList[0].taxpayerIdentificationNumber">
              {{ allOrderList[0].taxpayerIdentificationNumber }}
            </div>
          </div>
        </div>
        <div class="receiverInfo flex_wrap">
          <div v-if="allOrderList[0].invoiceType === '01'">
            <span>开户银行：</span>
            <div :title="allOrderList[0].bankname">
              {{ allOrderList[0].bankname }}
            </div>
          </div>
          <div v-if="allOrderList[0].invoiceType === '01'">
            <span>注册电话：</span>
            <div :title="allOrderList[0].taxpayertel">
              {{ allOrderList[0].taxpayertel }}
            </div>
          </div>
          <div v-if="allOrderList[0].invoiceType === '01'">
            <span>银行账号：</span>
            <div :title="allOrderList[0].bankaccount">
              {{ allOrderList[0].bankaccount }}
            </div>
          </div>
        </div>
        <div class="receiverInfo flex_wrap">
          <div v-if="allOrderList[0].invoiceType === '01'">
            <span>注册地址：</span>
            <div :title="allOrderList[0].taxpayeraddr">
              {{ allOrderList[0].taxpayeraddr }}
            </div>
          </div>
        </div>
        <h4 class="pd15">
          商品列表
        </h4>
        <div class="scrollbar">
          <el-scrollbar style="height:100%">
            <div
              v-for="(item, index) in allOrderList"
              :key="index"
              class="all-order"
            >
              <div class="item-title">
                <span>{{ item.createTime }}</span>
                <span>订单号: {{ item.orderNo }}</span>
                <span>
                  店铺:
                  <span class="goodsDepartCon">
                    {{
                      item.goodsDepartName
                    }}
                  </span>
                </span>
              </div>
              <div class="item">
                <div class="item-left">
                  <div class="item_box">
                    <div v-for="(val,i) in item.orderProductList" :key="i" class="shop-item">
                      <div style="cursor: pointer;" @click="goToDetail(val)">
                        <img :src="val.productPicture" alt width="75px" height="75px">
                      </div>
                      <div class="goodsName" @click="goToDetail(val)">
                        {{ val.goodsName }}
                      </div>
                      <div class="goodsPrice">
                        <span>￥{{ val.commodityPrice }}</span>
                      </div>
                      <div class="goodsNumber">
                        <span>x{{ val.number }}</span>
                        <!-- 新增退货 退货金额 -->
                        <div class="returnGoods">
                          <span v-if="val.returnType!=''&&val.returnType!=null" style="margin-right:5px;">
                            <b v-if="val.returnType === '010'">已换货</b>
                            <b v-if="val.returnType === '020'">已退货</b>
                          </span>
                          <span v-if="val.returnTotalPrice!=''&&val.returnTotalPrice!=null">
                            金额:{{ val.returnTotalPrice.toFixed(2) }}
                          </span>
                        </div>
                      </div>
                      <!-- 状态有值展示 -->
                      <div v-if="val.afterStatus" class="goodsStatus">
                        <span>{{ val.afterStatus }}</span>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="item-right">
                  <div class="total-count">
                    <div
                      :style="{height:item.orderProductList.length * 117+'px'}"
                      style="color: #666666;"
                      class="nd_in"
                    >
                      总额:
                      <span class="count">￥ {{ item.orderAmount }}</span>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </el-scrollbar>
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { reconciliationOfOrderDetails } from '@/api/shoppingmall/order'
export default {
  name: 'InvoiceAdd',
  props: {
    data: {
      type: Object,
      default: function() {
        return
      }
    }
  },
  data() {
    return {
      allOrderList: [],
      datas: {},
      status: ''
    }
  },
  watch: {
    data(val) {
      this.initdata(val)
    }
  },
  created() {
  },
  mounted() {
  },
  methods: {
    goToDetail(val) {
      this.$router.push({
        path: '/shop/goodsClassDetail',
        query: { id: val.goodsId }
      })
      // window.open(routes.href, '_blank')
    },
    initdata(val) {
      if (val.status) {
        this.status = val.status
      } else {
        this.status = ''
      }
      reconciliationOfOrderDetails(val.id, this.status).then(res => {
        this.allOrderList = res.data
      })
    }
  }
}

</script>

<style scoped lang="less">
.goodsPrice {
  width: 100px;
}
.pd15 {
  padding-left: 15px;
}
.card-title {
  margin: 10px 0;
}
.receiverInfo {
  padding: 0 30px;
  display: flex;
  >div {
    flex: 1;
    display: flex;
    >span {
      min-width: 30px;
      padding: 0 0 0 5px;
    }
    >div {
      cursor: pointer;
      flex: 1;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }
}
.flex_wrap {
  flex-wrap: wrap;
  >div {
    width: 33.33%;
    margin: 0 0 15px 0;
    >span {
      min-width: 75px;
      padding: 0 0 0 5px;
    }
  }
}
 .fr{
  margin-bottom: 20px;
}
.el-scrollbar__wrap {
  overflow: hidden;
}
.ss {
  font-size: 12px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: #999999;
  line-height: 24px;
}
.st {
  font-size: 12px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: #ff6600;
  line-height: 24px;
}
.sk {
  font-size: 12px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: #333333;
  line-height: 24px;
}
.item-title {
  width: 100%;
  background-color: #fafafa;
  height: 40px;
  line-height: 40px;
  font-size: 12px;

  .icon-shanchu {
    float: right;
    margin-right: 20px;
    width: 12px;
    height: 15px;
  }
  .icon-shanchu:hover {
    color: #ff6600;
  }

  span {
    display: inline-block;

    &:nth-child(1) {
      margin-left: 10px;
    }

    &:nth-child(2) {
      margin-left: 20px;
      margin-right: 30px;
    }
  }
}

.item {
  display: flex;
  margin-bottom: 15px;
  height: 100%;
  font: 12px/150% tahoma,arial,Microsoft YaHei,Hiragino Sans GB,"\u5b8b\u4f53",sans-serif;
  .item-left {
    width: 85%;
    // border-top: 1px solid #eeeeee;
    // border-bottom: 1px solid #eeeeee;
    // border-right: 1px solid #eeeeee;
    // border-left: 1px solid #eeeeee;
    .shop-item {
      display: flex;
      flex-direction: row;
      justify-content: flex-start;
      align-items: center;
      height: 119px;
      border-bottom: 1px solid #eeeeee;
      border-top: none;
      border-right: 1px solid #eeeeee;
      border-left: 1px solid #eeeeee;
      &:nth-of-type(1) {
        border-top: 1px solid #eeeeee;
      }
      div {
        &:nth-child(1) {
          margin-left: 10px;
        }

        &:nth-child(2) {
          margin-left: 20px;
          margin-right: 15px;
        }

        &:nth-child(4) {
          margin-left: 15px;
          color: #1f94f4;
        }
      }
    }

    .goodsName {
      width: 60%;
      color: #333333;
      font-family: "MicrosoftYaHei";
      cursor: pointer;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .goodsName:hover {
      color: #00aaca;
      font-family: "MicrosoftYaHei";
    }
    .goodsStatus{
      color: red;
    }
  }

  .item-right {
    width: 15%;
    height: 100%;
    border-right: 1px solid #eeeeee;
    // border-bottom: 1px solid #eeeeee;
    border-top: 1px solid #eeeeee;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    .total-count {
      text-align: center;
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
      align-items: center;
      border-bottom: 1px solid #eeeeee;
      /*margin-top: 20px;*/
      // padding-top: 10px;
      /*margin-left: 50px;*/
      border-right: 1px solid #eeeeee;
      width: 100%;
      .count {
        color: #ff6600;
        text-align: center;
        display: inline-block;
        line-height: 30px;
        margin-left: 5px;
      }
      .nd_in {
        display: flex;
        justify-content: center;
        align-items: center;
        &:nth-of-type(1) {
          border-top: none;
        }
        border-top: 1px solid #eeeeee;
        width: 100%;
      }
    }

    .sleep-fk {
      // width: 50%;
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
      align-items: center;
      padding-top: 10px;
      border-bottom: 1px solid #eeeeee;
      border-right: 1px solid #eeeeee;
      .order-detail {
        font-size: 12px;
        font-family: Microsoft YaHei;
        font-weight: 400;
        color: rgba(51, 51, 51, 1);
        line-height: 24px;
        color: #333333;
      }
    }

    .assess {
      // margin-left: 10px;
      background: #f2f2f2;
      border: 1px solid #e0e0e0;
      font-size: 12px;
      font-family: Microsoft YaHei;
      background: #f2f2f2;
      color: #333333;
      line-height: 26px;
      text-align: center;
      // margin-right: 20px;
      // margin-top: 20px;
      width: 67px;
      height: 26px;
      display: inline-block;
      cursor: pointer;
    }

    // .repay {
    //   color: #ff6600;
    //   border: 1px solid #ff6600;
    //   height: 26px;
    //   line-height: 26px;
    //   width: 67px;
    //   text-align: center;
    //   margin-right: 20px;
    //   margin-top: 20px;
    //   cursor: pointer;
    // }

    .dd {
      background: rgba(255, 255, 255, 1);
      border: 1px solid rgba(238, 238, 238, 1);
      line-height: 24px;
      font-size: 12px;
      padding: 5px 10px;
      margin-right: 20px;
      margin-top: 20px;
      color: #ff6600;
      border: 1px solid #ff6600;
      background: rgba(255, 255, 255, 1);
      box-sizing: border-box;
    }
  }
}
.item_title_top {
  width: 100%;
  background-color: #fafafa;
  height: 40px;
  line-height: 40px;
  font-size: 12px;
  border-left: 1px solid #eeeeee;
  border-right: 1px solid #eeeeee;
  border-top: none;
  &:nth-of-type(1) {
    border-top: 1px solid #eeeeee;
  }
  >span {
      margin-left: 15px;
      margin-right: 15px;
    &:nth-of-type(1) {
      margin-left: 10px;
    }
  }
}
// .next_box {
//   width: 100%;
// }
#no-order {
  width: 30%;
  display: flex;
  margin: 168px auto;
  p {
    text-indent: 35px;
    color: #333333;
    font-size: 16px;
    margin-top: 10px;
    &:nth-last-of-type(1) {
      font-size: 12px;
      width: 104px;
      height: 26px;
      text-indent: 0;
      text-align: center;
      background: rgba(255, 255, 255, 1);
      border: 1px solid rgba(224, 224, 224, 1);
      color: rgba(102, 102, 102, 1);
      line-height: 24px;
      margin-top: 35px;
      margin-left: 34px;
      cursor: pointer;
    }
  }
}
.goodsNumber{
  width: 100px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}
.item .item-left {
    .returnGoods{
      margin: 0!important;
      position: absolute;
      top: 30px;
      width: 200px;
      left: -60px;
      span{
        color:red;
        b{
          font-weight: normal;
        }
      }
    }
  }
.goodsDepartCon {
    display: inline-block;
    background-color: #f59a23;
    margin-left: 10px;
    border-radius: 4px;
    border-width: 0px;
    color: #FFFFFF;
    padding: 1px 5px;
    line-height: 20px;
}
.scrollbar {
  padding: 0 15px;
  max-height: 50vh;
  overflow: auto;
}
/deep/.el-scrollbar__wrap {
  overflow-x: hidden;
}
</style>
