<template>
  <!-- 冲正记录 -->
    <criteria-paged :model="model" v-ref:cp>
      <criteria partial='criteria' @condition-changed='$parent.searchCondition' v-ref:cri>
        <div class="form-horizontal select-overspread container-fluid auto" partial>
          <div class="row">
            <div class="form-group col-sm-3">
              <label class="font_normal_body"><strong>报建编号：</strong></label>
              <input type="text" class="input_search" style="width: 60%" v-model="model.f_apply_num"
                     v-on:keyup.enter="$parent.$parent.search()" condition="a.f_apply_num like '%{}%'" placeholder='报建编号'>
            </div>
            <div class="form-group col-sm-3">
              <label class="font_normal_body"><strong>用户名称：</strong></label>
              <input type="text" class="input_search" style="width: 60%" v-model="model.f_user_name"
                     v-on:keyup.enter="$parent.$parent.search()" condition="a.f_user_name like '%{}%'" placeholder='用户名称'>
            </div>
            <div class="form-group col-sm-3">
              <label class="font_normal_body"><strong>电&emsp;&emsp;话：</strong></label>
              <input type="text" class="input_search" style="width: 60%" v-model="model.f_phone"
                     v-on:keyup.enter="$parent.$parent.search()" condition="a.f_phone like '%{}%'" placeholder='电话'>
            </div>
            <div class="form-group col-sm-3 button-range">
              <button class="button_search button_spacing" @click="$parent.$parent.search()" v-el:cx>查询</button>
              <button class="button_clear button_spacing"  @click="$parent.$parent.clear()">清空</button>
              <export-excel :data="$parent.$parent.getCondition"
                            :field="$parent.$parent.getfield"
                            sqlurl="rs/logic/applyExportfile"
                            sql-name="getApplyChongZheng"
                            template-name='冲正记录信息导出'
                            :choose-col="true"></export-excel>
              <div
                :class="{'button_shrink_top':$parent.$parent.criteriaShow,'button_shrink_bottom':!$parent.$parent.criteriaShow}"
                @click="$parent.$parent.criteriaShow = !$parent.$parent.criteriaShow"
                class="button_spacing"
                style="float: right">
              </div>
            </div>
          </div>
          <div class="row" v-show="$parent.$parent.criteriaShow">
            <div class="form-group col-sm-3">
              <label class="font_normal_body"><strong>报建类型：</strong></label>
              <v-select
                v-model="model.f_apply_type"
                placeholder='请选择'
                condition="a.f_apply_type = '{}'"
                :value.sync="model.f_apply_type"
                :options='$parent.$parent.applytype'
                class="select select_list"
                :value-single="true"
                close-on-select ></v-select>
            </div>
            <div class="form-group col-sm-3">
              <label class="font_normal_body"><strong>收费人员：</strong></label>
              <input type="text" class="input_search" style="width: 60%" placeholder='收费人员' v-model="model.f_charge_collectors"
                     v-on:keyup.enter="$parent.$parent.search()"
                     condition="cr.f_charge_collectors like '%{}%'">
            </div>
            <div class="form-group col-sm-3">
              <label class="font_normal_body"><strong>付款方式：</strong></label>
              <v-select
                v-model="model.f_payment_method"
                placeholder='请选择'
                condition="cr.f_payment_method = '{}'"
                :value.sync="model.f_payment_method"
                :options='$parent.$parent.paymentMethod'
                class="select select_list"
                :value-single="true"
                close-on-select ></v-select>
            </div>
            <div class="form-group col-sm-3">
              <label class="font_normal_body"><strong>缴费状态：</strong></label>
              <v-select
                v-model="model.f_charge_status"
                placeholder='请选择'
                condition="cr.f_charge_status = '{}'"
                :value.sync="model.f_charge_status"
                :options='$parent.$parent.chargingStatus'
                class="select select_list"
                :value-single="true"
                close-on-select ></v-select>
            </div>
            <div class="form-group col-sm-3">
              <label  for="startDate" class="font_normal_body"><strong>开始时间：</strong></label>
              <datepicker id="startDate" placeholder="开始日期"
                          style="width: 60%!important;"
                          v-model="model.startDate"
                          :value.sync="model.startDate"
                          :format="'yyyy-MM-dd 00:00:00'"
                          :show-reset-button="true"
                          condition="cr.f_charge_date >= '{}'">
              </datepicker>
            </div>
            <div class="form-group col-sm-3">
              <label for="endDate" class="font_normal_body"><strong>结束时间：</strong></label>
              <datepicker id="endDate" placeholder="结束日期"
                          style="width: 60%!important;"
                          v-model="model.endDate"
                          :value.sync="model.endDate"
                          :format="'yyyy-MM-dd 23:59:59'"
                          :show-reset-button="true"
                          condition="cr.f_charge_date <= '{}'">
              </datepicker>
            </div>
          </div>
        </div>
      </criteria>
      <data-grid :model="model" partial='list' v-ref:grid style="overflow: auto" class="list_area table_sy">
        <template partial='head'>
          <tr>
            <th style="white-space: nowrap;">序号</th>
            <th style="white-space: nowrap;">报建编号</th>
            <th style="white-space: nowrap;">用户名称</th>
            <th style="white-space: nowrap;">电话</th>
            <th style="white-space: nowrap;">合同编号</th>
            <th style="white-space: nowrap;">报建类型</th>
            <th style="white-space: nowrap;">报建性质</th>
            <th style="white-space: nowrap;">收费金额</th>
            <th style="white-space: nowrap;">户数</th>
            <th style="white-space: nowrap;">付款方式</th>
            <th style="white-space: nowrap;">收费人员</th>
            <th style="white-space: nowrap;">收费日期</th>
            <th style="white-space: nowrap;">缴费状态</th>
            <th style="white-space: nowrap;">作废人员</th>
            <th style="white-space: nowrap;">作废时间</th>
            <th style="white-space: nowrap;">冲正原因</th>
            <th style="white-space: nowrap;">票据类型</th>
            <th style="white-space: nowrap;">发票代码</th>
            <th style="white-space: nowrap;">发票号码</th>
            <th style="white-space: nowrap;">票据状态</th>
          </tr>
        </template>
        <template partial='body'>
          <tr >
            <td style="text-align: center;">
              <nobr><font>{{$index+1}}</font></nobr>
            </td>
            <td  @click="$parent.$parent.$parent.showModel(row)" style="text-align: center;">
              <nobr><font>{{row.f_apply_num}}</font></nobr>
            </td>
            <td  @click="$parent.$parent.$parent.showModel(row)" style="text-align: center;">
              <nobr><font>{{row.f_user_name}}</font></nobr>
            </td>
            <td  @click="$parent.$parent.$parent.showModel(row)" style="text-align: center;">
              <nobr><font>{{row.f_phone}}</font></nobr>
            </td>
            <td  @click="$parent.$parent.$parent.showModel(row)" style="text-align: center;">
              <nobr><font>{{row.f_contract_number}}</font></nobr>
            </td>
            <td  @click="$parent.$parent.$parent.showModel(row)" style="text-align: center;">
              <nobr><font>{{row.f_apply_type}}</font></nobr>
            </td>
            <td  @click="$parent.$parent.$parent.showModel(row)" style="text-align: center;">
              <nobr><font>{{row.f_apply_nature}}</font></nobr>
            </td>
            <td  @click="$parent.$parent.$parent.showModel(row)" style="text-align: center;">
              <nobr><font>{{row.f_charge_money}}</font></nobr>
            </td>
            <td  @click="$parent.$parent.$parent.showModel(row)" style="text-align: center;">
              <nobr><font>{{row.f_feecount}}</font></nobr>
            </td>
            <td  @click="$parent.$parent.$parent.showModel(row)" style="text-align: center;">
              <nobr><font>{{row.f_payment_method}}</font></nobr>
            </td>
            <td  @click="$parent.$parent.$parent.showModel(row)" style="text-align: center;">
              <nobr><font>{{row.f_charge_collectors}}</font></nobr>
            </td>
            <td  @click="$parent.$parent.$parent.showModel(row)" style="text-align: center;">
              <nobr><font>{{row.f_charge_date}}</font></nobr>
            </td>
            <td  @click="$parent.$parent.$parent.showModel(row)" style="text-align: center;">
              <nobr><font>{{row.f_charge_status}}</font></nobr>
            </td>
            <td  @click="$parent.$parent.$parent.showModel(row)" style="text-align: center;">
              <nobr><font>{{row.f_void_staff}}</font></nobr>
            </td>
            <td  @click="$parent.$parent.$parent.showModel(row)" style="text-align: center;">
              <nobr><font>{{row.f_void_date}}</font></nobr>
            </td>
            <td  @click="$parent.$parent.$parent.showModel(row)" style="text-align: center;">
              <nobr><font>{{row.f_void_remarks}}</font></nobr>
            </td>
            <td  @click="$parent.$parent.$parent.showModel(row)" style="text-align: center;">
              <nobr><font>{{row.f_bill_style}}</font></nobr>
            </td>
            <td  @click="$parent.$parent.$parent.showModel(row)" style="text-align: center;">
              <nobr><font>{{row.f_bill_code}}</font></nobr>
            </td>
            <td  @click="$parent.$parent.$parent.showModel(row)" style="text-align: center;">
              <nobr><font>{{row.f_bill_number}}</font></nobr>
            </td>
            <td  @click="$parent.$parent.$parent.showModel(row)" style="text-align: center;">
              <nobr><font>{{row.f_bill_state}}</font></nobr>
            </td>
          </tr>
        </template>
      </data-grid>
    </criteria-paged>
  <modal v-if="showChongZheng" :show.sync="showChongZheng" v-ref:modal :large="true" :backdrop="false" style="overflow:auto">
    <header slot="modal-header" class="modal-header">
      <button type="button" class="close" @click="showChongZheng = !showChongZheng"><span>&times;</span></button>
      <h4 class="modal-title">冲正信息</h4>
    </header>
    <article slot="modal-body" class="modal-body clearfix">
      <div class="form-group col-sm-5">
        <label class="col-sm-4 control-label">收费金额:</label>
        <div class="col-sm-8">
          <input type="text"
                 class="form-control input_view"
                 style="width: 100%"
                 readonly
                 v-model="charge.f_charge_money" />
        </div>
      </div>
      <div class="form-group col-sm-5">
        <label class="col-sm-4 control-label">金额大写:</label>
        <div class="col-sm-8">
          <input type="text"
                 class="form-control input_view"
                 style="width: 100%"
                 readonly
                 v-model="charge.f_amount_words" />
        </div>
      </div>
      <div class="form-group col-sm-5">
        <label class="col-sm-4 control-label">付款方式:</label>
        <div class="col-sm-8">
          <input type="text"
                 class="form-control input_view"
                 style="width: 100%"
                 readonly
                 v-model="charge.f_payment_method" />
        </div>
      </div>
      <div class="form-group col-sm-5">
        <label class="col-sm-4 control-label">收费人员:</label>
        <div class="col-sm-8">
          <input type="text"
                 class="form-control input_view"
                 style="width: 100%"
                 readonly
                 v-model="charge.f_charge_collectors" />
        </div>
      </div>
      <div class="form-group  col-sm-5">
        <label class=" col-sm-4 control-label">发票代码:</label>
        <div class="col-sm-8">
          <input type="text"
                 class="form-control input_view"
                 style="width: 100%"
                 readonly
                 v-model="charge.f_bill_code" />
        </div>
      </div>
      <div class="form-group  col-sm-5">
        <label class=" col-sm-4 control-label">发票号码:</label>
        <div class="col-sm-8">
          <input type="text"
                 class="form-control input_view"
                 style="width: 100%"
                 readonly
                 v-model="charge.f_bill_number" />
        </div>
      </div>
      <div class="form-group  col-sm-5">
        <label class=" col-sm-4 control-label">购方单位名称:</label>
        <div class="col-sm-8">
          <input type="text"
                 class="form-control input_view"
                 style="width: 100%"
                 readonly
                 v-model="charge.f_paper_name" />
        </div>
      </div>
      <div class="form-group  col-sm-5">
        <label class=" col-sm-4 control-label">作废人员:</label>
        <div class="col-sm-8">
          <input type="text"
                 class="form-control input_view"
                 style="width: 100%"
                 readonly
                 v-model="charge.f_void_staff" />
        </div>
      </div>
      <div class="form-group  col-sm-5">
        <label class=" col-sm-4 control-label">作废日期:</label>
        <div class="col-sm-8">
          <input type="text"
                 class="form-control input_view"
                 style="width: 100%"
                 readonly
                 v-model="charge.f_void_date" />
        </div>
      </div>


      <div class="form-group col-sm-10">
        <label class="col-sm-2 control-label">作废原因:</label>
        <div class="col-sm-10">
          <input type="text"
                 class="form-control input_view"
                 style="width: 100%"
                 readonly
                 v-model="charge.f_void_remarks" />
        </div>
      </div>
      <apply-upload :blodid="charge.f_process_id"
                    :isupload = "false"
                    :isdelete="false"
                    :isusetype="true"
                    :isremark = "true"
                    :takeimg="false"
                    :issearch="false"
                    defname='冲正'>
      </apply-upload>
    </article>
    <footer slot="modal-footer" class="modal-footer">
    </footer>
  </modal>
</template>

<script>
import {PagedList} from 'vue-client'
import {HttpResetClass} from 'vue-client'
import {isEmpty} from '../../Util'
import Vue from "vue";
export default {
  title: '报建收费列表',
  data () {
    return {
      model: new PagedList('rs/sql/getApplyChongZheng', 30, null, {
        f_charge_money: 0
      }),
      applytype: [{label: '全部', value: ''}, ...this.$appdata.getParam('报建类型')?this.$appdata.getParam('报建类型'):[]],
      paymentMethod: [{label: '全部', value: ''}, ...this.$appdata.getParam('付款方式')?this.$appdata.getParam('付款方式'):[]],
      chargingStatus: [
        {label: '全部', value: ''},
        {label: '有效', value: '有效'}
      ],
      criteriaShow: false,
      showStatus: true,
      getfield: {
        'f_apply_num': '报建编号',
        'f_user_name': '用户名称',
        'f_phone': '电话',
        'f_contract_number': '合同编号',
        'f_apply_type': '报建类型',
        'f_apply_nature': '报建性质',
        'f_charge_money': '收费金额',
        'f_feecount': '收费户数',
        'f_payment_method': '付款方式',
        'f_charge_collectors': '收费人员',
        'f_charge_date': '收费日期',
        'f_charge_status': '缴费状态',
        'f_bill_style': '票据类型',
        'f_bill_code': '发票代码',
        'f_bill_number': '发票号码',
        'f_bill_state': '票据状态',
        'f_address': '地址',
        'f_void_remarks': '冲正原因'
      },
      charge: null,
      showPrint: false,
      showChongZheng: false,
      detailShow: false,
      detail: {
        title: '',
        confirmContent: '',
        type: ''
      }
    }
  },
  ready () {
    // 调用查询
    this.search()
  },
  methods: {
    showModel (row) {
      this.charge = row
      this.showChongZheng = true
    },
    clear () {
      Object.keys(this.$refs.cp.$refs.cri.model).forEach((key) => {
        this.$refs.cp.$refs.cri.model[key] = []
      })
    },
    searchCondition (args) {
      console.log("args.condition",args.condition)
      this.model.search(args.condition, args.model)
    },
    // 查询
    search () {
      this.$refs.cp.$refs.cri.search()
    },
    updateshowStatus(){
      this.showStatus = !this.showStatus
      this.search()
    },
    // 查看发票
  },
  computed: {
    getCondition () {
      return {
        condition: this.$refs.cp.$refs.cri.condition,
        data: {
          orgid: this.$login.f.orgid
        }
      }
    },
    getUserRolesname(){
      return this.$login.f.rolesnames.includes('营业厅报装')
    }
  }
}
</script>

<style scoped>
</style>
