<style scoped>
  .commonOrderForm {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    overflow: auto;
    /* max-height: 300px; */
    border-top: 3px solid #38425d;
    background-color: #ffffff;
    padding: 10px 10px 0;
    width: 100%;
    padding: 20px 20px 10px 80px;
  }

  .title {
    border-left: 3px solid #e95252;
    text-indent: 15px;
    height: 16px;
    font-family: "PingFangSc-Fine";
    font-size: 16px;
    margin-bottom: 20px;
    line-height: 14px;
    color: #000;
  }

  .passengerSaleList_table {
    width: 100%;
    color: #333;
    border-bottom: 1px solid #cccccc;
    border-right: 1px solid #cccccc;
  }

  .passengerSaleList_table tr {
    background: #fff;
  }

  .passengerSaleList_table tr th {
    background: #e6e6e6;
    height: 30px;
    font-size: 12px;
    text-align: center;
    border-top: 1px solid #cccccc;
    border-left: 1px solid #cccccc;
  }

  .passengerSaleList_table tr td {
    padding: 10px 10px 25px 10px;
    font-size: 12px;
    text-align: center;
    border-top: 1px solid #cccccc;
    border-left: 1px solid #cccccc;
  }

</style>
<!--下单表单-->
<template>
  <div class="commonOrderForm" :style="{ height: ScreenHeight }">
    <p class="title">
      {{ $t("salesModule.SignImdi") }} &nbsp;<span
        style="color:red;font-weight:bold;">{{$t('objFill.lianyunxxqtxm')}}</span>
      <span v-if="crmOrderObj">
        <span style="color: red">{{$t('objFill.yinliuren')}}：{{ crmOrderObj.LureEmpNmae }} </span>
        <span style="color: #2aaef2">/{{$t('objFill.keren')}}：{{ crmOrderObj.CRMGuestName }}</span>
      </span>
      <span class="fr">
        <el-button class="hollowFixedBtn" @click="cancelSubmit()">{{$t('pub.cancelBtn')}}</el-button>
        <el-button type="primary" class="normalBtn" @click="submitForm('addMsg')" :loading="saveLoading">
          {{$t('salesModule.SignImdi')}}
        </el-button>
      </span>
    </p>
    <el-form :model="addMsg" ref="addMsg" label-position="right" :rules="rules" label-width="110px">
      <el-row :gutter="20">
        <el-col :span="4">
          <!-- 客户类型 -->
          <el-form-item :label="$t('fnc.khleixing')" prop="CustomerType">
            <el-select v-model="addMsg.CustomerType" filterable :placeholder="$t('pub.pleaseSel')" @change="
                resetMsg(addMsg.CustomerType);
                getTypePrice();
                resetSelect();
                getClientSource();
                getCustomer();
                getTotalPrice();
                changeCustomer();
              ">
              <el-option v-for="item in customerTypeList" :label="item.Name" :value="item.Id" :key="item.Id">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="4" v-if="pagesTitle != '当地游产品'">
          <!-- 参团类型 -->
          <el-form-item :label="$t('fnc.ctleixing')" prop="GroupType">
            <el-select v-model="addMsg.GroupType"
              @change="changeGroupType(addMsg.GroupType),GetAutoCouponOrder(),getUserCouponList()" filterable
              :placeholder="$t('pub.pleaseSel')">
              <el-option v-for="item in joinTypeList" :label="item.Name" :value="item.Id" :key="item.Id">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="4" v-if="addMsg.GroupType == '3'">
          <!--自由行占床不占床0-占床，1-不占床-->
          <el-form-item :label="$t('salesModule.IsUseRoom')" prop="GroupTypeNeedHouse">
            <el-switch v-model="addMsg.GroupTypeNeedHouse" active-value="0" inactive-value="1"></el-switch>
          </el-form-item>
        </el-col>
        <el-col :span="4" v-if="addMsg.CustomerType == 3 || addMsg.CustomerType == 4">
          <!--联系人-->
          <el-form-item :label="$t('hotel.suplier_contact')" prop="ContactName">
            <el-input v-model="addMsg.ContactName"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="4" v-if="addMsg.CustomerType == 3 || addMsg.CustomerType == 4">
          <!--联系电话-->
          <el-form-item :label="$t('restaurant.res_ContactNumber')" prop="ContactMobile">
            <el-input v-model="addMsg.ContactMobile" maxlength="20"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="4" v-if="
            addMsg.CustomerType == 1 ||
            addMsg.CustomerType == 2 ||
            addMsg.CustomerType == ''
          ">
          <!--同行Id-->
          <el-form-item :label="$t('salesModule.CustomerStore')" prop="CustomerId">
            <el-select v-model="addMsg.CustomerId" filterable :placeholder="$t('pub.pleaseSel')"
              @change="changeCustomer(),GetAutoCouponOrder()">
              <el-option v-for="(item, index) in customerList" :label="item.customerName + '-' + item.contact"
                :value="item.customerId" :key="index">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="4" v-show="addMsg.GroupType == 2">
          <!--行业-->
          <el-form-item :label="$t('salesModule.HYLB')" prop="IndustryCategory">
            <el-input v-model="addMsg.IndustryCategory"></el-input>
          </el-form-item>
        </el-col>
        <template v-if="showCity && pagesTitle == '跟团游产品'">
          <el-col :span="4">
            <!--出发城市  -->
            <el-form-item :label="$t('system.table_goCity')" prop="DepartureCityId">
              <el-select v-model="addMsg.DepartureCityId" filterable :placeholder="$t('pub.pleaseSel')"
                @change="addMsg.IsIntermodal = 2">
                <el-option v-for="item in startCityList" :label="item.Name" :value="item.ID" :key="item.ID">
                </el-option>
              </el-select>
            </el-form-item>

          </el-col>
          <el-col :span="4">
            <!--出发是否联运 -->
            <el-form-item :label="$t('salesModule.goUnion')" prop="IsIntermodal">
              <el-switch v-model="addMsg.IsIntermodal" active-value="1" inactive-value="2"
                @change="getUnionTravelPrice(priceObj, 1)"></el-switch>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <!--联运时间-->
            <el-form-item :label="$t('salesModule.LYtime')" prop="GoCityTime" v-show="
                addMsg.IsIntermodal == 1
              ">
              <el-date-picker :picker-options="pickerOptions0" v-model="addMsg.GoCityTime" value-format="yyyy-MM-dd"
                type="date" @change="getUnionTravelPrice(priceObj, 1)"></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <!--返回城市-->
            <el-form-item :label="$t('salesModule.BackCity')" prop="ReturnArriveCityId">
              <el-select v-model="addMsg.ReturnArriveCityId" filterable :placeholder="$t('pub.pleaseSel')"
                @change="addMsg.IsReturnIntermodal = 2">
                <el-option v-for="item in startCityList" :label="item.Name" :value="item.ID" :key="item.ID">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <!--返程是否联运-->
            <el-form-item :label="$t('salesModule.backUnion')" prop="IsReturnIntermodal">
              <el-switch v-model="addMsg.IsReturnIntermodal" active-value="1" inactive-value="2"
                @change="getUnionTravelPrice(priceObj, 2)"></el-switch>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <!--返程联运时间-->
            <el-form-item :label="$t('salesModule.backUnionTime')" prop="IsReturnIntermodal" v-show="
                addMsg.IsReturnIntermodal == 1">
              <el-date-picker :picker-options="pickerOptions1" v-model="addMsg.BackCityTime" value-format="yyyy-MM-dd"
                type="date" @change="getUnionTravelPrice(priceObj, 2)"></el-date-picker>
            </el-form-item>
          </el-col>
        </template>
        <el-col :span="4">
          <!--prop="TC_Price"-->
          <el-form-item :label="$t('salesModule.TeamPrice')">
            <template v-if="addMsg.GroupType==4">
              <el-input v-model="SingleDMCPricex" :disabled="true" @input="getTotalPrice()"></el-input>
            </template>
            <template v-else-if="addMsg.GroupType==5">
              <el-input v-model="SingleAirticketMoney" :disabled="true" @change="getTotalPrice()"></el-input>
            </template>
            <template v-else>
              <el-input v-model="addMsg.TC_Price" :disabled="pagesTitle == '跟团游产品' ? false : true"
                @input="getTotalPrice()">
              </el-input>
            </template>
          </el-form-item>
        </el-col>
        <!--&& addMsg.DepartureCityId != priceObj.StartCityID-->
        <el-col :span="4" v-show="
            addMsg.IsIntermodal == 1
          ">
          <el-form-item :label="$t('salesModule.StartLY')">
            <el-input v-model="stratPrice" v-show="stratPriceShow" :disabled="true"></el-input>
            <span class="colorE95252" v-show="!stratPriceShow">{{ $t("pub.NoPrice") }}！</span>
          </el-form-item>
        </el-col>
        <!--&&addMsg.ReturnArriveCityId != priceObj.ReturnArriveCityId-->
        <el-col :span="4" v-show="
            addMsg.IsReturnIntermodal == 1
          ">
          <el-form-item :label="$t('salesModule.BackLY')">
            <el-input v-model="returnPrice" v-show="returnPriceShow" :disabled="true"></el-input>
            <span class="colorE95252" v-show="!returnPriceShow">{{ $t("pub.NoPrice") }}！</span>
          </el-form-item>
        </el-col>
        <el-col :span="4" v-if="HightUnitPrice === '2'">
          <el-form-item :label="$t('fnc.cjdanjia')" prop="Unit_Price">
            <el-select v-model="addMsg.Unit_Price" filterable :placeholder="$t('pub.pleaseSel')"
              @change="getTotalPrice(2)">
              <el-option v-for="item in Unit_PriceList" :label="item.LessMoney" :value="item.ID" :key="item.ID">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="4" v-else>
          <!--成交单价-->

          <el-form-item :label="$t('fnc.cjdanjia')" prop="Unit_Price">
            <template v-if="addMsg.GroupType == 4">
              <el-input v-model="SingleDMCPrice" @change="getTotalPrice(3)"></el-input>
            </template>
            <template v-else-if="addMsg.GroupType == 5">
              <el-input v-model="SingleAirticketMoney" @change="getTotalPrice(3)"></el-input>
            </template>
            <template v-else>
              <el-input v-model="addMsg.Unit_Price" @change="getTotalPrice(3)"> </el-input>
            </template>
          </el-form-item>
        </el-col>
        <el-col :span="4" v-show="addMsg.GroupType != '4'">
          <!--高于本团单价-->
          <el-form-item :label="$t('salesModule.UpTeamPrice')">
            <el-switch v-model="HightUnitPrice" active-value="1" inactive-value="2"></el-switch>
            <!--少价金额-->
            <p v-if="LessMoney == 0" style="line-height: 18px; color: #e95252">
              {{ $t("salesModule.Notice1") }}
            </p>
            <p v-else-if="LessMoney > 0" style="line-height: 18px; color: #e95252">
              {{ $t("salesModule.Notice2") }}{{ LessMoney
              }}{{ $t("salesModule.Notice3") }}
            </p>
          </el-form-item>
        </el-col>
        <el-col :span="4" style="text-align: right;">
          <span v-if="couponData" style="color: green;">
            {{$t('objFill.youhuihuod')}}: {{couponData.CouponsName}}
            {{$t('active.cl_man')}}{{couponData.yuankeyong}}{{$t('op.youhuihuod')}}
            <template v-if="couponData.CouponsType==1">{{$t('active.cl_dyquan')}}</template>
            <template v-if="couponData.CouponsType==2">{{$t('active.cl_zkquan')}}</template>
            {{couponData.Denomination}}
          </span>
          <span v-else style="color: red;">
            {{$t('objFill.dangqianbmbcyhd')}}
          </span>
        </el-col>
        <el-col :span="4" v-if="(addMsg.GroupType==1||addMsg.GroupType==2)&&couponList&&couponList.length>0">
          <el-form-item :label="$t('active.ad_yhq')" prop="">
            <el-select v-model="DiscountAmountId" :placeholder="$t('objFill.xuanzheyhq')" @change="getDiscountAmount"
              clearable>
              <el-option v-for="item in couponList" :label="item.couponName" :value="item.id" :key="item.id"
                :disabled="expiredTime(item)">
                <span>
                  <!-- 名称： -->
                  <span style="color: sandybrown;">{{item.couponName}}</span>
                </span>
                <span>
                  / <span
                    style="color: sandybrown;">{{item.couponsType==1?$t('active.cl_dyquan'):$t('objFill.zhekequan')}}</span>
                </span>
                <span style="margin-left: 10px;margin-right: 10px;">
                  {{$t('active.cl_man')}}
                  <span style="color:sandybrown;">{{item.useCondition}}</span>
                  {{$t('active.cl_keyong')}}
                </span>
                <!-- <span style="color: #E6A23C;">
                {{item.expirationDate}}失效
              </span> -->
              </el-option>
            </el-select>
            <span v-if="CalculationPreference()" style="color: red;">
              {{$t('fnc.youhui')}} {{addMsg.PreferPrice-CalculationPreference()}} {{$t('hotel.hotel_yuan')}}
            </span>
          </el-form-item>
          <!-- <div v-for="(x,index) in couponList">
            <span>{{$t('admin.mane')}}：{{x.couponName}}</span>
            <span>{{$t('fnc.jine')}}：{{x.denomination}}</span>
            <span>{{x.expirationDate}}失效</span>
            <span class="el-icon-success"></span>
          </div> -->
        </el-col>
      </el-row>
      <div style="width: 100%; border-top: 1px dashed #ccc; margin-bottom: 25px"></div>
      <el-row :gutter="20">
        <el-col :span="4">
          <el-form-item :label="$t('salesModule.SingleNum')" prop="AirticketNum" v-show="addMsg.GroupType == 4">
            <el-input v-model="addMsg.AirticketNum" @keyup.native="checkInteger(addMsg, 'AirticketNum')" @input="
                getNumber();
                getTotalPrice();
                getHouseNo();
                autoRemarks('AirticketNum', '单地接数量');
              "></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="4" v-show="addMsg.GroupType !== '4'">
          <!--成人人数-->
          <el-form-item :label="$t('salesModule.AdultNum')" prop="ManNum">
            <el-input v-model="addMsg.ManNum" :disabled="addMsg.GroupType === '4'"
              @keyup.native="checkInteger(addMsg, 'ManNum')" @input="
                getNumber();
                getHouseNo();
                getTotalPrice();
              " @change="getNumGuest(),GetAutoCouponOrder()"></el-input>
          </el-form-item>
        </el-col>
        <template v-if="pagesTitle == '跟团游产品'">
          <el-col :span="4">
            <p v-if="priceObj.IsSupportChildren == 2" style="
                color: #e95252;
                font-size: 12px;
                line-height: 40px;
                text-align: center;
              ">
              {{ $t("salesModule.NoSupplier") }}!
            </p>

            <el-form-item v-if="priceObj.IsSupportChildren == 1" :label="$t('Operation.Op_childNobed')"
              prop="ChirdNoNeedBedNum">
              <el-input v-model="addMsg.ChirdNoNeedBedNum" @keyup.native="checkInteger(addMsg, 'ChirdNoNeedBedNum')"
                @input="
                  getNumber();
                  getHouseNo();
                  getTotalPrice();
                  autoRemarks('ChirdNoNeedBedNum', '儿童不占床');
                "></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="4" v-if="priceObj.IsSupportChildren == 1&&addMsg.GroupType!=5">
            <el-form-item :label="$t('Operation.Op_childBed')" prop="ChirdNeedBedNum">
              <el-input v-model="addMsg.ChirdNeedBedNum" @keyup.native="checkInteger(addMsg, 'ChirdNeedBedNum')" @input="
                  getNumber();
                  getHouseNo();
                  getTotalPrice();
                  autoRemarks('ChirdNeedBedNum', '儿童占床');
                "></el-input>
            </el-form-item>
          </el-col>
        </template>
        <template v-if="pagesTitle == '当地游产品'">
          <el-col :span="4">
            <p v-if="priceObj.IsSupportChildren == 2" style="
                color: #e95252;
                font-size: 12px;
                line-height: 40px;
                text-align: center;
              ">
              {{ $t("salesModule.NoSupplier") }}!
            </p>

            <el-form-item v-if="priceObj.IsSupportChildren == 1" v-show="addMsg.GroupType !== '4'"
              :label="$t('salesModule.ChildNum')" prop="ChirdNum">
              <el-input v-model="addMsg.ChirdNum" :disabled="addMsg.GroupType === '4'"
                @keyup.native="checkInteger(addMsg, 'ChirdNum')" @input="
                  getNumber();
                  getTotalPrice();
                  autoRemarks('ChirdNum', '儿童人数');
                " @change="getNumGuest()"></el-input>
            </el-form-item>
          </el-col>
        </template>
        <el-col :span="4" v-if="priceObj.IsSupportChildren == 1" v-show="addMsg.GroupType !== '4'">
          <el-form-item :label="$t('salesModule.BabyNum')" prop="BabyNum">
            <el-input v-model="addMsg.BabyNum" :disabled="addMsg.GroupType === '4'"
              @keyup.native="checkInteger(addMsg, 'BabyNum')" @input="
                getNumber();
                getTotalPrice();
                autoRemarks('BabyNum', '婴儿人数');
              " @change="getNumGuest"></el-input>
          </el-form-item>
        </el-col>
        <template v-if="pagesTitle == '跟团游产品'">
          <el-col :span="4" v-show="addMsg.GroupType !== '4'">
            <el-form-item :label="$t('salesModule.OldPeopleNum')" prop="OldPeopleNum">
              <el-input v-model="addMsg.OldPeopleNum" :disabled="addMsg.GroupType === '4'"
                @keyup.native="checkInteger(addMsg, 'OldPeopleNum')" @input="
                  getNumber();
                  getHouseNo();
                  getTotalPrice();
                  autoRemarks('OldPeopleNum', '老人人数');
                " @change="GetAutoCouponOrder()"></el-input>
            </el-form-item>
          </el-col>
        </template>
        <template v-if="pagesTitle == '跟团游产品'">
          <el-col :span="4" v-if="addMsg.GroupTypeNeedHouse == '0'">
            <el-form-item :label="$t('salesModule.SingleRoomNum')" prop="SingleRoomNum">
              <el-input v-model="addMsg.SingleRoomNum" @keyup.native="checkInteger(addMsg, 'SingleRoomNum')" @input="
                  yzSingleBed();
                  getTotalPrice();
                  autoRemarks('SingleRoomNum', '单房数量');
                "></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="4" v-if="addMsg.GroupTypeNeedHouse == '0' && showCity">
            <el-form-item :label="$t('salesModule.BigRoomNum')" prop="BigRoomNum">
              <el-input v-model="addMsg.BigRoomNum" @keyup.native="checkInteger(addMsg, 'BigRoomNum')" @input="
                  yzBigBed();
                  getTotalPrice();
                  autoRemarks('BigRoomNum', '大床房');
                "></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="4" v-if="addMsg.GroupTypeNeedHouse == '0' && showCity">
            <el-form-item :label="$t('salesModule.TripleRoomNum')" prop="TripleRoomNum">
              <el-input v-model="addMsg.TripleRoomNum" @keyup.native="checkInteger(addMsg, 'TripleRoomNum')" @input="
                  yzThreeBed();
                  getTotalPrice();
                  autoRemarks('TripleRoomNum', '三人房');
                "></el-input>
            </el-form-item>
          </el-col>
        </template>
        <el-col :span="4" v-if="pagesTitle == '跟团游产品'">
          <el-form-item :label="$t('salesModule.VisaNum')" prop="VisaNum">
            <el-input v-model="addMsg.VisaNum" @keyup.native="checkInteger(addMsg, 'VisaNum')" @input="
                yzVisaNum();
                getTotalPrice();
                autoRemarks('VisaNum', '不要签证数量');
              "></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="4" v-if="showCity || pagesTitle == '当地游产品'">
          <el-form-item :label="$t('salesModule.SaleNum')" prop="SaleNum">
            <el-input v-model="addMsg.SafeNum" @keyup.native="checkInteger(addMsg, 'SafeNum')" @input="
                yzSafeNum();
                getTotalPrice();
              " @change="getNumGuest"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="4" v-if="pagesTitle == '跟团游产品'">
          <el-form-item :label="$t('salesModule.SingleFM')">
            <el-radio v-model="addMsg.OneSex" label="1">{{ $t("pub.man") }}
            </el-radio>
            <el-radio v-model="addMsg.OneSex" label="2">{{ $t("pub.woman") }}
            </el-radio>
          </el-form-item>
        </el-col>
        <el-col :span="4" v-if="addMsg.GroupTypeNeedHouse == '0' && pagesTitle == '跟团游产品'">
          <el-form-item :label="$t('salesModule.PredictRoomNum')" prop="PredictRoomNum">
            <el-input v-model="addMsg.PredictRoomNum" :disabled="true"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item :label="$t('fnc.yszonge')" prop="PreferPrice">
            <el-input v-model="addMsg.PreferPrice" :disabled="true"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="4" v-show="addMsg.CustomerType == 1 || addMsg.CustomerType == 2">
          <el-form-item :label="$t('salesModule.SharePeople')" prop="CommissionSharePeople">
            <el-select :disabled="isUpdateSharePeople" filterable clearable @change="getTotalPrice"
              v-model="addMsg.CommissionSharePeople" :placeholder="$t('pub.pleaseSel')">
              <el-option :label="$t('fnc.no')" value="-1" key="-1"></el-option>
              <el-option v-for="item in employeeList" :label="item.EmName" :value="item.EmployeeId"
                :key="item.EmployeeId"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="4" v-show="
            addMsg.CommissionSharePeople != '-1' &&
            (addMsg.CustomerType == 1 || addMsg.CustomerType == 2)
          ">
          <el-form-item :label="$t('salesModule.ShareMoney')" prop="CommissionShareMoney">
            <el-input v-model="addMsg.CommissionShareMoney" :disabled="true"></el-input>
          </el-form-item>
        </el-col>
        <template v-if="pagesTitle == '跟团游产品'">
          <el-col :span="4">
            <el-form-item :label="$t('Airticket.Air_EconomyClass')" prop="YSeatNum">
              <el-input v-model="addMsg.YSeatNum" @keyup.native="checkInteger(addMsg, 'YSeatNum')"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="$t('Airticket.Air_businessClass')" prop="ESeatNum">
              <el-input v-model="addMsg.ESeatNum" @input="getNumber()"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item :label="$t('Airticket.Air_firstClass')" prop="FSeatNum">
              <el-input v-model="addMsg.FSeatNum" @input="getNumber()"></el-input>
            </el-form-item>
          </el-col>
        </template>
        <el-col :span="4" v-if="showCity && pagesTitle == '跟团游产品'">
          <el-form-item :label="$t('salesModule.ScenicRefund')">
            <el-select filterable multiple class="multiple_input" v-model="addMsg.ScenicRefundArr"
              :placeholder="$t('pub.pleaseSel')" @change="ScenicRefundMethods">
              <el-option v-for="(item, index) in ScenicRefundList" :label="item.ScenicName" :value="item.Id"
                :key="index">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="4" v-if="showCity || pagesTitle == '当地游产品'">
          <el-form-item :label="$t('salesModule.MsgMoney')">
            <el-select filterable v-model="addMsg.IsShowMessagesMoney" :placeholder="$t('pub.pleaseSel')">
              <el-option :label="$t('system.table_isShows')" value="1"></el-option>
              <el-option :label="$t('MarketingActi.notShow')" value="2"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item :label="$t('salesModule.CustomFrom')" prop="ClientSource">
            <el-select v-model="addMsg.ClientSource" filterable :placeholder="$t('pub.pleaseSel')"
              @change="changeClientSource">
              <el-option v-for="(item, index) in clientSourceList" :label="item.Name" :value="item.Id" :key="index">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item :label="$t('salesModule.SSPT')" prop="BrandId"
            v-show="addMsg.ClientSource == 1 || addMsg.ClientSource == 4">
            <el-select v-model="addMsg.BrandId" filterable :placeholder="$t('pub.pleaseSel')">
              <el-option v-for="item in customerBrandList" :label="item.brandName" :value="item.dictId"
                :key="item.dictId">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="4" v-if="pagesTitle == '当地游产品'">
          <!--联系人-->
          <el-form-item :label="$t('objFill.xinglisl')" prop="LuggageNum">
            <el-input v-model="addMsg.LuggageNum"></el-input>
          </el-form-item>
        </el-col>

        <el-col :span="4">
          <!--交易方式-->
          <el-form-item :label="$t('tips.jiaoyifangshi')" prop="TradeWay"
            v-show="addMsg.ClientSource == 1 || addMsg.ClientSource == 4">
            <el-select v-model="addMsg.TradeWay" filterable :placeholder="$t('pub.pleaseSel')"
              @change="tradeWayMethods">
              <el-option v-for="item in tradeWayList" :label="item.Name" :value="item.Id" :key="item.Id">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <!--平台账户-->
        <el-col :span="4" v-if="addMsg.TradeWay == 1 || addMsg.TradeWay == 3">
          <el-form-item :label="$t('fnc.fkuanzhanghu')">
            <el-select filterable v-model="addMsg.PlatformAccount" :placeholder="$t('pub.pleaseSel')">
              <el-option v-for="item in PlatformAccountList" :label="item.Alias" :value="item.ID" :key="item.ID">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <!--平台订单-->
        <el-col :span="4" v-if="addMsg.TradeWay == 1 || addMsg.TradeWay == 3">
          <el-form-item :label="$t('salesModule.PlatOrder')" prop="PlatformOrder">
            <el-input v-model="addMsg.PlatformOrder" @input="platformOrderMethods" maxlength="20"></el-input>
          </el-form-item>
        </el-col>
        <!--报价单-->
        <el-col :span="4" style="display:none;">
          <el-form-item :label="$t('ground.bjd')" prop="QuotationUrl" v-show="addMsg.GroupType == '2'">
            <div style="margin-bottom: 10px; width: 32%" v-loading="uploadLloading"
              :element-loading-text="$t('objFill.pingminscz')">
              <el-upload ref="my-upload" class="upload-demo" :http-request="uploadFileBtn" :multiple="true"
                :show-file-list="true" :on-preview="previewFile" :on-remove="removeFile" :limit="1" action>
                <el-button size="small" type="primary">{{$t('tips.dianjishanhcuan')}}</el-button>
              </el-upload>
            </div>
          </el-form-item>
        </el-col>
      </el-row>
      <template v-if="pagesTitle == '当地游产品'">
        <el-row :gutter="20" style="margin-bottom: 20px">
          <el-col :span="24">
            <el-form-item :label="$t('objFill.fangkexinxi')" prop="">
              <table class="passengerSaleList_table" border="0" cellspacing="0" cellpadding="0">
                <thead>
                  <tr>
                    <th width="20%" style="min-width: 260px">{{$t('system.query_name')}}</th>
                    <th width="20%" style="min-width: 220px">{{$t('system.table_sex')}}</th>
                    <th width="20%" style="min-width: 220px">{{$t('admin.admin_Birthday')}}</th>
                    <th width="20%" style="min-width: 220px">{{$t('visaT.nationality')}}</th>
                    <th width="20%" style="min-width: 220px">{{$t('system.table_Passport')}}</th>
                    <th width="20%" style="min-width: 220px">{{$t('hotel.table_tel')}}</th>
                  </tr>
                </thead>

                <tbody>
                  <tr v-for="(item, index) in addMsg.GuestList" :key="index">
                    <td width="20%" style="min-width: 260px">
                      <div style="display: flex; flex-direction: row">
                        <el-form-item style="width: 50%" :label="`${$t('admin.admin_xing')} ${index + 1} `"
                          :prop="`GuestList.${index}.SurName`" :rules="rules.SurName" label-width="50px"
                          label-position="left">
                          <el-input size="small" v-model="item.SurName" :placeholder="$t('objFill.shuruxin')"
                            style="width: 100%" @input="
                              Transformation(item.SurName, 'SurName', index)
                            "></el-input>
                        </el-form-item>
                        <el-form-item style="width: 50%" :label="`${$t('admin.admin_ming')} ${index + 1} `"
                          :prop="`GuestList.${index}.Name`" :rules="rules.Name" label-width="50px"
                          label-position="left">
                          <el-input size="small" v-model="item.Name" :placeholder="$t('objFill.shuruming')"
                            style="width: 100%" @input="Transformation(item.Name, 'Name', index)"></el-input>
                        </el-form-item>
                      </div>
                    </td>
                    <td width="20%" style="min-width: 220px">
                      <el-form-item :label="`${$t('system.table_sex')} ${index + 1} `" :prop="`GuestList.${index}.Sex`"
                        :rules="rules.Sex" label-width="70px" label-position="left">
                        <el-select v-model="item.Sex" :placeholder="$t('rule.qxzxb')" style="width: 100%">
                          <el-option v-for="item in optionsList" :key="item.Id" :label="item.Name" :value="item.Id">
                          </el-option>
                        </el-select>
                      </el-form-item>
                    </td>
                    <td width="20%" style="min-width: 220px">
                      <el-form-item :label="`${$t('admin.admin_BirthDate')} ${index + 1} `"
                        :prop="`GuestList.${index}.Birthday`" :rules="rules.Birthday" label-width="100px"
                        label-position="left">
                        <el-date-picker v-model="item.Birthday" type="date" value-format="yyyy-MM-dd"
                          :placeholder="$t('objFill.xuanzhecsrq')">
                        </el-date-picker>
                      </el-form-item>
                    </td>
                    <td width="20%" style="min-width: 220px">
                      <el-form-item :label="`${$t('visaT.nationality')} ${index + 1} `"
                        :prop="`GuestList.${index}.Nationality`" :rules="rules.PassportNo" label-width="80px"
                        label-position="left">
                        <el-select v-model="item.Nationality" filterable size="mini" class="w230">
                          <el-option v-for="item in countryList" :key="item.ID" :label="item.Name" :value="item.ID">
                          </el-option>
                        </el-select>
                      </el-form-item>
                    </td>
                    <td width="20%" style="min-width: 220px">
                      <el-form-item :label="`${$t('system.table_Passport')} ${index + 1} `"
                        :prop="`GuestList.${index}.PassportNo`" :rules="rules.PassportNo" label-width="80px"
                        label-position="left">
                        <el-input size="small" v-model="item.PassportNo" :placeholder="$t('system.ph_Passport')"
                          style="width: 100%">
                        </el-input>
                      </el-form-item>
                    </td>
                    <td width="20%" style="min-width: 220px">
                      <el-form-item :label="`${$t('system.table_phone')} ${index + 1} `"
                        :prop="`GuestList.${index}.MobilePhone`" :rules="rules.MobilePhone" label-width="80px"
                        label-position="left">
                        <el-input size="small" type="Number" v-model="item.MobilePhone"
                          :placeholder="$t('admin.admin_phPhone')" style="width: 100%"></el-input>
                      </el-form-item>
                    </td>
                  </tr>
                  <tr v-if="!addMsg.GuestList || addMsg.GuestList.length == 0">
                    <td colspan="6">{{$t('objFill.zhanwufkxx')}}</td>
                  </tr>
                </tbody>
              </table>
            </el-form-item>
          </el-col>
        </el-row>
      </template>
      <el-row :gutter="20">
        <el-col :span="12" v-if="pagesTitle == '当地游产品'">
          <el-form-item :label="$t('objFill.jihedi')" prop="GatherAddress" label-width="125px" label-position="left">
            <el-input type="textarea" size="small" v-model="addMsg.GatherAddress"
              :placeholder="$t('objFill.qingsrjhed')" style="width: 100%"></el-input>
          </el-form-item>
        </el-col>
        <!--备注-->
        <el-col :span="pagesTitle == '当地游产品' ? 12 : 24">
          <el-form-item :label="$t('pub.pubRemark')" prop="Remarks">
            <el-input v-model="addMsg.Remarks" type="textarea" maxlength="500"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <!--v-if="addMsg.IsIntermodal == 1 || addMsg.IsReturnIntermodal == 1"-->
      <el-row :gutter="20">
        <el-col :span="24">
          <el-form-item :label="$t('objFill.liangyunbeizhu')" prop="UnionRemark">
            <el-input v-model="addMsg.UnionRemark" type="textarea" maxlength="500"
              :placeholder="$t('objFill.beijcdzsyw')"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>
<script>
  export default {
    //团期编号，订单编号(新增传0),下单人选择的公司
    props: [
      "showCity",
      "PTCID", //团期编号(必须传),
      "POrderId", //订单编号(新增传0)
      "PBranchId", //销售公司/联运公司
      "PProductType", //产品类型(1-常规团，2-包机团)
      "productObj",
      "pagesTitle",
    ],
    data() {
      return {
        DiscountAmountId: null,
        DiscountAmountObj: {},
        timer: false,
        fullHeight: document.documentElement.clientHeight,
        ScreenHeight: 0,
        pickerOptions0: {
          disabledDate: (time) => {
            let starTime = new Date(this.starTime);
            return time.getTime() > starTime.getTime();
          },
        },
        pickerOptions1: {
          disabledDate: (time) => {
            let endTime = new Date(this.endTime);
            return time.getTime() < endTime.getTime() - 5.64e7;
          },
        },
        CurrentUserInfo: {}, //当前登录用户信息
        HightUnitPrice: "2", //高于本团单价
        createByInfo: "",
        isUpdateSharePeople: false,
        starTime: "",
        endTime: "",
        stratPrice: "",
        stratPriceShow: false,
        returnPrice: "",
        returnPriceShow: false,
        minPrice: 0,
        Unit_PriceList: [], //成交单价下拉数据
        LessMoney: 0,
        addMsg: {
          price: "0",
          GroupTypeNeedHouse: "0",
          OrderId: "0",
          OneSex: "0",
          TCID: "0",
          CustomerType: "",
          GroupType: "",
          IndustryCategory: "",
          ContactName: "",
          ContactMobile: "",
          CustomerId: "",
          DepartureCityId: "0",
          ReturnArriveCityId: "",
          IsIntermodal: "2",
          IsReturnIntermodal: "2",
          Unit_Price: "0",
          TC_Price: "0",
          ManNum: "0", // 成人数量
          ChirdNum: "0", // 小孩数量
          ChirdNoNeedBedNum: "",
          ChirdNeedBedNum: "",
          BabyNum: "0",
          OldPeopleNum: "0",
          SingleRoomNum: "0",
          PreferPrice: "0",
          YSeatNum: "0",
          ESeatNum: "0",
          FSeatNum: "0",
          Commission: "0",
          ClientSource: "0",
          BrandId: "0",
          TradeWay: "2",
          PlatformAccount: "",
          PlatformOrder: "",
          GuestNum: "0",
          IsChildrenTour: "0",
          IsBirdDiscount: "0",
          PredictRoomNum: "0",
          BigRoomNum: "0",
          TripleRoomNum: "0",
          TradeDate: "",
          CostType: "",
          Remarks: "",
          VisaNum: "0",
          SafeNum: "0",
          AirticketNum: "0",
          ScenicRefundArr: [],
          GoCityTime: "",
          BackCityTime: "",
          CommissionSharePeople: "0",
          CommissionShareMoney: "0",
          OrderForm: "1",
          SonControlID: "-1",
          IsShowMessagesMoney: "2",
          QuotationUrl: "", //单团附件
          GuestList: [],
          GatherAddress: "",
          LureEmpId: 0, //引流id
          CRMGuestId: 0, //客人ID
          CouponAllotIds: '',
          LuggageNum: '', //行李数量
        },
        uploadLloading: false,
        rules: {
          CustomerType: [{
            required: true,
            message: this.$t('objFill.qingxuanzhekhlx'),
            trigger: "change",
          }, ],
          CustomerId: [{
            required: true,
            message: this.$t('objFill.qingxzkhmd'),
            trigger: "change",
          }, ],
          ManNum: [{
            required: true,
            message: this.$t('objFill.v101.myOrdersAllType.qingtianxcrrs'),
            trigger: "blur",
          }, ],
          ChirdNeedBedNum: [{
            required: true,
            message: this.$t('objFill.v101.myOrdersAllType.qingtxetzcrs'),
            trigger: "blur",
          }, ],
          BabyNum: [{
            required: true,
            message: this.$t('objFill.v101.myOrdersAllType.qingtxyers'),
            trigger: "blur",
          }, ],
          OldPeopleNum: [{
            required: true,
            message: this.$t('objFill.v101.myOrdersAllType.qingtxlrrs'),
            trigger: "blur",
          }, ],
          ChirdNoNeedBedNum: [{
            required: true,
            message: this.$t('objFill.v101.myOrdersAllType.qiingtxetbzcrs'),
            trigger: "blur",
          }, ],
          DepartureCityId: [{
            required: true,
            message: this.$t('objFill.qingxzcfcs'),
            trigger: "change",
          }, ],
          GroupType: [{
            required: true,
            message: this.$t('objFill.qingxzctlx'),
            trigger: "change",
          }, ],
          ClientSource: [{
            required: true,
            message: this.$t('objFill.qingxzkrly'),
            trigger: "change",
          }, ],
          TradeWay: [{
            required: true,
            message: this.$t('fnc.a_qxzjyfangshi'),
            trigger: "change",
          }, ],
          ContactName: [{
            required: true,
            message: this.$t('objFill.qingshurulxxm'),
            trigger: "blur",
          }, ],
          ContactMobile: [{
              required: true,
              message: this.$t('objFill.qingshurulxrdh'),
              trigger: "blur",
            },
            // {
            //   pattern: /^(0|86|17951)?(13[0-9]|15[012356789]|17[012356789]|18[0-9]|19[0-9]|14[57])[0-9]{8}$/,
            //   message: this.$t('rule.qsrtelphone'),
            // },
          ],
          SurName: [{
            required: true,
            message: this.$t('objFill.shuruxin'),
            trigger: "blur",
          }, ],
          Name: [{
            required: true,
            message: this.$t('objFill.shuruming'),
            trigger: "blur",
          }, ],
          Sex: [{
            required: true,
            message: this.$t('rule.qxzxb'),
            trigger: "change",
          }, ],
          Birthday: [{
            required: true,
            message: this.$t('admin.admin_phBirthDate'),
            trigger: "blur",
          }, ],
          Nationality: [{
            required: true,
            message: this.$t('visaT.qxzgj'),
            trigger: "change",
          }, ],
          PassportNo: [{
            required: true,
            message: this.$t('system.ph_Passport'),
            trigger: "blur",
          }, ],
          LuggageNum: [{
            required: true,
            message: this.$t('objFill.qingsrxls'),
            trigger: 'blur'
          }],
          MobilePhone: [{
              required: true,
              message: this.$t('objFill.qingshurulxrdh'),
              trigger: "blur",
            },
            // {
            //   pattern: /^(0|86|17951)?(13[0-9]|15[012356789]|17[012356789]|18[0-9]|19[0-9]|14[57])[0-9]{8}$/,
            //   message: this.$t('rule.qsrtelphone'),
            // },
          ],
          GatherAddress: [{
            required: true,
            message: this.$t('objFill.qingsrjhed'),
            trigger: "blur",
          }, ],
        },
        GuestList: [{
          SurName: "",
          Name: "",
          Sex: "",
          ESurName: "",
          EName: "",
          Birthday: "",
          Nationality: "",
          PassportNo: "",
          Remarks: "",
          MobilePhone: "",
        }, ],
        GuestObj: {
          SurName: "",
          Name: "",
          Sex: "",
          ESurName: "",
          EName: "",
          Birthday: "",
          Nationality: 509,
          PassportNo: "",
          Remarks: "",
          MobilePhone: "",
          Id: 0,
        },
        startCityList: [], //出发城市列表
        customerTypeList: [], //客户类型列表
        customerBrandList: [], //客户平平列表
        clientSourceList: [], //客人来源列表
        customerList: [], //客户列表
        joinTypeList: [], //参团类型列表
        tradeWayList: [], //交易方式列表
        ScenicRefundList: [], //可退景点列表
        employeeList: [], //员工列表
        PlatformAccountList: [], //平台账户绑定列表
        PlatformAccountList1: [], //所有平台账户列表
        DiplomacyPlatformAccountList: [], //外交平台账户列表
        ScenicRefundMoney: 0, //可退景点的金额
        remarkMsg: {
          zc: "",
          bzc: "",
          fjf: "",
          ye: "",
          lr: "",
          dd: "",
          df: "",
          dc: "",
          srf: "",
          qz: "",
          qzf: "",
        },
        otherRemark: "",
        SingleDMCPricex: 0, // 单地接;
        SingleDMCPrice: 0, // 单地接;
        SingleAirticketMoney: 0, //单机票
        optionsList: [{
            Name: this.$t('pub.man'),
            Id: 1
          },
          {
            Name: this.$t('pub.woman'),
            Id: 2
          },
        ],
        TotalNumber: 0, //总人数
        countryList: [], //国籍
        priceObj: {}, //团期价格信息
        crmOrderObj: null,
        couponData: null,
        couponList: [],
        saveLoading: false,
      };
    },
    methods: {
      // 获取已选优惠券
      getDiscountAmount() {
        let obj = this.couponList.find(x => {
          return x.id == this.DiscountAmountId
        })
        this.DiscountAmountObj = obj ? obj : {}
      },
      getUserCouponList() {
        let obj = this.customerList.find(x => {
          return x.customerId == this.addMsg.CustomerId
        })
        if (this.addMsg.GroupType != 1 && this.addMsg.GroupType != 2) {
          this.couponList = []
          this.DiscountAmountId = null
          this.DiscountAmountObj = {}
          return
        }
        if (obj && obj.customerAccountId && this.priceObj.LineID) {
          let params = {
            lineId: this.priceObj.LineID,
            lineteamId: 0,
            CouponsUseScope: 2,
            userId: obj.customerAccountId
          }
          this.apipost('coupon_post_GetUserCanUseCouponList', params, (res) => {
            if (res.data.resultCode == 1) {
              this.couponList = res.data.data
            }
          })
        }
      },
      // 大人>=2优惠
      GetAutoCouponOrder() {
        this.couponData = null
        let ChirdNum = Number(this.addMsg.ChirdNum);
        if (this.addMsg.GroupType == 4) {
          ChirdNum = 0;
        }
        this.addMsg.GuestNum =
          Number(this.addMsg.ManNum) +
          ChirdNum +
          Number(this.addMsg.OldPeopleNum) +
          Number(this.addMsg.BabyNum) +
          Number(this.addMsg.AirticketNum);
        let OrderGuest = this.addMsg.GuestNum - Number(this.addMsg.BabyNum)
        if (OrderGuest >= 2 && (this.addMsg.GroupType == 1 || this.addMsg.GroupType == 2) && this.addMsg.CustomerId >
          0) {
          let msg = {
            TCID: this.productObj.TCID,
            CustomerId: this.addMsg.CustomerId,
            OrderId: 0,
            StratDate: this.productObj.StartCityTime,
            OrderGuest: OrderGuest,
            lineId: this.priceObj.LineID
          }
          this.apipost(
            "coupon_post_GetAutoCouponOrder", msg,
            (res) => {
              if (res.data.resultCode == 1 && res.data.data != null) {
                this.couponData = res.data.data
              }
            }
          );
        }
      },
      Transformation(val, type, index) {
        let text = this.pinyin(val, {
          style: this.pinyin.STYLE_NORMAL,
        });
        if (type == "SurName") {
          let upText = text.join("").toLocaleUpperCase();
          this.addMsg.GuestList[index].ESurName = upText;
        }
        if (type == "Name") {
          let upText = text.join("").toLocaleUpperCase();
          this.addMsg.GuestList[index].EName = upText;
        }
      },
      getNumGuest() {
        let num = 0;
        if (!this.addMsg.GuestList || this.addMsg.GuestList.length == 0) {
          for (let i = 0; i < this.TotalNumber; i++) {
            this.addMsg.GuestList.push(JSON.parse(JSON.stringify(this.GuestObj)));
          }
        } else if (
          this.addMsg.GuestList &&
          this.addMsg.GuestList.length < this.TotalNumber
        ) {
          num = this.TotalNumber - this.addMsg.GuestList.length;
          for (let i = 0; i < num; i++) {
            this.addMsg.GuestList.push(JSON.parse(JSON.stringify(this.GuestObj)));
          }
        } else if (
          this.addMsg.GuestList &&
          this.addMsg.GuestList.length > this.TotalNumber
        ) {
          num = this.addMsg.GuestList.length - this.TotalNumber;
          for (let i = 0; i < num; i++) {
            let x = this.addMsg.GuestList.length - 1;
            this.addMsg.GuestList.splice(x, 1);
          }
        }
      },
      getCountry() {
        //获取国家
        let msg = {};
        this.apipost(
          "dict_post_Destination_GetCountry",
          msg,
          (res) => {
            if (res.data.resultCode == 1) {
              this.countryList = res.data.data;
            } else {
              this.$message.error(res.data.message);
            }
          },
          (err) => {}
        );
      },
      //参团类型切换
      changeGroupType(type) {
        if (type = !2) {
          this.addMsg.IndustryCategory = "";
          this.addMsg.QuotationUrl = "";
        }
        //单地接
        if (type == 4) {
          this.HightUnitPrice = "1";
          this.addMsg.AirticketNum = 0;
          this.addMsg.ManNum = 0;
          this.addMsg.BabyNum = 0;
          this.addMsg.OldPeopleNum = 0;

          this.addMsg.PreferPrice = 0;
          this.addMsg.SafeNum = 0;
          this.addMsg.VisaNum = 0;
          this.addMsg.PredictRoomNum = 0;
          this.addMsg.YSeatNum = 0;
        } else {
          this.HightUnitPrice = "2";
          this.addMsg.AirticketNum = 0;
          this.addMsg.ManNum = 0;
          this.addMsg.BabyNum = 0;
          this.addMsg.OldPeopleNum = 0;

          this.addMsg.PreferPrice = 0;
          this.addMsg.SafeNum = 0;
          this.addMsg.VisaNum = 0;
          this.addMsg.PredictRoomNum = 0;
          this.addMsg.YSeatNum = 0;
        }
        this.Unit_PriceList = [];
        this.addMsg.GroupTypeNeedHouse = "0";
      },
      //验证签证人数
      yzVisaNum() {
        let ChirdNum = Number(this.addMsg.ChirdNum);
        //地接
        if (this.addMsg.GroupType == 4) {
          ChirdNum = 0;
        }
        let count = Number(this.addMsg.AirticketNum) + Number(this.addMsg.ManNum) + ChirdNum + Number(this.addMsg
          .BabyNum) + Number(this.addMsg.OldPeopleNum);
        if (count < this.addMsg.VisaNum) {
          this.addMsg.VisaNum = count;
          this.Error(this.$t('objFill.qianzsbndyzrs'));
        }
      },
      //验证保险人数
      yzSafeNum() {
        let ChirdNum = Number(this.addMsg.ChirdNum);
        //单地接
        if (this.addMsg.GroupType == 4) {
          ChirdNum = 0;
        }
        let count =
          Number(this.addMsg.AirticketNum) +
          Number(this.addMsg.ManNum) +
          ChirdNum +
          Number(this.addMsg.BabyNum) +
          Number(this.addMsg.OldPeopleNum);
        this.TotalNumber = count;
        if (count < this.addMsg.SafeNum) {
          this.addMsg.SafeNum = count;
          this.Error(this.$t('objFill.baoxrsbndyzrs'));
          this.getNumGuest();
        }
      },
      //验证单房数量
      yzSingleBed() {
        let x =
          Number(this.addMsg.AirticketNum) +
          Number(this.addMsg.ManNum) +
          Number(this.addMsg.ChirdNeedBedNum) +
          Number(this.addMsg.OldPeopleNum) -
          Number(this.addMsg.SingleRoomNum);
        let y =
          x -
          Number(this.addMsg.TripleRoomNum) * 3 -
          Number(this.addMsg.BigRoomNum) * 2;
        if (y < 0) {
          this.addMsg.SingleRoomNum = 0;
        }
        this.getHouseNo();
        this.autoRemarks("SingleRoomNum", "单房数量");
      },
      //验证大床房
      yzBigBed() {
        let x =
          Number(this.addMsg.AirticketNum) +
          Number(this.addMsg.ManNum) +
          Number(this.addMsg.ChirdNeedBedNum) +
          Number(this.addMsg.OldPeopleNum) -
          Number(this.addMsg.SingleRoomNum);
        let y =
          x -
          Number(this.addMsg.TripleRoomNum) * 3 -
          Number(this.addMsg.BigRoomNum) * 2;
        if (y <= -1) {
          this.addMsg.BigRoomNum = 0;
        }
        this.getHouseNo();
        this.autoRemarks("BigRoomNum", "大床房");
      },
      //验证三人房
      yzThreeBed() {
        let x =
          Number(this.addMsg.AirticketNum) +
          Number(this.addMsg.ManNum) +
          Number(this.addMsg.ChirdNeedBedNum) +
          Number(this.addMsg.OldPeopleNum) -
          Number(this.addMsg.SingleRoomNum);
        let y =
          x -
          Number(this.addMsg.TripleRoomNum) * 3 -
          Number(this.addMsg.BigRoomNum) * 2;
        if (y <= -1) {
          this.addMsg.TripleRoomNum = 0;
        }
        this.getHouseNo();
        this.autoRemarks("TripleRoomNum", "三人房");
      },
      // 自动添加备注
      autoRemarks(key, text) {
        let count =
          Number(this.addMsg.AirticketNum) +
          Number(this.addMsg.ManNum) +
          Number(this.addMsg.ChirdNum) +
          Number(this.addMsg.BabyNum) +
          Number(this.addMsg.OldPeopleNum);
        this.remarkMsg.qz = "";
        if (
          this.addMsg[key].toString() !== "0" &&
          this.addMsg[key].toString() !== ""
        ) {
          if (
            this.addMsg[key].toString() !== count.toString() &&
            this.addMsg[key].toString() !== ""
          ) {
            if (text === "不要签证数量") {
              this.remarkMsg.qz = text + ":" + (count - this.addMsg[key]) + ";";
              if (this.priceObj.VisaPrice) {
                this.remarkMsg.qzf = "签证费" + this.priceObj.VisaPrice + "/人;";
              }
              if (this.priceObj.BackVisaPrice) {
                this.remarkMsg.qz =
                  text +
                  ":" +
                  (count - this.addMsg[key]) +
                  ";" +
                  "退签证费" +
                  this.priceObj.BackVisaPrice +
                  "/人;";
              }
            }
            if (text === "不要保险数量") {
              this.remarkMsg.bx = text + ":" + (count - this.addMsg[key]) + ";";
            }
          } else if (this.addMsg[key].toString() === count.toString()) {
            if (this.priceObj.VisaPrice) {
              this.remarkMsg.qzf = "签证费" + this.priceObj.VisaPrice + "/人;";
            }
            this.remarkMsg.qz = "";
          }
          if (text === "儿童不占床") {
            if (this.remarkMsg.bzc === "") {
              this.remarkMsg.bzc = "儿童不占床:" + this.addMsg[key] + ";";
              if (this.priceObj.ChildNoNeedPrice) {
                this.remarkMsg.bzc +=
                  "儿童不占床减免" + this.priceObj.ChildNoNeedPrice + "/人;";
              }
            } else {
              this.remarkMsg.bzc = "";
              this.remarkMsg.bzc = "儿童不占床:" + this.addMsg[key] + ";";
              if (this.priceObj.ChildNoNeedPrice) {
                this.remarkMsg.bzc +=
                  "儿童不占床减免" + this.priceObj.ChildNoNeedPrice + "/人;";
              }
            }
            if (this.remarkMsg.fjf === "") {
              if (
                this.priceObj["BabyChargePrice"] > 0 &&
                this.priceObj["BabyChargePrice"]
              ) {
                this.remarkMsg.fjf =
                  "儿童附加费:" + this.priceObj["BabyChargePrice"] + "/人;";
              } else {
                this.remarkMsg.fjf = "";
              }
            }
          }
          if (text === "儿童占床") {
            if (this.remarkMsg.zc === "") {
              this.remarkMsg.zc = "儿童占床:" + this.addMsg[key] + ";";
              if (this.priceObj.ChildNeedPrice) {
                this.remarkMsg.zc =
                  this.remarkMsg.zc +
                  "儿童占床附加费" +
                  this.priceObj.ChildNeedPrice +
                  "/人;";
              }
            } else {
              this.remarkMsg.zc = "";
              this.remarkMsg.zc = "儿童占床:" + this.addMsg[key] + ";";
              if (this.priceObj.ChildNeedPrice) {
                this.remarkMsg.zc =
                  this.remarkMsg.zc +
                  "儿童占床附加费" +
                  this.priceObj.ChildNeedPrice +
                  "/人;";
              }
            }
            if (this.remarkMsg.fjf === "") {
              this.remarkMsg.fjf = this.priceObj["BabyChargePrice"] ?
                "儿童附加费:" + this.priceObj["BabyChargePrice"] + "/人;" :
                "";
            }
          }
          if (text === "老人人数") {
            if (this.remarkMsg.lr === "") {
              this.remarkMsg.lr = "老人人数:" + this.addMsg[key] + ";";
              if (this.priceObj.OldManChargePrice) {
                this.remarkMsg.lr =
                  this.remarkMsg.lr + this.priceObj.OldManChargePrice + "/人;";
              }
            } else {
              this.remarkMsg.lr = "";
              this.remarkMsg.lr = "老人人数:" + this.addMsg[key] + ";";
              if (this.priceObj.OldManChargePrice) {
                this.remarkMsg.lr =
                  this.remarkMsg.lr + this.priceObj.OldManChargePrice + "/人;";
              }
            }
          }
          if (text === "婴儿人数") {
            if (this.remarkMsg.ye === "") {
              this.remarkMsg.ye =
                "婴儿人数:" +
                this.addMsg[key] +
                ";" +
                "婴儿价格:" +
                this.priceObj.BabyPrice +
                "/人;";
            } else {
              this.remarkMsg.ye = "";
              this.remarkMsg.ye =
                "婴儿人数:" +
                this.addMsg[key] +
                ";" +
                "婴儿价格:" +
                this.priceObj.BabyPrice +
                "/人;";
            }
          }
          if (text === "单地接数量") {
            if (this.remarkMsg.dd === "") {
              this.remarkMsg.dd = "单地接数量:" + this.addMsg[key] + ";";
            } else {
              this.remarkMsg.dd = "";
              this.remarkMsg.dd = "单地接数量:" + this.addMsg[key] + ";";
            }
          }
          if (text === "单房数量") {
            if (this.remarkMsg.df === "") {
              this.remarkMsg.df =
                "单房数量:" +
                this.addMsg[key] +
                ";" +
                "单房差价" +
                this.priceObj.SingleRoomPrice +
                "/人;";
            } else {
              this.remarkMsg.df = "";
              this.remarkMsg.df =
                "单房数量:" +
                this.addMsg[key] +
                ";" +
                "单房差价" +
                this.priceObj.SingleRoomPrice +
                "/人;";
            }
          }
          if (text === "大床房") {
            if (this.remarkMsg.dc === "") {
              this.remarkMsg.dc = "大床房:" + this.addMsg[key] + ";";
            } else {
              this.remarkMsg.dc = "";
              this.remarkMsg.dc = "大床房:" + this.addMsg[key] + ";";
            }
          }
          if (text === "三人房") {
            if (this.remarkMsg.srf === "") {
              this.remarkMsg.srf = "三人房:" + this.addMsg[key] + ";";
            } else {
              this.remarkMsg.srf = "";
              this.remarkMsg.srf = "三人房:" + this.addMsg[key] + ";";
            }
          }
        } else {
          if (text === "儿童不占床") {
            this.remarkMsg.bzc = "";
            this.remarkMsg.fjf = "";
          }
          if (text === "儿童占床") {
            this.remarkMsg.zc = "";
            this.remarkMsg.fjf = "";
          }
          if (text === "婴儿人数") {
            this.remarkMsg.ye = "";
          }
          if (text === "老人人数") {
            this.remarkMsg.lr = "";
          }
          if (text === "单地接数量") {
            this.remarkMsg.dd = "";
          }
          if (text === "单房数量") {
            this.remarkMsg.df = "";
          }
          if (text === "大床房") {
            this.remarkMsg.dc = "";
          }
          if (text === "三人房") {
            this.remarkMsg.srf = "";
          }
          if (text === "不要签证数量") {
            this.remarkMsg.qz = "";
            this.remarkMsg.qzf = "";
          }
          if (text === "不要保险数量") {
            this.remarkMsg.bx = "";
          }
        }
        let _this = this;
        let newRemark = "";
        _this.addMsg.Remarks = "";
        if (this.addMsg.GroupType == 4) {
          newRemark = _this.addMsg.Remarks + _this.otherRemark;
        } else {
          newRemark = _this.addMsg.Remarks;
        }
        newRemark = _this.addMsg.Remarks + _this.otherRemark;
        Object.keys(_this.remarkMsg).forEach(function (key) {
          newRemark = newRemark + _this.remarkMsg[key];
        });
        _this.addMsg.Remarks = newRemark;
      },
      //获取联运价格
      getUnionTravelPrice(obj, type) {
        let msg = {};
        msg.TCID = obj.TCID;
        msg.Type = type;
        if (type == 1) {
          msg.StartCityId = this.addMsg.DepartureCityId;
          msg.CityTime = this.addMsg.GoCityTime;
          if (this.addMsg.IsIntermodal == 2) {
            this.stratPrice = "0";
            this.stratPriceShow = false;
            this.getTotalPrice();
          } else {
            this.apipost("sellorder_get_GetUnionTravelPrice", msg, (res) => {
              if (res.data.resultCode == 1) {
                this.stratPrice = res.data.data.Price;
                if (this.stratPrice == 0) {
                  this.stratPriceShow = false;
                } else {
                  this.stratPriceShow = true;
                }
                this.getTotalPrice();
              }
            });
          }
        } else {
          msg.StartCityId = this.addMsg.ReturnArriveCityId;
          msg.CityTime = this.addMsg.BackCityTime;
          if (this.addMsg.IsReturnIntermodal == 2) {
            this.returnPrice = "0";
            this.returnPriceShow = true;
            this.getTotalPrice();
          } else {
            this.apipost("sellorder_get_GetUnionTravelPrice", msg, (res) => {
              if (res.data.resultCode == 1) {
                this.returnPrice = res.data.data.Price;
                if (this.returnPrice == 0) {
                  this.returnPriceShow = false;
                } else {
                  this.returnPriceShow = true;
                }
                this.getTotalPrice();
              }
            });
          }
        }
      },
      //可退景点(获取可退景点的可退金额)
      ScenicRefundMethods() {
        this.ScenicRefundMoney = 0;
        if (
          this.addMsg.ScenicRefundArr &&
          this.addMsg.ScenicRefundArr.length > 0
        ) {
          this.addMsg.ScenicRefundArr.forEach((x) => {
            let listIndex = this.ScenicRefundList.findIndex(
              (item) => item.Id == x
            );
            if (listIndex != -1) {
              this.ScenicRefundMoney +=
                this.ScenicRefundList[listIndex].RefundMoney;
            }
          });
        }
        this.getTotalPrice();
        this.getTicheng();
      },
      //交易方式
      tradeWayMethods(val) {
        if (val == 3) {
          this.addMsg.PlatformAccount = "";
          this.PlatformAccountList = this.DiplomacyPlatformAccountList;
        }
        if (val == 1) {
          this.addMsg.PlatformAccount = "";
          this.PlatformAccountList = this.PlatformAccountList1;
        }
        if (this.addMsg.TradeWay == 2) {
          this.addMsg.PlatformOrder = "";
          this.addMsg.PlatformAccount = "";
          this.addMsg.MinOrderPrice = 0;
          this.addMsg.CostType = "";
          this.addMsg.TradeDate = "";
        }
      },
      //获取平台订单
      platformOrderMethods() {
        if (this.addMsg.PlatformOrder == "") {
          this.addMsg.MinOrderPrice = 0;
          this.addMsg.CostType = "";
          this.addMsg.TradeDate = "";
        } else {
          this.addMsg.MinOrderPrice =
            this.minPrice *
            (Number(this.addMsg.AirticketNum) +
              Number(this.addMsg.ManNum) +
              Number(this.addMsg.ChirdNum) +
              Number(this.addMsg.OldPeopleNum));
        }
      },
      //获取线路最低定金金额
      getMinPrice(id) {
        this.apipost(
          "line_post_Get", {
            ID: id,
          },
          (res) => {
            if (res.data.resultCode == 1) {
              this.minPrice = res.data.data && res.data.data.LowDeposit;
            }
          }
        );
      },
      //客户类型切换 清空客户编号
      resetSelect() {
        if (this.addMsg.CustomerType == 1 || this.addMsg.CustomerType == 2) {
          this.addMsg.CustomerId = "";
        }
      },
      //清空联系人和联系电话
      resetMsg(type) {
        if (type == 3 || type == 4) {
          this.addMsg.ContactName = "";
          this.addMsg.ContactMobile = "";
        }
      },
      //计算少价金额
      getTypePrice() {
        if (this.addMsg.CustomerType < 3) {
          this.addMsg.ContactName = "";
          this.addMsg.ContactMobile = "";
        }
        if (this.addMsg.CustomerType == 1) {
          this.addMsg.TC_Price = this.priceObj.B2BMemberPrice;
          this.addMsg.Unit_Price = this.priceObj.B2BMemberPrice;
        }
        if (this.addMsg.CustomerType == 2) {
          this.addMsg.TC_Price = this.priceObj.B2BPrice;
          this.addMsg.Unit_Price = this.priceObj.B2BPrice;
        }
        if (this.addMsg.CustomerType == 3) {
          this.addMsg.TC_Price = this.priceObj.B2CMemberPrice;
          this.addMsg.Unit_Price = this.priceObj.B2CMemberPrice;
          this.addMsg.CustomerId = "0";
          this.addMsg.CommissionShareMoney = "0";
        }
        if (this.addMsg.CustomerType == 4) {
          this.addMsg.TC_Price = this.priceObj.B2CPrice;
          this.addMsg.Unit_Price = this.priceObj.B2CPrice;
          this.addMsg.CustomerId = "0";
          this.addMsg.CommissionShareMoney = "0";
        }
        this.Unit_PriceList = [];
        let maxPeopleNum =
          Number(this.addMsg.ManNum) +
          Number(this.addMsg.ChirdNoNeedBedNum) +
          Number(this.addMsg.ChirdNeedBedNum) +
          Number(this.addMsg.OldPeopleNum) +
          Number(this.addMsg.AirticketNum);
        if (maxPeopleNum > 0) {
          this.apipost(
            "sellorder_post_GetLessPrice", {
              TCID: this.priceObj.TCID,
              MaxPeopleNum: maxPeopleNum,
            },
            (res) => {
              this.LessMoney = res.data.data.lessMoney;
              if (parseFloat(this.LessMoney) > 0) {
                this.Unit_PriceList = [];
                for (var i = 0; i <= parseInt(this.LessMoney) / 10; i++) {
                  var obj = {
                    ID: "",
                    LessMoney: "",
                  };
                  obj.ID = this.addMsg.Unit_Price - i * 10;
                  obj.LessMoney = this.addMsg.Unit_Price - i * 10;
                  this.Unit_PriceList.push(obj);
                }
                if (
                  this.Unit_PriceList.findIndex(
                    (markers) => markers.ID == this.addMsg.Unit_Price
                  ) < 0
                ) {
                  var obj = {
                    ID: "",
                    LessMoney: "",
                  };
                  obj.ID = this.addMsg.Unit_Price;
                  obj.LessMoney = this.addMsg.Unit_Price;
                  this.Unit_PriceList.push(obj);
                }
              } else {
                this.Unit_PriceList = [];
                var obj = {
                  ID: "",
                  LessMoney: "",
                };
                obj.ID = this.addMsg.Unit_Price;
                obj.LessMoney = this.addMsg.Unit_Price;
                this.Unit_PriceList.push(obj);
              }
            }
          );
        }
      },
      //提成
      getTicheng() {
        let num =
          Number(this.addMsg.ManNum) +
          Number(this.addMsg.ChirdNum) +
          Number(this.addMsg.OldPeopleNum);
        let yh = 0;
        if (num > 0) {
          this.apipost(
            "sellorder_get_GetOrderMinPrice", {
              ltID: this.priceObj.ltID,
              Num: num,
            },
            (res) => {
              yh = res.data.data;
            }
          );
        }
        //let cj='成交单价-最低成交价格（标准单价-符合人数[成人，儿童，老人]条件的最高少价）'
        let chajia = Number(this.addMsg.Unit_Price) - (this.addMsg.TC_Price - yh);
        let ewtc = chajia > 0 ? chajia * 0.5 * num : chajia * num; //额外提成
        this.addMsg.Commission = (
          Number(this.addMsg.PreferPrice) * 0.01 +
          ewtc
        ).toFixed(2);
        this.addMsg.CommissionShareMoney = "0";
        if (
          (this.addMsg.CustomerType == 1 || this.addMsg.CustomerType == 2) &&
          this.addMsg.CommissionSharePeople != ""
        ) {
          if (this.addMsg.CommissionSharePeople != "-1") {
            if (this.addMsg.Commission > 0) {
              this.addMsg.CommissionShareMoney = this.addMsg.Commission / 2;
              this.addMsg.Commission =
                this.addMsg.Commission - this.addMsg.CommissionShareMoney;
            } else {
              this.addMsg.CommissionShareMoney = "0";
            }
          }
        }
      },
      //预计用房数
      getHouseNo() {
        //算法：((成人+儿童占床数+老人-（三人房数量*3）)-单房数)/2+单房数+三人房数量 8.7新增单地接儿童不占床  减去 儿童不占床
        let etbzc = 0;
        if (this.addMsg.GroupType == 4) {
          etbzc = this.addMsg.ChirdNoNeedBedNum ?
            Number(this.addMsg.ChirdNoNeedBedNum) :
            0;
        }
        this.addMsg.PredictRoomNum =
          (Number(this.addMsg.AirticketNum) +
            (Number(this.addMsg.ManNum) +
              Number(this.addMsg.ChirdNeedBedNum) -
              etbzc +
              Number(this.addMsg.OldPeopleNum)) -
            Number(this.addMsg.TripleRoomNum) * 3 -
            Number(this.addMsg.SingleRoomNum)) /
          2 +
          Number(this.addMsg.SingleRoomNum) +
          Number(this.addMsg.TripleRoomNum);
      },
      getNumber() {
        if (
          this.addMsg.GroupType == 4 &&
          parseInt(this.addMsg.ChirdNoNeedBedNum) >
          parseInt(this.addMsg.AirticketNum)
        ) {
          this.addMsg.ChirdNoNeedBedNum = 0;
          this.Error(this.$t('objFill.ertongbzcbndyddjr'));
          this.$forceUpdate();
          return;
        }
        let ChirdNum = 0;
        if (this.pagesTitle != "当地游产品") {
          ChirdNum =
            this.addMsg.ChirdNoNeedBedNum * 1 + this.addMsg.ChirdNeedBedNum * 1;
          //儿童人数
          this.addMsg.ChirdNum =
            this.addMsg.ChirdNoNeedBedNum * 1 + this.addMsg.ChirdNeedBedNum * 1;
        }
        if (this.pagesTitle == "当地游产品") {
          ChirdNum = Number(this.addMsg.ChirdNum);
        }
        if (this.addMsg.GroupType == 4) {
          ChirdNum = 0;
        }

        //签证人数
        this.addMsg.VisaNum =
          Number(this.addMsg.AirticketNum) +
          Number(this.addMsg.ManNum) +
          ChirdNum +
          Number(this.addMsg.BabyNum) +
          Number(this.addMsg.OldPeopleNum);
        //保险人数
        this.addMsg.SafeNum =
          Number(this.addMsg.AirticketNum) +
          Number(this.addMsg.ManNum) +
          ChirdNum +
          Number(this.addMsg.BabyNum) +
          Number(this.addMsg.OldPeopleNum);
        //总人数
        this.TotalNumber =
          Number(this.addMsg.AirticketNum) +
          Number(this.addMsg.ManNum) +
          ChirdNum +
          Number(this.addMsg.BabyNum) +
          Number(this.addMsg.OldPeopleNum);
        //座位数
        var SeatNum =
          Number(this.addMsg.ManNum) +
          Number(this.addMsg.ChirdNum) +
          Number(this.addMsg.OldPeopleNum) -
          (Number(this.addMsg.ESeatNum) + Number(this.addMsg.FSeatNum));
        this.addMsg.YSeatNum = SeatNum < 0 ? 0 : SeatNum;
        if (this.addMsg.GroupType == 4) {
          this.addMsg.YSeatNum = 0;
        }
        this.autoRemarks("VisaNum", "不要签证数量");
      },
      //计算价格
      getTotalPrice(t) {
        if (t === 3) {
          if (parseFloat(this.addMsg.Unit_Price).toString() === "NaN") {
            this.$message.error(this.$t('objFill.qingsrzqdjg'));
            this.addMsg.Unit_Price = this.addMsg.TC_Price;
            return;
          }
          if (parseFloat(this.addMsg.Unit_Price) < this.addMsg.TC_Price) {
            this.$message.error(this.$t('objFill.chengjiaojxdydybtdj'));
            this.addMsg.Unit_Price = this.addMsg.TC_Price;
            return;
          }
          if (parseFloat(this.SingleDMCPrice) < this.SingleDMCPricex) {
            this.$message.error(this.$t('objFill.chengjiaojxdydybtdj'));
            this.SingleDMCPrice = this.SingleDMCPricex;
            return;
          }
        }
        if (this.pagesTitle != "当地游产品") {
          //儿童人数=儿童占床人数+儿童不占床人数
          this.addMsg.ChirdNum = this.addMsg.ChirdNoNeedBedNum * 1 + this.addMsg.ChirdNeedBedNum * 1;
        }
        var DiscountPrice = 0; //早鸟优惠价格
        //享受早鸟优惠
        if (this.priceObj.IsBirdDiscount == 1) {
          DiscountPrice = Number(this.priceObj.DiscountPrice);
        }
        //成人价格=成人人数*(成交单价-早鸟优惠)
        let chengren = Number(this.addMsg.ManNum) * (Number(this.addMsg.Unit_Price) - DiscountPrice);

        //儿童价格=儿童人数*(单价-早鸟优惠+儿童附加费)
        let ertong = Number(this.addMsg.ChirdNum) * (Number(this.addMsg.Unit_Price) - DiscountPrice + Number(this
          .priceObj.BabyChargePrice));

        //婴儿价格=婴儿人数*婴儿价格
        let yinger = Number(this.addMsg.BabyNum) * Number(this.priceObj.BabyPrice);

        //老人价格=老人人数*(单价-早鸟优惠+老人附加费)
        let laoren = Number(this.addMsg.OldPeopleNum) * (Number(this.addMsg.Unit_Price) - this.priceObj.DiscountPrice +
          this.priceObj.OldManChargePrice);

        //杂费签证费
        let zafeiqianzhen =
          this.priceObj.OtherPrice *
          (Number(this.addMsg.ManNum) + Number(this.addMsg.ChirdNum) + Number(this.addMsg.OldPeopleNum)) +
          this.priceObj.VisaPrice *
          (Number(this.addMsg.AirticketNum) + Number(this.addMsg.ManNum) + Number(this.addMsg.ChirdNum) + Number(this
            .addMsg.OldPeopleNum)) -
          this.priceObj.BackVisaPrice *
          (Number(this.addMsg.AirticketNum) + Number(this.addMsg.ManNum) + Number(this.addMsg.ChirdNum) + Number(this
            .addMsg.BabyNum) + Number(this.addMsg.OldPeopleNum) - Number(this.addMsg.VisaNum));

        //单房价格=单房人数*单房差价格
        let danfang = Number(this.addMsg.SingleRoomNum) * this.priceObj.SingleRoomPrice;

        //儿童占床、不占床价格
        let ertongbed = this.priceObj.ChildNeedPrice * Number(this.addMsg.ChirdNeedBedNum) - this.priceObj
          .ChildNoNeedPrice * (Number(this.addMsg.ChirdNum) - Number(this.addMsg.ChirdNeedBedNum));

        //联运 (单价已包含联运价格了，所以不需要联运价格)
        let lianyun = 0;
        //  lianyun= (Number(this.addMsg.ManNum) +
        //     Number(this.addMsg.ChirdNum) +
        //     Number(this.addMsg.OldPeopleNum)) *
        //   (Number(this.stratPrice) + Number(this.returnPrice));

        //退景点费用
        var refundScenicPrice = this.ScenicRefundMoney * (Number(this.addMsg.ManNum) + Number(this.addMsg.ChirdNum) +
          Number(this.addMsg.OldPeopleNum));
        //单地接
        let dandijie = 0;
        if (this.addMsg.GroupType == 4) {
          dandijie = this.SingleDMCPrice * Number(this.addMsg.AirticketNum) - this.priceObj.ChildNoNeedPrice * Number(
            this.addMsg.ChirdNoNeedBedNum);
          ertong = 0;
          ertongbed = 0;
          zafeiqianzhen = 0;
        } else if (this.addMsg.GroupType == 5) {
          dandijie = 0;
          lianyun = 0;

          ertong = 0;
          yinger = 0;
          laoren = 0;
          ertongbed = 0;
          zafeiqianzhen = 0;
          danfang = 0;
          refundScenicPrice = 0;
          chengren = this.SingleAirticketMoney * (Number(this.TotalNumber));
        } else {
          dandijie = this.priceObj.SingleDMCPrice * Number(this.addMsg.AirticketNum);
        }

        //总应收价格
        this.addMsg.PreferPrice =
          dandijie +
          lianyun +
          chengren +
          ertong +
          yinger +
          laoren +
          zafeiqianzhen +
          danfang +
          ertongbed -
          refundScenicPrice;
        this.getTicheng();
        if (!t) {
          this.getTypePrice();
        }
      },
      //提交表单验证
      submitForm(addMsg) {
        if (this.TotalNumber == 0) {
          this.$message.error(this.$t('objFill.v101.myOrdersAllType.zongrsbnxy1'));
          return;
        }
        //提交创建、修改表单
        this.$refs[addMsg].validate((valid) => {
          console.log("valid", valid)
          if (valid) {
            this.saveOrder();
          } else {
            return false;
          }
        });
      },
      //关闭窗口
      cancelSubmit() {
        this.clearMsg();
        this.$emit("close");
      },
      //清空表单信息
      clearMsg() {
        this.DiscountAmountId = null,
          this.DiscountAmountObj = {},
          this.addMsg = {
            price: "0",
            GroupTypeNeedHouse: "0",
            OrderId: "0",
            OneSex: "0",
            TCID: "0",
            CustomerType: "",
            GroupType: "",
            IndustryCategory: "",
            ContactName: "",
            ContactMobile: "",
            CustomerId: "",
            DepartureCityId: "0",
            ReturnArriveCityId: "",
            IsIntermodal: "2",
            IsReturnIntermodal: "2",
            Unit_Price: "0",
            TC_Price: "0",
            ManNum: "0", // 成人数量
            ChirdNum: "0", // 小孩数量
            ChirdNoNeedBedNum: "",
            ChirdNeedBedNum: "",
            BabyNum: "0",
            OldPeopleNum: "0",
            SingleRoomNum: "0",
            PreferPrice: "0",
            YSeatNum: "0",
            ESeatNum: "0",
            FSeatNum: "0",
            Commission: "0",
            ClientSource: "",
            BrandId: "",
            TradeWay: "2",
            PlatformAccount: "",
            PlatformOrder: "",
            GuestNum: "0",
            IsChildrenTour: "0",
            IsBirdDiscount: "0",
            PredictRoomNum: "0",
            BigRoomNum: "0",
            TripleRoomNum: "0",
            TradeDate: "",
            CostType: "",
            Remarks: "",
            VisaNum: "0",
            SafeNum: "0",
            AirticketNum: "0",
            ScenicRefundArr: [],
            GoCityTime: "",
            BackCityTime: "",
            CommissionSharePeople: "-1",
            CommissionShareMoney: "0",
            OrderForm: "1",
            SonControlID: "-1",
            IsShowMessagesMoney: "2",
            QuotationUrl: "", //单团附件
            GuestList: [],
            GatherAddress: "",
            LureEmpId: 0, //引流id
            CRMGuestId: 0, //客人ID
            CouponAllotIds: '',
          };
        this.remarkMsg = {
          zc: "",
          bzc: "",
          fjf: "",
          ye: "",
          lr: "",
          dd: "",
          df: "",
          dc: "",
          srf: "",
          qz: "",
          qzf: "",
        };
        if (this.pagesTitle == "当地游产品") {
          this.addMsg.GroupType = "1";
        }
        this.clientSourceList = [];
        this.addMsg.ScenicRefundArr = [];
      },
      saveOrder() {
        // 判断单团类型
        if (this.addMsg.GroupType == 2) {
          if (this.addMsg.IndustryCategory == "") {
            this.Error(this.$t('objFill.v101.myOrdersAllType.qingtxhylb'));
            return;
          }
          // if (this.addMsg.QuotationUrl == "") {
          //   this.Error(this.$t('objFill.v101.FinancialModule.qingscfj'));
          //   return;
          // }
        } // 选择联运，联运备注必填
        if (
          this.addMsg.IsIntermodal == 1 ||
          this.addMsg.IsReturnIntermodal == 1
        ) {
          if (!this.addMsg.UnionRemark) {
            this.Error(this.$t('objFill.qingtxlybz'));
            return;
          }
        }
        //验证人数和机位数 20190807 修改 如果是不是单地接才判断
        if (this.addMsg.GroupType !== "4" && this.addMsg.GroupType !== "3") {
          if (this.addMsg.ChirdNoNeedBedNum == "") {
            this.addMsg.ChirdNoNeedBedNum = 0;
          }
          if (this.addMsg.ChirdNeedBedNum == "") {
            this.addMsg.ChirdNeedBedNum = 0;
          }
          if (
            Number(this.addMsg.ManNum) +
            Number(this.addMsg.ChirdNum) +
            Number(this.addMsg.OldPeopleNum) !=
            Number(this.addMsg.YSeatNum) +
            Number(this.addMsg.ESeatNum) +
            Number(this.addMsg.FSeatNum)
          ) {
            this.$message.warning(this.$t('objFill.renshuhjwsbd'));
            return;
          }
          if (
            Number(this.addMsg.AirticketNum) +
            Number(this.addMsg.ManNum) +
            Number(this.addMsg.ChirdNum) +
            Number(this.addMsg.OldPeopleNum) +
            Number(this.addMsg.BabyNum) <
            Number(this.addMsg.VisaNum)
          ) {
            this.$message.warning(this.$t('objFill.qianzsbndyrszh'));
            return;
          }

          if (
            Number(this.addMsg.AirticketNum) +
            Number(this.addMsg.ManNum) +
            Number(this.addMsg.ChirdNum) +
            Number(this.addMsg.OldPeopleNum) +
            Number(this.addMsg.BabyNum) <
            Number(this.addMsg.SafeNum)
          ) {
            this.$message.warning(this.$t('objFill.baoxiansbndyrszh'));
            return;
          }
          if (
            Number(this.addMsg.ChirdNum) -
            Number(this.addMsg.ChirdNeedBedNum) +
            Number(this.addMsg.BabyNum) >
            Number(this.addMsg.ManNum) +
            Number(this.addMsg.OldPeopleNum) +
            Number(this.addMsg.ChirdNeedBedNum)
          ) {
            this.$message.warning(this.$t('objFill.ertzcslbz'));
            return;
          }
          if (
            Number(this.addMsg.ChirdNeedBedNum) > Number(this.addMsg.ChirdNum)
          ) {
            this.$message.warning(this.$t('objFill.ertongzcbndyets'));
            return;
          }
        }
        if (this.CurrentUserInfo.EmployeeId == this.createByInfo) {
          if (this.addMsg.CommissionSharePeople == "-1") {
            this.addMsg.CommissionShareMoney = "0";
          }
        }
        //单地接
        if (this.addMsg.GroupType == 4) {
          this.addMsg.TC_Price = this.SingleDMCPricex; //地接时 本团单价
          this.addMsg.Unit_Price = this.SingleDMCPrice; // 地接时 成交单价
          if (this.addMsg.ChirdNoNeedBedNum == "") {
            this.addMsg.ChirdNoNeedBedNum = 0;
          }
        }

        let ChirdNum = Number(this.addMsg.ChirdNum);
        if (this.addMsg.GroupType == 4) {
          ChirdNum = 0;
        }
        // 判断交易方式是外交平台和平台付款
        if (this.addMsg.TradeWay == 1 || this.addMsg.TradeWay == 3) {
          if (this.addMsg.PlatformAccount == "") {
            this.Error(this.$t('objFill.v101.myOrdersAllType.qingxuanzskzhu'));
            return;
          }
        }
        this.addMsg.TCID = this.priceObj.TCID;
        this.addMsg.GuestNum =
          Number(this.addMsg.ManNum) +
          ChirdNum +
          Number(this.addMsg.OldPeopleNum) +
          Number(this.addMsg.BabyNum) +
          Number(this.addMsg.AirticketNum);

        this.addMsg.IsChildrenTour = this.priceObj.IsSupportChildren;
        this.addMsg.IsBirdDiscount = this.priceObj.IsBirdDiscount;
        let url;

        if (this.PProductType == 1) {
          if (this.pagesTitle == "跟团游产品") {
            url = "sellorder_post_SetOrderInfo_02";
            // 优惠券计算
            if ((this.addMsg.GroupType == 1 || this.addMsg.GroupType == 2) && this.DiscountAmountId) {
              this.addMsg.CouponAllotIds = this.DiscountAmountId
              // this.addMsg.PreferPrice = this.CalculationPreference()
            } else {
              this.addMsg.CouponAllotIds = ''
            }
          }
          if (this.pagesTitle == "当地游产品") {
            url = "sellorder_post_SetOneDayOrderInfo";
          }
        } else if (this.PProductType == 2) {
          url = "sellorder_post_SetTravelTeamOrderForB2B"; //包机团下单
        }
        this.saveLoading = true;
        this.apipost(url, this.addMsg, (res) => {
          this.saveLoading = false;
          if (res.data.resultCode == 1) {
            this.DiscountAmountId = null
            this.DiscountAmountObj = {}
            this.Success(res.data.message);
            this.$refs["addMsg"].resetFields();
            this.clearMsg();
            //调用父组件方法
            this.$emit("success");
          } else {
            this.Error(res.data.message);
          }
        });
      },
      // 优惠券有效期
      expiredTime(item) {
        let start_time = item.effectDate.split(' ')[0].replace(/-/g, '-')
        let end_time = item.expirationDate.split(' ')[0].replace(/-/g, '-')
        let date1 = new Date(start_time);
        let date2 = new Date(end_time);
        let date3 = new Date();
        if (this.addMsg.PreferPrice > item.useCondition &&
          (date3.Format("yyyy-MM-dd") >= date1.Format("yyyy-MM-dd") &&
            date2.Format("yyyy-MM-dd") > date3.Format("yyyy-MM-dd"))) {
          return false
        } else {
          return true
        }
      },
      // 优惠券计算
      CalculationPreference() {
        let ChirdNum = Number(this.addMsg.ChirdNum);
        if (this.addMsg.GroupType == 4) {
          ChirdNum = 0;
        }
        let Price = 0
        let PreferPrice = 0
        let PreferPriceTwo = 0
        let DiscountNumber =
          Number(this.addMsg.ManNum) +
          ChirdNum +
          Number(this.addMsg.OldPeopleNum)
        // couponsType 优惠券类型 1：抵用券，2：折扣卷
        if (DiscountNumber > 0 && this.DiscountAmountId && (this.addMsg.GroupType == 1 || this.addMsg.GroupType == 2)) {
          if (this.DiscountAmountObj && this.DiscountAmountObj.couponsType == 1) {
            if (this.addMsg.GroupType == 2) {
              if (DiscountNumber >= this.DiscountAmountObj.expansionModel.orderGuestNum) {
                PreferPrice = this.addMsg.PreferPrice - this.DiscountAmountObj.expansionModel.denomination
              }
            }
            PreferPriceTwo = this.addMsg.PreferPrice - this.DiscountAmountObj.denomination
          } else if (this.DiscountAmountObj && this.DiscountAmountObj.couponsType == 2) {
            if (this.addMsg.GroupType == 2) {
              if (DiscountNumber >= this.DiscountAmountObj.expansionModel.orderGuestNum) {
                PreferPrice = this.addMsg.PreferPrice - this.DiscountAmountObj.expansionModel.denomination
              }
            }
            PreferPriceTwo = this.addMsg.PreferPrice * (this.DiscountAmountObj.denomination / 100)
          }
          if ((PreferPrice > PreferPriceTwo) || PreferPrice == 0) {
            Price = PreferPriceTwo
          } else {
            Price = PreferPrice
          }
          return Price
        } else {
          return Price
        }
      },

      //获取所有账户列表
      getPlatformAccount(typeIdtwo) {
        let platBranchId = this.CurrentUserInfo.RB_Branch_id;
        this.apipost(
          "FinancialInstitutions_post_GetALLAccountList", {
            TypeId: typeIdtwo,
            BranchId: platBranchId,
          },
          (res) => {
            if (res.data.resultCode == 1) {
              this.PlatformAccountList1 = res.data.data;
            }
          }
        );
      },
      //获取外交平台账户列表
      getPlatformAccountNew() {
        this.apipost("Financial_get_GetDiplomacyPlatformList", {}, (res) => {
          if (res.data.resultCode == 1) {
            this.DiplomacyPlatformAccountList = [];
            let data = res.data.data;
            data.forEach((item) => {
              let obj = {
                Alias: item.Name,
                ID: item.ID,
              };
              this.DiplomacyPlatformAccountList.push(obj);
            });
          }
        });
      },
      //可退景点
      getScenicRefund(TCID) {
        this.apipost(
          "sellorder_get_GetScenicRefundList", {
            TCID,
          },
          (res) => {
            if (res.data.resultCode == 1) {
              this.ScenicRefundList = res.data.data;
              this.ScenicRefundList.forEach((item) => {
                item["ScenicName"] =
                  item.CouponsName + " -￥" + this.moneyFormat(item.RefundMoney);
              });
            }
          }
        );
      },
      //获取交易方式
      getTradeWay() {
        this.apipost("sellorder_get_GetSellTradeWayEnumList", {}, (res) => {
          if (res.data.resultCode == 1) {
            this.tradeWayList = res.data.data;
          }
        });
      },
      //客户品牌
      changeCustomer() {
        //给非直客  隐藏电话姓名赋值
        let obj = this.customerList.find(
          (item) => item.customerId == this.addMsg.CustomerId
        );
        this.customerId = obj && obj.customerId;
        this.createByInfo = obj && obj.createByInfo;
        this.addMsg.ContactName = obj && obj.customerName + "(" + obj.contact + ")";
        this.addMsg.ContactMobile = obj && obj.contactNumber;

        if (this.CurrentUserInfo.EmployeeId != this.createByInfo) {
          this.addMsg.CommissionSharePeople = this.createByInfo;
          this.isUpdateSharePeople = true;
        } else {
          this.addMsg.CommissionSharePeople = "-1";
          this.isUpdateSharePeople = false;
        }
        this.apipost(
          "app_today_visit_GetCustomerBrandByCustomerId", {
            customerInfoId: this.addMsg.CustomerId,
          },
          (res) => {
            if (res.data.resultCode == 1) {
              this.addMsg.BrandId = "";
              this.customerBrandList = res.data.data;
            }
          }
        );
      },
      //获取客户列表
      getCustomer() {
        this.apipost(
          "app_today_visit_GetOrderMyCustomerList", {
            typeId: this.addMsg.CustomerType,
            lineId: this.priceObj.LineID,
            IsLineId: 1,
          },
          (res) => {
            if (res.data.resultCode == 1) {
              this.customerList = res.data.data;
            }
          },
          (err) => {}
        );
      },
      //获取客户来源
      getClientSource() {
        this.addMsg.ClientSource = "";
        this.apipost(
          "sellorder_get_GetSellClientSourceEnumList", {
            typeId: this.addMsg.CustomerType,
          },
          (res) => {
            if (res.data.resultCode == 1) {
              this.clientSourceList = res.data.data;
            }
          }
        );
      },
      //参团类型
      getJoinType() {
        this.apipost("sellorder_get_GetOrderJoinEnumList", {}, (res) => {
          if (res.data.resultCode == 1) {
            this.joinTypeList = res.data.data;
            this.joinTypeList.splice(-1);
            this.joinTypeList.splice(-1);
            this.joinTypeList.splice(-1);
          }
        });
      },
      //获取客户类型
      getCustomerType() {
        this.apipost("sellorder_get_GetSellClientTypeEnumList", {}, (res) => {
          if (res.data.resultCode == 1) {
            if (this.showCity) {
              this.customerTypeList = res.data.data;
            } else {
              this.customerTypeList = res.data.data.filter((item) => item.Id < 3);
            }
          }
        });
      },
      //出发城市
      getCityList() {
        this.apipost("sellorder_get_GetAllStartCity", {}, (res) => {
          if (res.data.resultCode == 1) {
            this.startCityList = res.data.data;
          }
        });
      },
      //获取员工列表
      getEmployee() {
        var qEmpMsg = {
          BranchId: "-1",
          IsLeave: 0,
        };
        //员工
        this.apipost("admin_get_EmployeeGetList", qEmpMsg, (res) => {
          if (res.data.resultCode == 1) {
            this.employeeList = res.data.data;
          }
        });
      },
      //改变平台获取备注
      getRemarkDetail(id) {
        this.customerBrandList.forEach((x) => {
          if (x.dictId == id) {
            let msg = x.brandName + "订单号" + this.addMsg.PlatformOrder;
            this.addMsg.Remarks = msg;
          }
          this.$forceUpdate();
        });
      },
      //预览文件
      previewFile(e) {
        window.open(this.addMsg.QuotationUrl, "_blank");
        return;
      },
      //上传文件
      uploadFileBtn(file) {
        if (file.file.size > 1024 * 1024 * 100) {
          this.$message.warning(this.$t('objFill.v101.myOrdersAllType.shangcwjbndyybam'));
          this.$refs["my-upload"].clearFiles();
          return;
        }
        this.uploadLloading = true;
        //上传
        let newArr = [];
        newArr.push(file.file);
        let path = "/Upload/Temporary/";
        this.$message.info(this.$t("tips.shangchuanzhong"));
        this.UploadSelfFileT(path, newArr, (x) => {
          this.addMsg.QuotationUrl =
            this.domainManager().ViittoFileUrl + x.data.FilePath;
          this.$message.success(this.$t("tips.scchenggong"));
          this.uploadLloading = false;
        });
      },
      //移除文件
      removeFile(e) {
        this.addMsg.QuotationUrl = "";
      },
      //切换客人来源
      changeClientSource() {
        let text = "飞猪订单";
        if (
          this.addMsg.ClientSource == 4 &&
          this.addMsg.Remarks.indexOf(text) == -1
        ) {
          this.addMsg.Remarks = "飞猪订单；" + this.addMsg.Remarks;
        }
      },
      //获取团期价格信息
      getTravelPirceInfo() {
        var cmdStr = "";
        //常规团
        if (this.PProductType == 1) {
          cmdStr = "TaskManagemnet_get_GetSellProductCenter";
        }
        //包机团
        else if (this.PProductType == 2) {
          cmdStr = "sellorder_post_GetTravelTeamProductCenter";
        }
        var priceMsg = {
          pageIndex: 1,
          pageSize: 10,
          TCID: this.PTCID,
          BranchId: this.PBranchId,
        };
        this.apipost(cmdStr, priceMsg, (res) => {
          if (res.data.resultCode == 1) {
            var tempData = res.data.data.pageData;
            if (tempData && tempData.length > 0) {
              this.priceObj = tempData[0];
            }
          }
        });
      },
    },
    created() {
      this.CurrentUserInfo = this.getLocalStorage();
      this.getCustomerType(); //获取客户类型
      this.getPlatformAccountNew();
      this.getJoinType(); //参团类型
      this.getEmployee(); //获取员工列表
      this.getCityList(); //获取出发、返回城市
      this.getTradeWay(); //获取交易方式
      this.getCountry(); //获取国家
    },
    mounted() {
      const that = this;
      window.onresize = () => {
        return (() => {
          window.fullHeight = document.documentElement.clientHeight;
          that.fullHeight = window.fullHeight;
        })();
      };
      if (this.fullHeight > 700) {
        this.ScreenHeight = "600px";
      } else {
        this.ScreenHeight = "300px";
      }
      this.getMinPrice(this.productObj.LineID); // 当前线路报价

      //获取所有账户列表
      this.getPlatformAccount(this.productObj.PlatformAccountTypeId);
    },
    watch: {
      fullHeight(val) {
        if (!this.timer) {
          this.fullHeight = val;
          this.timer = true;
          let that = this;
          setTimeout(function () {
            that.timer = false;
          }, 400);
        }
        if (this.fullHeight > 700) {
          this.ScreenHeight = "600px";
        } else {
          this.ScreenHeight = "300px";
        }
      },
      productObj: {
        handler(oldValue, newVal) {
          this.clearMsg();
          this.addMsg.DepartureCityId = oldValue.StartCityID;
          this.addMsg.ReturnArriveCityId = oldValue.ReturnArriveCityId;
          this.addMsg.GoCityTime = this.starTime = oldValue.StartCityTime;
          this.addMsg.BackCityTime = this.endTime = oldValue.BackCityTime;
          this.addMsg.SonControlID = oldValue.SonControlID;
          this.SingleDMCPrice = oldValue.SingleDMCPrice;
          this.SingleAirticketMoney = oldValue.AirticketMoney;
          this.SingleDMCPricex = oldValue.SingleDMCPrice;
          this.priceObj = JSON.parse(JSON.stringify(oldValue));
          if (this.pagesTitle == "当地游产品") {
            let str = "";
            if (oldValue.OtherPrice > 0) {
              str += "杂费" + oldValue.OtherPrice + "/人;";
            }
            this.addMsg.Remarks = str;
            this.otherRemark = str;
          }
          // crm自动登陆传过来的参数
          if (this.$route.query.crmOrderObj) {
            this.crmOrderObj = JSON.parse(this.$route.query.crmOrderObj);
            this.addMsg.LureEmpId = this.crmOrderObj.LureEmpId; //引流id
            this.addMsg.CRMGuestId = this.crmOrderObj.CRMGuestId; //客人ID
          }

        },
        deep: true,
      },
      //监听TCID变化
      PTCID: function (oldValue, newVal) {
        this.getScenicRefund(this.PTCID); // 可退景点
      },
      'addMsg.CustomerId': {
        handler(oldValue, newVal) {
          if (oldValue) {
            this.getUserCouponList()
          }
        }
      },
    },
  };

</script>
