<style>
  @import "../../assets/css/newTravelManager.css";

  .productQuerySearch {
    width: 100%;
    min-height: auto;
    overflow: hidden;
    padding: 0 0 20px 0;
  }

  .productQuerySearch li {
    float: left;
    font-size: 12px;
    color: #666;
    margin: 20px 0 0px 0;
  }

  .productQuerySearch li>span {
    display: inline-block;
  }

  .productQuerySearch li span>em {
    display: inline-block;
    min-width: 60px;
    text-align: right;
    font-style: normal;
    margin: 0 12px 0 0;
  }

  .productQuerySearch li:last-child {
    position: fixed;
    z-index: 50;
    top: 36px;
    right: 20px;
  }

  .productQuerySearch ul {
    position: relative;
    overflow: hidden;
  }

  .elPopoverLayer {
    padding: 0px 10px;
  }

  .elPopoverLayer p {
    line-height: 34px;
    font-size: 12px;
  }

  .elPopoverLayer p>i {
    font-style: normal;
    border: 1px solid #999;
    padding: 0 3px;
    font-size: 12px;
    margin-right: 10px;
    font-weight: bold;
    color: #333;
  }

  .elPopoverLayer p>span {
    display: inline-block;
    width: 130px;
  }

  .elPopoverLayer p>span>b {
    margin-left: 10px;
    color: #2aaef2;
  }

  .superSearchLayer>p {
    padding: 20px 0;
    font-size: 14px;
    color: #333;
    font-weight: bold;
  }

  .superSearchLayer>div {
    margin-top: 20px;
    color: #666;
    font-size: 12px;
  }

  .superSearchLayer>div>span {
    margin: 0 15px 0 5px;
  }

  .productQuerybottomLayer {
    overflow: auto;
    position: fixed;
    /* max-height: 300px; */
    z-index: 50;
    bottom: 0;
    left: 0;
    border-top: 3px solid #38425d;
    background-color: #ffffff;
    padding: 10px 10px 0;
    width: 100%;
  }

  .productQuerybottomLayer .el-form-item__label {
    font-size: 12px !important;
  }

  .productQuerybottomLayer>p {
    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;
  }

  .productQuerybottomLayer .el-input {
    width: auto !important;
  }

  .productQueryList .disabledBtn {
    background: #999 !important;
    border-color: #999 !important;
  }

  .product_union {
    position: absolute;
    top: 0px;
    left: 0px;
    width: 0px;
    height: 0px;
    border-top: 15px solid red;
    border-bottom: 15px solid transparent;
    border-left: 15px solid red;
    border-right: 15px solid transparent;
  }

  .product_union::after {
    content: "联";
    position: absolute;
    top: -14px;
    left: -11px;
    white-space: nowrap;
    color: #ffffff;
    font-size: 12px;
  }

  .product_union1 {
    position: absolute;
    top: 0px;
    left: 0px;
    width: 0px;
    height: 0px;
    border-top: 15px solid red;
    border-bottom: 15px solid transparent;
    border-left: 15px solid red;
    border-right: 15px solid transparent;
  }

  .product_union1::after {
    content: "内";
    position: absolute;
    top: -14px;
    left: -11px;
    white-space: nowrap;
    color: #ffffff;
    font-size: 12px;
  }

  .product_warning {
    position: absolute;
    top: 0px;
    right: 0px;
    width: 0px;
    height: 0px;
    border-top: 10px solid red;
    border-bottom: 10px solid transparent;
    border-left: 10px solid transparent;
    border-right: 10px solid red;
  }

  .product_warning::after {
    content: "!";
    position: absolute;
    top: -12px;
    right: -5px;
    white-space: nowrap;
    color: #ffffff;
    font-size: 12px;
  }

  .PQ_detail {
    width: 100%;
    border-collapse: collapse;
  }

  .PQ_detail tr th,
  .v-table-title-cell {
    background: #e6e6e6;
    height: 40px;
    font-size: 14px;
    border-right: 1px solid #e6e6e6;
    color: #333;
  }

  .PQ_detail tr {
    background: #fff;
    text-align: center;
    height: 40px;
  }

  .PQ_detail tr td {
    font-size: 12px;
    border: 1px solid #e5e5e5;
  }

  .PQ_HotelPop {
    overflow: auto;
    max-height: 350px;
  }

  .PQ_HotelPop table td {
    padding: 5px 0;
    text-align: center;
  }

  .PQ_HotelPop table th {
    text-align: center;
  }

  .productQuerybottomLayer .el-upload-list {
    width: 200px;
  }

</style>
<template>
  <div class="flexOne">
    <div class="productQuerySearch" v-if="!TCIDList">
      <ul>
        <li><span><em>{{$t('scen.sc_cp')}}</em>
            <!--台湾印象只能看自公司的 不能切换 HK 2023-10-26 添加-->
            <el-select class='w150' v-model="msg.BranchId" :disabled="CurrentUserInfo.RB_Branch_id==1220" filterable
              :placeholder="$t('pub.pleaseSel')">
              <el-option v-for="item in companyList" :label='item.BName' :value='item.Id' :key='item.Id'>
              </el-option>
            </el-select>
          </span></li>
        <li><span><em>{{$t('advmanager.v_line')}}</em>
            <el-select class='w150' v-model="msg.LineId" filterable :placeholder="$t('pub.pleaseSel')"
              @change="getLineTeamList(msg.LineId),getAimPlaceList(msg.LineId,'')">
              <el-option :label="$t('pub.unlimitedSel')" value='-1'></el-option>
              <el-option v-for="item in LineList" :label='item.LineName' :value='item.LineID' :key='item.LineID'>
              </el-option>
            </el-select>
          </span></li>
        <li><span><em>{{$t('advmanager.v_xilie')}}</em>
            <el-select class='w150' v-model="msg.LineTeamId" filterable :placeholder="$t('pub.pleaseSel')"
              @change="getAimPlaceList('',msg.LineTeamId)">
              <el-option :label="$t('pub.unlimitedSel')" value='-1'></el-option>
              <el-option v-for="item in LineTeamList" :label='item.LtName' :value='item.LtID' :key='item.LtID'>
              </el-option>
            </el-select>
          </span></li>
        <li><span><em>{{$t('system.query_dest')}}</em>
            <el-select class='w150' v-model="msg.AimPlaceId" filterable :placeholder="$t('pub.pleaseSel')">
              <el-option :label="$t('pub.unlimitedSel')" value='-1'></el-option>
              <el-option v-for="item in AimPlaceList" :label='item.PlaceName' :value='item.PlaceID' :key='item.PlaceID'>
              </el-option>
            </el-select>
          </span></li>
        <li>
          <span>
            <em>{{$t('visa.v_tuanhao')}}</em>
            <el-input v-model='msg.TCID' class='w150'></el-input>
          </span>
        </li>
        <li><span><em>{{$t('hotel.hotel_StarDate')}}</em>
            <el-date-picker v-model='msg.StartTime' @change="dataDui()" class='w135' value-format="yyyy-MM-dd"
              type="date"></el-date-picker>
            -
            <el-date-picker v-model='msg.EndTime' @change="dataDui()" class='w135' value-format="yyyy-MM-dd"
              type="date"></el-date-picker>
          </span>
        </li>
        <li style="height:34px;line-height:34px;padding: 0 0 0 20px;vertical-align: middle;">
          <el-popover width="270" trigger="click">
            <div class="superSearchLayer">
              <p>{{$t('visa.v_tkgjcx')}}</p>
              <div><span>{{$t('visa.v_teamnum')}}</span>
                <el-input class='w69' v-model='msg.minGroupSize' @keyup.native="checkInteger(msg,'minGroupSize')">
                </el-input>
                -
                <el-input class='w69' v-model='msg.maxGroupSize' @keyup.native="checkInteger(msg,'maxGroupSize')">
                </el-input>
              </div>
              <div><span>{{$t('leader.leader_registraNum')}}</span>
                <el-input class='w69' v-model='msg.minApplySize' @keyup.native="checkInteger(msg,'minApplySize')">
                </el-input>
                -
                <el-input class='w69' v-model='msg.maxApplySize' @keyup.native="checkInteger(msg,'maxApplySize')">
                </el-input>
              </div>
              <div><span>{{$t('Airticket.Air_salesPlatform')}}</span>
                <el-select filterable multiple v-model="msg.SalePlat" :placeholder="$t('system.ph_buxian')"
                  class="w150 multiple_input">
                  <el-option v-for="item in salePlace" :key="item.Id" :label="item.Name" :value="item.Id">
                  </el-option>
                </el-select>
              </div>
              <div>
                <input type="button" style="width: 230px!important;" class="normalBtn" :value="$t('pub.searchBtn')"
                  @click="getList();resetPageIndex()" />
              </div>
            </div>
            <span slot="reference" style="cursor: pointer;">{{$t('visa.v_gjchaxun')}}<i
                class="el-icon-caret-bottom"></i></span>
          </el-popover>
        </li>
        <li style="height:34px;line-height:34px;padding: 0 0 0 20px;vertical-align: middle;">
          <el-popover width="260" trigger="click">
            <div>
              <div class="TC_queryTitle">{{$t('Operation.Op_TeamWarningSearch')}}</div>
              <div class="clearfix">
                <div class="TC_leftSearch">
                  <div>
                    <span
                      style="display:inline-block;margin: 0 5px 0 0;width:50px;text-align:right;">{{$t('leader.leader_registraNum')}}</span>
                    <el-select v-model="msg.WarningQuery" filterable :placeholder="$t('system.ph_buxian')" class="w150">
                      <el-option :label='$t("system.ph_buxian")' value='-1'></el-option>
                      <el-option :label="$t('salesModule.Nobaoming')" value='1'></el-option>
                      <el-option :label="$t('salesModule.Less10')" value='2'></el-option>
                      <el-option :label="$t('salesModule.More10')" value='3'></el-option>
                      <el-option :label="$t('salesModule.YWLess5')" value='4'></el-option>
                      <el-option :label="$t('salesModule.YHBRS')" value='5'></el-option>
                    </el-select>
                  </div>
                  <div>
                    <span
                      style="display:inline-block;margin: 0 5px 0 0;width:50px;text-align:right;">{{$t('Operation.Op_daysChoice')}}</span>
                    <el-select v-model="msg.RateOnDay" filterable :placeholder="$t('system.ph_buxian')" class="w150">
                      <el-option :label='$t("system.ph_buxian")' value='-1'></el-option>
                      <el-option :label="$t('salesModule.Inner10')" value='1'></el-option>
                      <el-option :label="$t('salesModule.Inner15')" value='2'></el-option>
                      <el-option :label="$t('salesModule.Inner20')" value='3'></el-option>
                      <el-option :label="$t('salesModule.Out20')" value='4'></el-option>
                    </el-select>
                  </div>
                  <div>
                    <span
                      style="display:inline-block;margin: 0 5px 0 0;width:50px;text-align:right;">{{$t('Operation.Op_Attendance')}}</span>
                    <el-select v-model="msg.RateOn" filterable :placeholder="$t('system.ph_buxian')" class="w150">
                      <el-option :label='$t("system.ph_buxian")' value='-1'></el-option>
                      <el-option label='100%' value='1'></el-option>
                      <el-option :label="$t('salesModule.Nomore80')" value='2'></el-option>
                      <el-option :label="$t('salesModule.Nomore60')" value='3'></el-option>
                      <el-option :label="$t('salesModule.Nomore40')" value='4'></el-option>
                    </el-select>
                  </div>
                </div>
              </div>
              <button class="normalBtn TC_SearchBtn"
                @click="getList();resetPageIndex()">{{$t('pub.searchBtn')}}</button>
            </div>
            <span slot="reference" style="cursor: pointer;">{{$t('Operation.Op_warningSearch')}}<i
                class="iconfont icon-xiaotuziCduan_1"></i></span>
          </el-popover>
        </li>
        <li>
          <input type="button" class="hollowFixedBtn" :value="$t('pub.searchBtn')"
            @click="getList();resetPageIndex()" />
        </li>
      </ul>
    </div>
    <el-pagination background @current-change="handleCurrentChange" :current-page.sync="currentPage"
      layout="total,prev, pager, next, jumper" :page-size="msg.pageSize" :total="total">
    </el-pagination>
    <!-- 产品列表 -->
    <productOrderList :loading="loading" :list="list" @success="resetPageIndex" :pagesTitle="pagesTitle">
    </productOrderList>
    <el-pagination background @current-change="handleCurrentChange" :current-page.sync="currentPage"
      layout="total,prev, pager, next, jumper" :page-size="msg.pageSize" :total="total">
    </el-pagination>
    <el-dialog custom-class='ComTeamPlan_info_box' :title="tripTitle" :visible.sync="outerVisible" center>
      <commonTeamInfo ref="comTeam"></commonTeamInfo>
    </el-dialog>

    <el-dialog custom-class='w450' title="行程下载" :visible.sync="travelControlTripLayerShow" center>
      <tripDownLoadCommon ref="tripDownLoadCommon" :tripObj="tripObj" @headCallBack="hideTripDown" :downType="1">
      </tripDownLoadCommon>
    </el-dialog>
  </div>
</template>

<script>
  import productOrderList from "../orderCommon/productOrderList.vue";
  import commonTeamInfo from "../commonPage/commonTeamInfo.vue";
  import tripDownLoadCommon from "../commonPage/TripDownLoadCommon.vue";
  import carousel from "../commonPage/carousel.vue";

  export default {
    data() {
      return {
        pagesTitle: '当地游产品',
        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
          }
        },
        travelControlTripLayerShow: false,
        wxLoading: false,
        HightUnitPrice: '2',
        userId: '',
        customerId: '',
        createByInfo: '',
        isUpdateSharePeople: false,
        starTime: '',
        endTime: '',
        stratPrice: '',
        stratPriceShow: false,
        returnPrice: '',
        returnPriceShow: false,
        minPrice: 0,
        loading: true,
        loading2: false,
        isShowLayer: false,
        outerVisible: false,
        tripTitle: '',
        currentPage: 1,
        total: 0,
        addObj: {},
        Unit_PriceList: [], //成交单价下拉数据
        LessMoney: 0,
        addMsg: {
          OrderId: '0',
          TCID: '0',
          CustomerType: '',
          GroupType: 1,
          ContactName: '',
          ContactMobile: '',
          CustomerId: '',
          DepartureCityId: '',
          ReturnArriveCityId: '',
          IsIntermodal: '2',
          IsReturnIntermodal: '2',
          Unit_Price: '0',
          TC_Price: '0',
          ManNum: '0',
          ChirdNum: '0',
          ChirdNoNeedBedNum: '0',
          ChirdNeedBedNum: '0',
          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',
          GuestList: [],
          GatherAddress: '',
          LureEmpId: 0, //引流id
          CRMGuestId: 0, //客人ID
          LuggageNum:''//行李数量
        },
        GuestList: [{
          SurName: '',
          Name: '',
          Sex: '',
          ESurName: '',
          EName: '',
          Birthday: '',
          Nationality: '',
          PassportNo: '',
          Remarks: '',
          MobilePhone: ''
        }],
        GuestObj: {
          SurName: '',
          Name: '',
          Sex: '',
          ESurName: '',
          EName: '',
          Birthday: '',
          Nationality: 2,
          PassportNo: '',
          Remarks: '',
          MobilePhone: '',
          Id: 0
        },
        employeeMsg: {
          BranchId: '-1',
          IsLeave: 0
        },
        employeeList: [],
        rules: {
          CustomerType: [{
            required: true,
            message: this.$t('objFill.qingxuanzhekhlx'),
            trigger: 'change'
          }],
          CustomerId: [{
            required: false,
            message: '请选择客户门店',
            trigger: 'change'
          }],
          DepartureCityId: [{
            required: true,
            message: '请选择出发城市',
            trigger: 'change'
          }],
          GroupType: [{
            required: true,
            message: '请选择参团类型',
            trigger: 'change'
          }],
          ClientSource: [{
            required: true,
            message: '请选择客人来源',
            trigger: 'change'
          }],
          TradeWay: [{
            required: true,
            message: '请选择交易方式',
            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: '请输入姓',
            trigger: 'blur'
          }, ],
          Name: [{
            required: true,
            message: '请输入名',
            trigger: 'blur'
          }, ],
          Sex: [{
            required: true,
            message: '请选择性别',
            trigger: 'change'
          }, ],
          Birthday: [{
            required: true,
            message: '请选择出生日期',
            trigger: 'blur'
          }, ],
          Nationality: [{
            required: true,
            message: '请选择国籍',
            trigger: 'change'
          }, ],
          PassportNo: [{
            required: true,
            message: '请输入护照号',
            trigger: 'blur'
          }, ],
          LuggageNum: [{
            required: true,
            message: '请输入行李数量',
            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: '请输入集合地',
            trigger: 'blur'
          }, ]
        },
        msg: {
          pageIndex: 1,
          pageSize: 10,
          LineId: '-1',
          LineTeamId: '-1',
          AimPlaceId: '-1',
          TCID: '',
          StartTime: '',
          EndTime: '',
          BranchId: '-1',
          CityId: '-1',
          DaysTrip: '',
          SalePlat: [],
          minGroupSize: '',
          maxGroupSize: '',
          minApplySize: '',
          maxApplySize: '',
          FlightID: '-1',
          TCIDList: '',
          WarningQuery: '-1',
          RateOnDay: '-1',
          RateOn: '-1'
        },
        defaultImg: 'this.src="' + require("../../assets/img/bg_z1@2x.png") + '"',
        list: [],
        LineList: [],
        LineTeamList: [],
        AimPlaceList: [],
        airlineList: [],
        companyList: [],
        salePlace: [],
        startCityList: [],
        startCityList1: [],
        tripDetails: [],
        khlxList: [],
        ctlxList: [],
        ddlyList: [],
        ddztList: [],
        khmdList: [],
        ssptList: [],
        jyfsList: [],
        fylxList: [],
        remarkMsg: {
          zc: '',
          bzc: '',
          fjf: '',
          ye: '',
          lr: '',
          dd: '',
          df: '',
          dc: '',
          srf: '',
          qz: '',
          qzf: '',
        },
        otherRemark: '',
        ScenicRefundList: [],
        PlatformAccountList: [],
        ScenicRefundMoney: 0,
        TCIDList: null,
        tripObj: {
          tcid: 0,
          configId: 0,
          cityId: 0,
          orderId: 0
        },
        SingleDMCPricex: 0, // 单地接;
        SingleDMCPrice: 0, // 单地接;
        optionsList: [{
            Name: '男',
            Id: 1
          },
          {
            Name: '女',
            Id: 2
          },
        ],
        TotalNumber: 0,
        countryList: [], //国籍
        //当前登录用户信息
        CurrentUserInfo: {},
        crmOrderObj: null,
      }
    },
    components: {
      productOrderList,
      commonTeamInfo: commonTeamInfo,
      tripDownLoadCommon: tripDownLoadCommon,
      carousel: carousel
    },
    watch: {

    },
    filters: {
      priceFormat(value) {
        if (value == null) {
          return 0.00;
        }
        let nStr = value.toFixed(2)
        nStr += '';
        let x = nStr.split('.');
        let x1 = x[0];
        let x2 = x.length > 1 ? '.' + x[1] : '';
        var rgx = /(\d+)(\d{3})/;
        while (rgx.test(x1)) {
          x1 = x1.replace(rgx, '$1' + ',' + '$2');
        }
        return x1 + x2;
      },
      priceFormat2(value) {
        if (value == null) {
          return '已包含';
        }
        let nStr = value.toFixed(2)
        nStr += '';
        let x = nStr.split('.');
        let x1 = x[0];
        let x2 = x.length > 1 ? '.' + x[1] : '';
        var rgx = /(\d+)(\d{3})/;
        while (rgx.test(x1)) {
          x1 = x1.replace(rgx, '$1' + ',' + '$2');
        }
        let result = x1 + x2
        if (result === '0.00') {
          result = '已包含'
        }
        return result;
      }
    },
    methods: {
      goB2Bdetail(ConfigId, tcid) {
        var B2BDomain = this.CurrentUserInfo.B2BDomain //'www.oytour.com';
        this.$tripUtils.GotoB2BPage(B2BDomain, encodeURIComponent(ConfigId), tcid);
      },
      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 => {}
        );
      },
      groupTypeChange: function (val) {
        if (val === '4') {
          this.addMsg.ManNum = 0
          this.addMsg.ChirdNoNeedBedNum = 0
          this.addMsg.ChirdNeedBedNum = 0
          this.addMsg.BabyNum = 0
          this.addMsg.OldPeopleNum = 0
          this.addMsg.ManNum = 0
          this.getNumber();
          this.getHouseNo();
          this.getTotalPrice()
        } else if (val === '1') {
          this.addMsg.AirticketNum = 0
          this.getNumber();
          this.getHouseNo();
          this.getTotalPrice()
        }
      },
      gettypechange(type) {
        if (type == 4) {
          this.HightUnitPrice = '1';
          this.addMsg.AirticketNum = 0;
          this.addMsg.ManNum = 0;
          this.addMsg.BabyNum = 0;
          this.addMsg.OldPeopleNum = 0;
          this.addMsg.ChirdNoNeedBedNum = 0;
          this.addMsg.ChirdNeedBedNum = 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.ChirdNoNeedBedNum = 0;
          this.addMsg.ChirdNeedBedNum = 0;

          this.addMsg.PreferPrice = 0;
          this.addMsg.SafeNum = 0;
          this.addMsg.VisaNum = 0;
          this.addMsg.PredictRoomNum = 0;
          this.addMsg.YSeatNum = 0;
        }
        this.Unit_PriceList = []
      },
      downloadFile: function (item) {
        let reg = /^http(s)?:\/\/(.*?)\//
        this.downloadFileRename(item.FullUrl.replace(reg, ''), item.Name);
      },
      yzVisaNum: function () {
        let count = (Number(this.addMsg.AirticketNum) + Number(this.addMsg.ManNum) + Number(this.addMsg.ChirdNum) +
          Number(this.addMsg.BabyNum) + Number(this.addMsg.OldPeopleNum))
        if (count < this.addMsg.VisaNum) {
          this.addMsg.VisaNum = count
          this.$message.error('签证人数不能大于总人数')
        }
      },
      yzSafeNum: function () {
        let count = (Number(this.addMsg.AirticketNum) + Number(this.addMsg.ManNum) + Number(this.addMsg.ChirdNum) +
          Number(this.addMsg.BabyNum) + Number(this.addMsg.OldPeopleNum))
        this.TotalNumber = count
        if (count < this.addMsg.SafeNum) {
          this.addMsg.SafeNum = count
          this.$message.error('保险人数不能大于总人数')
          this.getNumGuest()
        }
      },
      // 结束日期不能大于开始日期
      dataDui() {
        if (this.msg.StartTime > this.msg.EndTime && this.msg.EndTime !== "") {
          this.$message.error("结束日期不能大于开始日期");
          this.msg.EndTime = "";
        }
      },
      // 自动添加备注
      autoRemarks: function (key, text) {
        let count = (Number(this.addMsg.AirticketNum) + Number(this.addMsg.ManNum) + Number(this.addMsg.ChirdNum) +
          Number(this.addMsg.BabyNum) + Number(this.addMsg.OldPeopleNum))
        // if (this.addMsg[key].toString() !== count.toString() && this.addMsg[key].toString() !== '') {
        //   this.addMsg.Remarks = this.addMsg.Remarks + text + ':' + (count-this.addMsg[key]) + ';'
        // }
        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.addObj.VisaPrice) {
                this.remarkMsg.qzf = '签证费' + this.addObj.VisaPrice + '/人;';
              }
              if (this.addObj.BackVisaPrice) {
                this.remarkMsg.qz = text + ':' + (count - this.addMsg[key]) + ';' + '退签证费' + this.addObj
                  .BackVisaPrice +
                  '/人;';
              }
            }
            if (text === '不要保险数量') {
              this.remarkMsg.bx = text + ':' + (count - this.addMsg[key]) + ';';
            }
          } else if (this.addMsg[key].toString() === count.toString()) {
            if (this.addObj.VisaPrice) {
              this.remarkMsg.qzf = '签证费' + this.addObj.VisaPrice + '/人;';
            }
            this.remarkMsg.qz = '';
          }
          if (text === '儿童不占床') {
            if (this.remarkMsg.bzc === '') {
              this.remarkMsg.bzc = '儿童不占床:' + this.addMsg[key] + ';';
              if (this.addObj.ChildNoNeedPrice) {
                this.remarkMsg.bzc += '儿童不占床减免' + this.addObj.ChildNoNeedPrice + '/人;';
              }
            } else {
              this.remarkMsg.bzc = '';
              this.remarkMsg.bzc = '儿童不占床:' + this.addMsg[key] + ';';
              if (this.addObj.ChildNoNeedPrice) {
                this.remarkMsg.bzc += '儿童不占床减免' + this.addObj.ChildNoNeedPrice + '/人;';
              }
            }
            if (this.remarkMsg.fjf === '') {
              if (this.addObj['BabyChargePrice'] > 0 && this.addObj['BabyChargePrice']) {
                this.remarkMsg.fjf = '儿童附加费:' + this.addObj['BabyChargePrice'] + '/人;';
              } else {
                this.remarkMsg.fjf = '';
              }
            }
          }
          if (text === '儿童占床') {
            if (this.remarkMsg.zc === '') {
              this.remarkMsg.zc = '儿童占床:' + this.addMsg[key] + ';';
              if (this.addObj.ChildNeedPrice) {
                this.remarkMsg.zc = this.remarkMsg.zc + '儿童占床附加费' + this.addObj.ChildNeedPrice + '/人;';
              }
            } else {
              this.remarkMsg.zc = '';
              this.remarkMsg.zc = '儿童占床:' + this.addMsg[key] + ';';
              if (this.addObj.ChildNeedPrice) {
                this.remarkMsg.zc = this.remarkMsg.zc + '儿童占床附加费' + this.addObj.ChildNeedPrice + '/人;';
              }
            }
            if (this.remarkMsg.fjf === '') {
              this.remarkMsg.fjf = this.addObj['BabyChargePrice'] ? '儿童附加费:' + this.addObj['BabyChargePrice'] +
                '/人;' :
                '';
            }
          }
          if (text === '老人人数') {
            if (this.remarkMsg.lr === '') {
              this.remarkMsg.lr = '老人人数:' + this.addMsg[key] + ';';
              if (this.addObj.OldManChargePrice) {
                this.remarkMsg.lr = this.remarkMsg.lr + this.addObj.OldManChargePrice + '/人;';
              }
            } else {
              this.remarkMsg.lr = '';
              this.remarkMsg.lr = '老人人数:' + this.addMsg[key] + ';';
              if (this.addObj.OldManChargePrice) {
                this.remarkMsg.lr = this.remarkMsg.lr + this.addObj.OldManChargePrice + '/人;';
              }
            }
          }
          if (text === '婴儿人数') {
            if (this.remarkMsg.ye === '') {
              this.remarkMsg.ye = '婴儿人数:' + this.addMsg[key] + ';' + '婴儿价格:' + Number(this.addMsg.Unit_Price) + '/人;';
            } else {
              this.remarkMsg.ye = '';
              this.remarkMsg.ye = '婴儿人数:' + this.addMsg[key] + ';' + '婴儿价格:' + Number(this.addMsg.Unit_Price) + '/人;';
            }
          }
          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.addObj.SingleRoomPrice + '/人;';
            } else {
              this.remarkMsg.df = '';
              this.remarkMsg.df = '单房数量:' + this.addMsg[key] + ';' + '单房差价' + this.addObj.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 = '';
        newRemark = _this.addMsg.Remarks + _this.otherRemark;
        Object.keys(_this.remarkMsg).forEach(function (key) {
          newRemark = newRemark + _this.remarkMsg[key];
        });
        _this.addMsg.Remarks = newRemark;
      },
      autoRemarks2: function (key, text) {
        // let count = (Number(this.addMsg.AirticketNum)+Number(this.addMsg.ManNum)+Number(this.addMsg.ChirdNum)+Number(this.addMsg.BabyNum)+Number(this.addMsg.OldPeopleNum))
        // if (this.addMsg[key].toString() !== count.toString() && this.addMsg[key].toString() !== '') {
        //   this.addMsg.Remarks = this.addMsg.Remarks + text + ':' + (count-this.addMsg[key]) + ';'
        // }
      },
      // 获取微信二维码
      getWxCode: function (key) {
        this.wxLoading = false
        if (this.list[key].wxImage === '') {
          this.wxLoading = true
          this.apipost('TaskManagemnet_get_GetWeiXinShare', {
            ConfigId: this.list[key].ConfigID,
            TCID: this.list[key].TCID
          }, res => {
            if (res.data.resultCode == 1) {
              let url = res.data.data
              this.list[key].wxImage = url
              this.wxLoading = false
            } else {
              this.$message.error("二维码获取失败")
            }
          }, err => {})
        }
      },
      toTrip: function (obj) {
        this.tripObj.tcid = obj.TCID;
        this.tripObj.configId = obj.ConfigID;
        this.tripObj.cityId = obj.StartCityID;
        this.tripObj.orderId = 0;
        this.travelControlTripLayerShow = true;
      },
      hideTripDown() {
        this.travelControlTripLayerShow = false;
      },
      goUrl(path, id, tcmun) {
        this.$router.push({
          name: path,
          query: {
            "id": id,
            tcmun: tcmun,
            blank: 'y',
            tab: '团报名清单'
          }
        });
      },
      goUrlX(item) {
        this.$router.push({
          name: 'GroupAdvertising',
          query: {
            LineID: item.LineID,
            TCID: item.TCID,
            blank: 'y',
            tab: '团期广告'
          }
        });
      },
      //获取航班详情
      getDetails(index) {
        this.tripDetails = this.list[index].flightList;
      },
      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()
              }
            }, err => {})
          }
        } 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()
              }
            }, err => {})
          }
        }

      },
      ScenicRefundMethods() {
        if (this.addMsg.ScenicRefundArr.length == 0) {
          this.ScenicRefundMoney = 0;
        } else {
          this.ScenicRefundMoney = 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() {
        if (this.addMsg.TradeWay == 2) {
          this.addMsg.PlatformOrder = ''
          this.addMsg.PlatformAccount = ''
          this.addMsg.MinOrderPrice = 0
          this.addMsg.CostType = ''
          this.addMsg.TradeDate = ''
        }
      },
      platformOrderMethods() {
        return;
        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.LowDeposit
          }
        }, err => {})
      },
      resetSelect() {
        if (this.addMsg.CustomerType == 1) {
          this.addMsg.CustomerId = ''
        }
        if (this.addMsg.CustomerType == 2) {
          this.addMsg.CustomerId = ''
        }
      },
      getTypePrice() {
        this.addMsg.ContactName = ''
        this.addMsg.ContactMobile = ''
        if (this.addMsg.CustomerType == 1) {
          this.addMsg.TC_Price = this.addObj.B2BMemberPrice
          this.addMsg.Unit_Price = this.addObj.B2BMemberPrice;
          //this.addMsg.CustomerId = ''
        }
        if (this.addMsg.CustomerType == 2) {
          this.addMsg.TC_Price = this.addObj.B2BPrice
          this.addMsg.Unit_Price = this.addObj.B2BPrice;
          //this.addMsg.CustomerId = ''
        }
        if (this.addMsg.CustomerType == 3) {
          this.addMsg.TC_Price = this.addObj.B2CMemberPrice
          this.addMsg.Unit_Price = this.addObj.B2CMemberPrice;
          this.addMsg.CustomerId = '0'
          this.addMsg.CommissionShareMoney = '0'

        }
        if (this.addMsg.CustomerType == 4) {
          this.addMsg.TC_Price = this.addObj.B2CPrice
          this.addMsg.Unit_Price = this.addObj.B2CPrice;
          this.addMsg.CustomerId = '0'
          this.addMsg.CommissionShareMoney = '0'
        }
        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.addObj.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);
            }
          }, err => {})
        }

      },
      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.addObj.ltID,
            Num: num
          }, res => {
            yh = res.data.data
          }, err => {})
        }
        //  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+单房数+三人房数量
        this.addMsg.PredictRoomNum = (Number(this.addMsg.AirticketNum) + (Number(this.addMsg.ManNum) + Number(this
          .addMsg
          .ChirdNeedBedNum) + Number(this.addMsg.OldPeopleNum)) - Number(this.addMsg.TripleRoomNum) * 3 - Number(
          this.addMsg.SingleRoomNum)) / 2 + Number(this.addMsg.SingleRoomNum) + Number(this.addMsg.TripleRoomNum)
      },
      getNumber() {
        // this.addMsg.ChirdNum = this.addMsg.ChirdNoNeedBedNum * 1 + this.addMsg.ChirdNeedBedNum * 1
        this.addMsg.VisaNum = (Number(this.addMsg.AirticketNum) + Number(this.addMsg.ManNum) + Number(this.addMsg
            .ChirdNum) +
          Number(this.addMsg.BabyNum) + Number(this.addMsg.OldPeopleNum))
        this.addMsg.SafeNum = (Number(this.addMsg.AirticketNum) + Number(this.addMsg.ManNum) + Number(this.addMsg
            .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.BabyNum)) -
          (Number(this.addMsg.ESeatNum) + Number(this.addMsg.FSeatNum));
        this.TotalNumber = (Number(this.addMsg.AirticketNum) + Number(this.addMsg.ManNum) + Number(this.addMsg
            .ChirdNum) +
          Number(this.addMsg.BabyNum) + Number(this.addMsg.OldPeopleNum))
        this.addMsg.YSeatNum = SeatNum < 0 ? 0 : SeatNum;
        this.autoRemarks("VisaNum", "不要签证数量")
      },
      getTotalPrice(t) {
        if (t === 3) {
          if (parseFloat(this.addMsg.Unit_Price).toString() === "NaN") {
            this.$message.error('请输入正确的价格！')
            this.addMsg.Unit_Price = this.addMsg.TC_Price
            return
          }
          if (parseFloat(this.addMsg.Unit_Price) < this.addMsg.TC_Price) {
            this.$message.error('成交单价必须大于等于本团单价！')
            this.addMsg.Unit_Price = this.addMsg.TC_Price
            return
          }
          if (parseFloat(this.SingleDMCPrice) < this.SingleDMCPricex) {
            this.$message.error('成交单价必须大于等于本团单价！')
            this.SingleDMCPrice = this.SingleDMCPricex
            return
          }
        }
        if (this.addObj.IsBirdDiscount == 1) { //早鸟优惠
          //this.addMsg.Unit_Price  //成交单价
          //BabyPrice 婴儿价
          //BabyChargePrice  儿童附加费
          //OldManChargePrice  老人 附加费
          //DiscountPrice 早鸟优惠
          let chengren = Number(this.addMsg.ManNum) * (Number(this.addMsg.Unit_Price) - this.addObj.DiscountPrice)
          let ertong = Number(this.addMsg.ChirdNum) * (Number(this.addMsg.Unit_Price) - this.addObj.DiscountPrice +
            this.addObj.BabyChargePrice)

          let yinger = Number(this.addMsg.BabyNum) * Number(this.addMsg.Unit_Price)
          let laoren = Number(this.addMsg.OldPeopleNum) * (Number(this.addMsg.Unit_Price) - this.addObj.DiscountPrice +
            this.addObj.OldManChargePrice)
          let zafeiqianzhen = this.addObj.OtherPrice * (Number(this.addMsg.ManNum) + Number(this.addMsg.ChirdNum) +
              Number(this.addMsg.OldPeopleNum)) + this.addObj.VisaPrice * (Number(this.addMsg.AirticketNum) + Number(
              this.addMsg.ManNum) + Number(this.addMsg.ChirdNum) + Number(this.addMsg.OldPeopleNum)) - this.addObj
            .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.addObj.SingleRoomPrice
          let ertongbed = this.addObj.ChildNeedPrice * Number(this.addMsg.ChirdNeedBedNum) - this.addObj
            .ChildNoNeedPrice *
            (Number(this.addMsg.ChirdNum) - Number(this.addMsg.ChirdNeedBedNum))
          let lianyun = (Number(this.addMsg.ManNum) + Number(this.addMsg.ChirdNum) + Number(this.addMsg.OldPeopleNum)) *
            (Number(this.stratPrice) + Number(this.returnPrice))
          let dandijie
          if (this.addMsg.GroupType == 4) {
            dandijie = this.SingleDMCPrice * Number(this.addMsg.AirticketNum)
          } else {
            dandijie = this.addObj.SingleDMCPrice * Number(this.addMsg.AirticketNum)
          }
          this.addMsg.PreferPrice = dandijie + lianyun + chengren + ertong + yinger + laoren + zafeiqianzhen + danfang +
            ertongbed - this.ScenicRefundMoney * (Number(this.addMsg.ManNum) + Number(this.addMsg.ChirdNum) + Number(
              this.addMsg.OldPeopleNum));
        } else {
          let chengren = Number(this.addMsg.ManNum) * (Number(this.addMsg.Unit_Price))
          let ertong = Number(this.addMsg.ChirdNum) * (Number(this.addMsg.Unit_Price) + this.addObj.BabyChargePrice)
          let yinger = Number(this.addMsg.BabyNum) * Number(this.addMsg.Unit_Price)
          let laoren = Number(this.addMsg.OldPeopleNum) * (Number(this.addMsg.Unit_Price) + this.addObj
            .OldManChargePrice)
          let zafeiqianzhen = this.addObj.OtherPrice * (Number(this.addMsg.ManNum) + Number(this.addMsg.ChirdNum) +
              Number(this.addMsg.OldPeopleNum)) + this.addObj.VisaPrice * (Number(this.addMsg.AirticketNum) + Number(
              this.addMsg.ManNum) + Number(this.addMsg.ChirdNum) + Number(this.addMsg.OldPeopleNum)) - this.addObj
            .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.addObj.SingleRoomPrice
          let ertongbed = this.addObj.ChildNeedPrice * Number(this.addMsg.ChirdNeedBedNum) - this.addObj
            .ChildNoNeedPrice *
            (Number(this.addMsg.ChirdNum) - Number(this.addMsg.ChirdNeedBedNum))
          let lianyun = (Number(this.addMsg.ManNum) + Number(this.addMsg.ChirdNum) + Number(this.addMsg.OldPeopleNum)) *
            (Number(this.stratPrice) + Number(this.returnPrice))
          let dandijie
          if (this.addMsg.GroupType == 4) {
            dandijie = this.SingleDMCPrice * Number(this.addMsg.AirticketNum)
          } else {
            dandijie = this.addObj.SingleDMCPrice * Number(this.addMsg.AirticketNum)
          }
          this.addMsg.PreferPrice = dandijie + lianyun + chengren + ertong + yinger + laoren + zafeiqianzhen + danfang +
            ertongbed - this.ScenicRefundMoney * (Number(this.addMsg.ManNum) + Number(this.addMsg.ChirdNum) + Number(
              this.addMsg.OldPeopleNum));
        }
        this.getTicheng();
        if (!t) {
          this.getTypePrice()
        }
      },
      yzBigBed2() {
        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", "大床房");
      },
      yzBigBed1() {
        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", "三人房");
      },
      submitForm(addMsg) { //提交创建、修改表单
        if (this.TotalNumber == 0) {
          this.$message.error('总人数不能小于1人')
          return
        }
        this.$refs[addMsg].validate((valid) => {
          if (valid) {
            this.saveOrder()
          } else {
            return false;
          }
        });
      },
      cancelSubmit() {
        this.isShowLayer = false
        this.$refs['addMsg'].resetFields();
        this.clearMsg()
      },
      clearMsg() {
        this.addMsg.OrderId = '0'
        this.addMsg.TCID = '0'
        this.addMsg.IsIntermodal = '2'
        this.addMsg.IsReturnIntermodal = '2'
        this.addMsg.Unit_Price = '0'
        this.addMsg.TC_Price = '0'
        this.addMsg.ManNum = '0'
        this.addMsg.ChirdNum = '0'
        this.addMsg.ChirdNeedBedNum = '0'
        this.addMsg.BabyNum = '0'
        this.addMsg.OldPeopleNum = '0'
        this.addMsg.SingleRoomNum = '0'
        this.addMsg.PreferPrice = '0'
        this.addMsg.YSeatNum = '0'
        this.addMsg.ESeatNum = '0'
        this.addMsg.FSeatNum = '0'
        this.addMsg.Commission = '0'
        this.addMsg.BrandId = ''
        this.addMsg.PlatformAccount = ''
        this.addMsg.TradeWay = '2'
        this.addMsg.GuestNum = '0'
        this.addMsg.IsChildrenTour = '0'
        this.addMsg.OrderId = '0'
        this.addMsg.IsBirdDiscount = '0'
        this.addMsg.PredictRoomNum = '0'
        this.addMsg.BigRoomNum = '0'
        this.addMsg.TripleRoomNum = '0'
        this.addMsg.TradeDate = ''
        this.addMsg.CostType = ''
        this.addMsg.LuggageNum=''
        this.addMsg.PlatformOrder = ''
        this.ddlyList = []
        this.addMsg.Remarks = ''
        this.addMsg.MinOrderPrice = ''
        this.addMsg.VisaNum = '0';
        this.addMsg.SafeNum = '0';
        this.addMsg.AirticketNum = '0';
        this.addMsg.ScenicRefundArr = [];
        this.ScenicRefundMoney = 0;
        this.addMsg.CommissionSharePeople = '-1'
        this.addMsg.CommissionShareMoney = '0'
        this.addMsg.IsShowMessagesMoney = '2'
        this.remarkMsg = {
          zc: '',
          bzc: '',
          fjf: '',
          ye: '',
          lr: '',
          dd: '',
          df: '',
          dc: '',
          srf: '',
          qz: '',
          qzf: '',
        }
      },
      saveOrder() {
        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('保险数量不能大于人数总和！')
          return
        }
        if (this.userId == 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; // 地接时 成交单价
        }
        this.addMsg.TCID = this.addObj.TCID
        this.addMsg.GuestNum = Number(this.addMsg.ManNum) + Number(this.addMsg.ChirdNum) + Number(this.addMsg
            .OldPeopleNum) +
          Number(this.addMsg.BabyNum) + Number(this.addMsg.AirticketNum)
        this.addMsg.IsChildrenTour = this.addObj.IsSupportChildren
        this.addMsg.IsBirdDiscount = this.addObj.IsBirdDiscount
        this.apipost('sellorder_post_SetOneDayOrderInfo', this.addMsg, res => {
          if (res.data.resultCode == 1) {
            this.$message.success(res.data.message)
            this.$refs['addMsg'].resetFields();
            this.getList()
            this.clearMsg()
            this.isShowLayer = false
          } else {
            this.$message.error(res.data.message)
          }
        }, err => {})
      },
      getNumGuest() {
        let num = 0
        if (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.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.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)
          }
        }
      },
      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;
        }
      },
      goBuy(obj) {
        this.isUpdateSharePeople = false
        this.isShowLayer = true
        this.addObj = obj
        this.addMsg.DepartureCityId = obj.StartCityID
        this.addMsg.ReturnArriveCityId = obj.ReturnArriveCityId

        this.addMsg.GoCityTime = this.starTime = obj.StartCityTime
        this.addMsg.BackCityTime = this.endTime = obj.BackCityTime
        this.addMsg.SonControlID = obj.SonControlID;
        this.getMinPrice(obj.LineID);
        this.getScenicRefund(obj.TCID);
        this.getPlatformAccount(obj.PlatformAccountTypeId);
        this.clearMsg()
        let str = ''
        if (obj.OtherPrice > 0) {
          str += '杂费' + obj.OtherPrice + '/人;'
        }
        this.addMsg.Remarks = str
        this.otherRemark = str;
        this.SingleDMCPrice = obj.SingleDMCPrice;
        this.SingleDMCPricex = obj.SingleDMCPrice;
      },
      getPlatformAccount(typeIdtwo) {
        let platBranchId = this.getLocalStorage().RB_Branch_id;
        this.apipost('FinancialInstitutions_post_GetALLAccountList', {
          TypeId: typeIdtwo,
          BranchId: platBranchId
        }, res => {
          if (res.data.resultCode == 1) {
            this.PlatformAccountList = res.data.data
          }
        }, err => {})
      },
      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);
            })
          }
        }, err => {})
      },
      getJyfs() {
        this.apipost('sellorder_get_GetSellTradeWayEnumList', {}, res => {
          if (res.data.resultCode == 1) {
            this.jyfsList = res.data.data
          }
        }, err => {})
      },
      getFylx() {
        this.apipost('Financial_post_GetByOrderCostTypeList', {
          Type: 1
        }, res => {
          if (res.data.resultCode == 1) {
            this.fylxList = res.data.data
          } else {
            this.Error(res.data.message);
          }
        }, err => {})
      },
      getSspt() {
        //给非直客  隐藏电话姓名赋值
        let obj = this.khmdList.find(item => item.customerId == this.addMsg.CustomerId)
        this.customerId = obj.customerId
        this.createByInfo = obj.createByInfo
        this.addMsg.ContactName = obj.customerName + '(' + obj.contact + ')'
        this.addMsg.ContactMobile = obj.contactNumber

        if (this.userId != 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.ssptList = res.data.data
          }
        }, err => {})
      },
      getKhmdList() {
        this.apipost('app_today_visit_GetOrderMyCustomerList', {
          typeId: this.addMsg.CustomerType,
          lineId: this.addObj.LineID,
          IsLineId: 1,
        }, res => {
          if (res.data.resultCode == 1) {
            this.khmdList = res.data.data
          }
        }, err => {})
      },
      getDdztList() {
        this.apipost('sellorder_post_GetSellOrderStatusEnumList', {}, res => {
          if (res.data.resultCode == 1) {
            this.ddztList = res.data.data
          }
        }, err => {})
      },
      getDdlyList() {
        this.addMsg.ClientSource = ''
        this.apipost('sellorder_get_GetSellClientSourceEnumList', {
          typeId: this.addMsg.CustomerType
        }, res => {
          if (res.data.resultCode == 1) {
            this.ddlyList = res.data.data
          }
        }, err => {})
      },
      getCtlxList() {
        this.apipost('sellorder_get_GetOrderJoinEnumList', {}, res => {
          if (res.data.resultCode == 1) {
            this.ctlxList = res.data.data
            // 屏蔽订车订房订门票
            this.ctlxList.splice(-1)
            this.ctlxList.splice(-1)
            this.ctlxList.splice(-1)
          }
        }, err => {})
      },
      getKhlxList() {
        this.apipost('sellorder_get_GetSellClientTypeEnumList', {}, res => {
          if (res.data.resultCode == 1) {
            this.khlxList = res.data.data
          }
        }, err => {})
      },

      getJourney(id, title) {
        var that = this;
        this.tripTitle = title;
        this.$nextTick(() => {
          that.$refs.comTeam.GetTrip(id);
        });
        that.outerVisible = true;
      },
      getList() {
        this.loading = true
        this.apipost('sellorder_post_GetOneDayProductCenter', this.msg, res => {
          if (res.data.resultCode == 1) {
            this.loading = false
            this.total = res.data.data.count
            for (let i = 0; i < res.data.data.pageData.length; i++) {
              res.data.data.pageData[i]['wxImage'] = ''
            }
            this.list = res.data.data.pageData;
          } else {
            this.Error(res.data.message)
          }
        }, err => {})
      },
      getLineList() {
        this.apipost("line_post_GetAllList_V2", {
          LineDirection: 3
        }, res => {
          if (res.data.resultCode == 1) {
            this.LineList = res.data.data;
          }
        });
      },
      getFlightDetails(id) {
        this.apipost('travel_get_GetTripForSell', {
          TCID: id
        }, res => {
          if (res.data.resultCode == 1) {
            this.tripDetails = res.data.data.FlightList
          } else {
            this.Error(res.data.message)
          }
        }, err => {})

      },
      //获取系列列表
      getLineTeamList(lineId) {
        this.LineTeamList = []
        this.apipost("team_post_GetList", {
          lineID: lineId,
          isTOOP: 1
        }, res => {
          if (res.data.resultCode == 1) {
            this.msg.LineTeamId = '-1'
            this.LineTeamList = res.data.data;
          }
        });
      },
      //获取目的地列表
      getAimPlaceList(lineId, lineTeamId) {
        let myLineId = lineId === '' ? this.msg.LineId : lineId
        let myLineTeamId = lineTeamId === '' ? this.msg.LineTeamId : lineTeamId
        this.AimPlaceList = []

        this.apipost("team_post_GetListForCascading", {
          LineID: myLineId,
          LtID: myLineTeamId
        }, res => {
          if (res.data.resultCode == 1) {
            this.msg.AimPlaceId = '-1'
            this.AimPlaceList = res.data.data;
          }
        });
      },
      getStartList() {
        this.apipost("sellorder_get_GetAllStartCity", {}, res => {
          if (res.data.resultCode == 1) {
            this.startCityList = res.data.data;
          } else {}
        });
      },
      getStartList1() {
        this.apipost("city_post_GetList", {
          isDefault: -1,
          priceType: -1
        }, res => {
          if (res.data.resultCode == 1) {
            this.startCityList1 = res.data.data;
          } else {}
        });
      },
      getCompanyList() {
        let userInfo = this.getLocalStorage();
        let RB_Group_id = userInfo.RB_Group_id;
        let msg = {
          Status: 0,
          is_show: 0,
          RB_Group_Id: RB_Group_id
        }
        this.apipost('admin_get_BranchGetList', msg, res => {
          if (res.data.resultCode == 1) {
            this.companyList = [{
              Id: '-1',
              BName: '不限'
            }];
            res.data.data.forEach(x => {
              var obj = {
                Id: '',
                BName: ''
              }
              obj.Id = x.Id.toString();
              obj.BName = x.BName;
              this.companyList.push(obj);
            })
          }
        }, err => {})
      },
      getAirlineList() { //获取航空公司*
        let msg = {};
        this.apipost('airline_post_GetList', msg, res => {
          this.airlineList = res.data.data;
        }, err => {})
      },

      getSalePlace() {
        this.apipost('travel_get_GetTravelSelectEnum', {}, res => {
          if (res.data.resultCode == 1) {
            this.salePlace = res.data.data.SalePlat
          }
        }, err => {})
      },

      handleCurrentChange(val) {
        this.msg.pageIndex = val;
        this.getList()
      },
      resetPageIndex() {
        this.msg.pageIndex = 1;
        this.currentPage = 1
      },
      getEmployee() { //员工
        this.apipost('admin_get_EmployeeGetList', this.employeeMsg, res => {
          if (res.data.resultCode == 1) {
            this.employeeList = res.data.data;
          } else {}
        }, err => {})
      },
      //改变平台获取备注
      getRemarkDetail(id) {
        this.ssptList.forEach(x => {
          if (x.dictId == id) {
            let msg = x.brandName + '订单号' + this.addMsg.PlatformOrder;
            this.addMsg.Remarks = msg;
          }
          this.$forceUpdate();
        })
      },
    },
    mounted() {
      // 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
      }

      this.userId = this.getLocalStorage().EmployeeId
      this.msg.BranchId = this.getLocalStorage().RB_Branch_id.toString()
      if (this.$route.query.id) {
        this.msg.BranchId = '-1'
        this.msg.TCID = this.$route.query.id
      }
      if (this.$route.query.TCIDList) {
        this.msg.TCIDList = this.TCIDList = this.$route.query.TCIDList;
      }
      if (this.msg.StartTime === "") {
        let nowDay = this.FormartDate(new Date());
        this.msg.StartTime = nowDay;
      }
      let userInfo = this.getLocalStorage()
      this.CurrentUserInfo = userInfo

      this.getEmployee()
      this.getCompanyList()
      this.getList()
      this.getLineList()
      this.getSalePlace()
      this.getAirlineList()
      this.getStartList()
      this.getStartList1()
      this.getKhlxList()
      this.getCtlxList()
      //	this.getDdlyList()
      this.getDdztList()
      //	this.getKhmdList()
      this.getJyfs()
      this.getFylx()
      this.getCountry() //国籍

    }
  }

</script>
