    <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('order.orderno')" >
                <div class="block">
                  <el-input style="width: 100%;" class="filter-item" v-model="seachQuery.od_no" :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('order.username')" >
                <div class="block">
                  <el-input style="width: 100%;" class="filter-item" v-model="seachQuery.od_user_name" :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('order.cmphone')" >
                <div class="block">
                  <el-input style="width: 100%;" class="filter-item"
                    v-model="seachQuery.od_phone" :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('order.status')" >
                <div class="block">
                  <el-select class="filter-item" v-model="seachQuery.od_status" filterable  style="width: 100%;">
                  <el-option v-for="item in statusOptions" :key="item.value" :label="item.label" :value="item.value">
                  </el-option>
                  </el-select>
                </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('order.startdate')" >
                <div class="block">
                  <el-date-picker v-model="seachQuery.od_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('order.enddate')" >
                <div class="block">
                  <el-date-picker v-model="seachQuery.od_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('order.mmid')" >
                <div class="block">
                  <el-select class="filter-item" v-model="seachQuery.od_mmid" filterable  style="width: 100%;">
                  <el-option v-for="item in mmsoptions" :key="item.id" :label="item.truename" :value="item.id">
                  </el-option>
                  </el-select>
                </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('order.packageid')" >
                <div class="block">
                  <el-select class="filter-item" v-model="seachQuery.od_product_id" default-first-optionplaceholder="请选择套餐" style="width: 100%;">
                    <el-option v-for="item in packageoptions" :key="item.p_code" :label="item.p_name" :value="item.p_code">
                    </el-option>
                  </el-select>
                </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('order.cityid')" >
                <div class="block">
                  <el-select v-if="mktEnable" disabled  class="filter-item" v-model="seachQuery.od_cityid" default-first-optionplaceholder="请选择城市" style="width: 100%;">
                    <el-option v-for="city in citysOptions" :key="city.branche_code" :label="city.branche_name" :value="city.branche_code">
                    </el-option>
                  </el-select>
                  <el-select v-else class="filter-item" v-model="seachQuery.od_cityid" default-first-optionplaceholder="请选择城市" style="width: 100%;">
                    <el-option v-for="city in citysOptions" :key="city.branche_code" :label="city.branche_name" :value="city.branche_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('order.contract')" >
                <div class="block">
                  <el-input style="width: 100%;" class="filter-item" v-model="seachQuery.od_contract" :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('order.consultant_order')" >
                <div class="block">
                  <el-select v-if="isvisit" class="filter-item"  v-model="seachQuery.od_consultantid" default-first-optionplaceholder="请选择城市" style="width: 100%;">
                    <el-option v-for="item in consultantOptions" :key="item.id" :label="item.name" :value="item.id">
                    </el-option>
                  </el-select>
                  <el-select v-else  disabled class="filter-item"  v-model="seachQuery.od_consultantid" default-first-optionplaceholder="请选择城市" style="width: 100%;">
                    <el-option v-for="item in consultantOptions" :key="item.id" :label="item.name" :value="item.id">
                    </el-option>
                  </el-select>
                </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('order.introducer')" >
                <div class="block">
                  <el-input style="width:100%;" class="filter-item" v-model="seachQuery.od_introducer_phone" :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('order.ismdj')" >
                <div class="block">
                 <el-select class="filter-item" v-model="seachQuery.od_ismdj" default-first-optionplaceholder="请选择" style="width: 100%;">
                    <el-option v-for="item in mdjOptions" :key="item.value" :label="item.label" :value="item.value">
                    </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('order.user')" >
                <div class="block">
                  <el-select class="filter-item" v-model="seachQuery.od_user" default-first-optionplaceholder="请选择" style="width: 100%;">
                    <el-option v-for="item in adminUserOptions" :key="item.id" :label="item.name" :value="item.id">
                    </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('order.date')" >
                <div class="block">
                  <el-date-picker v-model="seachQuery.od_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-row>
          <el-row :gutter="24" >
            <div  align="center" > <el-button class="filter-item" type="primary" v-waves :loading ="buttonloading" icon="el-icon-search" @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" style="margin-left: 10px;" @click="hrefAdd" type="primary"
                    icon="el-icon-edit">{{$t('table.add')}}
            </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('order.orderno')" width="170">
            <template slot-scope="scope">
                <a href="#" @click="infoshow(scope.row.od_no)"><span style="color:#409EFF">{{scope.row.od_no}}</span></a>
            </template>
          </el-table-column>
          <el-table-column align="center" :label="$t('order.status')">
            <template slot-scope="scope">
              <el-tag v-if="scope.row.od_status === 1" >订单保存</el-tag>
              <el-tag v-if="scope.row.od_status === 2" type = "success">部分支付</el-tag>
              <el-tag v-if="scope.row.od_status === 3" type = "success">全部支付</el-tag>
              <el-tag v-if="scope.row.od_status === 4" type = "success">服务完成</el-tag>
              <el-tag v-if="scope.row.od_status === 9" type = "warning">用户退单</el-tag>
            </template>
          </el-table-column>
          <el-table-column align="center" :label="$t('order.cmphone')" width="110">
            <template slot-scope="scope">
              <span>{{scope.row.od_phone}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" :label="$t('order.mmid')">
            <template slot-scope="scope">
              <span>{{scope.row.od_mmname}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" :label="$t('order.startdate')">
            <template slot-scope="scope">
              <span>{{scope.row.od_startdate}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" :label="$t('order.cityid')">
            <template slot-scope="scope">
              <span>{{scope.row.od_cityidname}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" :label="$t('order.amount')">
            <template slot-scope="scope" >
              <span id="moeny">{{scope.row.od_order_amount - scope.row.od_promotion_discount - scope.row.od_other_discount - scope.row.od_mgm_discount  |numFilter}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" :label="$t('order.consultant')">
            <template slot-scope="scope">
              <span>{{scope.row.od_consultantname}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" :label="$t('table.actions')" width="368" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <a href="#" v-if="scope.row.od_status < 2" @click="hrefYsOrderEdit(scope.row.id)"><el-tag>{{$t('table.edit')}}</el-tag></a> 
            <el-tag v-else type="info">{{$t('table.edit')}}</el-tag>
            <a href="#" v-if="scope.row.od_status < 2" @click="hrefYsOrderDelete(scope.row.id)"><el-tag>{{$t('table.delete')}}</el-tag></a>
            <el-tag v-else type="info">{{$t('table.delete')}}</el-tag>
            <a href="#" v-if="scope.row.od_status <= 2" @click="herfEarnestPay(scope.row)"><el-tag>{{$t('order.pay')}}</el-tag></a> 
            <el-tag v-else type="info">{{$t('order.pay')}}</el-tag>
            <a href="#"  v-if="scope.row.od_status == 3" @click="hrefFinish(scope.row)"><el-tag>{{$t('order.finish')}}</el-tag></a> 
            <el-tag v-else type="info">{{$t('order.finish')}}</el-tag>
            <a href="#" @click="hrefChangeMm(scope.row)"  v-if="scope.row.od_status == 2 || scope.row.od_status == 3"> <el-tag  >{{$t('order.changemm')}}</el-tag></a>
            <el-tag v-else type="info">{{$t('order.changemm')}}</el-tag>
            <a href="#"  @click="hrefReturn(scope.row)" v-if="scope.row.od_status == 2 || scope.row.od_status == 3"> <el-tag >{{$t('order.return')}}</el-tag></a>
            <el-tag v-else type="info" >{{$t('order.return')}}</el-tag>
          </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[dialogEarnestStatus]" :visible.sync="dialogFormEarnestPay" :before-close="handleClose">
          <el-form :rules="rulesPay" ref="earnestPayForm" :model="earnestPayInfo" label-position="left" label-width="80px"
                  style='width: 600px;margin-left:20px'>
          <el-row :gutter="24" style="margin-bottom: 15px;">
            <el-col :span="12">
              <div class="grid-content bg-purple">
                <el-form-item  :label="$t('order.orderno')" >
                  <span style="font-size: 18px;color: #606266;font-weight: 400;">{{earnestPayInfo.cp_orderno}}</span>
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="12">
            <el-button v-if="is_voucher == 1" :loading ="buttonsaveloading" type="primary" @click="payYsOrder">{{$t('table.confirm')}}</el-button>
            <el-button v-if="is_voucher == 1" @click="resetEarnestPayForm('earnestPayForm')">{{$t('navbar.reset')}}</el-button>
            </el-col>
          </el-row>
          <el-row :gutter="24" style="margin-bottom: 15px;">
            <el-col :span="14">
              <div class="grid-content bg-purple" style="width: 100%">
                <el-form-item  :label="$t('order.amount')" style="width:100%">
                  <span style = "color:#ff4949; font-size: 20px;">￥</span>
                  <span style = "color:#ff4949; font-size: 30px;">{{earnestPayInfo.cp_payamount_show|numFilter}}</span>
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="10">
              <div class="grid-content bg-purple" style="width: 300px;">
                <el-form-item  :label="$t('order.od_vip_cash')" style="width: 310px;color:#ff4949; font-size: 30px;">
                  <span style = "color:#ff4949; font-size: 20px;">￥</span>
                  <span style = "color:#ff4949; font-size: 30px;">{{earnestPayInfo.cp_discount|numFilter}}</span>
                </el-form-item>
              </div>
            </el-col>
          </el-row>

          <el-row :gutter="24" style="margin-bottom: 15px;">
            <el-col :span="14">
              <div class="grid-content bg-purple" style="width: 100%">
                <el-form-item  :label="$t('order.paid_amount')" style="width:100%">
                  <span style = "color:#ff4949; font-size: 20px;">￥</span>
                  <span style = "color:#ff4949; font-size: 30px;">{{earnestPayInfo.paid_amount|numFilter}}</span>
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="10">
              <div class="grid-content bg-purple" style="width: 300px;">
                <el-form-item  :label="$t('order.paid_count')" style="width: 310px;color:#ff4949; font-size: 30px;">
                  <span style = "color:#ff4949; font-size: 30px;">{{earnestPayInfo.paid_count}}</span>
                </el-form-item>
              </div>
            </el-col>
          </el-row>
          <el-row :gutter="24" style="margin-bottom: 15px;">
            <el-col :span="14">
              <div class="grid-content bg-purple">
                <el-form-item  :label="$t('order.paytype')" prop="cp_paytype">
                  <el-select class="filter-item" v-model="earnestPayInfo.cp_paytype" filterable  style="width: 200px;"  @change="payMentChanged">
                    <el-option v-for="item in payOption" :key="item.pm_code" :label="item.pm_name" :value="item.pm_code">
                    </el-option>
                  </el-select>
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="10">
              <div class="grid-content bg-purple" style="width: 300px;">
                <el-form-item  :label="$t('order.payment_amount')" style="width: 310px;" prop="cp_payamount">
                  <div class="block">
                      <el-input-number v-model="earnestPayInfo.cp_payamount" style="width: 180px;" :controls=false :precision="2" :max="9999999"> </el-input-number>
                  </div>
                </el-form-item>
              </div>
            </el-col>
          </el-row>


          <el-row :gutter="20" v-if="is_voucher == 1 && !paidError && !paidError">
          <el-col :span="20">
            <div class="grid-content bg-purple">
              <el-form-item  :label="$t('order.out_trade_no')" style="width: 710px;" >
                <div class="block" style="width: 510px;">
                <el-input style="width: 100%;" class="filter-item" v-model="earnestPayInfo.out_trade_no">
                </el-input>
                </div>
              </el-form-item>
            </div>
            </el-col>
        </el-row>

          <el-row :gutter="20" v-if="is_voucher == 1 && !paidError && !paidError">
          <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"
                  :before-upload="beforeUpdate"
                  :on-remove="handleRemovevoucher">
                  <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-row :gutter="20" v-if="is_voucher == 2 && !paidError && !paidError">
          <el-col :span="8">
            <div class="grid-content bg-purple">
              <el-form-item  :label="$t('order.payvoucher')" prop="np">
              <div class="block" style="width: 100%;">
              <el-image 
                style="width: 200px; height: 200px"
                :src="voucherImg" 
                :preview-src-list="voucherImgList">
                <div slot="error" class="image-slot">
                  <i class="el-icon-loading"></i>
                </div>
              </el-image>
                </div>
              </el-form-item>
            </div>
          </el-col>
        </el-row>

        <el-row :gutter="20" v-if="paid">
          <el-col :span="20">
            <div class="grid-content bg-purple">
              <el-form-item  :label="$t('order.out_trade_no')" style="width: 710px;" >
                <div class="block" style="width: 510px;">
                    已支付完成
                </div>
              </el-form-item>
            </div>
            </el-col>
        </el-row>

        <el-row :gutter="20" v-if="paidError">
          <el-col :span="20">
            <div class="grid-content bg-purple">
              <el-form-item  :label="$t('order.out_trade_no')" style="width: 710px;" >
                <div class="block" style="width: 510px;">
                    支付失败，请选择其他付款方式
                </div>
              </el-form-item>
            </div>
            </el-col>
        </el-row>

    </el-form>
        </el-dialog>
        <!--变更月嫂-->
        <el-dialog :title="textMap[dialogChangeMMStatus]" :visible.sync="dialogChangeMM" :before-close="handleClose">
          <el-form :rules="rulesChangeMM" ref="changeMMForm" :model="changeMMInfo" label-position="left" label-width="80px"
                  style='width: 600px;margin-left:20px'>
          <el-row :gutter="24" style="margin-bottom: 15px;">
            <el-col :span="14">
              <div class="grid-content bg-purple" style="width: 100%;">
                <el-form-item  :label="$t('order.orderno')" style="width: 100%;">
                  <span style="font-size: 18px;color: #606266;font-weight: 400;">{{changeMMInfo.od_no}}</span>
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="10">
              <div class="grid-content bg-purple" style="width: 300px;">
                <el-form-item  :label="$t('order.mmidOld')" style="width: 310px;color:#ff4949; font-size: 30px;">
                  <span style="font-size: 18px;color: #606266;font-weight: 400;">{{changeMMnameShow}}</span>
                </el-form-item>
              </div>
            </el-col>
          </el-row>
          <el-row :gutter="24" style="margin-bottom: 15px;">
            <el-col :span="14">
              <div class="grid-content bg-purple" style="width: 100%;">
                <el-form-item  :label="$t('order.startdate')" style="width: 100%;">
                  <span style="font-size: 18px;color: #606266;font-weight: 400;">{{changStartDateShow}}</span>
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="10">
              <div class="grid-content bg-purple" style="width: 300px;">
                <el-form-item  :label="$t('order.enddate')" style="width: 310px;color:#ff4949; font-size: 30px;">
                  <span style="font-size: 18px;color: #606266;font-weight: 400;">{{changeMMInfo.od_enddate}}</span>
                </el-form-item>
              </div>
            </el-col>
          </el-row>
          <el-row :gutter="24" style="margin-bottom: 15px;">
            <el-col :span="14">
              <div class="grid-content bg-purple" style="width: 300px;">
                <el-form-item  :label="$t('order.startdateNew')" style="width: 310px;" prop="od_startdate">
                  <div class="block">
                      <el-date-picker @change="checkStartDate" v-model="changeMMInfo.od_startdate" align="right" type="datetime" placeholder="选择日期" :picker-options="pickerOptions1" style="width: 200px;">
                      </el-date-picker>
                  </div>
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="10">
              
              <div class="grid-content bg-purple">
                <el-form-item  :label="$t('order.mmidNew')" prop="od_mmid">
                  <el-select class="filter-item" v-model="changeMMInfo.od_mmid" filterable  style="width: 200px;">
                    <el-option v-for="item in changeoptions"  :key="item.id" :label="item.truename" :value="item.id" :disabled="item.disabled">
                    </el-option>
                  </el-select>
                </el-form-item>
              </div>
            </el-col>
          </el-row>
          <el-row :gutter="24" style="margin-bottom: 15px;">
            <el-col :span="24">
            <el-form-item  :label="$t('order.comments')" prop="od_user_name" style="width: 107%;">
            <div class="block">
                <el-input
                    type="textarea"
                    :rows="4"
                    placeholder="请输入备注"
                    :maxlength = 200
                    v-model="changeMMInfo.od_comment">
                </el-input>
            </div>
          </el-form-item>
            </el-col>
          </el-row>
            </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button  :loading ="buttonsaveloading" type="primary" @click="changeMMSave">{{$t('table.confirm')}}</el-button>
            <el-button @click="resetChangeMMForm('changeMMForm')">{{$t('navbar.reset')}}</el-button>
          </div>
        </el-dialog>
        <!--用户退单-->
          <el-dialog :title="textMap[dialogReturnStatus]" :visible.sync="dialogReturn" :before-close="handleClose">
          <el-form :rules="rulesReturn" ref="returnForm" :model="returnInfo" label-position="left" label-width="80px"
                  style='width: 600px;margin-left:20px'>
            <el-row :gutter="24" style="margin-bottom: 15px;">
            <el-col :span="14">
              <div class="grid-content bg-purple" style="width: 100%;">
                <el-form-item  :label="$t('order.orderno')" style="width: 100%;">
                  <span style="font-size: 18px;color: #606266;font-weight: 400;">{{returnInfo.od_no}}</span>
                </el-form-item>
              </div>
            </el-col>
          </el-row>
          <el-row :gutter="24" style="margin-bottom: 15px;">
            <el-col :span="14">
              <div class="grid-content bg-purple" style="width: 100%;">
                <el-form-item  :label="$t('order.consultant_order')" style="width: 100%;">
                  <span style="font-size: 18px;color: #606266;font-weight: 400;">{{returnCTNameShow}}</span>
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="10">
              <div class="grid-content bg-purple" style="width: 300px;">
                <el-form-item  :label="$t('order.mmidOld')" style="width: 310px;color:#ff4949; font-size: 30px;">
                  <span style="font-size: 18px;color: #606266;font-weight: 400;">{{returnMMnameShow}}</span>
                </el-form-item>
              </div>
            </el-col>
          </el-row>
          <el-row :gutter="24" style="margin-bottom: 15px;">
            <el-col :span="24">
              <el-form-item  :label="$t('order.od_refund')"  style="width: 95%;" prop="od_refund">
                  <el-input-number v-model="returnInfo.od_refund" style="width: 100%;" :controls=false :precision="2" :max="9999999"> </el-input-number>
                </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24" style="margin-bottom: 15px;">
            <el-col :span="24">
            <el-form-item  :label="$t('order.return_comments')" prop="od_user_name" style="width: 95%;">
            <div class="block">
                <el-input
                    type="textarea"
                    :rows="4"
                    placeholder="请输入备注"
                    :maxlength = 200
                    v-model="returnInfo.od_comment">
                </el-input>
            </div>
          </el-form-item>
            </el-col>
          </el-row>
          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button  :loading ="buttonsaveloading" type="primary" @click="returnSave">{{$t('table.confirm')}}</el-button>
            <el-button @click="resetChangeMMForm('returnForm')">{{$t('navbar.reset')}}</el-button>
          </div>
          </el-dialog>

        <el-dialog title="Reading statistics" :visible.sync="dialogPvVisible">
          <el-table :data="pvData" border fit highlight-current-row style="width: 100%">
            <el-table-column prop="key" label="Channel"></el-table-column>
            <el-table-column prop="pv" label="Pv"></el-table-column>
          </el-table>
          <span slot="footer" class="dialog-footer">
            <el-button type="primary" @click="dialogPvVisible = false">{{$t('table.confirm')}}</el-button>
          </span>
        </el-dialog>
      </div>
    </template>
    <script>
      import { fetchPv, createArticle, deleteOrderPayPhoto, queryServiceUserStockCondition, getBranches, getjlServiceUsers, checkStockDate, queryOrderPayPhoto, deletePayPhoto } from '@/api/article'
      import { queryYSOrder, deleteYSOrder, insertYsOrderPay, finishYSOrder, changMM, checkSLStartDate, insertYSOrderReturn, createPayQrCode } from '@/api/order'
      import { getPackageSelect } from '@/api/couponapi'
      import { getPayMentSelect, selectCustomerPay } from '@/api/equipmentapi'
      import { getConsultants, getJlAdminUsers } from '@/api/dc'
      import { getRatioById } from '@/api/packageapi'
      import waves from '@/directive/waves' // 水波纹指令
      import { parseTime } from '@/utils'
      import config from '@/utils/config'
      import regex from '@/utils/regex'
      // arr to obj ,such as { CN : "China", US : "USA" }
      export default {
        name: 'ysorder',
        directives: {
          waves
        },
        filters: {
          numFilter(value) {
            return parseFloat(value).toFixed(2)
          }
        },
        data() {
          return {
            userMkt: null,
            mktEnable: null,
            payVoucherUrl: null,
            isvisit: true,
            url: config.BASE_URL + '/uploadPayImg',
            fileListvoucher: [],
            filename: null,
            queryvoucher: {
              eh_code: null,
              cv_orderstaus: null
            },
            datavoucher: {
              eh_code: 0,
              cv_orderstaus: 0,
              out_trade_no: null
            },
            removePhoto: {
              cv_filename: null
            },
            p_pay_money: 0,
            removeVoucher: {
              eh_code: null,
              cv_orderstaus: 0
            },
            delOrderNo: null,
            delOrderStatus: null,
            dialogVisible: false,
            dialogImageUrl: undefined,
            tableKey: 0,
            list: null,
            total: null,
            voucherImg: null,
            voucherImgList: [],
            page: 1,
            limit: 10,
            queryType: 'list',
            cp_payamountold: null,
            listLoading: true,
            buttonloading: false,
            buttonsaveloading: false,
            alipayImg: null,
            checkdate: {
              servant_code: undefined,
              stock_status: undefined,
              start_date: undefined,
              end_date: undefined
            },
            finishInfo: {
              id: null,
              od_status: null,
              od_no: null,
              od_mmid: null,
              od_phone: null,
              od_introducer_phone: null,
              od_enddate: null,
              od_cityid: null,
              od_order_amount: null,
              od_product_id: null
            },
            earnestPayInfo: {
              cp_ordertype: null,
              cp_orderno: null,
              cp_orderstatus: null,
              cp_channel: null,
              cp_discount: null,
              cp_paytype: null,
              cp_payamount: null,
              cp_payamount_show: null,
              cp_comments: null,
              cp_usercode: null,
              paid_amount: 0,
              paid_count: 0,
              out_trade_no: null,
              cv_filepath: null,
              od_product_name: null,
              od_product_id: null,
              ratio: null,
              payment_steps: null,
              cp_date: null,
              od_biz_user: null
            },
            changeMMInfo: {
              od_no: null,
              od_mmid: null,
              od_startdate: null,
              od_enddate: null,
              od_mmidOld: null,
              od_comment: null,
              od_userid: null
            },
            returnInfo: {
              od_no: null,
              od_comment: null,
              od_date: null,
              od_userid: null,
              od_refund: null,
              od_consultantid: null
            },
            od_refundOld: null,
            returnCTNameShow: null,
            changStartDateShow: null,
            changeMMnameShow: null,
            returnMMnameShow: null,
            seachQuery: {
              od_no: null,
              od_user_name: null,
              od_status: null,
              od_phone: null,
              od_startdate: null,
              od_enddate: null,
              od_mmid: null,
              od_product_id: null,
              od_cityid: null,
              od_contract: null,
              od_consultantid: null,
              od_introducer_phone: null,
              od_ismdj: null,
              od_user: null,
              od_date: null,
              page: null,
              limit: null
            },
            idcardquery: {
              idcard: null
            },
            ysOrderDel: {
              id: 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' }],
            branchesOptions: [],
            citysOptions: [],
            packageoptions: [],
            consultantOptions: [],
            adminUserOptions: [],
            mdjOptions: [{ value: '1', label: '是' }, { value: '0', label: '否' }],
            statusOptions: [{ value: '1', label: '订单保存' }, { value: '2', label: '部分支付' }, { value: '3', label: '全部支付' }, { value: '4', label: '服务完成' }, { value: '9', label: '用户退单' }],
            mmsoptions: [],
            changeoptions: [],
            payOption: [],
            is_voucher: 0,
            showReviewer: false,
            ethnicgroupptions: '',
            provinceoptions: '',
            dialogFormBalancePay: false,
            dialogFormEarnestPay: false,
            dialogChangeMM: false,
            dialogReturn: false,
            checkidcard: {
              idcard: undefined
            },
            dialogEarnestStatus: '',
            dialogBalanceStatus: '',
            dialogChangeMMStatus: '',
            dialogReturnStatus: '',
            textMap: {
              update: 'Edit',
              create: '添加月嫂'
            },
            paid: false,
            paidError: false,
            dialogPvVisible: false,
            pvData: [],
            updateStatus: {
              id: undefined,
              status: undefined
            },
            rules: {
              cm_phone: [{ required: true, message: '请输入手机号码！', trigger: 'blur' },
                { pattern: regex.REPHONE, message: '手机号格式错误！', trigger: 'blur' }],
              ot_startdate: [{ required: true, message: '请输入开始日期！', trigger: 'blur' }],
              ot_enddate: [{ required: true, message: '请输入结束日期！', trigger: 'blur' }],
              jl_mmid: [{ required: true, message: '请选择月嫂！', trigger: 'blur' }],
              packageid: [{ required: true, message: '请选择服务城市！', trigger: 'blur' }],
              cityid: [{ required: true, message: '请选择服务城市！', trigger: 'blur' }]
            },
            rulesPay: {
              cp_paytype: [{ required: true, message: '请选择付款方式！', trigger: 'blur' }]
            },
            rulesChangeMM: {
              od_mmid: [{ required: true, message: '请选择将要服务的月嫂！', trigger: 'blur' }],
              od_startdate: [{ required: true, message: '请选择新月嫂服务开始日期!', trigger: 'blur' }]
            },
            rulesReturn: {
              od_comment: [{ required: true, message: '请填写退单说明,以便后期分析！', trigger: 'blur' }],
              od_refund: [{ required: true, message: '推荐金额不能为空！', trigger: 'blur' }]
            },
            downloadLoading: false
          }
        },
        created() {
          // od_consultantid
          if (this.$store.getters.isvisit === 1) {
            this.seachQuery.od_consultantid = this.$store.getters.id
            this.isvisit = false
          }
          this.userMkt = this.$store.getters.mkt
          if (this.userMkt !== 'ALL') {
            this.seachQuery.od_cityid = this.userMkt
            this.mktEnable = true
          }
          this.list = []
          this.listLoading = false
          this.getList()
          getBranches().then(response5 => {
            this.branchesOptions = response5.data
            this.citysOptions = response5.data
          })
          getPackageSelect().then(response6 => {
            this.packageoptions = response6.data
          })
          getjlServiceUsers().then(response7 => {
            this.mmsoptions = response7.data
          })
          getConsultants().then(response2 => {
            this.consultantOptions = response2.data
          })
          getJlAdminUsers().then(response1 => {
            this.adminUserOptions = response1.data
          })
          getPayMentSelect().then(response3 => {
            this.payOption = response3.data
          })
        },
        methods: {
          getList() {
            this.seachQuery.page = this.page
            this.seachQuery.limit = this.limit
            this.queryType = 'list'
            this.listLoading = true
            queryYSOrder(this.seachQuery).then(response => {
              this.list = response.data.items
              this.total = response.data.total
              this.listLoading = false
            })
          },
          handleFilter() {
            if (this.seachQuery.experience === 0) {
              this.seachQuery.experience = null
            }
            this.seachQuery.page = this.page
            this.seachQuery.limit = this.limit
            this.queryType = 'query'
            this.listLoading = true
            queryYSOrder(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
            queryYSOrder(this.seachQuery).then(response => {
              this.list = response.data.items
              this.total = response.data.total
              this.listLoading = false
              this.buttonloading = false
            })
          },
          handleSizeChange(val) {
            this.limit = val
            if (this.queryType === 'list') {
              this.seachQuery.limit = val
              this.seachQuery.page = this.page
              this.getList()
            } else {
              this.seachQuery.limit = val
              this.seachQuery.page = this.page
              this.handleFilter()
            }
          },
          handleCurrentChange(val) {
            this.page = val
            if (this.queryType === 'list') {
              this.seachQuery.limit = this.limit
              this.seachQuery.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
          },
          hrefAdd() {
            this.$router.push({ name: 'ysorderadd' })
          },
          herfEarnestPay(row) {
            this.is_voucher = null
            var dd_pay = row.od_order_amount - row.od_mgm_discount - row.od_promotion_discount - row.od_other_discount
            this.earnestPayInfo.out_trade_no = null
            if (row.od_order_amount <= 0) {
              this.$message.error('订单金额不能小于零,请重新编辑确认！')
            } else {
              // 读取套餐 支付比例
              var searchePackage = {
                id: null
              }
              var ratioArray = null
              searchePackage.id = row.od_product_id
              getRatioById(searchePackage).then(response => {
                ratioArray = response.data.payment_steps.split(',')
                var searchCustomerPay = {
                  cp_orderno: null
                }
                searchCustomerPay.cp_orderno = row.od_no
                selectCustomerPay(searchCustomerPay).then(response => {
                  var pay_sum = 0
                  if (response.data.length > 0) { // 如果支付次数大于0
                    this.earnestPayInfo.payment_steps = response.data.length + 1
                    this.earnestPayInfo.ratio = ratioArray[response.data.length]
                    for (var i = 0; i < response.data.length; i++) {
                      pay_sum = pay_sum + response.data[i].cp_payamount
                    }
                    // 当支付次数大于套餐设置次数时：推荐支付金额 = 订单金额 - 推荐金额
                    if (response.data.length >= ratioArray.length) {
                      this.earnestPayInfo.cp_payamount = dd_pay - pay_sum
                    } else {
                      this.earnestPayInfo.cp_payamount = dd_pay * Number(ratioArray[response.data.length])
                    }
                    // 超出金额后拿总金额-已支付金额
                    if (Number(pay_sum) + this.earnestPayInfo.cp_payamount > dd_pay) {
                      this.earnestPayInfo.cp_payamount = dd_pay - pay_sum
                    }
                    this.earnestPayInfo.paid_amount = pay_sum
                    this.earnestPayInfo.paid_count = response.data.length
                    this.cp_payamountold = this.earnestPayInfo.cp_payamount
                  } else {
                    this.earnestPayInfo.payment_steps = 1
                    this.earnestPayInfo.cp_payamount = dd_pay * Number(ratioArray[0])
                    this.earnestPayInfo.ratio = ratioArray[0]
                    this.cp_payamountold = dd_pay * Number(ratioArray[0])
                    // 重置上一个打开窗口的信息
                    this.earnestPayInfo.paid_count = 0
                    this.earnestPayInfo.paid_amount = 0
                  }
                  if (ratioArray.length === 1) { // 几次支付
                    this.earnestPayInfo.payment_steps = 1
                    this.earnestPayInfo.ratio = 1
                    this.earnestPayInfo.cp_payamount = dd_pay - pay_sum
                    this.cp_payamountold = dd_pay - pay_sum
                  }
                })
              })
              this.earnestPayInfo.dialogEarnestStatus = 'create'
              this.earnestPayInfo.cp_ordertype = 2
              this.earnestPayInfo.cp_orderno = row.od_no
              this.earnestPayInfo.cp_orderstatus = 2
              this.earnestPayInfo.cp_discount = Number(row.od_mgm_discount) + Number(row.od_promotion_discount) + Number(row.od_other_discount)
              this.earnestPayInfo.cp_payamount_show = row.od_order_amount
              this.earnestPayInfo.cp_payamount = row.od_order_pay_amount
              this.earnestPayInfo.cp_paytype = null
              this.earnestPayInfo.yop_payvoucher = null
              this.earnestPayInfo.od_product_name = row.od_product_name
              this.earnestPayInfo.od_product_id = row.od_product_id
              this.queryvoucher.eh_code = row.od_no
              this.queryvoucher.cv_orderstaus = 2
              this.datavoucher.eh_code = row.od_no
              this.datavoucher.cv_orderstaus = 2
              this.delOrderNo = row.od_no
              this.delOrderStatus = 2
              this.checkdate.servant_code = row.od_mmid
              this.checkdate.start_date = row.od_startdate
              this.checkdate.end_date = row.od_enddate
              this.dialogFormEarnestPay = true
              this.fileListvoucher = []
              this.$nextTick(() => {
                this.$refs['earnestPayForm'].clearValidate()
              })
            }
          },
          handleClose(done) {
            this.$confirm('确认关闭？').then(_ => {
              this.removeVoucher.eh_code = this.delOrderNo
              this.removeVoucher.cv_orderstaus = this.delOrderStatus
              deleteOrderPayPhoto(this.removeVoucher).then(response9 => {
              })
              done()
            }).catch(_ => {})
          },
          payYsOrder() {
            this.$refs['earnestPayForm'].validate((valid) => {
              if (valid) {
                if (this.is_voucher === 1) {
                  if (this.earnestPayInfo.out_trade_no === null) {
                    createArticle(this.temp).then(() => {
                      this.$notify({
                        title: '失败',
                        message: '请输入流水号',
                        type: 'error',
                        duration: 2000
                      })
                    })
                    return null
                  }
                }
                if (Number(this.earnestPayInfo.cp_payamount) > (Number(this.earnestPayInfo.cp_payamount_show) - Number(this.earnestPayInfo.cp_discount))) {
                  this.$message.error('支付金额不能大于订单金额!')
                } else {
                  this.buttonsaveloading = true
                  var date1 = new Date()
                  this.earnestPayInfo.cp_usercode = this.$store.getters.introduction
                  this.earnestPayInfo.cp_date = date1.getFullYear() + '-' + (date1.getMonth() + 1) + '-' + date1.getDate() + ' ' + date1.getHours() + ':' + date1.getMinutes() + ':' + date1.getSeconds()
                  this.earnestPayInfo.cv_filepath = this.payVoucherUrl
                  insertYsOrderPay(this.earnestPayInfo).then(response => {
                    if (response.data === 1) {
                      this.buttonsaveloading = false
                      this.getList()
                      this.dialogFormEarnestPay = false
                      createArticle(this.temp).then(() => {
                        this.$notify({
                          title: '成功',
                          message: '支付成功!',
                          type: 'success',
                          duration: 2000
                        })
                      })
                    } else if (response.data === 99) {
                      createArticle(this.temp).then(() => {
                        this.$notify({
                          title: '失败',
                          message: '流水号重复！',
                          type: 'error',
                          duration: 2000
                        })
                      })
                    } else {
                      this.buttonsaveloading = false
                      createArticle(this.temp).then(() => {
                        this.$notify({
                          title: '失败',
                          message: '支付失败！',
                          type: 'error',
                          duration: 2000
                        })
                      })
                    }
                  })
                }
              }
            })
          },
          hrefYsOrderEdit(id) {
            this.$router.push({ name: 'ysorderedit', params: { orderid: id }})
          },
          hrefYsOrderDelete(id) {
            createArticle(this.temp).then(() => {
              this.$confirm('此操作将永久删除该单据, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
              }).then(() => {
                this.ysOrderDel.id = id
                this.listLoading = true
                deleteYSOrder(this.ysOrderDel).then(response => {
                  this.list = response.data.items
                  this.total = response.data.total
                  this.listLoading = false
                  if (response.data === 1) {
                    this.getList()
                    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(() => {})
            })
          },
          hrefFinish(row) {
            if (Number(row.od_order_pay_amount) !== 0) {
              this.$message.error('还有款项未付!')
            } else {
              this.finishInfo.id = row.id
              this.finishInfo.od_status = 4
              this.finishInfo.od_mmid = row.od_mmid
              this.finishInfo.od_no = row.od_no
              this.finishInfo.od_phone = row.od_phone
              this.finishInfo.od_introducer_phone = row.od_introducer_phone
              this.finishInfo.od_enddate = row.od_enddate
              this.finishInfo.od_cityid = row.od_cityid
              this.finishInfo.od_order_amount = row.od_order_amount
              this.finishInfo.od_product_id = row.od_product_id
              var datenow = Date.parse(new Date())
              var date2 = Date.parse(row.od_enddate)
              var diffDays = date2 - datenow
              if (diffDays > 0) {
                createArticle(this.temp).then(() => {
                  this.$confirm('还没到服务结束日期,确认完成?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                  }).then(() => {
                    finishYSOrder(this.finishInfo).then(response => {
                      if (response.data === 1) {
                        this.buttonsaveloading = false
                        this.getList()
                        this.dialogFormBalancePay = false
                        createArticle(this.temp).then(() => {
                          this.$notify({
                            title: '成功',
                            message: '订单成功!',
                            type: 'success',
                            duration: 2000
                          })
                        })
                      } else {
                        this.buttonsaveloading = false
                        createArticle(this.temp).then(() => {
                          this.$notify({
                            title: '失败',
                            message: '完成失败！',
                            type: 'error',
                            duration: 2000
                          })
                        })
                      }
                    })
                  }).catch(() => {
                  })
                })
              } else {
                finishYSOrder(this.finishInfo).then(response => {
                  if (response.data === 1) {
                    this.buttonsaveloading = false
                    this.getList()
                    this.dialogFormBalancePay = false
                    createArticle(this.temp).then(() => {
                      this.$notify({
                        title: '成功',
                        message: '完成成功!',
                        type: 'success',
                        duration: 2000
                      })
                    })
                  } else {
                    this.buttonsaveloading = false
                    createArticle(this.temp).then(() => {
                      this.$notify({
                        title: '失败',
                        message: '完成失败！',
                        type: 'error',
                        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
            })
          },
          beforeUpdate(file) {
            this.datavoucher.out_trade_no = this.earnestPayInfo.out_trade_no
            if (file.size > 1000000) {
              this.$message.error('上传照片大于1M！')
              return false
            }
          },
          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
            })
          },
          payMentChanged(value) {
            this.paid = false
            this.paidError = false
            this.voucherImg = null
            this.voucherImgList = []
            this.is_voucher = this.payOption.filter(item => item.id === Number(value))[0].is_voucher
            if (this.is_voucher === 2) {
              var data = {
                orderNo: null,
                channel: null,
                price: null,
                originPrice: null,
                title: null,
                productName: null,
                productId: null,
                payment_steps: null
              }
              data.orderNo = this.earnestPayInfo.cp_orderno
              data.channel = this.payOption.filter(item => item.id === Number(value))[0].qr_channel
              data.price = this.earnestPayInfo.cp_payamount
              data.originPrice = this.earnestPayInfo.cp_payamount
              data.title = '悦所' + this.earnestPayInfo.od_product_name + ',支付比例：' + this.earnestPayInfo.ratio * 100 + '%'
              data.productName = this.earnestPayInfo.od_product_name
              data.productId = this.earnestPayInfo.od_product_id
              data.payment_steps = this.earnestPayInfo.payment_steps
              createPayQrCode(data).then(response9 => {
                if (response9.data === 'all') {
                  this.paid = true
                } else if (response9.data === 'error') {
                  this.paidError = true
                } else {
                  this.alipayImg = 'data:image/png;base64,' + response9.data
                  this.voucherImg = 'data:image/png;base64,' + response9.data
                  this.voucherImgList.push('data:image/png;base64,' + response9.data)
                }
              })
            }
          },
          handleref() {
            this.seachQuery.od_no = null
            this.seachQuery.od_user_name = null
            this.seachQuery.od_status = null
            this.seachQuery.od_phone = null
            this.seachQuery.od_startdate = null
            this.seachQuery.od_enddate = null
            this.seachQuery.od_mmid = null
            this.seachQuery.od_product_id = null
            this.seachQuery.od_cityid = null
            this.seachQuery.od_contract = null
            if (this.$store.getters.isvisit === 1) {
              this.seachQuery.od_consultantid = this.$store.getters.id
            } else {
              this.seachQuery.od_consultantid = null
            }
            this.seachQuery.od_introducer_phone = null
            this.seachQuery.od_ismdj = null
            this.seachQuery.od_user = null
            this.seachQuery.od_date = null
            this.seachQuery.page = 1
            this.seachQuery.limit = 10
          },
          resetEarnestPayForm(formName) {
            this.is_voucher = null
            this.earnestPayInfo.out_trade_no = null
            this.removeVoucher.eh_code = this.delOrderNo
            this.removeVoucher.cv_orderstaus = this.delOrderStatus
            deleteOrderPayPhoto(this.removeVoucher).then(response9 => {
            })
            this.fileListvoucher = []
            this.earnestPayInfo.cp_paytype = null
            this.earnestPayInfo.cp_payamount = this.cp_payamountold // ??
            this.earnestPayInfo.yop_payvoucher = null
          },
          resetChangeMMForm(formName) {
            this.changeMMInfo.od_mmid = null
            this.changeMMInfo.od_startdate = null
            this.changeMMInfo.od_comment = null
          },
          resetReturnForm(formName) {
            this.returnInfo.od_comment = null
          },
          // 图片上传
          handlePictureCardPreview(file) {
            this.dialogImageUrl = file.url
            this.dialogVisible = true
          },
          uploadSuccess(response, file, fileList) {
            this.fileListvoucher = fileList
            this.payVoucherUrl = response.url
            this.filename = response.filename
          },
          handleRemovevoucher(file, fileList) {
            this.fileListvoucher = []
            this.payVoucherUrl = null
            this.removePhoto.cv_filename = this.filename
            deletePayPhoto(this.removePhoto).then(response9 => {
            })
          },
          imgChange() {
            this.fileListvoucher = []
            this.imageUrl = null
            queryOrderPayPhoto(this.queryvoucher).then(response7 => {
              this.fileListvoucher = response7.data
            })
          },
          UploadUrl() {
            return this.url
          },
          infoshow(od_no) {
            this.$router.push({ name: 'ysordershow', params: { od_no: od_no }})
          },
          hrefChangeMm(row) {
            var mmsoptionsTemp = []
            for (var i = 0, l = this.mmsoptions.length; i < l; i++) {
              var optionsTemp = {
                id: null,
                truename: null,
                disabled: null
              }
              optionsTemp.id = this.mmsoptions[i].id
              optionsTemp.truename = this.mmsoptions[i].truename
              if (this.mmsoptions[i].id === row.od_mmid) {
                optionsTemp.disabled = true
              }
              mmsoptionsTemp.push(optionsTemp)
            }
            this.mmsoptions = mmsoptionsTemp
            this.changeMMInfo.dialogChangeMMStatus = 'create'
            this.changeMMInfo.od_no = row.od_no
            this.changeMMInfo.od_mmidOld = row.od_mmid
            this.changeMMInfo.od_product_item_id = row.od_product_item_id
            this.changeMMInfo.od_cityid = row.od_cityid
            this.changeMMnameShow = row.od_mmname
            this.changStartDateShow = row.od_startdate
            this.changeMMInfo.od_enddate = row.od_enddate
            this.changeMMInfo.od_mmid = null
            this.changeMMInfo.od_startdate = null
            this.dialogChangeMM = true
            this.fileListvoucher = []
            this.$nextTick(() => {
              this.$refs['changeMMForm'].clearValidate()
            })
          },
          getMMStock() {
            var queryStock = {}
            var dateTemp = new Date(this.changeMMInfo.od_startdate)
            queryStock.service_start = dateTemp.getFullYear() + '-' + (dateTemp.getMonth() + 1) + '-' + dateTemp.getDate()
            queryStock.days = this.changeMMInfo.od_product_item_id
            queryStock.status = 1
            queryStock.limit = 100
            queryStock.cityname = this.changeMMInfo.od_cityid
            queryStock.page = 1
            queryServiceUserStockCondition(queryStock).then(response => {
              this.changeoptions = response.data.items
            })
          },
          changeMMSave() {
            this.$refs['changeMMForm'].validate((valid) => {
              if (valid) {
                var checkChangeMM = {
                  servant_code: null,
                  stock_status: null,
                  start_date: null,
                  end_date: null
                }
                var dateTemp = new Date(this.changeMMInfo.od_startdate)
                checkChangeMM.servant_code = this.changeMMInfo.od_mmid
                checkChangeMM.start_date = dateTemp.getFullYear() + '-' + (dateTemp.getMonth() + 1) + '-' + dateTemp.getDate() + ' ' + dateTemp.getHours() + ':' + dateTemp.getMinutes() + ':' + dateTemp.getSeconds()
                checkChangeMM.end_date = this.changeMMInfo.od_enddate
                checkStockDate(checkChangeMM).then(response3 => {
                  if (response3.data === 1) {
                    this.buttonsaveloading = true
                    this.changeMMInfo.od_startdate = dateTemp.getFullYear() + '-' + (dateTemp.getMonth() + 1) + '-' + dateTemp.getDate() + ' ' + dateTemp.getHours() + ':' + dateTemp.getMinutes() + ':' + dateTemp.getSeconds()
                    this.changeMMInfo.od_userid = this.$store.getters.introduction
                    changMM(this.changeMMInfo).then(response => {
                      if (response.data === 1) {
                        this.buttonsaveloading = false
                        this.getList()
                        this.dialogChangeMM = false
                        createArticle(this.temp).then(() => {
                          this.$notify({
                            title: '成功',
                            message: '变更月嫂成功!',
                            type: 'success',
                            duration: 2000
                          })
                        })
                      } else if (response.data === 1) {
                        this.$message.error('该订单今天只能变更一次!')
                      } else {
                        createArticle(this.temp).then(() => {
                          this.$notify({
                            title: '失败',
                            message: '变更月嫂失败!',
                            type: 'warning',
                            duration: 2000
                          })
                        })
                      }
                      this.changeMMInfo.od_no = null
                      this.changeMMInfo.od_mmid = null
                      this.changeMMInfo.od_startdate = null
                      this.changeMMInfo.od_enddate = null
                      this.changeMMInfo.od_mmidOld = null
                      this.changeMMInfo.od_comment = null
                      this.changeMMInfo.od_userid = null
                    })
                  } else {
                    this.$message.error('该月嫂无档期!')
                  }
                })
              }
            })
          },
          returnSave() {
            this.$refs['returnForm'].validate((valid) => {
              if (valid) {
                if (this.returnInfo.od_refund > this.od_refundOld || this.returnInfo.od_refund <= 0) {
                  this.$message.error('退单金额不正确!')
                  this.returnInfo.od_refund = 0
                } else {
                  this.returnInfo.od_user = this.$store.getters.introduction
                  var date1 = new Date()
                  this.returnInfo.od_date = date1.getFullYear() + '-' + (date1.getMonth() + 1) + '-' + date1.getDate() + ' ' + date1.getHours() + ':' + date1.getMinutes() + ':' + date1.getSeconds()
                  this.buttonsaveloading = true
                  insertYSOrderReturn(this.returnInfo).then(response => {
                    this.buttonsaveloading = false
                    if (response.data === 1) {
                      this.getList()
                      this.dialogReturn = false
                      createArticle(this.temp).then(() => {
                        this.$notify({
                          title: '成功',
                          message: '退单成功!',
                          type: 'success',
                          duration: 2000
                        })
                      })
                    } else {
                      createArticle(this.temp).then(() => {
                        this.$notify({
                          title: '成功',
                          message: '退单成功!',
                          type: 'success',
                          duration: 2000
                        })
                      })
                    }
                    this.returnInfood_no = null
                    this.returnInfood_comment = null
                    this.returnInfood_date = null
                    this.returnInfood_userid = null
                    this.returnInfood_refund = null
                    this.returnInfood_consultantid = null
                  })
                }
              }
            })
          },
          checkStartDate() {
            var checkStartDateInfo = {
              od_no: null
            }
            checkStartDateInfo.od_no = this.changeMMInfo.od_no
            checkSLStartDate(checkStartDateInfo).then(response => {
              var date1 = new Date(response.data)
              date1.setDate(date1.getDate() + 1)
              var date2 = Date.parse(this.changeMMInfo.od_startdate)
              var diffDays = date1 - date2
              if (diffDays > 0) {
                this.$message.error('开始日期不能超过订单开始日期和变更月嫂的开始日期!')
                this.changeMMInfo.od_startdate = null
              }
            })
            this.getMMStock()
          },
          hrefReturn(row) {
            this.returnInfo.changeMMForm = 'create'
            this.returnInfo.od_no = row.od_no
            this.returnInfo.od_mmid = row.od_mmid
            this.returnInfo.od_consultantid = row.od_consultantid
            this.od_refundOld = row.od_order_amount
            this.returnCTNameShow = row.od_consultantname
            this.returnMMnameShow = row.od_mmname
            this.dialogReturn = true
            this.$nextTick(() => {
              this.$refs['returnForm'].clearValidate()
            })
          },
          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;
    }
    .el-checkbox.el-checkbox {
        margin-left: 30px;
    }
    .el-input-number .el-input__inner {
      text-align: right;
    }
    #moeny{
      float: right;
    }
    </style>
    