<!--订单操作-->
<template>
  <div>
  <div class="q-mb-sm text-accent">
    <span class="text-primary">班级：</span>{{saveObj.ClassName}}
    <span class="q-ml-md text-primary">课程：</span>{{saveObj.CourseName}}
  </div>
    <div class="row q-mb-md">
      <div class="col-10 flex">
        <div v-for="(item, index) in stuData.StuList">
          <q-chip icon="person" class="primary"
            >{{ item.StuName }}
            <span v-if="item.IsRenewGuest == 1">(续费)</span>
          </q-chip>
        </div>
      </div>
      <div class="col-2">
        <q-toggle
          v-model="OrderMsg.IsChaBan"
          :true-value="1"
          :false-value="0"
          label="插班报入"
        />
      </div>
    </div>
    <div style="row items-center">
      <div class="col row wrap q-mr-lg q-col-gutter-md">
        <q-input
          filled
          stack-label
          maxlength="3"
          :dense="false"
          @keyup.native="checkInteger(OrderMsg, 'GuestNum')"
          v-model="OrderMsg.GuestNum"
          @input="calcPrice()"
          label="人数"
          :rules="[val => !!val || '请填写人数']"
          disable
          class="col-6 q-py-sm"
        />
        <template v-if="OrderMsg.IsChaBan == 1">
          <q-select
            filled
            option-value="CourseId"
            :disable="modityOrderType == 2"
            option-label="CourseName"
            ref="CourseId"
            v-model="OrderMsg.CourseId"
            :options="CourseList"
            emit-value
            map-options
            class="col-6 q-py-sm"
            :rules="[val => !!val || '请选择课程']"
            label="选择课程"
            @input="calcPrice()"
          />
          <q-input
            filled
            stack-label
            :dense="false"
            v-model="OrderMsg.StartClassHours"
            :disable="modityOrderType == 2"
            @keyup.native="checkInteger(OrderMsg, 'StartClassHours')"
            ref="StartClassHours"
            @input="calcPrice()"
            class="col-6 q-py-sm"
            label="起始课时"
          />
          <q-input
            filled
            v-model="OrderMsg.EffectTime"
            ref="EffectTime"
            :rules="[val => !!val || '请填生效时间']"
            class="col-6 q-py-sm"
            :disable="modityOrderType == 2"
            mask="date"
            label="生效时间"
          >
            <template v-slot:append>
              <q-icon name="event" class="cursor-pointer">
                <q-popup-proxy
                  ref="qDateProxy1"
                  transition-show="scale"
                  transition-hide="scale"
                >
                  <q-date
                    v-model="OrderMsg.EffectTime"
                    @input="() => $refs.qDateProxy1.hide()"
                  />
                </q-popup-proxy>
              </q-icon>
            </template>
          </q-input>
          <q-select
            filled
            option-value="OrderId"
            option-label="CourseName"
            class="col-6 q-py-sm"
            :disable="modityOrderType == 2"
            v-model="OrderMsg.UpOrderId"
            :options="beforeOrderList"
            emit-value
            map-options
            label="前置订单"
          >
            <template
              v-slot:option="{
                itemProps,
                itemEvents,
                opt,
                selected,
                toggleOption
              }"
            >
              <q-item v-bind="itemProps" v-on="itemEvents">
                <q-item-section>
                  <q-item-label
                    ><span style="color:blue">{{ opt.OrderId }}</span>
                    {{ opt.CourseName }} {{ opt.ClassName }}
                    {{ getStudent(opt.GuestList) }}</q-item-label
                  >
                </q-item-section>
              </q-item>
            </template>
          </q-select>
        </template>
        <q-input
          filled
          stack-label
          :dense="false"
          v-model="OrderMsg.Class_Price"
          :disable="true"
          class="col-6 q-py-sm"
          label="单价(课程售价)"
          style="display:none;"
        />
        <template v-if="modityOrderType == 1">
          <q-input
            filled
            stack-label
            :dense="false"
            v-model="OrderMsg.Unit_Price"
            :disable="IsShowUpPrice == true ? false : true"
            @blur="calcPrice()"
            class="col-6 q-py-sm"
            label="成交单价"
            :rules="[val => !!val || '请填成交单价']"
          />
          <q-toggle
            v-model="IsShowUpPrice"
            label="高于定价收生"
            class="q-mb-md"
            style="display:none;"
          />
        </template>
        <template v-if="modityOrderType == 2">
          <q-input
            filled
            stack-label
            :dense="false"
            v-model="OrderMsg.Unit_Price"
            :disable="true"
            @input="calcPrice()"
            class="col-6 q-py-sm"
            label="成交单价"
            :rules="[val => !!val || '请填成交单价']"
          />
        </template>
        <q-input
          filled
          stack-label
          :dense="false"
          v-model="OrderMsg.DiscountMoney"
          :disable="true"
          class="col-6 q-py-sm"
          label="优惠金额"
        />
        <!-- <q-input filled stack-label :dense="false" v-model="OrderMsg.PerDiscountMoney" :disable="true"
          class="col-6 q-py-sm" label="优惠金额(每人)" :hint="'总优惠金额：'+(OrderMsg.PerDiscountMoney*OrderMsg.GuestNum)" /> -->
        <template v-if="modityOrderType == 3">
          <q-input
            filled
            stack-label
            :dense="false"
            v-model="OrderMsg.Unit_Price"
            @input="calcPrice()"
            class="col-6 q-py-sm"
            label="成交单价"
            :rules="[val => !!val || '请填成交单价']"
          />
        </template>
        <q-input
          filled
          stack-label
          :disable="modityOrderType != 3"
          :dense="false"
          maxlength="10"
          @keyup.native="checkPrice(OrderMsg, 'PreferPrice')"
          v-model="OrderMsg.PreferPrice"
          class="col-6 q-py-sm"
          label="应收"
        />

        <q-select
          :disable="modityOrderType == 2"
          standout="bg-primary text-white"
          option-value="Id"
          option-label="Name"
          v-model="OrderMsg.OrderSource"
          :options="SourceEnumList"
          emit-value
          map-options
          class="col-6 q-py-sm"
          label="客人来源"
        />
        <q-select
          :disable="(modityOrderType == 2 || OrderMsg.JoinType == 3)||HelpEnterDisable"
          v-model="OrderMsg.HelpEnterId"
          :options="EmployeeList"
          filled
          use-input
          label="协助老师"
          option-label="EmployeeName"
          option-value="Id"
          ref="EmployeeName"
          class="col-6 q-py-sm"
          emit-value
          map-options
          @filter="filterFn"
        >
          <template v-slot:no-option>
            <q-item>
              <q-item-section class="text-grey">
                未找到相关数据
              </q-item-section>
            </q-item>
          </template>
        </q-select>
        <q-select
          :disable="(modityOrderType == 2 || OrderMsg.JoinType == 3)||CourseConsultantDisable"
          v-model="OrderMsg.CourseConsultantId"
          :options="EmployeeList"
          filled
          use-input
          label="课程顾问"
          option-label="EmployeeName"
          option-value="Id"
          ref="EmployeeName"
          class="col-6 q-py-sm"
          emit-value
          map-options
          @filter="filterFn"
        >
          <template v-slot:no-option>
            <q-item>
              <q-item-section class="text-grey">
                未找到相关数据
              </q-item-section>
            </q-item>
          </template>
        </q-select>
        <q-input
          :disable="modityOrderType == 2"
          v-if="OrderMsg.OrderSource == 3"
          filled
          stack-label
          :dense="false"
          maxlength="50"
          v-model="OrderMsg.GeneralOccupation"
          class="col-6 q-py-sm"
          label="一般同行"
        />
        <q-input
          :disable="modityOrderType == 2"
          v-if="OrderMsg.OrderSource == 7"
          filled
          stack-label
          :dense="false"
          maxlength="50"
          v-model="OrderMsg.EduOccupation"
          class="col-6 q-py-sm"
          label="教育同行"
        />
        <!-- <q-toggle :disable="(modityOrderType==2)" v-model="OrderMsg.IsLessPrice" :false-value="0" :true-value="1"
          label="是否少价" class="q-mb-md" /> -->
        <q-input
          :disable="modityOrderType == 2"
          v-if="OrderMsg.IsLessPrice == 1"
          @input="calcPrice()"
          @keyup.native="checkPrice(OrderMsg, 'PerLessMoney')"
          maxlength="10"
          filled
          stack-label
          :dense="false"
          v-model="OrderMsg.PerLessMoney"
          class="col-6 q-py-sm"
          label="少价金额(每人)"
          :hint="'总少价金额：' + OrderMsg.PerLessMoney * OrderMsg.GuestNum"
        />
        <q-input
          disable
          v-if="OrderMsg.EnterId >0"
          filled
          stack-label
          v-model="EnterName"
          class="col-6 q-py-sm"
          label="市场人员"
        />
        <q-input
          filled
          stack-label
          :dense="false"
          v-model="OrderMsg.SaleRemark"
          type="textarea"
          class="col-12 q-py-sm"
          label="备注"
        />
      </div>
    </div>

    <div
      class="dialog-out-close"
      @click="closeEditOrder"
      style="height:40px !important;border-top-left-radius: 4px !important;border-bottom-left-radius: 4px !important;"
    >
      <q-icon name="iconfont icon-jujue1" size="26px" />
    </div>
  </div>
</template>
<script>
import {
  getClassOrderInfo, //获取订单操作日志列表
  getOrderSourceEnumList, //获取订单来源 枚举
  setClassOrder, //修改订单
  queryChaClassInfo,
  GetSelectClassOrderList, //获取前置下拉
} from "../../../../api/sale/sale";
import {
    GetStudentAssistList,
  } from '../../../../api/sale/sale'//获取协助人员
import { queryEmployee } from "../../../../api/users/user"; //获取员工
export default {
  props: {
    saveObj: {
      type: Object,
      default: null
    },
    //订单类型
    orderType: {
      type: Number,
      default: 1
    },
    //修改订单类型
    modityOrderType: {
      type: Number,
      default: 0 //1-销售修改，2-OP修改，3-总经理修改
    },
    stuData: {
      //学生是否续费
      type: Object,
      default: null
    }
  },
  data() {
    return {
      IsShowEditOrder: true,

      OrderMsg: {
        ClassId: 0, //班级编号
        GuestNum: 0, //人数
        B2CRatio: 0,
        B2CReNewRatio: 0,
        Unit_Price: 0,
        PreferPrice: 0, //应收
        OrderSource: 0,
        SaleRemark: "",
        Class_Price: 0, //单价
        OrderId: 0,
        OrderType: 0, //订单类型(1-班级课程订单，2-留学就业订单)
        SourceId: 0, //来源编号
        HelpEnterId: 0, //协助老师编号
        GeneralOccupation: "", //一般同行
        EduOccupation: "", //教育同行
        IsLessPrice: 0, //是否少价 0 不少 1 少
        LessPrice: 0, //少价金额
        PerLessMoney: 0, //每人少价金额
        OrderNature: 1, //订单性质
        OldPreferPrice: 0, //原实际应收
        IsChaBan: 0, //是否插班报入(1-是)
        CourseId: "", //课程编号
        StartClassHours: 0, //已上课时
        EffectTime: "", //生效时间
        UpOrderId: 0, //前置订单编号
        JoinType: 1, //订单报入类型
        DiscountMoney: 0, //优惠金额
        PerDiscountMoney: 0, //每人优惠金额
        CourseConsultantId: 0, //课程顾问
        CustomerId: 0, //同行
        OrderIdentify: 2, //标识参数，  1产品下单   2客户转订单
        StuIds: "",
        EnterId:0,//市场人员
        //  NormalCommission:'',//正常返佣金额
        //  RenewCommission:"",// 预计返佣金额
      },
      EnterName:'',//市场人员
      Unit_PriceRemark: "", //单价规则
      IsShowUpPrice: false, //是否显示高于定价
      UnitPrice: 0,
      SourceEnumList: [], //订单来源
      EmployeeList: [], //员工列表
      AllemployeeList: [], //所有员工列表
      CourseList: [], //课程列表
      courseObj: {}, //选择的课程
      beforeOrderList: [], //前置订单数据
      HelpEnterDisable:false,//是否可选择协助教师
      CourseConsultantDisable:false,//是否可选择课程顾问
    };
  },
  created() {
    if (this.saveObj && this.saveObj.CourseId) {
      this.OrderMsg.CourseId = this.saveObj.CourseId;
    }
    this.getOrderSEList();
    this.getEmployee();
    this.initConfig();
    this.getSelectClass();
  },
  mounted() {
    this.initData();
    this.getAssistList();
    this.OrderMsg.EnterId=this.stuData.EnterId
    this.EnterName=this.stuData.EnterName
  },
  methods: {
    //获取协助人员
      getAssistList() {
       const ids = this.stuData.StuList.map(e => e.StuId).toString();
        GetStudentAssistList({StuId: ids}).then(res => {
          if (res.Code == 1) {
            res.Data.map(e=>{
              if(e.AssistType==4){
                this.OrderMsg.HelpEnterId=e.AssistId
                this.HelpEnterDisable=true
              }
              if(e.AssistType==2){
                this.OrderMsg.CourseConsultantId=e.AssistId
                this.CourseConsultantDisable=true
              }
            })
          }
        })
      },
    //获取班级课程信息
    initConfig() {
      var qMsg = {
        ClassId: 0
      };
      if (this.saveObj.ClassId) {
        qMsg.ClassId = this.saveObj.ClassId;
      }
      queryChaClassInfo(qMsg).then(res => {
        if (res.Code == 1) {
          this.CourseList = res.Data.otherCourse;
          if (this.saveObj && this.saveObj.OrderId > 0) {
          } else {
            this.OrderMsg.StartClassHours = res.Data.finishHours;
          }
          if (this.OrderMsg && this.OrderMsg.CourseId) {
            this.courseObj = this.CourseList.find(
              x => x.CourseId == this.OrderMsg.CourseId
            );
          }
          this.calcPrice();
        }
      });
    },
    //计算课程单价和应收金额
    calcPrice() {
      var guestNum = 0;
      if (this.OrderMsg.GuestNum && this.OrderMsg.GuestNum > 0) {
        guestNum = Number(this.OrderMsg.GuestNum);
      }
      let temp = this.CourseList.find(
        x => x.CourseId == this.OrderMsg.CourseId
      );
      if (temp) {
        this.courseObj = temp;
        var tempDiscountMoney = 0; //优惠金额
        // var tempSaleRemark = `直客首次报名优惠比例${temp.B2CRatio ?? 0}%`; //备注
        //插班课时单价
        var classHourPrice = temp.SellPrice / this.courseObj.ClassHours;
        var chaBanPrice = Number(
          classHourPrice *
            (this.courseObj.ClassHours - this.OrderMsg.StartClassHours)
        ).toFixed(2);
        if (guestNum == 1) {
          if (temp.CoursePriceList && temp.CoursePriceList.length > 0) {
            if (temp.CoursePriceList[0].PriceType == 0) {
              if (this.OrderMsg.IsChaBan == 1) {
                tempDiscountMoney =
                  (chaBanPrice * temp.CoursePriceList[0].PriceMoney) / 100;
              } else {
                tempDiscountMoney =
                  (temp.SellPrice * temp.CoursePriceList[0].PriceMoney) / 100;
              }
              // tempSaleRemark = "单人报名优惠" + temp.CoursePriceList[0].PriceMoney + "%";
            } else {
              tempDiscountMoney = item.CoursePriceList[0].PriceMoney;
              // tempSaleRemark = "单人报名优惠" + temp.CoursePriceList[0].PriceMoney;
            }
          }
        }
        if (guestNum > 1) {
          if (temp.CoursePriceList && temp.CoursePriceList.length > 0) {
            if (temp.CoursePriceList[1].PriceType == 0) {
              // tempSaleRemark = "双人报名优惠" + temp.CoursePriceList[1].PriceMoney + "%";
              if (this.OrderMsg.IsChaBan == 1) {
                tempDiscountMoney =
                  (chaBanPrice * temp.CoursePriceList[1].PriceMoney) / 100;
              } else {
                tempDiscountMoney =
                  (temp.SellPrice * temp.CoursePriceList[1].PriceMoney) / 100;
              }
            } else {
              tempDiscountMoney = item.CoursePriceList[1].PriceMoney;
              // tempSaleRemark = "双人报名优惠" + temp.CoursePriceList[1].PriceMoney;
            }
          }
        }
        var perDiscountMoney = Number(tempDiscountMoney).toFixed(2);
        this.OrderMsg.PerDiscountMoney = perDiscountMoney;
        //计算每人优惠和总优惠
        // if (this.OrderMsg.IsChaBan == 1) {
        //   this.OrderMsg.Unit_Price = chaBanPrice;
        //   this.UnitPrice = chaBanPrice;
        // } else {
        //   this.OrderMsg.Unit_Price = temp.SellPrice;
        //   this.UnitPrice = temp.SellPrice;
        // }
        // this.OrderMsg.SaleRemark = tempSaleRemark;
      } else {
        if (this.saveObj.ClassId) {
          this.OrderMsg.ClassId = this.saveObj.ClassId;
        }
        if (this.saveObj.Unit_Price) {
          this.OrderMsg.Unit_Price = this.saveObj.Unit_Price;
          this.UnitPrice = this.saveObj.Unit_Price;
        }
        if (this.saveObj.SourceId) {
          this.OrderMsg.SourceId = this.saveObj.SourceId;
        }
        this.courseObj = {};
      }

      /**计算少价---开始*/
      var tempPerLessMoney = 0;
      if (this.OrderMsg.PerLessMoney && this.OrderMsg.PerLessMoney > 0) {
        tempPerLessMoney = this.OrderMsg.PerLessMoney;
      }
      this.OrderMsg.LessPrice = tempPerLessMoney * guestNum;
      /**计算少价----结束*/
      var unit_price = 0;
      if (this.OrderMsg.Unit_Price && this.OrderMsg.Unit_Price > 0) {
        unit_price = Number(this.OrderMsg.Unit_Price);
      }
      var str = "";
      //计算应收价格
      if (this.OrderMsg.IsChaBan == 1) {
        var newPreferPrice = 0;
        if (
          this.courseObj &&
          this.courseObj.CourseId &&
          this.courseObj.CourseId > 0
        ) {
          newPreferPrice = chaBanPrice * guestNum;
        }
        this.OrderMsg.PreferPrice =
          Number(newPreferPrice).toFixed(2) - this.OrderMsg.LessPrice;
      } else {
        this.OrderMsg.PreferPrice =
          Number(guestNum * unit_price).toFixed(2) - this.OrderMsg.LessPrice;
      }
      //留学就业订单
      if (this.OrderMsg.OrderType == 2) {
        this.OrderMsg.OldPreferPrice = Number(guestNum * unit_price).toFixed(2);
      }

      this.OrderMsg.GuestNum = this.stuData.StuList.length;
      this.OrderMsg.DiscountMoney = 0;

      this.stuData.StuList.map(e => {
        if (e.IsRenewGuest == 0) {
          this.OrderMsg.DiscountMoney +=
            this.OrderMsg.Class_Price * this.OrderMsg.B2CRatio;
        } else {
          this.OrderMsg.DiscountMoney +=
            this.OrderMsg.Class_Price * this.OrderMsg.B2CReNewRatio;
        }
      });
    },
    initData() {
      this.OrderMsg.HelpEnterId = 0;
      this.OrderMsg.GeneralOccupation = "";
      this.OrderMsg.EduOccupation = "";
      this.OrderMsg.IsLessPrice = 0;
      this.OrderMsg.LessPrice = 0;
      this.OrderMsg.PerLessMoney = 0;
      this.OrderMsg.OrderNature = 0;
      this.OrderMsg.OldPreferPrice = 0;
      this.OrderMsg.StartClassHours = 0;
      this.OrderMsg.IsChaBan = 0;
      this.OrderMsg.EffectTime = "";
      this.OrderMsg.UpOrderId = 0;
      this.OrderMsg.JoinType = 1;
      this.OrderMsg.DiscountMoney = 0;
      this.OrderMsg.PerDiscountMoney = 0;
      this.OrderMsg.OrderType = this.orderType;
      this.OrderMsg.B2CRatio = 0;
      this.OrderMsg.B2CReNewRatio = 0;
      this.OrderMsg.CustomerId = 0;
      this.OrderMsg.CourseConsultantId = 0;
      if (this.OrderMsg.OrderType == 2) {
        this.OrderMsg.OrderNature = 1;
      }
      if (this.saveObj) {
        if (this.saveObj.ClassId) {
          this.OrderMsg.ClassId = this.saveObj.ClassId;
        }
        if (this.saveObj.Unit_Price) {
          this.OrderMsg.Unit_Price = this.saveObj.Unit_Price;
          this.OrderMsg.Class_Price = this.saveObj.Unit_Price;
          this.UnitPrice = this.saveObj.Unit_Price;
        }
        if (this.saveObj.SourceId) {
          this.OrderMsg.SourceId = this.saveObj.SourceId;
        }

        if (this.saveObj.CourseId) {
          this.OrderMsg.CourseId = this.saveObj.CourseId;
        } else {
          this.OrderMsg.CourseId = "";
        }
        if (this.saveObj.B2CRatio) {
          this.OrderMsg.B2CRatio =
            this.saveObj.B2CRatio > 1
              ? this.saveObj.B2CRatio / 100
              : this.saveObj.B2CRatio;
        }
        if (this.saveObj.B2CReNewRatio) {
          this.OrderMsg.B2CReNewRatio =
            this.saveObj.B2CReNewRatio > 1
              ? this.saveObj.B2CReNewRatio / 100
              : this.saveObj.B2CReNewRatio;
        }
      }
      this.IsShowEditOrder = true;

      this.calcPrice();
      if (this.stuData.RenewNum > 0) {
        this.OrderMsg.SaleRemark = `首次报名优惠比例${this.saveObj
          .B2CRatio ?? 0}%;续费优惠比例${this.saveObj.B2CReNewRatio ?? 0}%`; //备注
      } else {
        this.OrderMsg.SaleRemark = `首次报名优惠比例${this.saveObj
          .B2CRatio ?? 0}%`; //备注
      }
    },
    //筛选员工
    filterFn(val, update) {
      update(() => {
        if (val === "") {
          this.EmployeeList = JSON.parse(JSON.stringify(this.AllemployeeList));
        } else {
          const needle = val.toLowerCase();
          this.EmployeeList = this.AllemployeeList.filter(
            v => v.EmployeeName.toLowerCase().indexOf(needle) > -1
          );
        }
      });
    },
    //获取业务员
    getEmployee() {
      var qMsg = {
        Dept_Id: 0
      };
      queryEmployee(qMsg).then(res => {
        if (res.Code == 1) {
          this.EmployeeList = res.Data;
          this.AllemployeeList = res.Data;
          let obj = {
            Id: 0,
            EmployeeName: "不限"
          };
          this.EmployeeList.unshift(obj);
        }
      });
    },
    //关闭弹窗
    closeEditOrder() {
      this.IsShowEditOrder = false;
      this.$emit("close");
    },
    //获取订单来源
    getOrderSEList() {
      getOrderSourceEnumList({}).then(res => {
        if (res.Code == 1) {
          var tempArray = res.Data;
          this.SourceEnumList = tempArray;
          this.OrderMsg.OrderSource = tempArray[0].Id;
        }
      });
    },
    //修改订单
    saveOrderInfo() {
      //插班验证课程和生效时间
      if (this.OrderMsg.IsChaBan == 1) {
        this.$refs.CourseId.validate();
        this.$refs.EffectTime.validate();
        if (this.$refs.CourseId.hasError) {
          this.$q.notify({
            type: "negative",
            position: "top",
            message: `请选择课程!`
          });
          return;
        }
        if (this.$refs.EffectTime.hasError) {
          this.$q.notify({
            type: "negative",
            position: "top",
            message: `请选择生效时间!`
          });
          return;
        }
      }
      this.OrderMsg.StuIds = this.stuData.StuList.map(e => e.StuId).toString();
      this.OrderMsg.CustomerId = this.stuData.CustomerId;
      setClassOrder(this.OrderMsg).then(res => {
        if (res.Code == 1) {
          this.$q.notify({
            icon: "iconfont icon-chenggong",
            color: "accent",
            timeout: 2000,
            message: "操作成功!",
            position: "top"
          });
          //调用父页面成功方法
          this.$emit("success");
          this.IsShowEditOrder = false;
        } else {
          this.$q.notify({
            type: "negative",
            position: "top",
            message: res.Message
          });
        }
      });
    },
    //获取前置下拉数据
    getSelectClass() {
      var qMsg = {
        ClassId: 0
      };
      if (this.saveObj.ClassId) {
        qMsg.ClassId = this.saveObj.ClassId;
      }
      GetSelectClassOrderList(qMsg).then(res => {
        if (res.Code == 1) {
          this.beforeOrderList = res.Data;
        }
      });
    },
    getStudent(item) {
      let str = "";
      if (item && item.length > 1) {
        str = item[0].GuestName + "等" + item.length + "人";
      }
      if (item.length == 1) {
        str = item[0].GuestName;
      }
      return str;
    },
  }
};
</script>
