/**
* @Author Sean
* @Date 2019/10/22
*/
<template>
  <h-view id="reimburseDetail" class="public-style" style="height: 100%">
    <h-header :proportion="[5,1,1]" class="bar-custom">
      <div slot="left" class="h-header-btn">
        <img src="@/assets/userBind/arrow.png" @click="$routeGo()" >
        <span>退款明细</span>
      </div>
    </h-header>
    <h-content>
      <list-item :item-height="44">
        <item>
          <div slot="name">交易流水号</div>
          <div slot="content">{{ detail.order_number }}</div>
        </item>
        <item>
          <div slot="name">交易时间</div>
          <div slot="content">{{ detail.order_date }}</div>
        </item>
        <item>
          <div slot="name">收款账号</div>
          <div slot="content">{{ '暂无字段' }}</div>
        </item>
        <item>
          <div slot="name">收款账户名称</div>
          <div slot="content">{{ '暂无字段' }}</div>
        </item>
        <item>
          <div slot="name">商业伙伴</div>
          <div slot="content">{{ detail.bp_name }}</div>
        </item>
        <item>
          <div slot="name">商业伙伴类型</div>
          <div slot="content">{{ detail.bp_type_n }}</div>
        </item>
        <item>
          <div slot="name">付款账号</div>
          <div slot="content">{{ '暂无字段' }}</div>
        </item>
        <item>
          <div slot="name">付款账户名称</div>
          <div slot="content">{{ '暂无字段' }}</div>
        </item>
      </list-item>
      <div v-for="(list,index) in conList" :key="index" class="contract">
        <div>
          <div class="top">
            <img src="@/assets/reimburseMyself/q.png" >
            <span class="number">合同号</span>
            <span>{{ list.project_number }}</span>
          </div>
          <scroll ref="scroll" :updateData="[conList]" :pullUp="true" @pullingUp="getConList">
            <div v-for="(item,indexTwo) in list.con_lists" :key="indexTwo" class="bottom">
              <list-item >
                <item>
                  <div slot="name">首付款</div>
                  <div slot="content">{{ item.down_payment | currency }}</div>
                </item>
                <item>
                  <div slot="name">保证金</div>
                  <div slot="content">{{ item.deposit | currency }}</div>
                </item>
                <item>
                  <div slot="name">手续费</div>
                  <div slot="content">{{ item.lease_charge | currency }}</div>
                </item>
                <item>
                  <div slot="name">GPS费用</div>
                  <div slot="content">{{ item.gps_fee | currency }}</div>
                </item>
                <item>
                  <div slot="name">保险押金</div>
                  <div slot="content">{{ item.insurance_fee	| currency }}</div>
                </item>
              </list-item>
            </div>
          </scroll>
        </div>
      </div>
    </h-content>
  </h-view>
</template>

<script>
export default {
  data () {
    return {
      detail: {},
      conList: [],
      pagenum: 1,
    }
  },
  beforeRouteEnter (to, from, next) {
    next(vm => {
      vm.pagenum = 1
      vm.getDetail()
      vm.getConList()
    })
  },
  created: function () {},
  mounted: function () {},
  updated: function () {},
  destroyed: function () {},
  methods: {
    getDetail () {
      let vm = this
      let url = process.env.basePath + 'my_repayment_detial_query'
      let param = {
        order_id: vm.$route.params.order_id,
      }
      hlsPopup.showLoading('请稍候')
      vm.$post(url, param).then(function (res) {
        vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
          vm.detail = res.info
        } else {
          hlsPopup.showLongCenter(res.message)
        }
      })
    },
    getConList () {
      let vm = this
      let url = process.env.basePath + 'my_con_list_query'
      let param = {
        order_id: vm.$route.params.order_id,
        pagesize: 10,
        pagenum: vm.pagenum,
      }
      hlsPopup.showLoading('请稍候')
      vm.$post(url, param).then(function (res) {
        vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
          let returnData = []
          returnData = res.prj_lists
          if (returnData.length === 0) {
            vm.$refs.scroll.update(true)
          } else if (returnData.length > 0 && returnData.length < 10) {
            vum.forEach(returnData, function (data, index, array) {
              vm.conList.push(array[index])
            })
            vm.pagenum++
            vm.$refs.scroll.update(true)
          } else if (returnData.length === 10) {
            vum.forEach(returnData, function (data, index, array) {
              vm.conList.push(array[index])
            })
            vm.pagenum++
            vm.$refs.scroll.update(false)
          }
        } else {
          hlsPopup.showLongCenter(res.message)
        }
      })
    },
  },
}
</script>
<style lang="less" rel="stylesheet">
#reimburseDetail {
  .h-header-btn {
    img {
      width: 16px;
      height: 16px;
      margin-left: 4px;
    }
    span {
      font-family: PingFangSC-Semibold;
      margin-left: 16px;
      font-size: 17px;
      letter-spacing: 0.61px;
      line-height: 24px;
    }
  }
  .hls-item .contents .add-name .left-icon {
    width: 30px;
  }

  .list-wrap {
    margin: 10px;
  }

  .add-name {
    .time-font {
      font-family: PingFangSC-Regular;
      font-size: 14px;
      color: #656464;
    }
  }

  .add-content {
    .money-font {
      font-family: Verdana-Bold;
      font-size: 15px;
      color: rgba(56, 63, 69, 0.6);
      font-weight: 600;
    }

    .time-font {
      font-family: PingFangSC-Regular;
      font-size: 14px;
      color: #656464;
    }
  }
  .contract {
    width: 359px;
    background-color: #fff;
    margin: 0 auto;
    margin-top: 8px;
    .top {
      height: 43px;
      display: flex;
      align-items: center;
      display: flex;
      img {
        width: 30px;
        height: 30px;
        margin-left: 10px;
      }
      .number {
        margin-left: 10px;
        font-family: PingFangSC-Semibold;
        font-size: 14px;
        color: #4b4a4b;
        letter-spacing: 0;
        line-height: 18px;
      }
      span:last-child {
        margin-left: 116px;
        font-family: PingFangSC-Semibold;
        font-size: 14px;
        color: rgba(75, 74, 75, 0.97);
        letter-spacing: 0;
        line-height: 18px;
      }
    }
    .bottom {
      width: 300px;
      margin: 0 auto;
      display: flex;
    }
    .left {
      flex: 1;
    }
    .right {
      flex: 1;
      text-align: right;
    }
  }
}
</style>