<style scoped>
/* .background {
    backface-visibility: #fff;
    padding: 20px;
} */
.heading {
  font-size: 20px;
  font-weight: bold;
}
.title {
  margin: 20px 0 10px 0;
}
</style>
<template>
  <q-card flat class="q-pa-md" style="background: #fff; width: 600px; min-width: 375px">
    <div class="bacakground">
      <div class="heading">{{ $t("travel.addTitle") }}</div>
      <q-form @submit="saveOrder">
        <div class="row">
          <div class="col">
            <div class="title">{{ $t("travel.man") }}</div>
            <q-input
              v-model="addMsg.ManNum"
              class="col q-mr-md"
              mask="#"
              reverse-fill-mask
              dense
              type="text"
              standout
              @keyup.native="checkInteger(addMsg, 'ManNum')"
              @update:model-value="
                getNumber();
                getHouseNo();
                getTotalPrice();
              "
            ></q-input>
          </div>
          <div class="col">
            <div class="title">{{ $t("travel.oldPeople") }}</div>
            <q-input
              v-model="addMsg.OldPeopleNum"
              class="col q-mr-md"
              mask="#"
              reverse-fill-mask
              dense
              type="text"
              standout
              @keyup.native="checkInteger(addMsg, 'OldPeopleNum')"
              @update:model-value="
                getNumber();
                getHouseNo();
                getTotalPrice();
                autoRemarks('OldPeopleNum', '老人人数');
              "
            ></q-input>
          </div>
        </div>
        <div class="row">
          <div class="col">
            <div class="title">{{ $t("travel.childNeedBed") }}</div>
            <q-input
              v-model="addMsg.ChirdNeedBedNum"
              class="col q-mr-md"
              mask="#"
              reverse-fill-mask
              dense
              type="text"
              standout
              @keyup.native="checkInteger(addMsg, 'ChirdNeedBedNum')"
              @update:model-value="
                getNumber();
                getHouseNo();
                getTotalPrice();
                autoRemarks('ChirdNeedBedNum', '儿童占床');
              "
            ></q-input>
          </div>
          <div class="col">
            <div class="title">{{ $t("travel.ChirdNoNeedBedNum") }}</div>
            <q-input
              v-model="addMsg.ChirdNoNeedBedNum"
              class="col q-mr-md"
              mask="#"
              reverse-fill-mask
              dense
              type="text"
              standout
              @keyup.native="checkInteger(addMsg, 'ChirdNoNeedBedNum')"
              @update:model-value="
                getNumber();
                getHouseNo();
                getTotalPrice();
                autoRemarks('ChirdNoNeedBedNum', '儿童不占床');
              "
            ></q-input>
          </div>
        </div>
        <div class="row">
          <div class="col">
            <div class="title">{{ $t("travel.BabyNum") }}</div>
            <q-input
              v-model="addMsg.BabyNum"
              class="col q-mr-md"
              mask="#"
              reverse-fill-mask
              dense
              type="text"
              standout
              @keyup.native="checkInteger(addMsg, 'BabyNum')"
              @update:model-value="
                getNumber();
                getTotalPrice();
                autoRemarks('BabyNum', '婴儿人数');
              "
            ></q-input>
          </div>
          <div class="col">
            <div class="title">{{ $t("travel.SingleRoomNum") }}</div>
            <q-input
              v-model="addMsg.SingleRoomNum"
              class="col q-mr-md"
              mask="#"
              reverse-fill-mask
              dense
              type="text"
              standout
              @keyup.native="checkInteger(addMsg, 'SingleRoomNum')"
              @update:model-value="
                yzBigBed2();
                getTotalPrice();
                autoRemarks('SingleRoomNum', '单房数量');
              "
            ></q-input>
          </div>
        </div>
        <div class="row">
          <div class="col">
            <div class="title">{{ $t("travel.VisaNum") }}</div>
            <q-input
              v-model="addMsg.VisaNum"
              class="col q-mr-md"
              mask="#"
              reverse-fill-mask
              dense
              type="text"
              standout
              @keyup.native="checkInteger(addMsg, 'VisaNum')"
              @update:model-value="
                yzVisaNum();
                getTotalPrice();
                autoRemarks2('VisaNum', '不要签证数量');
                autoRemarks('VisaNum', '不要签证数量');
              "
            ></q-input>
          </div>
          <div class="col">
            <div class="title">{{ $t("travel.OneSex") }}</div>
            <q-radio
              v-model="addMsg.OneSex"
              checked-icon="task_alt"
              unchecked-icon="panorama_fish_eye"
              val="1"
              :label="$t('travel.male')"
              @update:model-value="changePeople"
            />
            <q-radio
              v-model="addMsg.OneSex"
              checked-icon="task_alt"
              unchecked-icon="panorama_fish_eye"
              val="2"
              :label="$t('travel.woman')"
              @update:model-value="changePeople"
            />
          </div>
          <!-- <div class="col">
            <div class="title">保险数量</div>
            <q-input
              v-model="addMsg.SafeNum"
              class="col q-mr-md"
              mask="#"
              reverse-fill-mask
              dense
              type="text"
              standout
               @keyup.native="checkInteger(addMsg, 'SafeNum')" @update:model-value="
                  yzSafeNum();
                  getTotalPrice();
                  autoRemarks2('SafeNum', '不要保险数量');
                "></q-input>
          </div> -->
        </div>
        <div class="row">
          <div class="col">
            <div class="title">{{ $t("travel.PredictRoomNum") }}</div>
            <q-input
              class="col q-mr-md"
              reverse-fill-mask
              dense
              type="text"
              standout
              v-model="addMsg.PredictRoomNum"
              :disable="true"
            ></q-input>
          </div>
          <div class="col">
            <div class="title">{{ $t("travel.YSeatNum") }}</div>
            <q-input
              v-model="addMsg.YSeatNum"
              class="col q-mr-md"
              mask="#"
              reverse-fill-mask
              dense
              type="text"
              standout
              @keyup.native="checkInteger(addMsg, 'YSeatNum')"
            ></q-input>
          </div>
        </div>
        <div class="row">
          <div class="col">
            <div class="title">{{ $t("travel.FSeatNum") }}</div>
            <q-input
              v-model="addMsg.FSeatNum"
              class="col q-mr-md"
              mask="#"
              reverse-fill-mask
              dense
              type="text"
              standout
              @update:model-value="getNumber()"
            ></q-input>
          </div>
          <div class="col">
            <div class="title">{{ $t("travel.ESeatNum") }}</div>
            <q-input
              v-model="addMsg.ESeatNum"
              class="col q-mr-md"
              mask="#"
              reverse-fill-mask
              dense
              type="text"
              standout
              @update:model-value="getNumber()"
            ></q-input>
          </div>
        </div>
        <!-- <div class="row">
          <div class="col">
            <div class="title">{{ $t('travel.ContactName') }}</div>
            <q-input
              v-model="addMsg.ContactName"
              class="col q-mr-md"
              reverse-fill-mask
              dense
              type="text"
              standout
               :rules="[ val => val && val.length > 0 || ' ']"
            ></q-input>
          </div>
          <div class="col">
            <div class="title">{{ $t('travel.ContactMobile') }}</div>
            <q-input
              v-model="addMsg.ContactMobile"
              class="col q-mr-md"
              mask="#"
              reverse-fill-mask
              dense
              type="text"
              standout
               :rules="[ val => val && val.length > 0 || ' ']"
            ></q-input>
          </div>
        </div> -->
        <div>
          <div class="title">{{ $t("travel.Remarks") }}</div>
          <q-input
            v-model="addMsg.Remarks"
            class="col q-mr-md"
            reverse-fill-mask
            dense
            type="text"
            standout
          ></q-input>
        </div>
        <div class="row justify-between items-center">
          <div class="title">{{ $t("travel.PreferPrice") }}</div>
          <div class="text-subtitle2 text-weight-bolder text-primary">
            {{ addMsg.PreferPrice }}
          </div>
        </div>
        <div class="row justify-end">
          <q-btn unelevated class="bg-grey-3 hover q-mr-md" @click="cancel">{{
            $t("travel.cancel")
          }}</q-btn>
          <q-btn
            :loading="loading"
            color="primary"
            unelevated
            class="q-ml-md"
            type="submit"
            >{{ $t("travel.submit") }}</q-btn
          >
        </div>
      </q-form>
    </div>
  </q-card>
</template>

<script>
import { defineComponent, inject, reactive, toRefs, watch } from "vue";
import travelService from "../../../api/travel";
import { ApiResult } from "../../../@types/enumHelper";
import message from "../../../utils/message";
import { getStoreGetter } from "../../../store/utils";
export default defineComponent({
  props: ["info"],
  components: {},
  setup(props, context) {
    const addMsg = reactive({
      OrderSource: 2,
      price: 0,
      GroupTypeNeedHouse: 0,
      OrderId: 0,
      OneSex: 0,
      TCID: 0,
      CustomerType: 2, // 默认为普通客户
      GroupType: 1,
      IndustryCategory: "",
      ContactName: "",
      ContactMobile: "",
      CustomerId: "",
      DepartureCityId: 0,
      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: 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: "", //单团附件
    });
    const data = reactive({
      ScenicRefundList: [],
      khlxList: [],
      ctlxList: [],
      addObj: {},
      copyId: 0,
      showBankAccount: false,
      OrderID: "",
      showOrderdDetail: false,
      pages: {
        pageIndex: 1,
        pageSize: 10,
        pageCount: 0,
      },
      loadingCel: false,
      loading: false,
      userInfo: null,
    });
    data.addObj = props.info;
    data.userInfo = getStoreGetter("user", "getUser");
    addMsg.TCID = props.info.TCID;
    addMsg.TC_Price = data.addObj.B2BPrice;
    addMsg.Unit_Price = data.addObj.B2BPrice;
    const methods = {
      changePeople(value) {
        addMsg.OneSex = value;
      },
      cancel() {
        context.emit("close");
      },
      //验证只能输入整数【负数：isMinus传true】
      checkInteger(item, filed, isMinus) {
        var value = "" + item[filed]; //转字符串
        var t = value.charAt(0);
        value = value.replace(this.$commonUtils.Regex.isInteger, "");
        //是否允许负数
        if (isMinus && t == "-") {
          value = "-" + value;
        }
        item[filed] = value;
      },
      getHouseNo() {
        let etbzc = 0;
        //算法：((成人+儿童占床数+老人-（三人房数量*3）)-单房数)/2+单房数+三人房数量 8.7新增单地接儿童不占床  减去 儿童不占床

        addMsg.PredictRoomNum =
          (Number(addMsg.AirticketNum) +
            (Number(addMsg.ManNum) +
              Number(addMsg.ChirdNeedBedNum) -
              etbzc +
              Number(addMsg.OldPeopleNum)) -
            Number(addMsg.TripleRoomNum) * 3 -
            Number(addMsg.SingleRoomNum)) /
            2 +
          Number(addMsg.SingleRoomNum) +
          Number(addMsg.TripleRoomNum);
      },
      getNumber() {
        let ChirdNum = addMsg.ChirdNoNeedBedNum * 1 + addMsg.ChirdNeedBedNum * 1;
        addMsg.ChirdNum = addMsg.ChirdNoNeedBedNum * 1 + addMsg.ChirdNeedBedNum * 1;
        addMsg.VisaNum =
          Number(addMsg.AirticketNum) +
          Number(addMsg.ManNum) +
          ChirdNum +
          Number(addMsg.BabyNum) +
          Number(addMsg.OldPeopleNum);
        addMsg.SafeNum =
          Number(addMsg.AirticketNum) +
          Number(addMsg.ManNum) +
          ChirdNum +
          Number(addMsg.BabyNum) +
          Number(addMsg.OldPeopleNum);
        var TotalNumber =
          Number(addMsg.AirticketNum) +
          Number(addMsg.ManNum) +
          ChirdNum +
          Number(addMsg.BabyNum) +
          Number(addMsg.OldPeopleNum);
        var SeatNum =
          Number(addMsg.ManNum) +
          Number(addMsg.ChirdNum) +
          Number(addMsg.OldPeopleNum) -
          (Number(addMsg.ESeatNum) + Number(addMsg.FSeatNum));
        addMsg.YSeatNum = SeatNum < 0 ? 0 : SeatNum;
        methods.autoRemarks("VisaNum", "不要签证数量");
      },
      yzBigBed2() {
        let x =
          Number(addMsg.AirticketNum) +
          Number(addMsg.ManNum) +
          Number(addMsg.ChirdNeedBedNum) +
          Number(addMsg.OldPeopleNum) -
          Number(addMsg.SingleRoomNum);
        let y = x - Number(addMsg.TripleRoomNum) * 3 - Number(addMsg.BigRoomNum) * 2;
        if (y < 0) {
          addMsg.SingleRoomNum = 0;
        }
        methods.getHouseNo();
        methods.autoRemarks("SingleRoomNum", "单房数量");
      },
      // 自动添加备注
      autoRemarks(key, text) {},
      // 计算价格
      getTotalPrice() {
        addMsg.ChirdNum = addMsg.ChirdNoNeedBedNum * 1 + addMsg.ChirdNeedBedNum * 1;
        if (data.addObj.IsBirdDiscount == 1) {
          //早鸟优惠
          //addMsg.Unit_Price  //成交单价
          //BabyPrice 婴儿价
          //BabyChargePrice  儿童附加费
          //OldManChargePrice  老人 附加费
          //DiscountPrice 早鸟优惠
          let chengren =
            Number(addMsg.ManNum) *
            (Number(addMsg.Unit_Price) - data.addObj.DiscountPrice);
          let ertong =
            Number(addMsg.ChirdNum) *
            (Number(addMsg.Unit_Price) -
              data.addObj.DiscountPrice +
              data.addObj.BabyChargePrice);

          let yinger = Number(addMsg.BabyNum) * data.addObj.BabyPrice;
          let laoren =
            Number(addMsg.OldPeopleNum) *
            (Number(addMsg.Unit_Price) -
              data.addObj.DiscountPrice +
              data.addObj.OldManChargePrice);
          let zafeiqianzhen =
            data.addObj.OtherPrice *
              (Number(addMsg.ManNum) +
                Number(addMsg.ChirdNum) +
                Number(addMsg.OldPeopleNum)) +
            data.addObj.VisaPrice *
              (Number(addMsg.AirticketNum) +
                Number(addMsg.ManNum) +
                Number(addMsg.ChirdNum) +
                Number(addMsg.OldPeopleNum)) -
            (data.addObj.BackVisaPrice || 0) *
              (Number(addMsg.AirticketNum) +
                Number(addMsg.ManNum) +
                Number(addMsg.ChirdNum) +
                Number(addMsg.BabyNum) +
                Number(addMsg.OldPeopleNum) -
                Number(addMsg.VisaNum));
          let danfang = Number(addMsg.SingleRoomNum) * data.addObj.SingleRoomPrice;
          let ertongbed =
            data.addObj.ChildNeedPrice * Number(addMsg.ChirdNeedBedNum) -
            data.addObj.ChildNoNeedPrice *
              (Number(addMsg.ChirdNum) - Number(addMsg.ChirdNeedBedNum));
          let lianyun = 0;
          // (Number(addMsg.ManNum) +
          //   Number(addMsg.ChirdNum) +
          //   Number(addMsg.OldPeopleNum)) *
          // (Number(this.stratPrice) + Number(this.returnPrice));
          let dandijie;
          dandijie = (data.addObj.SingleDMCPrice || 0) * Number(addMsg.AirticketNum);
          addMsg.PreferPrice =
            dandijie +
            lianyun +
            chengren +
            ertong +
            yinger +
            laoren +
            zafeiqianzhen +
            danfang +
            ertongbed;
        } else {
          let chengren = Number(addMsg.ManNum) * Number(addMsg.Unit_Price);
          let ertong =
            Number(addMsg.ChirdNum) *
            (Number(addMsg.Unit_Price) + data.addObj.BabyChargePrice);
          let yinger = Number(addMsg.BabyNum) * data.addObj.BabyPrice;
          let laoren =
            Number(addMsg.OldPeopleNum) *
            (Number(addMsg.Unit_Price) + data.addObj.OldManChargePrice);
          let zafeiqianzhen =
            data.addObj.OtherPrice *
              (Number(addMsg.ManNum) +
                Number(addMsg.ChirdNum) +
                Number(addMsg.OldPeopleNum)) +
            data.addObj.VisaPrice *
              (Number(addMsg.AirticketNum) +
                Number(addMsg.ManNum) +
                Number(addMsg.ChirdNum) +
                Number(addMsg.OldPeopleNum)) -
            (data.addObj.BackVisaPrice || 0) *
              (Number(addMsg.AirticketNum) +
                Number(addMsg.ManNum) +
                Number(addMsg.ChirdNum) +
                Number(addMsg.BabyNum) +
                Number(addMsg.OldPeopleNum) -
                Number(addMsg.VisaNum));
          let danfang = Number(addMsg.SingleRoomNum) * data.addObj.SingleRoomPrice;
          let ertongbed =
            data.addObj.ChildNeedPrice * Number(addMsg.ChirdNeedBedNum) -
            data.addObj.ChildNoNeedPrice *
              (Number(addMsg.ChirdNum) - Number(addMsg.ChirdNeedBedNum));
          let lianyun = 0;

          let dandijie;
          dandijie = (data.addObj.SingleDMCPrice || 0) * Number(addMsg.AirticketNum);

          addMsg.PreferPrice =
            dandijie +
            lianyun +
            chengren +
            ertong +
            yinger +
            laoren +
            zafeiqianzhen +
            danfang +
            ertongbed;
        }
      },
      getTicheng() {
        //提成
        let num =
          Number(addMsg.ManNum) + Number(addMsg.ChirdNum) + Number(addMsg.OldPeopleNum);
        let yh = 0;
        if (num > 0) {
          this.apipost(
            "sellorder_get_GetOrderMinPrice",
            {
              ltID: data.addObj.ltID,
              Num: num,
            },
            (res) => {
              yh = res.data.data;
            },
            (err) => {}
          );
        }
        //  let cj='成交单价-最低成交价格（标准单价-符合人数[成人，儿童，老人]条件的最高少价）'
        let chajia = Number(addMsg.Unit_Price) - (addMsg.TC_Price - yh);
        let ewtc = chajia > 0 ? chajia * 0.5 * num : chajia * num; //额外提成
        addMsg.Commission = (Number(addMsg.PreferPrice) * 0.01 + ewtc).toFixed(2);
        addMsg.CommissionShareMoney = 0;
        if (
          (addMsg.CustomerType == 1 || addMsg.CustomerType == 2) &&
          addMsg.CommissionSharePeople != ""
        ) {
          if (addMsg.CommissionSharePeople != "-1") {
            if (addMsg.Commission > 0) {
              addMsg.CommissionShareMoney = addMsg.Commission / 2;
              addMsg.Commission = addMsg.Commission - addMsg.CommissionShareMoney;
            } else {
              addMsg.CommissionShareMoney = 0;
            }
          }
        }
      },
      getTypePrice() {
        //addMsg.ContactName = ''
        //addMsg.ContactMobile = ''
        if (addMsg.CustomerType == 1) {
          addMsg.TC_Price = data.addObj.B2BMemberPrice;
          addMsg.Unit_Price = data.addObj.B2BMemberPrice;
          //addMsg.CustomerId = ''
        }
        if (addMsg.CustomerType == 2) {
          addMsg.TC_Price = data.addObj.B2BPrice;
          addMsg.Unit_Price = data.addObj.B2BPrice;
          //addMsg.CustomerId = ''
        }
        if (addMsg.CustomerType == 3) {
          addMsg.TC_Price = data.addObj.B2CMemberPrice;
          addMsg.Unit_Price = data.addObj.B2CMemberPrice;
          addMsg.CustomerId = 0;
          addMsg.CommissionShareMoney = 0;
        }
        if (addMsg.CustomerType == 4) {
          addMsg.TC_Price = data.addObj.B2CPrice;
          addMsg.Unit_Price = data.addObj.B2CPrice;
          addMsg.CustomerId = 0;
          addMsg.CommissionShareMoney = 0;
        }
        this.Unit_PriceList = [];
        let maxPeopleNum =
          Number(addMsg.ManNum) +
          Number(addMsg.ChirdNoNeedBedNum) +
          Number(addMsg.ChirdNeedBedNum) +
          Number(addMsg.OldPeopleNum) +
          Number(addMsg.AirticketNum);
        if (maxPeopleNum > 0) {
          this.apipost(
            "sellorder_post_GetLessPrice",
            {
              TCID: data.addObj.TCID,
              MaxPeopleNum: maxPeopleNum,
            },
            (res) => {
              this.LessMoney = res.data.data.lessMoney;
              if (parseFloat(this.LessMoney) > 0) {
                for (var i = 0; i <= parseInt(this.LessMoney) / 10; i++) {
                  var obj = {
                    ID: "",
                    LessMoney: "",
                  };
                  obj.ID = addMsg.Unit_Price - i * 10;
                  obj.LessMoney = addMsg.Unit_Price - i * 10;
                  this.Unit_PriceList.push(obj);
                }
                if (
                  this.Unit_PriceList.findIndex(
                    (markers) => markers.ID == addMsg.Unit_Price
                  ) < 0
                ) {
                  var obj = {
                    ID: "",
                    LessMoney: "",
                  };
                  obj.ID = addMsg.Unit_Price;
                  obj.LessMoney = addMsg.Unit_Price;
                  this.Unit_PriceList.push(obj);
                }
              } else {
                var obj = {
                  ID: "",
                  LessMoney: "",
                };
                obj.ID = addMsg.Unit_Price;
                obj.LessMoney = addMsg.Unit_Price;
                this.Unit_PriceList.push(obj);
              }
            },
            (err) => {}
          );
        }
      },
      clearMsg() {
        addMsg.OrderId = 0;
        addMsg.TCID = 0;
        addMsg.IsIntermodal = "2";
        addMsg.IsReturnIntermodal = "2";
        addMsg.Unit_Price = 0;
        addMsg.TC_Price = 0;
        addMsg.ManNum = 0;
        addMsg.ChirdNum = 0;
        addMsg.ChirdNeedBedNum = 0;
        addMsg.BabyNum = 0;
        addMsg.OldPeopleNum = 0;
        addMsg.SingleRoomNum = 0;
        addMsg.PreferPrice = 0;
        addMsg.YSeatNum = 0;
        addMsg.ESeatNum = 0;
        addMsg.FSeatNum = 0;
        addMsg.Commission = 0;
        addMsg.BrandId = 0;
        addMsg.PlatformAccount = "";
        addMsg.TradeWay = "2";
        addMsg.GuestNum = 0;
        addMsg.IsChildrenTour = 0;
        addMsg.OrderId = 0;
        addMsg.IsBirdDiscount = 0;
        addMsg.PredictRoomNum = 0;
        addMsg.BigRoomNum = 0;
        addMsg.TripleRoomNum = 0;
        addMsg.TradeDate = "";
        addMsg.CostType = "";
        addMsg.PlatformOrder = "";
        addMsg.Remarks = "";
        addMsg.MinOrderPrice = "";
        addMsg.VisaNum = 0;
        addMsg.SafeNum = 0;
        addMsg.AirticketNum = 0;
        addMsg.ScenicRefundArr = [];
        addMsg.CommissionSharePeople = "-1";
        addMsg.CommissionShareMoney = 0;
        addMsg.IsShowMessagesMoney = "2";
        addMsg.OneSex = 0;
      },
      saveOrder() {
        addMsg.CustomerId = data.userInfo.customerId;
        addMsg.CreateBy = data.userInfo.salesBaseInfo.employeeId;
        addMsg.GuestNum =
          Number(addMsg.ManNum) +
          Number(addMsg.OldPeopleNum) +
          Number(addMsg.ChirdNeedBedNum) +
          Number(addMsg.ChirdNoNeedBedNum) +
          Number(addMsg.BabyNum);
        data.loading = true;
        travelService
          .newOrder(addMsg)
          .then((r) => {
            data.loading = false;
            if (r.data.resultCode == ApiResult.SUCCESS) {
              message.successMsg(r.data.message);
              context.emit("close");
            } else {
              message.errorMsg(r.data.message);
            }
          })
          .catch((e) => {
            message.errorMsg(e.message);
            data.loading = false;
          });
      },
    };
    return {
      ...toRefs(data),
      addMsg,
      ...methods,
    };
  },
});
</script>

<style></style>
