<style scoped>
    .customerDialogBox.add-box .add-tit {
        display: flex;
        justify-content: space-between;
        align-items: center;
        height: 20px;
    }
    
    .customerDialogBox.add-box .add-tit p {
        display: flex;
        align-items: center;
        font-weight: bold;
        color: rgba(17, 17, 17, 1);
        font-size: 14px;
    }
    
    .customerDialogBox.add-box .add-tit p span {
        display: inline-block;
        width: 6px;
        height: 6px;
        background: #409efe;
        border-radius: 50%;
        margin-right: 10px;
    }
    
    .customerDialogBox.add-box .el-dialog__header {
        padding: 15px 20px;
        background: rgba(255, 255, 255, 1);
    }
    
    .customerDialogBox.add-box .dialog-footer {
        text-align: center;
        background-color: rgba(248, 250, 251, 1);
        padding-bottom: 20px;
    }
    
    .customerDialogBox.add-box .el-dialog__footer {
        padding: 0;
    }
    
    .customerDialogBox.add-box .el-dialog__body {
        background-color: rgba(248, 250, 251, 1);
        padding-top: 20px;
        max-height: 500px;
        overflow: auto;
    }
    
    .customerDialogBox .add-box-btn.el-button {
        border-radius: 0;
        background-color: #409efecc;
        border-color: #409efecc;
        color: white;
        padding: 12px 43px;
    }
    
    .customerDialogBox .add-box-btn.el-button:hover {
        background-color: #409efe;
        border-color: #409efe;
        color: white;
    }
    
    .customerDialogBox .add-box-btn.el-button.add-box-cancel {
        color: #409efecc;
        background-color: white;
    }
    
    .customerDialogBox .add-box-btn.el-button.add-box-cancel:hover {
        color: #409efe;
        background-color: white;
    }
    
    .customerDialogBox .el-input .el-input-group__append {
        background-color: #409efe;
        border-color: #409efe;
        color: #fff;
    }
    
    .customerDialogBox .form-box .form-box-tit {
        display: flex;
        align-items: center;
        margin-bottom: 20px;
    }
    
    .customerDialogBox .form-box .radius {
        display: flex;
        width: 4px;
        height: 4px;
        background: rgba(255, 164, 117, 1);
        border-radius: 50%;
        margin-right: 10px;
    }
    
    .customerDialogBox .up-img-box .uib-item {
        margin-right: 30px;
        width: 120px;
        height: 120px;
        background-color: white;
        position: relative;
        margin-bottom: 30px;
    }
    
    .customerDialogBox .up-img-box .uib-item p {
        position: absolute;
        bottom: -30px;
        font-size: 12px;
        text-align: center;
        width: 100%;
    }
    
    .customerDialogBox .up-img-box .uib-item:hover .imgzhe-btn {
        opacity: 1;
    }
    
    .customerDialogBox .imgzhe {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
    }
    
    .customerDialogBox .imgzhe .imgzhe-btn {
        background: rgba(0, 0, 0, 0.6);
        width: 100%;
        height: 100%;
        text-align: center;
        line-height: 120px;
        position: absolute;
        top: 0;
        opacity: 1;
        transition: all linear 0.5s;
    }
    
    .customerDialogBox .imgzhe .imgzhe-btn i {
        font-size: 22px;
        margin-right: 5px;
        color: white;
        cursor: pointer;
    }
    
    .customerDialogBox .up-ctrl {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
    }
    
    .customerDialogBox .up-ctrl>div {
        width: 100%;
        height: 100%;
        text-align: center;
        line-height: 140px;
    }
    
    .el-upload-dragger {
        width: 100% !important;
    }
    
    .certificate-img-box {
        display: flex;
        flex-wrap: wrap;
    }
    
    .img-box {
        width: 100px;
        height: 100px;
        margin-right: 10px;
    }
    
    .form-box-log {
        border-left: 1px solid #E9E9E9;
    }
    
    .form-log-title {
        width: 100%;
        position: relative;
    }
    
    .form-log-text {
        display: flex;
        justify-content: space-between;
        margin-bottom: 10px;
    }
    
    .form-log-text span:first-child {
        color: #409efe;
        font-size: 15px;
    }
    
    .form-log-text span:last-child {
        color: #555;
    }
    
    .form-log-text,
    .form-log-center {
        padding: 0 0 0 20px;
    }
    
    .log-radius {
        position: absolute;
        width: 5px;
        height: 5px;
        left: -3px;
        border-radius: 100%;
        top: 15px;
        background: rgba(255, 164, 117, 1);
        border-radius: 50%;
        margin-right: 10px;
    }
    
    .form-log-center {
        margin-bottom: 20px;
        letter-spacing: 2px;
    }
    
    .Credentials-box {
        /* display: flex; */
    }
    
    .Credentials-box .el-image {
        width: 80px;
        height: 80px;
        margin-right: 10px;
        margin-bottom: 10px;
    }
    
    .Credentials-text {
        display: flex;
        align-items: flex-start;
    }
    
    .Credentialstext-box {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
    }
    
    .Credentialstext-box p {
        margin-bottom: 10px;
        color: #409efe;
    }
    
    .Credentialsimg-box {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .MultipleChoice-outerLayer {
        display: flex;
        flex-direction: column;
        margin-bottom: 20px;
        background: #fff;
    }
    
    .MultipleChoice-item {
        display: flex;
    }
    
    .MultipleChoice-item.bottom0 {
        margin-bottom: 0;
    }
    
    .MultipleChoice-OrderType {
        padding: 9px 19px 0 19px;
    }
    
    .el-form-item.MultipleChoice-OrderType {
        margin-bottom: 0 !important;
    }
    
    .MultipleChoice-left {}
    
    .MultipleChoice-left .el-checkbox-group {
        display: flex;
        flex-direction: column;
    }
    
    .MultipleChoice-left .el-checkbox-group .el-checkbox {
        flex: 1;
        padding: 30px 19px;
    }
    
    .MultipleChoice-right {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        padding: 15px 0 0 0;
    }
    
    .MultipleChoice-right-box {
        background: #fff;
        flex: 1;
        padding: 9px 19px;
        margin-bottom: 20px;
    }
    
    .MultipleChoice-right-box.active {
        background: #F5F7FA;
    }
    
    .MultipleChoice-right-box .el-form-item {
        margin-bottom: 0;
    }
    
    .combo-box {
        display: flex;
        justify-content: space-between;
    }
    
    .combo-center.active {
        background: #F5F7FA;
    }
    
    .combo-center {
        flex: 1;
        padding: 9px 19px 0 19px;
    }
    
    .combo-center:first-child {
        margin-right: 30px;
    }
</style>
<template>
      <el-dialog :visible.sync="dialogTableVisible" 
      @closed="closedDialog" 
      :close-on-click-modal="false" 
      class="add-box add-box1 customerDialogBox"
      :width="width">
          <div class="add-tit" slot="title">
              <p><span></span>{{name}}</p>
              <span icon="el-icon-close"></span>
          </div>
          <div class="form-box" v-if="show">
              <el-form :model="form" ref="form" class="MyEditForm" :rules="rules">
                  <p class="form-box-tit" v-if="name!='操作日志'&&name!='凭证图'"><span class="radius"></span>
                  {{name!='修改出票状态'?' 基本信息':' 上传'+text+'凭证'}}</p>
                  <el-row :gutter="30">
                    <el-col :span="8" v-if="name=='新建机票订单'||name=='编辑机票订单'">
                          <div class="MyEditForm-item">
                              <el-form-item label="预计人数" prop="GuestCount">
                                  <el-input placeholder="请输入预计人数" onkeyup="this.value=this.value.replace(/[^\d.]/g,'');" v-model="form.GuestCount"></el-input>
                              </el-form-item>
                          </div>
                      </el-col>
                      <el-col :span="8" v-if="name=='新建机票订单'||name=='编辑机票订单'">
                          <div class="MyEditForm-item">
                              <el-form-item label="出行概述" prop="StartCityName">
                                  <el-input placeholder="请输入出现时间、出发地、目的地" v-model="form.StartCityName"></el-input>
                              </el-form-item>
                          </div>
                      </el-col>
                      <!-- <el-col :span="8">
                          <div class="MyEditForm-item">
                              <el-form-item label="到达城市" prop="EndCityName">
                                  <el-input placeholder="请输入到达城市" v-model="form.EndCityName"></el-input>
                              </el-form-item>
                          </div>
                      </el-col> -->
                      <el-col :span="8" v-if="name=='新建机票订单'||name=='编辑订单金额'||name=='编辑机票订单'">
                          <div class="MyEditForm-item">
                              <el-form-item label="报价总金额" prop="Money">
                                  <el-input :value="form.Money" disabled></el-input>
                                  <!-- <el-input placeholder="请输入报价总金额" onkeyup="this.value=this.value.replace(/[^\d.]/g,'');" v-model="form.Money"></el-input> -->
                              </el-form-item>
                          </div>
                      </el-col>
                  </el-row>
                    <el-row :gutter="30" v-if="name=='新建机票订单'||name=='编辑订单金额'||name=='编辑机票订单'">
                        <el-col :span="24">
                            <div class="MultipleChoice-outerLayer">
                                <el-form-item class="MultipleChoice-OrderType" label="订单类型" prop="OrderType">
                                    <p style="opacity: 0;">{{form.OrderType}}</p>
                                </el-form-item>
                                <div class="MultipleChoice-item"> 
                                    <div class="MultipleChoice-left">
                                        <el-checkbox-group v-model="checkList" @change="clickMultipleChoice">
                                        <el-checkbox v-for="(item,index) in MultipleChoiceList" :key="index"
                                        :label="item.Id">{{item.Name}}</el-checkbox>
                                        </el-checkbox-group>
                                    </div>
                                    <div class="MultipleChoice-right">
                                        <div class="MultipleChoice-right-box"
                                            :class="AirTicketsShow?'active':''">
                                            <el-form-item label="机票金额" prop="TicketMoney">
                                                <el-input placeholder="请输入机票金额" onkeyup="this.value=this.value.replace(/[^\d.]/g,'');" 
                                                v-model="form.TicketMoney"
                                                :disabled="AirTicketsShow"></el-input>
                                            </el-form-item>
                                        </div>
                                        <div class="MultipleChoice-right-box"
                                            :class="visaShow?'active':''">
                                            <el-form-item label="签证金额" prop="VisaMoney">
                                                <el-input placeholder="请输入签证金额" onkeyup="this.value=this.value.replace(/[^\d.]/g,'');" 
                                                v-model="form.VisaMoney"
                                                :disabled="visaShow"></el-input>
                                            </el-form-item>
                                        </div>
                                        <div class="MultipleChoice-right-box"
                                            :class="groundShow?'active':''">
                                            <el-form-item label="地接金额" prop="DiJieMoney">
                                                <el-input placeholder="请输入地接金额" onkeyup="this.value=this.value.replace(/[^\d.]/g,'');" 
                                                v-model="form.DiJieMoney"
                                                :disabled="groundShow"></el-input>
                                            </el-form-item>
                                        </div>
                                        <div class="combo-box"
                                            >
                                            <div class="combo-center"
                                            :class="comboShow?'active':''">
                                                <el-form-item label="套餐金额" prop="MealMoney">
                                                    <el-input placeholder="请输入套餐金额" onkeyup="this.value=this.value.replace(/[^\d.]/g,'');" 
                                                    v-model="form.MealMoney"
                                                    :disabled="comboShow"></el-input>
                                                </el-form-item>
                                            </div>
                                            <div class="combo-center"
                                            :class="comboShow?'active':''">
                                                <el-form-item label="说明" prop="MealDescription"
                                                :rules="comboShow?[{ required: false}]:rules.MealDescription">
                                                    <el-input placeholder="请输入套餐说明" 
                                                    v-model="form.MealDescription"
                                                    :disabled="comboShow"></el-input>
                                                </el-form-item>
                                            </div>
                                        </div>
                                    </div>
                                </div> 
                            </div> 
                            
                        </el-col>
                    </el-row>
                  <el-row v-if="name=='新建机票订单'||name=='编辑订单金额'||name=='编辑机票订单'">
                      <el-col :span="24">
                          <div class="MyEditForm-item label-pad-left">
                              <el-form-item v-if="name=='新建机票订单'||name=='编辑机票订单'" label="备注">
                                  <el-input type="textarea" placeholder="订单备注" v-model="form.Remark"></el-input>
                              </el-form-item>
                              <el-form-item v-if="name=='编辑订单金额'" label="备注" prop="Remark">
                                  <el-input type="textarea" placeholder="订单备注" v-model="form.Remark"></el-input>
                              </el-form-item>
                          </div>
                      </el-col>
                  </el-row>
                  <el-row v-if="name=='修改出票状态'">
                    <el-col v-if="obj.TicketStatus==2" :span="24">
                      <div class="MyEditForm-item">
                        <el-form-item label="出票状态" prop="Type">
                            <el-radio-group v-model="form.Type">
                              <el-radio v-for="(item,index) in radioList"
                              @change="radioChange"
                              :key="index"
                              :label="item.id">{{item.name}}</el-radio>
                          </el-radio-group>
                        </el-form-item> 
                      </div>
                    </el-col>
                    <el-col :span="24">
                      <div class="MyEditForm-item">
                        <el-form-item label="凭证/图片" prop="">
                          <div class="certificate-img-box">
                            <div class="img-box" v-for="(item,index) in form.Voucher" :key="index">
                                <el-image 
                                  style="width: 100px; height: 100px"
                                  :src="item" 
                                  :preview-src-list="form.Voucher">
                                </el-image>
                              </div>
                          </div>    
                        </el-form-item> 
                      </div>
                    </el-col>
                    <el-col :span="24">
                      <div class="MyEditForm-item">
                        <el-form-item label="上传图片" prop="Voucher">
                            <el-upload
                              ref="ticketUpload"
                              class="upload-demo"
                              drag
                              action=""
                              :file-list="fileList"
                              :http-request="uploadImg"
                              :multiple="true"
                              accept="image/jpeg,image/gif,image/png,image/bmp"
                              :on-success="handleAvatarSuccess"
                              >
                              <i class="el-icon-upload"></i>
                              <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
                              <!-- <div class="el-upload__tip" slot="tip">只能上传jpg/png文件，且不超过500kb</div> -->
                          </el-upload>
                        </el-form-item> 
                          
                      </div>
                      
                    </el-col>
                  </el-row>
                  <el-row v-if="name=='订单转交'">
                       <el-col>
                          <div class="MyEditForm-item">
                              <el-form-item label="转交业务员" prop="EnterId">
                                <el-select 
                                  size="mini"
                                  filterable
                                  v-model="form.EnterId" 
                                  clearable
                                  placeholder="请选择业务员">
                                      <el-option 
                                          v-for="item in EmployeeList"
                                          :label='item.EmName'
                                          :value='item.EmployeeId'
                                          :key='item.EmployeeId'>
                                      </el-option>
                                  </el-select>
                                  <!-- <el-input placeholder="请输入转交人id" onkeyup="this.value=this.value.replace(/[^\d.]/g,'');" v-model="form.EnterId"></el-input> -->
                              </el-form-item>
                          </div>
                      </el-col>
                  </el-row>
              </el-form>
              <div v-if="name=='凭证图'" class="Credentials-box">
                <div class="Credentials-text">
                  <div class="Credentialstext-box">
                    <p>熔断凭证</p>
                    <div class="Credentialsimg-box">
                      <el-image v-for="(items,index) in obj.CancelVoucherList" :key="index"
                      :src="domainManager().ViittoFileUrl+items"></el-image>
                    </div>
                    
                  </div>
                  <div class="Credentialstext-box">
                    <p>取消凭证</p>
                    <div class="Credentialsimg-box">
                      <el-image v-for="(items,index) in obj.TicketVoucherList" :key="index"
                      :src="domainManager().ViittoFileUrl+items">
                      </el-image>
                    </div>
                    
                  </div>
                </div>
              </div>
              <div v-if="name=='操作日志'">
                <div v-for="(item,index) in logData" :key="index">
                  <div class="form-box-log">
                    <div class="form-log-title">
                      <span class="log-radius"></span>
                      <div class="form-log-text">
                        <span>
                          {{item.CreateByName}}
                        </span>
                        <span>
                          {{item.CreateTime}}
                        </span>
                      </div>
                    </div>
                    <div class="form-log-center">
                      {{item.LogContent}}
                    </div>
                  </div>
                </div>
              </div>
              
              <div v-if="total>0">
                <el-pagination class="Mypagination" background @current-change="handleCurrentChange"
                    :page-sizes="[10, 20, 60, 90, 100]" :page-size="msg.pageSize" layout="sizes, prev, pager, next"
                    @size-change="handleSizeChange" :total="total">
                </el-pagination>
            </div>
          </div>
          <div slot="footer" class="dialog-footer">
              <el-button type="primary" class="add-box-btn" @click="submitForm('form')">确 定</el-button>
              <el-button class="add-box-btn add-box-cancel" @click="dialogTableVisible = false, resetForm('form')">取 消</el-button>
          </div>
      </el-dialog>
  </template>
<script>
    export default {
        props: {
            ID: {
                type: Number,
                default: 0
            },
            name: {
                type: String,
                default: ""
            },
            CustomerId: {
                type: Number,
                default: 0
            },
            GuestId: {
                type: Number,
                default: 0
            },
            OrderId: {
                type: String,
                default: ""
            },
            obj: {
                type: Object,
                default: {}
            }
        },
        data() {
            return {
                comboShow: true,
                groundShow: true,
                visaShow: true,
                AirTicketsShow: true,
                checkList: [], //已选存储
                MultipleChoiceList: [ //多选项目
                    {
                        Name: '机票',
                        Id: '1'
                    }, {
                        Name: '签证',
                        Id: '2'
                    }, {
                        Name: '地接',
                        Id: '3'
                    }, {
                        Name: '套餐',
                        Id: '4'
                    }
                ],
                EmployeeList: [],
                width: "",
                logData: [],
                total: 0,
                msg: {
                    pageIndex: 1,
                    pageSize: 10,
                    OrderId: "",
                },
                Voucher: [],
                fileList: [],
                radioList: [{
                    name: '航班熔断',
                    id: '3'
                }, {
                    name: '用户取消航班',
                    id: '4'
                }, ],
                text: '',
                CustomerList: [],
                LineList: [],
                LineTeamList: [],
                dialogTableVisible: false,
                form: {
                    OrderId: 0,
                    GuestId: null,
                    GuestCount: 1,
                    StartCityName: "",
                    EndCityName: "",
                    Money: null,
                    Remark: "",
                    Type: "",
                    Voucher: [],
                    EnterId: "",
                    OrderType: "", //类型
                    MealDescription: "", //说明
                    TicketMoney: 0, //机票应收
                    VisaMoney: 0, //签证应收
                    DiJieMoney: 0, //地接应收
                    MealMoney: 0, //套餐应收
                },
                BusinessStatusEnum: [],
                rules: {
                    GuestCount: [{
                        required: true,
                        message: "请选择客户",
                        trigger: "change"
                    }, ],
                    StartCityName: [{
                        required: true,
                        message: "请输入出现时间、出发地、目的地",
                        trigger: "blur"
                    }, ],
                    // EndCityName: [
                    //   { required: true, message: "请输入到达城市", trigger: "blur" },
                    // ],
                    Money: [{
                        required: true,
                        message: "请在勾选的类型后面里输入金额",
                        trigger: "change"
                    }, ],
                    Remark: [{
                        required: true,
                        message: "请输入备注",
                        trigger: "blur"
                    }],
                    Type: [{
                        required: true,
                        message: "选择出票状态",
                        trigger: "change"
                    }, ],
                    Voucher: [{
                        required: true,
                        message: "上传凭据",
                        trigger: "blur"
                    }],
                    EnterId: [{
                        required: true,
                        message: "请选择转交人",
                        trigger: "blur"
                    }],
                    OrderType: [{
                        required: true,
                        message: "请选择订单类型",
                        trigger: "blur"
                    }],
                    MealDescription: [{
                        required: true,
                        message: "请输入套餐说明",
                        trigger: "blur"
                    }],
                    MealMoney: [{
                        required: true,
                        message: "请输入套餐金额",
                        trigger: "blur"
                    }],
                    TicketMoney: [{
                        required: true,
                        message: "请输入机票金额",
                        trigger: "blur"
                    }],
                    VisaMoney: [{
                        required: true,
                        message: "请输入签证金额",
                        trigger: "blur"
                    }],
                    DiJieMoney: [{
                        required: true,
                        message: "请输入地接金额",
                        trigger: "blur"
                    }],
                },
                show: true,
            };
        },
        computed: {

        },
        watch: {
            ID: {
                handler(val, oldVal) {

                },
                deep: true,
            },
            GuestId: {
                handler(val, oldVal) {
                    this.form.GuestId = val
                },
                deep: true,
            },
            CustomerId: {
                handler(val, oldVal) {

                },
                deep: true,
            },
            obj: {
                handler(val, oldVal) {
                    if (this.name == '操作日志') {
                        this.getList()
                    }
                },
                deep: true,
            },
            form: {
                handler(val, oldVal) {
                    // console.log(val.MealMoney, '---')
                    val.TicketMoney = val.TicketMoney - 0
                    val.VisaMoney = val.VisaMoney - 0
                    val.DiJieMoney = val.DiJieMoney - 0
                    val.MealMoney = val.MealMoney - 0
                    this.form.Money = val.MealMoney + val.TicketMoney + val.VisaMoney + val.DiJieMoney
                },
                deep: true,
            },
        },
        mounted() {
            this.form.GuestId = this.GuestId
            if (this.name == "编辑机票订单") {
                this.checkList = this.obj.OrderType.split(',')
                if (this.obj.OrderType.indexOf(1) != -1) {
                    this.AirTicketsShow = false
                } else {
                    this.AirTicketsShow = true
                }
                if (this.obj.OrderType.indexOf(2) != -1) {
                    this.visaShow = false
                } else {
                    this.visaShow = true
                }
                if (this.obj.OrderType.indexOf(3) != -1) {
                    this.groundShow = false
                } else {
                    this.groundShow = true
                }
                if (this.obj.OrderType.indexOf(4) != -1) {
                    this.comboShow = false
                } else {
                    this.comboShow = true
                }
                this.form = {
                    GuestId: this.GuestId,
                    OrderId: this.obj.OrderId,
                    GuestCount: this.obj.GuestCount,
                    StartCityName: this.obj.StartCityName,
                    EndCityName: this.obj.EndCityName,
                    Money: this.obj.Money,
                    Remark: this.obj.Remark,
                    OrderType: this.obj.OrderType, //类型
                    MealDescription: this.obj.MealDescription, //说明
                    TicketMoney: this.obj.TicketMoney, //机票应收
                    VisaMoney: this.obj.VisaMoney, //签证应收
                    DiJieMoney: this.obj.DiJieMoney, //地接应收
                    MealMoney: this.obj.MealMoney, //套餐应收
                }

            }
            if (this.obj.TicketStatus == 1) {
                this.text = '出票'
            }
            if (this.name == '操作日志') {
                this.width = "600px"
                this.getList()
            }
            if (this.name == '订单转交') {
                this.width = "400px"
                this.Employee()
            }
            if (this.name == '编辑订单金额') {
                this.width = "600px"
            }
            if (this.name == '凭证图') {
                this.width = "600px"
            }
            let $this = this;
            setTimeout(() => {
                $this.dialogTableVisible = true;
            }, 50);
        },
        methods: {
            // 多选发生变化
            clickMultipleChoice() {
                if (this.checkList.length > 0) {

                    if (this.checkList.slice(-1)[0] == 4) {
                        this.delType(1)
                        this.delType(2)
                        this.delType(3)
                        this.AirTicketsShow = true
                        this.visaShow = true
                        this.groundShow = true
                        this.comboShow = false
                        this.form.TicketMoney = 0
                        this.form.VisaMoney = 0
                        this.form.DiJieMoney = 0
                    } else {
                        this.delType(4)
                        this.checkList.forEach(item => {
                            if (item == '1') {
                                this.AirTicketsShow = false
                            }
                            if (item == '2') {
                                this.visaShow = false
                            }
                            if (item == '3') {
                                this.groundShow = false
                            }
                        });
                        if (this.checkList.indexOf('1') == -1) {
                            this.AirTicketsShow = true
                            this.form.TicketMoney = 0
                        }
                        if (this.checkList.indexOf('2') == -1) {
                            this.visaShow = true
                            this.form.VisaMoney = 0
                        }
                        if (this.checkList.indexOf('3') == -1) {
                            this.groundShow = true
                            this.form.DiJieMoney = 0
                        }
                        if (this.checkList.indexOf('4') == -1) {
                            this.comboShow = true
                            this.form.MealMoney = 0
                            this.form.MealDescription = ""
                        }
                    }

                    this.form.OrderType = this.checkList.join(',')
                } else if (this.checkList.length == 0) {
                    this.AirTicketsShow = true
                    this.visaShow = true
                    this.groundShow = true
                    this.comboShow = true
                    this.form.TicketMoney = 0
                    this.form.VisaMoney = 0
                    this.form.DiJieMoney = 0
                    this.form.MealMoney = 0
                    this.form.MealDescription = ""
                    this.form.OrderType = ""
                }

            },
            // 删除套餐值
            delType(item) {
                for (let i = 0; i < this.checkList.length; i++) {
                    if (this.checkList[i] == item) {
                        this.checkList.splice(i, 1)
                    }
                }
            },
            // 获取业务员
            Employee() {
                let userInfo = this.getLocalStorage();
                let msg = {
                    RB_Group_id: userInfo.RB_Group_id,
                    BranchId: -1,
                    DepartmentId: 0,
                    PostId: 0,
                    IsLeave: 0,
                };
                this.apipost2(
                    "admin_get_EmployeeGetList",
                    msg,
                    (res) => {
                        if (res.data.resultCode == 1) {
                            this.EmployeeList = res.data.data;
                        } else {}
                    },
                    (err) => {}
                );
            },
            closedDialog() {
                this.MsgBus.$emit("closeTicketOrderDialogBox");
            },
            // 操作日志
            getList() {
                if (this.name == '操作日志') {
                    this.msg.OrderId = this.obj.OrderId

                }
                this.apipost("/api/Order/GetOrderLogPageList", this.msg, (res) => {
                    if (res.data.resultCode == 1) {
                        this.logData = res.data.data.pageData
                        this.total = res.data.data.count
                    } else {
                        this.$message.error(res.data.message);
                    }
                });
            },
            //上传文件后清空文件队列
            handleAvatarSuccess(res, file) {
                this.$refs.ticketUpload.clearFiles();
                if (res.resultCode == 1) {
                    this.Success(res.message);
                }
            },
            //上传图片
            uploadImg(file) {
                let newArr = [];
                newArr.push(file.file);
                let path = "/Upload/Temporary/";
                this.UploadSelfFileT(path, newArr, (x) => {
                    let url = this.domainManager().ViittoFileUrl + x.data.FilePath;
                    let data = x.data.FilePath
                        // this.form.Voucher.push({
                        //   name: file.file.name,
                        //   url: url,
                        //   size: (file.file.size / 1024).toFixed(2) + "kb",
                        // });
                    this.Voucher.push(data)
                    this.form.Voucher.push(url);
                });
            },
            radioChange() {
                if (this.form.Type == '3') {
                    this.text = '航班熔断'
                }
                if (this.form.Type == '4') {
                    this.text = '用户取消航班'
                }
            },
            // 修改订单状态
            reviseData() {
                if (this.obj.TicketStatus == 1) {
                    this.form.Type = '2'
                }
                if (this.obj.OrderId) {
                    this.form.OrderId = this.obj.OrderId
                }
                let data = {
                    OrderId: this.form.OrderId,
                    Type: this.form.Type,
                    Voucher: this.Voucher
                }
                this.apipost("/api/Order/SetGuestOrderState", data, (res) => {
                    if (res.data.resultCode == 1) {
                        this.dialogTableVisible = false;
                        this.$message.success("操作成功");
                        this.MsgBus.$emit("closeTicketOrderDialogBox");
                        this.MsgBus.$emit("closeGetList");
                        this.resetForm("form");
                    } else {
                        this.$message.error(res.data.message);
                    }
                });
            },
            // 编辑金额
            editData() {
                if (this.obj.OrderId) {
                    this.form.OrderId = this.obj.OrderId
                }
                let data = {
                    OrderId: this.form.OrderId,
                    Money: this.form.Money,
                    Remark: this.form.Remark
                }
                this.apipost("/api/Order/SetGuestOrderMoney", data, (res) => {
                    if (res.data.resultCode == 1) {
                        this.dialogTableVisible = false;
                        this.$message.success("操作成功");
                        this.MsgBus.$emit("closeTicketOrderDialogBox");
                        this.MsgBus.$emit("closeGetList");
                        this.resetForm("form");
                    } else {
                        this.$message.error(res.data.message);
                    }
                });
            },
            // 新增订单
            addData() {
                if (this.checkList.indexOf('1') != -1 || this.checkList.indexOf('2') != -1 || this.checkList.indexOf('3') != -1 || this.checkList.indexOf('4') != -1) {
                    if (this.checkList.indexOf('1') != -1 && this.form.TicketMoney <= 0) {
                        this.$message({
                            type: 'warning',
                            message: '机票金额请输入大于0的金额!'
                        });
                        return
                    }
                    if (this.checkList.indexOf('2') != -1 && this.form.VisaMoney <= 0) {
                        this.$message({
                            type: 'warning',
                            message: '签证金额请输入大于0的金额!'
                        });
                        return
                    }
                    if (this.checkList.indexOf('3') != -1 && this.form.DiJieMoney <= 0) {
                        this.$message({
                            type: 'warning',
                            message: '地接金额请输入大于0的金额!'
                        });
                        return
                    }
                    if (this.checkList.indexOf('4') != -1 && this.form.MealMoney <= 0) {
                        this.$message({
                            type: 'warning',
                            message: '套餐金额请输入大于0的金额!'
                        });
                        return
                    }
                }
                let data
                if (this.name == '新建机票订单') {
                    data = {
                        OrderId: this.form.OrderId,
                        GuestId: this.form.GuestId,
                        GuestCount: this.form.GuestCount,
                        StartCityName: this.form.StartCityName,
                        EndCityName: this.form.EndCityName,
                        Money: this.form.Money,
                        Remark: this.form.Remark,
                        OrderType: this.form.OrderType, //类型
                        MealDescription: this.form.MealDescription, //说明
                        TicketMoney: this.form.TicketMoney, //机票应收
                        VisaMoney: this.form.VisaMoney, //签证应收
                        DiJieMoney: this.form.DiJieMoney, //地接应收
                        MealMoney: this.form.MealMoney, //套餐应收
                    }
                }
                if (this.name == '编辑机票订单') {
                    data = {
                        OrderId: this.form.OrderId,
                        GuestId: this.form.GuestId,
                        GuestCount: this.form.GuestCount,
                        StartCityName: this.form.StartCityName,
                        EndCityName: this.form.EndCityName,
                        Money: this.form.Money,
                        Remark: this.form.Remark,
                        OrderType: this.form.OrderType, //类型
                        MealDescription: this.form.MealDescription, //说明
                        TicketMoney: this.form.TicketMoney, //机票应收
                        VisaMoney: this.form.VisaMoney, //签证应收
                        DiJieMoney: this.form.DiJieMoney, //地接应收
                        MealMoney: this.form.MealMoney, //套餐应收
                    }
                }
                this.apipost("/api/Order/SetGuestOrderInfo", data, (res) => {
                    if (res.data.resultCode == 1) {
                        this.dialogTableVisible = false;
                        this.$message.success("操作成功");
                        this.MsgBus.$emit("closeTicketOrderDialogBox");
                        this.MsgBus.$emit("closeGetList");
                        this.checkList = []
                        this.AirTicketsShow = true
                        this.visaShow = true
                        this.groundShow = true
                        this.comboShow = true
                        this.resetForm("form");
                    } else {
                        this.$message.error(res.data.message);
                    }
                });
            },
            ConvertData() {
                if (this.obj.OrderId) {
                    this.form.OrderId = this.obj.OrderId
                }
                let data = {
                    OrderId: this.form.OrderId,
                    EnterId: this.form.EnterId,
                }
                this.apipost("/api/Order/SetGuestOrderCareOf", data, (res) => {
                    if (res.data.resultCode == 1) {
                        this.dialogTableVisible = false;
                        this.$message.success("操作成功");
                        this.MsgBus.$emit("closeTicketOrderDialogBox");
                        this.MsgBus.$emit("closeGetList");
                        this.resetForm("form");
                    } else {
                        this.$message.error(res.data.message);
                    }
                });
            },
            submitForm(addMsg) {
                //提交创建、修改表单
                if (this.name == '新建机票订单' || this.name == '编辑机票订单') {
                    this.$refs[addMsg].validate((valid) => {
                        if (valid) {
                            this.addData();
                        } else {
                            return false;
                        }
                    });
                }
                if (this.name == '编辑订单金额') {
                    this.$refs[addMsg].validate((valid) => {
                        if (valid) {
                            this.editData();
                        } else {
                            return false;
                        }
                    });
                }
                if (this.name == '修改出票状态') {
                    this.$refs[addMsg].validate((valid) => {
                        if (valid) {
                            this.reviseData();
                        } else {
                            return false;
                        }
                    });
                }
                if (this.name == '操作日志') {
                    this.dialogTableVisible = false;
                    this.MsgBus.$emit("closeTicketOrderDialogBox");
                }
                if (this.name == '订单转交') {
                    this.$refs[addMsg].validate((valid) => {
                        if (valid) {
                            this.ConvertData();
                        } else {
                            return false;
                        }
                    });
                }

            },
            resetForm(formName) {
                this.dialogTableVisible = false;
                this.MsgBus.$emit("closeTicketOrderDialogBox");
                // 重置表单
                this.form = {
                    OrderId: 0,
                    GuestId: null,
                    GuestCount: 1,
                    StartCityName: "",
                    EndCityName: "",
                    Money: null,
                    Remark: "",
                    EnterId: ""
                };
                this.$refs[formName].resetFields();
            },
            handleSizeChange(val) {
                this.msg.pageSize = val;
                this.getList();
            },
            handleCurrentChange(val) {
                this.msg.pageIndex = val;
                this.getList();
            },
        },
    };
</script>