<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-2" style="text-align:left">{{model.f_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_collection}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-4">备注:</label>
        <span class = "col-sm-8" style="text-align:left">{{model.f_comments}}</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 () {
    let sql = 'singleTable_OrderBy'
    let param = {
      items: 'f_comments,f_last_tablebase,f_tablebase,f_userinfo_id,f_user_name,f_pregas,f_preamount,f_balance,f_curbalance,f_operator,f_collection,f_surplus_gas,f_haircut_gas',
      tablename: 't_sellinggas',
      condition: `id = ${this.data.id}`,
      orderitem: 'id'
    }
    this.$info(`加载数据中..., sql:${sql}`)
    this.$refs.pv.load('rs/logic/getOneData', {data: {sql: sql, params: param}}).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>
