<template>
  <div class="auto">
    <partial-view v-ref:pv>
      <div class="row">
        <label class = "col-sm-3 control-label">用户姓名:</label>
        <span class = "col-sm-3">{{model.f_user_name}}</span>
        <label class="col-sm-3">卡&nbsp;&nbsp;号:</label>
        <span class = "col-sm-3">{{model.f_card_id ? model.f_card_id : '暂无'}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-3 control-label">气量:</label>
        <span class = "col-sm-3">{{model.f_pregas}}</span>
        <label class="col-sm-3">金额:</label>
        <span class = "col-sm-3">{{model.f_preamount}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-3 control-label"> 操作:</label>
        <span class = "col-sm-3">{{data.type}}</span>
        <label class="col-sm-3" v-if="data.type==='物联网赠气'||data.type==='卡表赠气'">气量:</label>
        <span class = "col-sm-3" v-if="data.type==='物联网赠气'||data.type==='卡表赠气'">{{model.f_pregas}}</span>
        <label class="col-sm-3" v-if="data.type==='物联网赠费'||data.type==='卡表赠费'">金额:</label>
        <span class = "col-sm-3" v-if="data.type==='物联网赠费'||data.type==='卡表赠费'">{{model.f_preamount}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-3 control-label">备注:</label>
        <span class = "col-sm-9">{{model.f_comments}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-3 control-label">操作人:</label>
        <span class = "col-sm-3">{{model.f_operator}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-3 control-label">操作时间:</label>
        <span class = "col-sm-9">{{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 params = {
      items: 'id, f_user_name , f_card_id, f_pregas, f_type ,f_preamount, f_comments, f_operator',
      tablename: 't_fillgas',
      condition: 'id = ' + this.data.id,
      orderitem: 'id'
    }
    this.$info(`加载数据中..., sql:${sql}`)
    this.$refs.pv.load('rs/logic/getOneData', {data: {sql: sql, params: params}}).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>
