<template>
  <div class="app-container calendar-list-container">
		 <div class="filter-container" ref="filter-container">
		  <el-form ref="queryForm"  :model="listQuery" label-width="100px">
		    <el-row>
					<el-col :span="5">
					  <el-form-item label="所属地区" prop="zoneId">
					    <el-select class="filter-item" v-model="listQuery.zoneId" placeholder="请选择" @change="getProvinceRegions">
					      <el-option :key="undefined" label="无" :value="undefined"></el-option>
					      <el-option v-for="val in getAllZoneList" :key="val.id" :label="val.name" :value="val.id"> </el-option>
					    </el-select>
					  </el-form-item>
					</el-col>
					<el-col :span="5">
					  <el-form-item label="所属公司" prop="startCompanyId">
					      <el-select class="filter-item" v-model="listQuery.startCompanyId" placeholder="请选择" @change="getAllBranchCompanyChange">
					        <el-option :key="undefined" label="无" :value="undefined"></el-option>
					        <el-option v-for="val in allBranchCompany" :key="val.id" :label="val.name" :value="val.id"> </el-option>
					      </el-select>
					  </el-form-item>
					</el-col>
					 <el-col :span="5">
					  <el-form-item label="订单号">
					    <el-input v-model="listQuery.no" placeholder="请输入订单号"></el-input>
					  </el-form-item>
					</el-col>
          <el-col :span="5">
					  <el-form-item label="订单状态">
					    <el-select class="filter-item" v-model="listQuery.status" placeholder="请选择状态">
              <!--"0--删除"+"1--创建订单" +"2--取消" +"3--待付款" +"4--待出行" +"5--出行中（进行中）" +"6--已完成"-->
								<el-option :key="null" label="全部订单" :value="null" ></el-option>
								<el-option :key="3" label="待支付" :value="3"></el-option>
								<el-option :key="4" label="待出行" :value="4"></el-option>
								<el-option :key="5" label="出行中" :value="5"></el-option>
								<el-option :key="6" label="已完成" :value="6"></el-option>
                <el-option :key="2" label="已取消" :value="2"></el-option>
					    </el-select>
					  </el-form-item>
					</el-col>

		    </el-row>
		  </el-form>
		  <el-button class="filter-item" type="primary" v-waves icon="search" @click="handleFilter">搜索</el-button>
			<el-button class="filter-item" type="primary" v-waves icon="delete" @click="clearSearch">清除搜索</el-button>
		</div>
    <el-table :key='tableKey' :data="list" v-loading.body="listLoading"
              border fit highlight-current-row
              style="width: 100%">
      <el-table-column align="center" label="ID" width="70">
        <template scope="scope">
          <span>{{scope.row.id}}</span>
        </template>
      </el-table-column>
      <el-table-column width="200" align="center" label="订单号/下单时间">
        <template scope="scope">
          <span>{{scope.row.no}}</span><br><span>{{scope.row.crtTime}}</span>
        </template>
      </el-table-column>
      <el-table-column width="150" align="center" label="用户ID/用户名">
			  <template scope="scope">
			   <span>{{scope.row.userId}}</span>/<span>{{scope.row.username}}</span>
			  </template>
			</el-table-column>
      <el-table-column width="180" align="center" label="名称/车牌号">
        <template scope="scope">
          <span>{{scope.row.name}}</span><br/><span>{{scope.row.vehicleNumberPlat}}</span>
        </template>
      </el-table-column>
			<el-table-column width="150" align="center" label="姓名/手机号">
			  <template scope="scope">
			   <span>{{scope.row.username}}</span>/<span>{{scope.row.telephone}}</span>
			  </template>
			</el-table-column>
			<el-table-column width="200" align="center" label="取车时间/还车时间">
			  <template scope="scope">
			   取:<span>{{dateFormat(scope.row.orderRentVehicleDetail.startTime)}}</span><br/>
				 还:<span>{{dateFormat(scope.row.orderRentVehicleDetail.endTime)}}</span>
			  </template>
			</el-table-column>
      <el-table-column width="200" align="center" label="交车公司">
        <template scope="scope">
          <span>{{scope.row.startCompanyName}}</span><br/>
					<span>({{scope.row.orderRentVehicleDetail.startCityName}}{{scope.row.orderRentVehicleDetail.startAddr}})</span>
        </template>
      </el-table-column>
			 <el-table-column width="200" align="center" label="收车公司">
			  <template scope="scope">
			     <span>{{scope.row.endCompanyName}}</span><br/>
			    <span>({{scope.row.orderRentVehicleDetail.endCityName}}{{scope.row.orderRentVehicleDetail.endAddr}})</span>
			  </template>
			</el-table-column>
      <el-table-column width="110" align="center" label="订单金额">
        <template scope="scope">
          <span>{{scope.row.orderAmount}}元</span>
        </template>
      </el-table-column>

			<el-table-column width="110" align="center" label="订单状态">
			  <template scope="scope">
					<span v-if="scope.row.status == '2'">取消</span>
					<span v-if="scope.row.status == '3'">待付款</span>
					<span v-if="scope.row.status == '4'">待出行</span>
					<span v-if="scope.row.status == '5'">出行中</span>
					<span v-if="scope.row.status == '6'">已完成</span>
			  </template>
			</el-table-column>
			 
			<el-table-column width="110" align="center" label="订单详情">
			  <template scope="scope">
					<span style="color: #13CE66;cursor: pointer;" @click="handleOrderDetail(scope.row)">订单详情</span>
			  </template>
			</el-table-column>
     <el-table-column align="center" label="操作" width="400">
          <template scope="scope">          
					 <el-button  size="small" type="success" @click="handleHandoverOrderVehicle(scope.row)">交车记录</el-button>
					 <el-button  size="small" type="success" @click="handleReturnOrderVehicle(scope.row)">还车记录</el-button>
					 <el-button  size="small" type="success" @click="handleRefundVehicle(scope.row)">押金记录</el-button>
					 <el-button size="small" v-if="scope.row.status == 6" type="success" @click="illegalInquiry(scope.row)">违章查询</el-button>
					</template>
      </el-table-column>
    </el-table>

    <!--违章查询弹框-->
    <Illegal :row="currentRow" v-if="illegalVisible" v-on:illegalEvent = "illegalEvent"></Illegal>
    <!--查看详情弹框-->
    <Detail :row="currentRow" v-if="detailVisible" v-on:detailEvent= "detailEvent"></Detail>

    <div v-show="!listLoading" class="pagination-container">
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                     :current-page.sync="listQuery.page" :page-sizes="[10,20,30, 50]" :page-size="listQuery.limit"
                     layout="total, sizes, prev, pager, next, jumper" :total="total"></el-pagination>
    </div>
		
		<!-- 订单详情 -->
		 <el-dialog :title="modalTitle" :visible.sync="bannerDialogVisible">
		  <el-form :model="form" :rules="rules" ref="form" label-width="90px">
						<div class="label-title">
							<span >订单号:</span><span class="label-text">{{form.no}}</span>
							<span >支付时间:</span><span class="label-text">{{form.crtTime}}</span>
						</div>
						<div class="label-title">
							<span >订单状态:</span><span class="label-text">{{form.ststusName}}</span>
						</div>
				    <div class="label-title">
				    	<span >姓名/手机号:</span> <span class="label-text"><span >{{form.username}}</span>/<span>{{form.telephone}}</span></span>
				    </div>
						<div class="label-title">
							<span >配车:</span> <span class="label-text"><span >{{form.vehicleNumberPlat}}</span><a class="label-text" style="color: #1478F0;">重新配车></a></span>
						</div>
						<div class="label-title">
							<span >取车:</span>  <span  class="label-text">{{form.orderRentVehicleDetail.startTime}}</span><span class="label-text">{{form.orderRentVehicleDetail.startAddr}}</span>  <span class="label-text">交车公司:</span><span>{{form.startCompanyName}}</span>
						</div>
						<div class="label-title">
							<span >还车:</span>  <span  class="label-text">{{form.orderRentVehicleDetail.endTime}}</span><span class="label-text">{{form.orderRentVehicleDetail.endAddr}}</span>  <span class="label-text">交车公司:</span><span>{{form.endCompanyName}}</span>
						</div>
						<table class="orderDetail">
							<tr>
								<td>房车</td>
								<td>租借天数</td>
								<td>费用明细</td>
							</tr>
								<tr>
									<td>{{form.name}}{{tourCostDetail}}</td>
									<td>{{form.orderRentVehicleDetail.dayNum}}天</td>
									<td>{{tourCostDetail}}</td>
								</tr>
								<tr>
									<td ></td>
									<td ></td>
									<td >共计:{{form.realAmount}}</td>
								</tr>
						</table>
							<div style="margin-top: 20px;">
										<div><span style="font-size: 20px;font-weight: bold;">驾驶人信息</span></div>
										<div style="margin-top: 10px;"><span>{{this.form.orderVehicleCrosstownDto?this.form.orderVehicleCrosstownDto.licenseName:''}}</span><span class="label-text">{{this.form.orderVehicleCrosstownDto?this.form.orderVehicleCrosstownDto.licensePhone:''}}</span><span class="label-text">{{this.form.orderVehicleCrosstownDto?this.form.orderVehicleCrosstownDto.licenseIdCard:''}}</span></div><br/>
										<div v-if="this.form.orderVehicleCrosstownDto?true:false"><img class="label-text " id = "license-img" :src="this.form.orderVehicleCrosstownDto?this.form.orderVehicleCrosstownDto.licenseImg:''"></div>
							</div>
					
		  </el-form>
		</el-dialog>
		
		
		
		<el-dialog :title="modalTitle" :visible.sync="orderVehicleCrosstownVisible">
		  <el-form :model="form" :rules="rules" ref="form" label-width="90px">
						<div class="label-title">
							<span >订单号:</span><span class="label-text">{{form.no}}</span>
							<span >支付时间:</span><span class="label-text">{{form.crtTime}}</span>
						</div>
						<div class="label-title">
							<span >订单状态:</span><span class="label-text">{{form.ststusName}}</span>
						</div>
				    <div class="label-title">
				    	<span >姓名/手机号:</span> <span class="label-text"><span >{{form.username}}</span>/<span>{{form.telephone}}</span></span>
				    </div>
						<div class="label-title">
							<span >取车:</span>  <span  class="label-text">{{form.orderRentVehicleDetail.startTime}}</span><span class="label-text">{{form.orderRentVehicleDetail.startAddr}}</span>  <span class="label-text">交车公司:</span><span>{{form.startCompanyName}}</span>
						</div>
						<div class="label-title">
							<span >还车:</span>  <span  class="label-text">{{form.orderRentVehicleDetail.endTime}}</span><span class="label-text">{{form.orderRentVehicleDetail.endAddr}}</span>  <span class="label-text">交车公司:</span><span>{{form.endCompanyName}}</span>
						</div>
						<div v-if="vehicleDetail" style="border: 1px solid;">
								<div style="border-bottom: 1px solid;">
									<span class="label-text">交车交接人:</span><span class="label-text">{{orderReturnVehicleCrosstown.username}}</span>
								</div>
								<div>
									<span class="label-text">上传驾驶证*:</span><span class="label-text">{{orderReturnVehicleCrosstown.licenseName}}</span><span class="label-text">{{orderReturnVehicleCrosstown.licensePhone}}</span><br/>
									<span style="margin-left:110px;">身份证号:</span> <span class="label-text">{{orderReturnVehicleCrosstown.licenseIdCard}}</span><br />
									<img :src="orderReturnVehicleCrosstown.licenseImg" style="width: 100px; height: 100px;margin-left:110px;"/>
								</div>
								
								<div>
											<span class="label-text">拍照取证*:</span><br/>
											<!-- <div v-for="(item, i) in otherImg">
												<img :src="item" style="width: 100px; height: 100px;margin-left:110px;"/>
											</div> -->
											<img src="../../../assets/404_images/404.png" style="width: 100px; height: 100px;margin-left:110px;"/>
											<img src="../../../../dist/static/img/success.8304acb.png" style="width: 100px; height: 100px;margin-left:110px;"/>
											<img src="../../../../dist/static/img/success.8304acb.png" style="width: 100px; height: 100px;margin-left:110px;"/>
											<img src="../../../../dist/static/img/success.8304acb.png" style="width: 100px; height: 100px;margin-left:110px;"/>
								</div>
								<div v-if="handover">
									<span class="label-text">房车公里数*:</span><span class="label-text">当前公里数:</span><span class="label-text">{{orderReturnVehicleCrosstown.mileage}}Km</span><br/>
									<img :src="orderReturnVehicleCrosstown.mileageImg" style="width: 100px; height: 100px;margin-left:110px;"/>
								</div>
								<div v-if="returnVehicle">
									<span class="label-text">钥匙照片*:</span><br/>
									<img :src="orderReturnVehicleCrosstown.vehicleKey" style="width: 100px; height: 100px;margin-left:110px;"/>
								</div>
								<div v-if="returnVehicle">
									<span class="label-text">押金扣除项*:</span><span>{{orderReturnVehicleCrosstown.deduction?'有扣除项':'没有扣除项'}}</span><br/>
										
								</div>
								<div>
									<span class="label-text">备注:</span></span><span class="label-text">{{orderReturnVehicleCrosstown.remak}}</span>
								</div>
							<div>
								
							</div>
						</div>
						<!--押金记录-->
						<div v-if="refundshow">
								
						</div>
					
		  </el-form>
		</el-dialog>
		
		
		
  </div>
</template>

<script>
  import Illegal from "./illegalModal";//违章查询
  import Detail from "./detail";//违章查询
  import {
    formatDate
  } from '../../../utils/dateFormattor';
  import {
    page,
		getAllBranchCompany,
		getAllBranchCompanyByZoneId,
		getOrderVehicleCrosstown
  } from 'api/order/rentVehicle';
	import {
	  timestamp2Date
	} from 'utils/dateUtils';
  import { mapGetters } from 'vuex';
  import rsCode from '../../../utils/rsCode';
	  import {
	  getSysRegionByIds
	} from 'api/vehicle/vehicleInfo/';
	import {
	  getAllZone
	} from 'api/base_info/constant/';
  export default {
    name: 'branchCompanyStock',
    components: {
      Illegal,
      Detail,
    },
    data() {
      return {
       form: {
					couponAmount: undefined,
					crtHost: undefined,
					crtName: undefined,
					crtTime: undefined,
					crtUser: undefined,
					detailId: undefined,
					endCompanyName: undefined,
					goodsAmount: undefined,
					hasDiscount: undefined,
					hasMemberRight: undefined,
					hasPay: undefined,
					id: undefined,
					name: undefined,
					no: undefined,
					orderAmount: undefined,
					orderOrigin: undefined,
					orderVehicleCrosstownDto: {
						licenseIdCard: "",
						licenseImg: "",
						licenseName: "",
					  licensePhone: ""},
					orderRentVehicleDetail: {
						bookRecordId: undefined,
						costDetail: undefined,
						crtTime: undefined,
						dayNum: undefined,
						deposit: undefined,
						driverType: undefined,
						endAddr: undefined,
						endCity: undefined,
						endCityName: undefined,
						endCompanyId: undefined,
						endTime: undefined,
						freeDays: undefined,
						handelViolation: undefined,
						id: undefined,
						modelId: undefined,
						myDriverIds: undefined,
						orderId: undefined,
						score: undefined,
						startAddr: undefined,
						startCity: undefined,
						startCityName: undefined,
						startCompanyId: undefined,
						startTime: undefined,
						stime: undefined,
						suserid: undefined,
						updTime: undefined,
						vehicleId: undefined,
					},
					payOrigin: undefined,
					picture: undefined,
					realAmount: undefined,
					refundStatus: undefined,
					startCompanyName: undefined,
					status: undefined,
					ststusName:undefined,
					telephone: undefined,
					type: undefined,
					updTime: undefined,
					userId: undefined,
					username: undefined,
					vehicleNumberPlat: undefined,
					version: undefined
       },
				orderVehicleCrosstownVisible:false,
			  bannerDialogVisible: false,//添加、编辑弹框
				modalTitle: '订单详情',
        illegalVisible: false,//违章查询弹框
        detailVisible:false,
        rules: {
          // companyName: [
          //   {
          //     required: true,
          //     message: '请输入用户',
          //     trigger: 'blur'
          //   }
          // ],
        },
        list: null,
        total: null,
        listLoading: true,
        listQuery: {
          page: 1,
          limit: 20,
          type:1,
					no: null,
					status:null,
					startTime: undefined,
					endTime:undefined,
					zoneId:undefined,
					startCompanyId: undefined
        },
				baranchQuery: {
					zoneId:null
				},
				orderVehicleQuery: {
					orderId:null,
					type:undefined
				},
        dialogFormVisible: false,
        dialogStatus: '',
        btn_del: true,
        btn_buy: true,
        btn_cancel: true,
				allZoneArr:[],//全部片区
				allBranchCompany:[],
				tourCostDetail:'',
				damageSafe:'',
				serviceCost:0,
				orderReturnVehicleCrosstown:{
					crtTime: undefined,
					deduction: undefined,
					id: undefined,
					imgs: undefined,
					isDel: undefined,
					mileage: undefined,
					mileageImg: undefined,
					orderId: undefined,
					orderNo: undefined,
					orperaterId: undefined,
					remak: undefined,
					status: undefined,
					statusId: undefined,
					statusTime: undefined,
					type: undefined,
					updTime: undefined,
					userLicenseId: undefined,
					username: undefined,
					licenseIdCard: undefined,
					licenseImg: undefined,
					licenseName: undefined,
					licensePhone: undefined
				},//还车记录
        tableKey: 0,
				otherImg:[],
				handover:false,
				returnVehicle: false,
				refundshow:false,//退款信息
				vehicleDetail:true //交还车信息，默认全部显示
      }
    },
    created() {
      this.getList();
      this.btn_del = this.elements['branchCompany/stockApply:btn_delete'];
    },
    computed: {
      ...mapGetters([
        'elements'
      ]),
      provinceRegions() {
        return getSonRegionByCodes(1);
      },
			//获取大区列表
			getAllZoneList(){
			  this.allZoneArr = getAllZone();
			  return getAllZone();
			},
      cityRegions() {
        if (!this.$utils.isInteger(this.form.addrProvince)) {
          return null;
        }
        return getSonRegionByCodes(this.form.addrProvince);
      }
    },
    methods: {
      handleOrderDetail(row) {
				 this.form = row;
				if (this.form.status == 2) {
					this.form.ststusName = '取消';
				}
				if (this.form.status == 3) {
					this.form.ststusName = '待付款';
				}
				if (this.form.status == 4) {
					this.form.ststusName = '待出行';
				}
				if (this.form.status == 5) {
					this.form.ststusName = '出行中';
				}
				if (this.form.status == 6) {
					this.form.ststusName = '已完成';
				}
       this.form.orderRentVehicleDetail.startTime = timestamp2Date(this.form.orderRentVehicleDetail.startTime)
				 this.form.orderRentVehicleDetail.endTime = timestamp2Date(this.form.orderRentVehicleDetail.endTime)
				  this.costDetail = JSON.parse(this.form.orderRentVehicleDetail.costDetail)
				 var cost = '';
				 this.costDetail.children.forEach(function(a) {
				 						 cost += a.key + ":" +a.detail+" "
				 })
				 	this.tourCostDetail = cost
				 if(this.form.orderRentVehicleDetail.driverType==1) {
					 this.serviceCost = this.form.orderRentVehicleDetail.dayNum * 600
				 }
        this.bannerDialogVisible = true;
    },
      /**
       * 操作-违章查询按钮，显示违章弹框
       */
      illegalInquiry(row){
        this.currentRow = row;
        this.illegalVisible = true;
      },
      /**
       * 操作-查看详情按钮，显示详情弹框
       */
      detailInquiry(row){
        this.currentRow = row;
        this.detailVisible = true;
      },
      /**
       * 关闭违章查询弹框
       * */
      illegalEvent(params){
        this.illegalVisible = false;
        if(params){
          console.log(params);
        }
      },
      /**
       * 关闭违章查询弹框
       * */
      detailEvent(params){
        this.detailVisible = false;
        if(params){
          console.log(params);
        }
      },
			handleHandoverOrderVehicle(row) {
				console.log(row)
				this.modalTitle = "交车记录"
				 this.form = row;
				if (this.form.status == 2) {
					this.form.ststusName = '取消';
				}
				if (this.form.status == 3) {
					this.form.ststusName = '待付款';
				}
				if (this.form.status == 4) {
					this.form.ststusName = '待出行';
				}
				if (this.form.status == 5) {
					this.form.ststusName = '出行中';
				}
				if (this.form.status == 6) {
					this.form.ststusName = '已完成';
				}
			 this.form.orderRentVehicleDetail.startTime = timestamp2Date(this.form.orderRentVehicleDetail.startTime)
				 this.form.orderRentVehicleDetail.endTime = timestamp2Date(this.form.orderRentVehicleDetail.endTime)
				  this.costDetail = JSON.parse(this.form.orderRentVehicleDetail.costDetail)
				 var cost = '';
				 this.costDetail.children.forEach(function(a) {
				 						 cost += a.key + ":" +a.detail+" "
				 })
				 	this.tourCostDetail = cost
				 if(this.form.orderRentVehicleDetail.driverType==1) {
					 this.serviceCost = this.form.orderRentVehicleDetail.dayNum * 600
				 }
				this.orderVehicleQuery.orderId = this.form.id
				this.orderVehicleQuery.type = 1
				this.getAllOrderVehicleCrosstown();
				this.handover = true
				this.returnVehicle = false
				this.vehicleDetail=true
				 if(this.orderReturnVehicleCrosstown.imgs) {
					this.otherImg = orderReturnVehicleCrosstown.imgs.split(',')
				}
			},
			getAllOrderVehicleCrosstown() {
				getOrderVehicleCrosstown(this.orderVehicleQuery)
				.then(response => {
											console.log(response)
									 if(response.data.length <=0 ) {
														  alert("交还车记录不存在")
													 }else {
														 this.orderVehicleCrosstownVisible = true
														 this.orderReturnVehicleCrosstown = response.data[0];
														
													 }
								})
				
				
			},
			
			handleReturnOrderVehicle(row) {
				console.log(row)
					this.modalTitle = "还车记录"
					 this.form = row;
					if (this.form.status == 2) {
						this.form.ststusName = '取消';
					}
					if (this.form.status == 3) {
						this.form.ststusName = '待付款';
					}
					if (this.form.status == 4) {
						this.form.ststusName = '待出行';
					}
					if (this.form.status == 5) {
						this.form.ststusName = '出行中';
					}
					if (this.form.status == 6) {
						this.form.ststusName = '已完成';
					}
				 this.form.orderRentVehicleDetail.startTime = timestamp2Date(this.form.orderRentVehicleDetail.startTime)
					 this.form.orderRentVehicleDetail.endTime = timestamp2Date(this.form.orderRentVehicleDetail.endTime)
					  this.costDetail = JSON.parse(this.form.orderRentVehicleDetail.costDetail)
					 var cost = '';
					 this.costDetail.children.forEach(function(a) {
					 						 cost += a.key + ":" +a.detail+" "
					 })
					 	this.tourCostDetail = cost
					 if(this.form.orderRentVehicleDetail.driverType==1) {
						 this.serviceCost = this.form.orderRentVehicleDetail.dayNum * 600
					 }
					 this.orderVehicleQuery.orderId = this.form.id
					  this.orderVehicleQuery.type = 2
					this.getAllOrderVehicleCrosstown();
						this.returnVehicle = true
						this.handover = false
						this.vehicleDetail=true
						 if(this.orderReturnVehicleCrosstown.imgs) {
							this.otherImg = orderReturnVehicleCrosstown.imgs.split(',')
						}
				},
				handleRefundVehicle(row) {
					console.log(row)
						this.modalTitle = "还车记录"
						 this.form = row;
						if (this.form.status == 2) {
							this.form.ststusName = '取消';
						}
						if (this.form.status == 3) {
							this.form.ststusName = '待付款';
						}
						if (this.form.status == 4) {
							this.form.ststusName = '待出行';
						}
						if (this.form.status == 5) {
							this.form.ststusName = '出行中';
						}
						if (this.form.status == 6) {
							this.form.ststusName = '已完成';
						}
					 this.form.orderRentVehicleDetail.startTime = timestamp2Date(this.form.orderRentVehicleDetail.startTime)
					 this.form.orderRentVehicleDetail.endTime = timestamp2Date(this.form.orderRentVehicleDetail.endTime)						 
					 this.orderVehicleCrosstownVisible = true
						this.vehicleDetail=false
					},
			//监听change事件
			 getProvinceRegions(item) {
					this.listQuery.zoneId = item
					this.baranchQuery.zoneId = item
					getAllBranchCompanyByZoneId(this.baranchQuery)
					.then(response => {
					  this.allBranchCompany = response.data;
					})
			 },
			 getAllBranchCompanyChange(item) {
				 this.listQuery.startCompanyId = item
			 },
      handleCancel(row) {
        this.$confirm('此操作将放弃购买, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        })
          .then(() => {
            cancelApply(row.id)
              .then(() => {
                this.$notify({
                  title: '成功',
                  message: '操作成功',
                  type: 'success',
                  duration: 2000
                });
                this.getList();
              });
          });
      },
			
      handleDelete(row) {
        this.$confirm('此操作将永久删除, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        })
          .then(() => {
            delObj(row.id)
              .then(() => {
                this.$notify({
                  title: '成功',
                  message: '删除成功',
                  type: 'success',
                  duration: 2000
                });
                const index = this.list.indexOf(row);
                this.list.splice(index, 1);
              });
          });
      },
			 handleFilter() {
			  this.listQuery.page = 1;
			  this.$refs.queryForm.validate(valid => {
			    if (valid) {
			      this.getList();
			    } else {
			      return false;
			    }
			  });
			},
			clearSearch() {
				this.listQuery ={
				  page: 1,
          limit: 20,
          type:1,
					no: null,
					status:null,
					startTime: undefined,
					endTime:undefined,
					zoneId:undefined,
					startCompanyId: undefined
				}
				this.getList()
			},
      /**
       * 获取订单列表
       */
      getList() {
        this.listLoading = true;
				console.log(this.listQuery)
				// if(this.listQuery.startTime){
				//   this.listQuery.startTime = this.listQuery.startTime.getTime();
				// }
				// if(this.listQuery.endTime){
				//   this.listQuery.endTime = this.listQuery.endTime.getTime();
				// }
        page(this.listQuery)
          .then(response => {
            this.list = response.data.data;
            this.total = response.data.totalCount;
            this.listLoading = false;
          })
      },
      handleSizeChange(val) {
        this.listQuery.limit = val;
        this.getList();
      },
			dateFormat(timestamp) {
				let date = new Date(timestamp);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
				return formatDate(date, 'yyyy-MM-dd hh:mm:ss');
			},
      handleCurrentChange(val) {
        this.listQuery.page = val;
        this.getList();
      }
    }
  }
</script>

<style>
	.label-text{
			margin-left: 10px;
			margin-right: 20px;
	}
		.label-title{
		margin-top: 10px;
	}
	.orderDetail tr td{
		width: 500px;
		text-align: center;
		border: 0.0625rem solid;
		margin-left: 100px;
		margin-right: 100px;
	}
	.label-value{
		margin-left: 80px;
		margin-right: 100px;
	}
	#license-img{
		width: 50px;
		height: 50px;
	}
</style>