<template >
  <div class="panel panel-default auto repair-info-content">
    <div class="panel-body">
      <div class="panel panel-default well" v-for="row in model">
        <div class="bg-info">
          <div class="row form-group">
            <div class="col-xs-12 col-sm-12 col-md-12">
              <div class="row">
                <div class="col-xs-6 col-sm-6 col-md-6">
                  旧表号: {{row.f_old_meternumber}}
                </div>
                <div class="col-xs-6 col-sm-6 col-md-6">
                  新表号: {{row.f_new_meternumber}}
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12">
                  旧表底数: {{row.f_new_meter_base}}
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12">
                  新表底数: {{row.f_old_meter_base}}
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12">
                  旧表品牌: {{row.f_old_meter_brand}}
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12">
                  新表品牌: {{row.f_new_meter_brand}}
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12">
                  换表补气金额: {{row.f_newtable_fillfee}}
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12">
                  换表补气气量: {{row.f_newtable_fillgas}}
                </div>

              </div>
            </div>
          </div>
        </div>
      </div>
      <p v-show="model.length == 0 ">此用户暂无换表记录</p>
    </div>
  </div>
</template>

<script>
  import { PagedList } from 'vue-client'
  import { HttpResetClass } from 'vue-client'
  import co from 'co'
  export default {
    title: '换表记录',
    data () {
      return {
        model: [],
        show: false,
        row: Object
      }
    },
    props: {
      user: {
        type: Object
      },
      f_userinfo_id:''
    },
    methods: {
      getmodel () {
        let userinfoid
        if(this.f_userinfo_id){
          userinfoid = this.f_userinfo_id
        }else{
          userinfoid = this.user.f_userinfo_id
          console.log(this.user.f_userinfo_id)
        }
        console.log(userinfoid)
        let http = new HttpResetClass()
        http.load('POST', `${this.$androidUtil.getProxyUrl()}/rs/sql/getChangeTable`, {
          data: {
            items: "*",
            tablename: "t_userfiles",
            condition: `f_userinfo_id = '${userinfoid}'`
          }
        }, {resolveMsg: null, rejectMsg: null}).then((res)=>{

          this.model=res.data
          this.show1=true
        })
      },
      back(){

      }
    },
    watch: {
      'user' (val) {
        // this.model.search(`card_id = ${this.user.card_id}`)
        if(this.user){
          if (!(this.user.isNuN)) {
            this.model= []
            this.getmodel()
          }
        }
      },
      'f_userinfo_id'(){
        if(this.f_userinfo_id){
          this.model= []
          this.getmodel()
        }
      }
    },
    ready () {
      if (this.user && this.user.f_userinfo_id) {
        // this.model.search(`card_id = ${this.user.card_id}`)
        this.getmodel()
      }
      if(this.f_userinfo_id){
        this.getmodel()
      }
    }
  }
</script>
<style>
  .app-botton {
    position:fixed;
    background: #87b2dd;
    color: #FFF;
    padding: 8px;
    text-align: center;
    font-size: 1.2em;
    z-index: 10;
    opacity:0.5;
    bottom: 50px;
    margin-top: -10px;
    height: 40px;
  }
</style>
