<template>
  <div class="auto">
    <partial-view v-ref:pv>
      <div class="row">
        <label class = "col-sm-4">客户名称:</label>
        <span class = "col-sm-8" style="text-align:left">{{model.f_user_name}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-4">客户编号:</label>
        <span class = "col-sm-8" style="text-align:left">{{data.f_userinfo_id}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-4">上期底数:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_last_tablebase}}</span>
        <label class = "col-sm-4">本期底数:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_tablebase}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-4"> 用气量:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_pregas}}</span>
        <label class = "col-sm-4">用气金额:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_preamount}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-4"> 本期剩余气量:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_surplus_gas}}</span>
        <label class = "col-sm-4" >本期扣减气量:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_haircut_gas}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-4">上期结余:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_user_balance}}</span>
        <label class = "col-sm-4" >本期结余:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_curbalance}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-4">操作人:</label>
        <span class = "col-sm-8" style="text-align:left">{{model.f_operator}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-4">操作时间:</label>
        <span class = "col-sm-8" style="text-align:left">{{data.f_operate_date}}</span>
      </div>
    </partial-view>
  </div>
</template>

<script>
export default {
  title: '自动下账详情',
  props: ['data'],
  data () {
    return {
      model: {}
    }
  },
  ready () {
    // 由于查询条目，表和‘机表收费’一样 故使用此sql
    let sql = 'machineMeterCenter'
    let condition = {
      id: this.data.id,
      f_userinfo_id: this.data.f_userinfo_id
    }
    this.$info(`加载数据中..., sql:${sql}`)
    this.$refs.pv.load('rs/logic/getOneData', {data: {sql: sql, params: condition}}).then((a) => {
      this.$info(`成功获取到数据！, data:${JSON.stringify(a.data)}`)
      this.model = a.data
    }).catch((error) => {
      if (error.status) {
        this.$warn(`加载数据出错, ${JSON.stringify(error)}`)
        return
      }
      throw error
    })
  }
}
</script>
