      <template>
        <div class="app-container calendar-list-container">
          <el-form label-position="right" label-width="100px"  style='width:100%;'>
            <el-row :gutter="24">
              <el-col :xs="23" :sm="23" :md="12" :lg="6" :xl="6">
                <div class="grid-content bg-purple" >
                  <el-form-item  :label="$t('equipment.orderno')" >
                    <div class="block">
                      <el-input style="width: 100%;" class="filter-item" v-model="seachQuery.eh_code" :maxlength = 20>
                      </el-input>
                    </div>
                  </el-form-item>
                </div>
            </el-col>
            <el-col :xs="23" :sm="23" :md="11" :lg="6" :xl="6">
              <div class="grid-content bg-purple" >
                <el-form-item  :label="$t('equipment.orderstatus')" >
                  <div class="block">
                    <el-select class="filter-item" v-model="seachQuery.eh_status" filterable  style="width: 100%;">
                      <el-option v-for="item in statusOptions" :key="item.key" :label="item.label" :value="item.key">
                      </el-option>
                    </el-select>
                  </div>
                </el-form-item>
              </div>
            </el-col>
            <el-col :xs="23" :sm="23" :md="12" :lg="6" :xl="6">
              <div class="grid-content bg-purple" >
                <el-form-item  :label="$t('equipment.orderdate')"  >
                  <div class="block">
                    <el-date-picker v-model="seachQuery.eh_date" value-format="yyyy-MM-dd" align="right" type="date" placeholder="选择日期" :picker-options="pickerOptions1" style="width: 100%;">
                    </el-date-picker>
                  </div>
                </el-form-item>
              </div>
            </el-col>
            <el-col :xs="23" :sm="23" :md="11" :lg="5" :xl="5">
              <div class="grid-content bg-purple" >
                <el-form-item  :label="$t('equipment.orderuser')"  >
                  <div class="block">
                    <el-input style="width: 100%;" class="filter-item" v-model="seachQuery.eh_usercode" :maxlength = 20>
                    </el-input>
                  </div>
                </el-form-item>
              </div>
            </el-col>
            </el-row>
            <el-row :gutter="24">
              <el-col :xs="23" :sm="23" :md="12" :lg="6" :xl="6">
                <div class="grid-content bg-purple" >
                <el-form-item  :label="$t('equipment.eh_cmphone')"  >
                  <div class="block">
                    <el-input style="width: 100%;" class="filter-item" v-model="seachQuery.eh_cmphone" :maxlength = 20>
                    </el-input>
                  </div>
                </el-form-item>
              </div>
          </el-col>
            <el-col :xs="23" :sm="23" :md="11" :lg="6" :xl="6">
              <div class="grid-content bg-purple" >
                <el-form-item  :label="$t('equipment.eh_cmname')"  >
                  <div class="block">
                    <el-input style="width: 100%;" class="filter-item" v-model="seachQuery.eh_cmname" :maxlength = 20>
                    </el-input>
                  </div>
                </el-form-item>
              </div>
            </el-col>
            <el-col :xs="23" :sm="23" :md="12" :lg="6" :xl="6">
              <div class="grid-content bg-purple" >
                <el-form-item  :label="$t('equipment.eh_cmaddress')"  >
                  <div class="block">
                    <el-input style="width: 100%;" class="filter-item"
                        v-model="seachQuery.eh_cmaddress" :maxlength = 20>
                    </el-input>
                  </div>
                </el-form-item>
              </div>
            </el-col>
            <el-col :xs="23" :sm="23" :md="11" :lg="5" :xl="5">
              <div class="grid-content bg-purple" >
                <el-form-item  :label="$t('equipment.eh_cmidcard')"  >
                  <div class="block">
                    <el-input style="width: 100%;" class="filter-item" v-model="seachQuery.eh_cmidcard" :maxlength = 20>
                    </el-input>
                  </div>
                </el-form-item>
              </div>
            </el-col>
            </el-row>
            <el-row :gutter="24">
              <el-col :xs="23" :sm="23" :md="12" :lg="6" :xl="6">
                <div class="grid-content bg-purple" >
                <el-form-item  :label="$t('equipment.type')" >
                  <div class="block">
                    <el-select class="filter-item" v-model="seachQuery.et_type" filterable  style="width: 100%;">
                      <el-option v-for="item in equipmentTypesOptions" :key="item.et_code" :label="item.et_name" :value="item.et_code">
                      </el-option>
                    </el-select>
                  </div>
                </el-form-item>
              </div>
          </el-col>
            <el-col :xs="23" :sm="23" :md="11" :lg="6" :xl="6">
              <div class="grid-content bg-purple" >
                <el-form-item  :label="$t('equipment.id')" >
                  <div class="block">
                    <el-input style="width: 100%;" class="filter-item" v-model="seachQuery.ed_emcode" :maxlength = 20>
                </el-input>
                  </div>
                </el-form-item>
              </div>
            </el-col>
            <el-col :xs="23" :sm="23" :md="12" :lg="6" :xl="6">
              <div class="grid-content bg-purple" >
                <el-form-item  :label="$t('equipment.eh_rental')" >
                  <div class="block">
                    <el-input-number style="width: 100%;" v-model="seachQuery.eh_rental" controls-position="right" :max="99999"></el-input-number>
                  </div>
                </el-form-item>
              </div>
            </el-col>
            <el-col :xs="23" :sm="23" :md="11" :lg="5" :xl="5">
              <div class="grid-content bg-purple" >
                <el-form-item  :label="$t('equipment.eh_mortagage')" >
                  <div class="block">
                     <el-input-number style="width: 100%;" v-model="seachQuery.eh_mortagage" controls-position="right" :max="99999"></el-input-number>
                  </div>
                </el-form-item>
              </div>
            </el-col>
            </el-row>

            <el-row :gutter="24">
              <el-col :xs="23" :sm="23" :md="12" :lg="6" :xl="6">
                <div class="grid-content bg-purple" >
                <el-form-item  :label="$t('equipment.orderstartdate')" >
                  <div class="block">
                    <el-date-picker v-model="seachQuery.ed_startdate" value-format="yyyy-MM-dd" align="right" type="date" placeholder="选择日期" :picker-options="pickerOptions1" style="width: 100%;">
                    </el-date-picker>
                  </div>
                </el-form-item>
              </div>
          </el-col>
            <el-col :xs="23" :sm="23" :md="11" :lg="6" :xl="6">
              <div class="grid-content bg-purple" >
                <el-form-item  :label="$t('equipment.orderenddate')" >
                  <div class="block">
                    <el-date-picker v-model="seachQuery.ed_enddate" value-format="yyyy-MM-dd" align="right" type="date" placeholder="选择日期" :picker-options="pickerOptions1" style="width: 100%;">
                    </el-date-picker>
                  </div>
                </el-form-item>
              </div>
            </el-col>
            <el-col :xs="23" :sm="23" :md="12" :lg="6" :xl="6">
              <div class="grid-content bg-purple" >
                <el-form-item  :label="$t('equipment.source')" >
                  <div class="block">
                    <el-select class="filter-item" v-model="seachQuery.eh_source" filterable  style="width: 100%;">
                      <el-option v-for="item in sourceOptions" :key="item.key" :label="item.label" :value="item.key">
                      </el-option>
                    </el-select>
                  </div>
                </el-form-item>
              </div>
            </el-col>
            </el-row>
            <el-row :gutter="24" >
              <div  align="center" > <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" :loading ="buttonloading" @click="handleFilterfirst">
              {{$t('table.search')}}
            </el-button>
            <el-button class="filter-item" type="primary" v-waves icon="el-icon-delete" @click="handleref">
              {{$t('table.cancel')}}
            </el-button></div>
            </el-row>
            <el-row :gutter="24">
              <div align="right">
                <el-button class="filter-item"  @click="femadd" type="primary"
                      icon="el-icon-edit">{{$t('equipment.emhadd')}}
              </el-button>&nbsp;&nbsp;&nbsp;
              </div>
            </el-row>
          </el-form>
          <el-table :key='tableKey' :data="list" v-loading="listLoading" element-loading-text="加载中......" border fit
                    highlight-current-row
                    style="width: 100%">
            <el-table-column align="center" :label="$t('equipment.orderno')" width="170">
              <template slot-scope="scope">
                  <a href="#" @click="infoshow(scope.row.eh_code)"><span style="color:#409EFF">{{scope.row.eh_code}}</span></a>
              </template>
            </el-table-column>
            <el-table-column align="center" :label="$t('equipment.source')">
              <template slot-scope="scope">
                <span v-if="scope.row.eh_source == '1'" >{{'线上'}}</span>
                  <span v-if="scope.row.eh_source == '2'" >{{'线下'}}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" :label="$t('equipment.eh_cmname')">
              <template slot-scope="scope">
                <span>{{scope.row.eh_cmname}}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" :label="$t('equipment.eh_cmphone')">
              <template slot-scope="scope">
                <span>{{scope.row.eh_cmphone}}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" :label="$t('equipment.eh_rental')">
              <template slot-scope="scope">
                <span>{{scope.row.eh_rental}}</span>
              </template>
            </el-table-column>
              <el-table-column align="center" :label="$t('equipment.eh_mortagage')">
              <template slot-scope="scope">
                <span>{{scope.row.eh_mortagage}}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" :label="$t('equipment.orderdate')">
              <template slot-scope="scope">
                <span>{{scope.row.eh_date}}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" :label="$t('equipment.orderstatus')">
              <template slot-scope="scope">
                <span v-if="scope.row.eh_status == '1'">{{'已保存'}}</span>
                <span v-if="scope.row.eh_status == '2'">{{'已支付'}}</span>
                <span v-if="scope.row.eh_status == '3'">{{'租赁中'}}</span>
                <span v-if="scope.row.eh_status == '4'">{{'已完成'}}</span>
                <span v-if="scope.row.eh_status == '9'">{{'返还确认'}}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" :label="$t('table.actions')" width="328" class-name="small-padding fixed-width">
            <template slot-scope="scope">
              <div style="width:100%" v-if="scope.row.eh_source == '1'">
                <a v-if="scope.row.eh_status == '1' || scope.row.eh_status == '2'" href="#" @click="hrefequipmenthireeditonline(scope.row.eh_code)">
                <el-tag>{{$t('table.edit')}}</el-tag></a>
              <a v-else href="#" ><el-tag type="info">{{$t('table.edit')}}</el-tag></a> 

              <a v-if="scope.row.eh_status == '1'" href="#" @click="equipmenthiredelete(scope.row.eh_code)"><el-tag>{{$t('table.delete')}}</el-tag></a>
              <a v-else ><el-tag type="info">{{$t('table.delete')}}</el-tag></a> 

              <a ><el-tag type="info" >{{$t('equipment.orderpay')}}</el-tag></a>

              <a v-if="scope.row.eh_status == '2'" href="#" @click="addequipmentActive(scope.row)"><el-tag>{{$t('equipment.orderinit')}}</el-tag></a>
              <a  v-else ><el-tag type="info" >{{$t('equipment.orderinit')}}</el-tag></a>

              <a v-if="scope.row.eh_status == '3' || scope.row.eh_status == '9' " href="#" @click="equipmentreturn(scope.row.eh_code)"><el-tag>{{$t('equipment.orderreturn')}}</el-tag></a>
              <a v-else ><el-tag type="info">{{$t('equipment.orderreturn')}}</el-tag></a>
              </div>
              <div style="width:100%" v-else >
                <a v-if="scope.row.eh_status == '1'" href="#" @click="hrefequipmenthireedit(scope.row.eh_code)">
                <el-tag>{{$t('table.edit')}}</el-tag></a>
              <a v-else href="#" ><el-tag type="info">{{$t('table.edit')}}</el-tag></a> 

              <a v-if="scope.row.eh_status == '1'" href="#" @click="equipmenthiredelete(scope.row.eh_code)"><el-tag>{{$t('table.delete')}}</el-tag></a>
              <a v-else ><el-tag type="info">{{$t('table.delete')}}</el-tag></a> 

              <a v-if="scope.row.eh_status == '1'" href="#" @click="handleCreate(scope.row)"><el-tag>{{$t('equipment.orderpay')}}</el-tag></a>
              <a  v-else ><el-tag type="info" >{{$t('equipment.orderpay')}}</el-tag></a>

              <a v-if="scope.row.eh_status == '2'" href="#" @click="addequipmentActive(scope.row)"><el-tag>{{$t('equipment.orderinit')}}</el-tag></a>
              <a  v-else ><el-tag type="info" >{{$t('equipment.orderinit')}}</el-tag></a>

              <a v-if="scope.row.eh_status == '3' ||scope.row.eh_status == '9' " href="#" @click="equipmentreturn(scope.row.eh_code)"><el-tag>{{$t('equipment.orderreturn')}}</el-tag></a>
              <a v-else ><el-tag type="info">{{$t('equipment.orderreturn')}}</el-tag></a>
              </div>
            </template>
          </el-table-column>
          </el-table>
          <div class="pagination-container">
            <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
                          :current-page="page" :page-sizes="[10,20,30,50]" :page-size="limit"
                          layout="total, sizes, prev, pager, next, jumper" :total="total">
            </el-pagination>
          </div>
        <!--支付-->
        <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" :before-close="handleClose">
          <el-form :rules="rules" ref="addForm" :model="addorderpay" label-position="left" label-width="100px"
                  style='width: 700px;margin-left:20px'>
                <el-row :gutter="20" style="margin-bottom: 15px;">
                  <el-col :span="12">
                    <el-form-item  :label="$t('equipment.orderno')" width="100%">
                        <div class="block">
                        <span>{{orderpayshow.eh_code}}</span>
                        </div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item  :label="$t('equipment.paytotal')">
                        <div class="block">
                        <span style="color:#ff4949; font-size: 30px;">￥{{orderpayshow.eh_total}}</span>
                        </div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20" style="margin-bottom: 15px;">
                  <el-col :span="12">
                    <el-form-item  :label="$t('equipment.eh_mortagage')" width="100%">
                        <div class="block">
                        <span >￥{{orderpayshow.eh_mortagage}}</span>
                        </div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item  :label="$t('equipment.eh_rental')">
                        <div class="block">
                        <span >￥{{orderpayshow.eh_rental}}</span>
                        </div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20" style="margin-bottom: 15px;">
                  <el-col :span="12">
                    <div class="grid-content bg-purple" style="width: 300px;">
                      <el-form-item  :label="$t('equipment.cp_channel')" style="width: 310px;">
                        <div class="block">
                      <el-select class="filter-item" v-model="addorderpay.cp_channel" filterable  style="width: 200px;">
                      <el-option v-for="item in discountOption" :key="item.dc_code" :label="item.dc_name" :value="item.dc_code">
                      </el-option>
                      </el-select>
                        </div>
                      </el-form-item>
                    </div>
                  </el-col>
                  <el-col :span="8">
                    <div class="grid-content bg-purple" style="width: 300px;">
                      <el-form-item  :label="$t('equipment.cp_discount')" style="width: 310px;">
                        <div class="block">
                      <el-input-number v-model="addorderpay.cp_discount" controls-position="right" :max="999999" @blur="calculateDiscount()"></el-input-number>
                        </div>
                      </el-form-item>
                    </div>
                  </el-col>
                </el-row>
                <el-row :gutter="20" style="margin-bottom: 15px;">
                  <el-col :span="12">
                    <div class="grid-content bg-purple" style="width: 300px;" >
                      <el-form-item  :label="$t('equipment.cp_paytype')" style="width: 310px;" prop="cp_paytype">
                        <div class="block">
                      <el-select class="filter-item" v-model="addorderpay.cp_paytype" filterable  style="width: 200px;">
                      <el-option v-for="item in payOption" :key="item.pm_code" :label="item.pm_name" :value="item.pm_code">
                      </el-option>
                      </el-select>
                        </div>
                      </el-form-item>
                    </div>
                  </el-col>
                  <el-col :span="8">
                    <div class="grid-content bg-purple" style="width: 300px;">
                      <el-form-item  :label="$t('equipment.cp_payamount')" style="width: 310px;" prop="cp_payamount">
                        <div class="block">
                      <el-input-number  v-model="addorderpay.cp_payamount" controls-position="right" :max="999999"></el-input-number>
                        </div>
                      </el-form-item>
                    </div>
                  </el-col>
                </el-row>
                <el-row :gutter="20" style="margin-bottom: 15px;">
                  <el-col :span="12">
                    <div class="grid-content bg-purple" style="width: 300px;">
                      <el-form-item  :label="$t('equipment.cp_comments')" style="width: 310px;">
                        <div class="block">
                      <el-input v-model="addorderpay.cp_comments" style="width: 560px;"> </el-input>
                        </div>
                      </el-form-item>
                    </div>
                  </el-col>
                </el-row>
        <el-row :gutter="20">
        <el-col :span="20">
          <div class="grid-content bg-purple">
            <el-form-item  :label="$t('equipment.voucher')" style="width: 710px;" >
              <div class="block" style="width: 510px;">
              <el-upload
                :action="url"
                list-type="picture-card"
                :data="datavoucher"
                :on-preview="handlePictureCardPreview"
                :file-list="fileListvoucher"
                :on-success="uploadSuccess"
                :on-remove="handleRemovevoucher"
                :before-upload="beforeUpdate">
                <i class="el-icon-plus"></i>
              </el-upload>
              <el-dialog :visible.sync="dialogVisible">
                <img width="100%" :src="dialogImageUrl" alt="">
              </el-dialog>
              </div>
            </el-form-item>
          </div>
          </el-col>
        <el-col :span="6"><div class="grid-content bg-purple">&nbsp;</div></el-col>
      </el-row>
            </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button  type="primary" @click="addOrderPay()">{{$t('table.confirm')}}</el-button>
            <el-button @click="resetForm('addForm')">{{$t('navbar.reset')}}</el-button>
          </div>
        </el-dialog>
        </div>
      </template>
      <script>
        import { fetchPv, updateArticle, deleteCustomerPayVoucherAll, createArticle, deletePayPhoto, queryPayPhoto } from '@/api/article'
        import { getEquipmentTypes, getAllEquipmenteHireHeads, insertCustomerPay, equipmentActive, queryEquipmenteHireHead, deleteEquipmenteHireHead, getDiscountChannelSelect, getPayMentSelect, checkEqEmcode } from '@/api/equipmentapi'
        import waves from '@/directive/waves' // 水波纹指令
        import { parseTime } from '@/utils'
        import config from '@/utils/config'
        // arr to obj ,such as { CN : "China", US : "USA" }
        export default {
          name: 'equipmenthire',
          directives: {
            waves
          },
          data() {
            return {
              url: config.BASE_URL + '/uploadPayImg',
              tableKey: 0,
              dialogVisible: false,
              dialogImageUrl: undefined,
              list: null,
              total: null,
              page: 1,
              limit: 10,
              queryType: 'list',
              fileListvoucher: [],
              listLoading: true,
              buttonloading: false,
              listQuery: {
                importance: undefined,
                title: undefined,
                type: undefined,
                sort: '+id'
              },
              checkdate: {
                ei_code: undefined
              },
              checkEq: {
                eh_code: undefined
              },
              seachQuery: {
                eh_code: null,
                eh_status: null,
                eh_date: null,
                eh_usercode: null,
                eh_cmphone: null,
                eh_cmname: null,
                eh_cmaddress: null,
                eh_cmidcard: null,
                et_type: null,
                ed_emcode: null,
                eh_rental: null,
                eh_mortagage: null,
                ed_startdate: null,
                ed_enddate: null,
                eh_source: null,
                page: null,
                limit: null
              },
              queryvoucher: {
                eh_code: null
              },
              datavoucher: {
                eh_code: 0,
                cv_orderstaus: 99
              },
              idcardquery: {
                idcard: null
              },
              equipmenthiredel: {
                eh_code: undefined
              },
              checksalt: {
                salt: undefined
              },
              pickerOptions1: {
                shortcuts: [{
                  text: '今天',
                  onClick(picker) {
                    picker.$emit('pick', new Date())
                  }
                }, {
                  text: '昨天',
                  onClick(picker) {
                    const date = new Date()
                    date.setTime(date.getTime() - 3600 * 1000 * 24)
                    picker.$emit('pick', date)
                  }
                }, {
                  text: '一周前',
                  onClick(picker) {
                    const date = new Date()
                    date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
                    picker.$emit('pick', date)
                  }
                }]
              },
              sortOptions: [{ label: 'ID Ascending', key: '+id' }, { label: 'ID Descending', key: '-id' }],
              statusOptions: [{ label: '保存', key: 1 }, { label: '已支付', key: 2 }, { label: '租赁中', key: 3 }, { label: '已完成', key: 4 }, { label: '返还确认', key: 9 }],
              sourceOptions: [{ label: '线上', key: 1 }, { label: '线下', key: 2 }],
              showReviewer: false,
              equipmentTypesOptions: [],
              discountOption: [],
              payOption: [],
              ethnicgroupptions: '',
              provinceoptions: '',
              dialogFormVisible: false,
              dialogFormVisiblemore: false,
              checkidcard: {
                idcard: undefined
              },
              dialogStatus: '',
              textMap: {
                update: 'Edit',
                create: '添加月嫂'
              },
              dialogPvVisible: false,
              pvData: [],
              updateStatus: {
                id: undefined,
                status: undefined
              },
              downloadLoading: false,
              rules: {
                cp_paytype: [{ required: true, message: '请选择支付方式！', trigger: 'blur' }],
                cp_payamount: [{ required: true, message: '整录入支付金额!', trigger: 'blur' }]
              },
              addorderpay: {
                id: undefined,
                cp_ordertype: undefined,
                cp_orderno: undefined,
                cp_channel: undefined,
                cp_discount: undefined,
                cp_paytype: undefined,
                cp_payamount: undefined,
                cp_comments: undefined,
                cp_usercode: undefined,
                cp_date: undefined
              },
              equipmentactive: {
                eh_cmphone: null,
                eh_code: null,
                cp_usercode: null
              },
              orderpayshow: {
                eh_code: null,
                eh_rental: null,
                eh_mortagage: null,
                eh_total: null,
                eh_old: null
              },
              removePhoto: {
                cv_filename: null
              },
              removeVoucher: {
                eh_code: null
              }
            }
          },
          created() {
            this.getList()
            getEquipmentTypes().then(response1 => {
              this.equipmentTypesOptions = response1.data
            })
            getDiscountChannelSelect().then(response2 => {
              this.discountOption = response2.data
            })
            getPayMentSelect().then(response3 => {
              this.payOption = response3.data
            })
          },
          methods: {
            getList() {
              this.listQuery.page = this.page
              this.listQuery.limit = this.limit
              this.queryType = 'list'
              this.listLoading = true
              getAllEquipmenteHireHeads(this.listQuery).then(response => {
                this.list = response.data.items
                this.total = response.data.total
                this.listLoading = false
              })
            },
            handleFilter() {
              this.seachQuery.page = this.page
              this.seachQuery.limit = this.limit
              this.queryType = 'query'
              this.listLoading = true
              queryEquipmenteHireHead(this.seachQuery).then(response => {
                this.list = response.data.items
                this.total = response.data.total
                this.listLoading = false
              })
            },
            handleFilterfirst() {
              this.seachQuery.page = 1
              this.seachQuery.limit = 10
              this.queryType = 'query'
              this.listLoading = true
              this.buttonloading = true
              queryEquipmenteHireHead(this.seachQuery).then(response => {
                this.list = response.data.items
                this.total = response.data.total
                this.listLoading = false
                this.buttonloading = false
              })
              this.page = 1
            },
            handleSizeChange(val) {
              this.limit = val
              if (this.queryType === 'list') {
                this.listQuery.limit = val
                this.listQuery.page = this.page
                this.getList()
              } else {
                this.seachQuery.limit = val
                this.seachQuery.page = this.page
                this.handleFilter()
              }
            },
            infoshow(eh_code) {
              this.$router.push({ name: 'equipmenthireshow', params: { eh_code: eh_code }})
            },
            calculateDiscount() {
              if (this.addorderpay.cp_channel !== null) {
                if (this.addorderpay.cp_discount !== this.orderpayshow.eh_old) {
                  this.orderpayshow.eh_total = this.orderpayshow.eh_rental + this.orderpayshow.eh_mortagage - this.addorderpay.cp_discount
                  this.orderpayshow.eh_old = this.addorderpay.cp_discount
                  this.addorderpay.cp_payamount = this.orderpayshow.eh_rental + this.orderpayshow.eh_mortagage - this.addorderpay.cp_discount
                }
              } else {
                this.$message({ message: '请选择折扣渠道！', type: 'warning' })
                this.addorderpay.cp_discount = 0
              }
            },
            handleCurrentChange(val) {
              this.page = val
              if (this.queryType === 'list') {
                this.listQuery.limit = this.limit
                this.listQuery.page = val
                this.getList()
              } else {
                this.seachQuery.limit = this.limit
                this.seachQuery.page = val
                this.handleFilter()
              }
            },
            handleModifyStatus(row, status) {
              this.$message({
                message: '操作成功',
                type: 'success'
              })
              row.status = status
            },
            femadd() {
              this.$router.push({ name: 'equipmenthireadd' })
            },
            addequipmentActive(row) {
              if (row.eh_source === 1) {
                this.checkEq.eh_code = row.eh_code
                checkEqEmcode(this.checkEq).then(response => {
                  if (response.data === '') {
                    this.$notify({
                      title: '失败',
                      message: '租赁单还没有设备编号!',
                      type: 'warning',
                      duration: 2000
                    })
                  } else {
                    this.equipmentactive.eh_cmphone = row.eh_cmphone
                    this.equipmentactive.eh_code = row.eh_code
                    this.equipmentactive.eh_usercode = this.$store.state.user.introduction
                    equipmentActive(this.equipmentactive).then(response => {
                      if (response.data === 1) {
                        createArticle(this.temp).then(() => {
                          this.dialogFormVisible = false
                          this.$notify({
                            title: '成功',
                            message: '设备激活成功!',
                            type: 'success',
                            duration: 2000
                          })
                        })
                        this.getList()
                      }
                    })
                  }
                })
              } else {
                this.equipmentactive.eh_cmphone = row.eh_cmphone
                this.equipmentactive.eh_code = row.eh_code
                this.equipmentactive.eh_usercode = this.$store.state.user.introduction
                equipmentActive(this.equipmentactive).then(response => {
                  if (response.data === 1) {
                    createArticle(this.temp).then(() => {
                      this.dialogFormVisible = false
                      this.$notify({
                        title: '成功',
                        message: '设备激活成功!',
                        type: 'success',
                        duration: 2000
                      })
                    })
                    this.getList()
                  }
                })
              }
            },
            handleCreate(row) {
              this.addorderpay.dialogStatus = 'create'
              this.addorderpay.cp_ordertype = 1
              this.addorderpay.cp_orderno = row.eh_code
              this.addorderpay.cp_channel = null
              this.addorderpay.cp_discount = 0
              this.addorderpay.cp_paytype = null
              this.addorderpay.cp_payamount = row.eh_rental + row.eh_mortagage
              this.addorderpay.cp_comments = null
              this.addorderpay.cp_usercode = this.$store.state.user.introduction
              this.addorderpay.cp_date = new Date()
              this.orderpayshow.eh_code = row.eh_code
              this.orderpayshow.eh_rental = row.eh_rental
              this.orderpayshow.eh_mortagage = row.eh_mortagage
              this.orderpayshow.eh_total = row.eh_rental + row.eh_mortagage
              this.orderpayshow.eh_old = 0
              this.datavoucher.eh_code = row.eh_code
              this.dialogFormVisible = true
              this.fileListvoucher = []
              this.$nextTick(() => {
                this.$refs['addForm'].clearValidate()
              })
            },
            addOrderPay() {
              this.$refs['addForm'].validate((valid) => {
                if (valid) {
                  this.addorderpay.cp_date = this.addorderpay.cp_date.getFullYear() + '-' + (this.addorderpay.cp_date.getMonth() + 1) + '-' + this.addorderpay.cp_date.getDate()
                  this.listLoading = true
                  insertCustomerPay(this.addorderpay).then(response => {
                    this.getList()
                    this.listLoading = false
                  })
                  this.$refs['addForm'].validate((valid) => {
                    if (valid) {
                      createArticle(this.temp).then(() => {
                        this.dialogFormVisible = false
                        this.$notify({
                          title: '成功',
                          message: '支付成功!',
                          type: 'success',
                          duration: 2000
                        })
                      })
                    }
                  })
                }
              })
            },
            handleClose(done) {
              this.$confirm('确认关闭？').then(_ => {
                this.removeVoucher.eh_code = this.orderpayshow.eh_code
                deleteCustomerPayVoucherAll(this.removeVoucher).then(response9 => {
                })
                done()
              }).catch(_ => {})
            },
            handleUpdate(row) {
              this.temp = Object.assign({}, row) // copy obj
              this.temp.timestamp = new Date(this.temp.timestamp)
              this.dialogStatus = 'update'
              this.dialogFormVisible = true
              this.$nextTick(() => {
                this.$refs['dataForm'].clearValidate()
              })
            },
            hrefequipmenthireedit(eh_code) {
              this.$router.push({ name: 'equipmenthireedit', params: { eh_code: eh_code }})
            },
            hrefequipmenthireeditonline(eh_code) {
              this.$router.push({ name: 'equipmenthireonline', params: { eh_code: eh_code }})
            },
            equipmenthiredelete(eh_code) {
              createArticle(this.temp).then(() => {
                this.$confirm('此操作将永久删除该单据, 是否继续?', '提示', {
                  confirmButtonText: '确定',
                  cancelButtonText: '取消',
                  type: 'warning'
                }).then(() => {
                  this.equipmenthiredel.eh_code = eh_code
                  this.listLoading = true
                  deleteEquipmenteHireHead(this.equipmenthiredel).then(response => {
                    this.list = response.data.items
                    this.total = response.data.total
                    this.listLoading = false
                    if (response.data === 1) {
                      createArticle(this.temp).then(() => {
                        this.$notify({
                          title: '成功',
                          message: '删除成功',
                          type: 'success',
                          duration: 2000
                        })
                      })
                    } else {
                      createArticle(this.temp).then(() => {
                        this.$notify({
                          title: '错误',
                          message: '错误',
                          type: 'error',
                          duration: 2000
                        })
                      })
                    }
                  })
                }).catch(() => {
                })
              })
            },
            equipmentreturn(eh_code) {
              this.$router.push({ name: 'equipmentreturn', params: { eh_code: eh_code }})
            },
            updateData() {
              this.$refs['dataForm'].validate((valid) => {
                if (valid) {
                  const tempData = Object.assign({}, this.temp)
                  tempData.timestamp = +new Date(tempData.timestamp) // change Thu Nov 30 2017 16:41:05 GMT+0800 (CST) to 1512031311464
                  updateArticle(tempData).then(() => {
                    for (const v of this.list) {
                      if (v.id === this.temp.id) {
                        const index = this.list.indexOf(v)
                        this.list.splice(index, 1, this.temp)
                        break
                      }
                    }
                    this.dialogFormVisible = false
                    this.$notify({
                      title: '成功',
                      message: '更新成功',
                      type: 'success',
                      duration: 2000
                    })
                  })
                }
              })
            },
            handleDelete(row) {
              this.$notify({
                title: '成功',
                message: '删除成功',
                type: 'success',
                duration: 2000
              })
              const index = this.list.indexOf(row)
              this.list.splice(index, 1)
            },
            handleFetchPv(pv) {
              fetchPv(pv).then(response => {
                this.pvData = response.data.pvData
                this.dialogPvVisible = true
              })
            },
            handleDownload() {
              this.downloadLoading = true
              import('@/vendor/Export2Excel').then(excel => {
                const tHeader = ['timestamp', 'title', 'type', 'importance', 'status']
                const filterVal = ['timestamp', 'title', 'type', 'importance', 'status']
                const data = this.formatJson(filterVal, this.list)
                excel.export_json_to_excel(tHeader, data, 'table-list')
                this.downloadLoading = false
              })
            },
            handleref() {
              this.seachQuery.eh_code = null
              this.seachQuery.eh_status = null
              this.seachQuery.eh_date = null
              this.seachQuery.eh_usercode = null
              this.seachQuery.eh_cmphone = null
              this.seachQuery.eh_cmname = null
              this.seachQuery.eh_cmaddress = null
              this.seachQuery.eh_cmidcard = null
              this.seachQuery.et_type = null
              this.seachQuery.ed_emcode = null
              this.seachQuery.eh_rental = null
              this.seachQuery.eh_mortagage = null
              this.seachQuery.ed_startdate = null
              this.seachQuery.ed_enddate = null
              this.seachQuery.eh_source = null
              this.seachQuery.page = null
              this.seachQuery.limit = null
            },
            resetForm() {
              this.removeVoucher.eh_code = this.orderpayshow.eh_code
              deleteCustomerPayVoucherAll(this.removeVoucher).then(response9 => {
              })
              this.fileListvoucher = []
              this.addorderpay.cp_ordertype = 1
              this.addorderpay.cp_channel = null
              this.addorderpay.cp_discount = 0
              this.addorderpay.cp_paytype = null
              this.addorderpay.cp_payamount = this.orderpayshow.eh_rental + this.orderpayshow.eh_mortagage
              this.addorderpay.cp_comments = null
              this.addorderpay.cp_usercode = this.$store.state.user.introduction
              this.addorderpay.cp_date = new Date()
              this.orderpayshow.eh_old = 0
            },
            handlePictureCardPreview(file) {
              this.dialogImageUrl = file.url
              this.dialogVisible = true
            },
            uploadSuccess(response, file, fileList) {
              this.imgChange()
            },
            handleRemovevoucher(file, fileList) {
              this.removePhoto.cv_filename = file.name
              deletePayPhoto(this.removePhoto).then(response9 => {
              })
              // this.imgChange()
            },
            imgChange() {
              this.fileListvoucher = []
              this.imageUrl = null
              this.queryvoucher.eh_code = this.orderpayshow.eh_code
              queryPayPhoto(this.queryvoucher).then(response7 => {
                this.fileListvoucher = response7.data
              })
            },
            beforeUpdate(file) {
              if (file.size > 1000000) {
                this.$message.error('上传照片大于1M！')
                return false
              }
            },
            UploadUrl() {
              return this.url
            },
            formatJson(filterVal, jsonData) {
              return jsonData.map(v => filterVal.map(j => {
                if (j === 'timestamp') {
                  return parseTime(v[j])
                } else {
                  return v[j]
                }
              }))
            }
          }
        }
      </script>
      <style>
      .el-form--label-left .el-form-item__label{
        text-align:right
      }
      .el-rate{
        line-height: 0;
        margin-top:8px;
      }
      .avatar-uploader-icon {
        font-size: 28px;
        color: #8c939d;
        width: 300px;
        height: 300px;
        line-height: 300px;
        text-align: center;
      }
      .el-checkbox.el-checkbox {
          margin-left: 30px;
      }
      </style>
      