<!--订单列表-->
<template>
  <div class="classorder classorder-bottom">
    <div class="table-head">
      <table class="enrollTotalSearchTable" border="0" cellspacing="0" cellpadding="0">
        <colgroup>
          <col width="12%" />
          <col width="8.5%" />
          <col width="6.5%" />
          <col width="8.5%" />
          <col width="6.5%" />
          <col width="6.5%" />
          <col width="6.5%" />
          <col width="6.5%" />
          <col width="6.5%" />
          <col width="6.5%" />
          <col width="6.5%" />
          <col width="6.5%" />          
          <col width="100px"/>
        </colgroup>
        <thead>
          <tr class="fix_th">
            <th width="12%">单号</th>
            <th width="8.5%">客人</th>
            <th width="6.5%">人数</th>
            <th width="8.5%">出行概述</th>
            <th width="6.5%">应收</th>
            <th width="6.5%">实收</th>
            <th width="6.5%">退款</th>
            <th width="6.5%">成本</th>
            <th width="6.5%">手续费</th>
            <th width="6.5%">待收</th>
            <th width="6.5%">出票状态</th>
            <th width="6.5%">签证状态</th>
            <th width="6.5%">订单状态</th>
            <th width="100px">操作</th>
          </tr>
        </thead>
      </table>
    </div>
    <div class="table-body" v-loading="loading">
      <table class="enrollTotalSearchTable" border="0" cellspacing="0" cellpadding="0">
        <colgroup>
          <col width="12%" />
          <col width="8.5%" />
          <col width="6.5%" />
          <col width="8.5%" />
          <col width="6.5%" />
          <col width="6.5%" />
          <col width="6.5%" />
          <col width="6.5%" />
          <col width="6.5%" />
          <col width="6.5%" />
          <col width="6.5%" />
          <col width="6.5%" />
          <col width="100px"/>
        </colgroup>
        <template>
          <tbody v-for="(item, index) in dataList" :key="index">
            <tr>
              <td :rowspan="3">
               <p class="OrderId-text" @click="clickSingleNumber(item)">
                   <span class="text-underline">{{item.OrderId}}</span> 
                   <span class="OrderType-text"
                   :class="[items.Id==1?'one':
                   (items.Id==2?'two':
                   (items.Id==3?'three':
                   (items.Id==4?'four':
                   (items.Id==5?'five':'')))),{'line-through':items.show}]"
                   
                   v-for="(items,index) in item.MultipleChoiceList">{{items.Name}}</span>
               </p>
               <p class="CreateByName-text">{{item.CreateByName}}</p>
               <p class="CreateByName-text">业务员：<span class="colorblue">{{item.EnterName}}</span></p>
               <p>{{item.CreateTime}}</p>
              </td>
              <td style="border:none" min-width="6.5%">
                  <p class="colorblue font-color-link" 
                  @click="openNameDetails(item)">{{item.GuestName}}</p>
                  <p>{{item.MobilePhone}}</p>
              </td>
              <td style="border:none">{{item.GuestCount}}人</td>
              <td style="border:none">
                  {{item.StartCityName}}
              </td>
              <td style="border:none">
                  <p @click="item.TicketStatus==1&&item.OrderStatus==1?editOrderAmount(item):''" class="cp"
              :class="item.TicketStatus==1&&item.OrderStatus==1?'font-color-link':''">{{item.Money}}</p>
              </td>
              <td style="border:none">
                  {{item.IncomeMoney}}
              </td>
              <td style="border:none">
                  {{item.BackMoney}}
              </td>
              <td style="border:none">
                  {{item.PayMoney}}
              </td>
              <td style="border:none">
                {{item.TaxMoney}}
              </td>
              <td style="border:none">
                <span :style="{color: item.DueinMoney==0?'blue':'red'}">{{item.DueinMoney}}</span>
              </td>
              <td style="border:none">
                <p class="TicketVoucher-box">
                    <span  @click="item.TicketStatusName!='无需机票'?modifyStatus(item):''" 
                  class="cp tatusText"
                  :class="item.TicketStatus==1?'grey':
                  (item.TicketStatus==2?'success':
                  (item.TicketStatus==3?'error':
                  (item.TicketStatus==4?'cancel':
                  (item.TicketStatus==5?'Black':''))))">
                      {{item.TicketStatusName}}
                  </span>
                  <i v-if="item.TicketStatus!=1&&item.TicketVoucherList!=[]&&item.CancelVoucherList!=[]&&item.TicketStatusName!='无需机票'" class="cp iconfont iconpingzhengchaxun Credentials" 
                  @click="viewCredentials(item)"></i>
                </p>
                
              </td>
              <td style="border:none">
                <p class="TicketVoucher-box">
                  <span @click="item.VisaStatus=='1'?AmendVisa(item):''" 
                class="tatusText"
                :class="item.VisaStatus==1?'grey'+' cp':
                (item.VisaStatus==2?'success':
                (item.VisaStatus==0?'Black':''))">
                  {{item.VisaStatus==1?'未出签':(item.VisaStatus==2?'已出签':'无需签证')}}
                </span>
                <i v-if="item.VisaStatus==2" class="cp iconfont iconpingzhengchaxun Credentials" 
                  @click="CheckOutDetails(item)"></i>
              </p>
                
              </td>
              <td style="border:none">
                  <div class="Order-list-Status" :class="item.OrderStatus=='1'?'one':
                  (item.OrderStatus=='2'?'two':
                  (item.OrderStatus=='3'?'three':
                  (item.OrderStatus=='4'?'four':
                  (item.OrderStatus=='5'?'five':
                  (item.OrderStatus=='6'?'six':'')))))">
                    <span>{{item.OrderStatusName}}</span>
                 </div>
              </td>
              <td style="border:none;width:150px">
                  <div class="enedit-box">
                    <el-tooltip
                    v-if="item.OrderStatus!=2&&item.OrderStatus!=5"
                    class="item-but" effect="dark" content="编辑订单" placement="top">
                        <i class="iconfont iconwenbenbianji cp" @click="editOrder(item)"></i>
                    </el-tooltip>
                    <div>
                        <el-select style="width:80px;"  class="select-right" 

                        clearable
                        size="mini" 
                        v-model="item.More" placeholder="更多"
                        @change="chooseMore(item)">
                            <el-option
                            v-for="items in item.MoreList"
                            v-if="items.show"
                            :key="items.Id"
                            :label="items.Name"
                            :value="items.Id">
                            </el-option>
                        </el-select>
                    </div>
                    
                </div>
              </td>
            </tr>
            <tr>
              <td :colspan="9" style="height: 108px;text-align: left">
                <div>备注：</div>
                <div class="remarks-b">
                    <div v-if="item.Remark != null || item.Remark != ''">
                        <div>{{ item.Remark }}</div>
                    </div>
                    <span v-if="item.Remark == null || item.Remark == ''">暂无</span>
                </div>
              </td>
              <td :colspan="4" style="height: 108px;text-align: left">
                <div class="documents-text">
                    <div class="documents-left">
                        <div>收入单据：</div>
                        <span
                        :class="item.Status===1&&item.Is_Cashier===0?'one':(item.Status===1&&item.Is_Cashier===1?'two':(item.Status===2?'three':''))"
                        v-for="(item,index) in item.IncomeFinance" :key="index"
                        @click="openDetails(item)">{{item.FrID}}</span>
                    </div>
                    <div class="documents-right">
                        <el-tooltip
                        class="item-but" effect="dark" content="制单" placement="top">
                            <i class="iconfont iconwenbenbianji cp"
                            :class="item.OrderStatus!=2&&item.OrderStatus!=5?'blue':''"
                            @click="item.OrderStatus!=2&&item.OrderStatus!=5?makeAdocument(item,index,1):''"></i>
                        </el-tooltip>
                        <div v-show="item.actuallyReceived" class="agreement-IncomeMoney-pop">
                            <div class="float-flag-shape"></div>
                            <el-checkbox-group v-model="item.checkList" 
                                @change="clickMultipleChoice(item,index,1)">
                                <el-checkbox v-for="(items,indexs) in item.MultipleChoiceList" :key="indexs"
                                :label="items.Id">{{items.Name}}</el-checkbox>
                            </el-checkbox-group>
                            <div class="agreement-Cancel">
                                <span @click="popCancelClick(item,index,1)">取消</span>
                                <span @click="popClick(item,index,1)">确定</span>
                            </div>
                            
                        </div>
                    </div> 
                </div>
                <div class="documents-text">
                    <div class="documents-left">
                        <div>退款单据：</div>
                        <span
                        :class="item.Status===1&&item.Is_Cashier===0?'one':(item.Status===1&&item.Is_Cashier===1?'two':(item.Status===2&&item.Is_Cashier===1?'three':''))"
                        v-for="(item,index) in item.BackFinance" :key="index"
                        @click="openDetails(item)">{{item.FrID}}</span>
                    </div>
                    <div class="documents-right">
                        <el-tooltip
                        class="item-but" effect="dark" content="制单" placement="top">
                            <i class="iconfont iconwenbenbianji cp" 
                            :class="item.OrderStatus!=2&&item.OrderStatus!=5?'blue':''"
                            @click="item.OrderStatus!=2&&item.OrderStatus!=5?makeAdocument(item,index,2):''"></i>
                        </el-tooltip>
                    </div>
                </div>
                <div class="documents-text">
                    <div class="documents-left">
                        <div>成本单据：</div>
                        <span
                        :class="item.Status==1&&item.Is_Cashier==0?'one':(item.Status==1&&item.Is_Cashier==1?'two':(item.Status==2?'three':''))"
                        v-for="(item,index) in item.PayFinance" :key="index"
                        @click="openDetails(item)">{{item.FrID}}</span>
                    </div>
                    <div class="documents-right">
                        <el-tooltip
                        class="item-but" effect="dark" content="制单" placement="top">
                            <i class="iconfont iconwenbenbianji cp" 
                            :class="item.OrderStatus!=2&&item.OrderStatus!=5?'blue':''"
                            @click="item.OrderStatus!=2&&item.OrderStatus!=5?makeAdocument(item,index,3):''"></i>
                        </el-tooltip>
                        <div v-show="item.cost" class="agreement-IncomeMoney-pop">
                            <div class="float-flag-shape"></div>
                            <el-radio-group v-model="item.selectedType" @change="clickMultipleChoice(item,index,3)">
                            <el-radio v-for="(item,index) in item.MultipleChoiceList" :key="index"
                            :label="item.Id">{{item.Name}}</el-radio>
                            </el-radio-group>
                            <div class="agreement-Cancel">
                                <span @click="popCancelClick(item,index,3)">取消</span>
                                <span @click="popClick(item,index,3)">确定</span>
                            </div>
                            
                        </div>
                    </div>
                </div>
              </td>
            </tr>
          </tbody>
        </template>
    <!--取消订单-->
    </table>
</div>
<el-drawer :with-header="false" size='70%' :visible.sync="drawer" direction="rtl" :before-close="handleClose">
    <customerInfoBox :CustomerId="CustomerId" :activeNameNum="activeNameNum" :receiptType="receiptType"/>
</el-drawer>
<!-- 单号抽屉 -->
<el-drawer @closed="closeOrderDrawerHandler" :with-header="false" size='70%' :visible.sync="orderDrawer" direction="rtl" :before-close="handleClose">
    <orderDetailsDrawer v-if="currentOrder" :orderId="currentOrder.OrderId" :activeNameNum="activeNameNum" />
</el-drawer>

</div>
</template>

<script>
import customerInfoBox from "../guestManagement/customerInfoBox";
import orderDetailsDrawer from "./orderDetailsDrawer";
export default {
  components: {
    customerInfoBox,
    orderDetailsDrawer,
  },
  props: {
    //订单
    dataList: {
      type: Array,
      default: null,
    },
    loading: {
      type: Boolean,
      default: false,
    },
    superManage: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
        receiptType:{},
        activeNameNum:"1",
        MultipleChoiceList: [ //多选项目
            {
                Name: '机票',
                Id: '1'
            }, {
                Name: '签证',
                Id: '2'
            }, {
                Name: '地接',
                Id: '3'
            }, {
                Name: '套餐',
                Id: '4'
            }, {
                Name: '套餐',
                Id: '5'
            }
        ],
      userInfo: {},
      MoreList: [
        {
          Name: "取消订单",
          Id: "1",
          show: true,
        },
        {
          Name: "订单转交",
          Id: "2",
          show: true,
        },
        {
          Name: "修改出票状态",
          Id: "4",
          show: true,
        },
        {
          Name: '完结',
          Id: '6',
          show: false
        },
        {
          Name: "操作日志",
          Id: "3",
          show: true,
        }
      ],
      clickMore: "",
      drawer: false,
      orderDrawer: false,
      CustomerId: "",
      CustomerName: "",
      currentOrder: null,
    };
  },
  created() {},
  watch: {
    loading: {
      handler(val, oldVal) {
        this.loading = val;
      },
      deep: true,
    }
  },
  mounted() {
    this.userInfo = this.getLocalStorage();
  },
  methods: {
    // 多选发生变化
    clickMultipleChoice(row, index, num) {
      if (num == 1) {
        row.selectedType = row.checkList.join(",");
      }
    },
    // 删除套餐值
    delType(row, item) {
      for (let i = 0; i < row.checkList.length; i++) {
        if (row.checkList[i] == item) {
          row.checkList.splice(i, 1);
        }
      }
    },
    // 取消
    popCancelClick(row, index, num) {
      this.dataList.forEach((item) => {
        item.checkList = [];
        item.selectedType = "";
        item.actuallyReceived = false;
        item.cost = false;
      });
    },
    // 确定弹窗
    popClick(row, index, num) {
      if (!row.selectedType) {
        this.$message.warning("请选择类型!");
        return;
      }
      this.makeAdocumentFun(row, index, num);
      this.dataList[index].actuallyReceived = false;
      this.dataList[index].cost = false;
    },
    // 点击单号
    clickSingleNumber(item) {
      this.currentOrder = item;
      this.orderDrawer = true;
    },
    closeOrderDrawerHandler() {
      this.currentOrder = null;
      this.orderDrawer = false;
    },
    handleClose(done) {
      done();
    },
    openNameDetails(item) {
      this.drawer = true;
      this.CustomerId = item.GuestId;
      this.CustomerName = item.GuestName;
    },
    // 查看出票凭据
    viewCredentials(row) {
      let $this = this;
      this.MsgBus.$emit(
        "CredentialsOrderTicketOrderBoxOpen",
        $this.ID,
        row,
        true
      );
    },
    // 清空下拉
    emptyMore() {
        this.dataList.forEach(item => {
            return item.More = ''
        })
    },
    chooseMore(row) {
      //   取消订单
      if (row.More == "1") {
        this.cancelOrder(row);
      }
      //   订单转交
      if (row.More == "2") {
        this.convertOrder(row);
      }
      //   编辑订单金额
      if (row.More == '3') {
          this.editOrderAmount(row)
      }
      //   修改出票状态
      if (row.More == '4') {
        this.modifyStatus(row)
      }
      //   修改出签状态
      if (row.More == "5") {
        this.AmendVisa(row)
      }
      //   完结
      if (row.More == "6") {
        this.orderCompleted(row)
      }
      //   操作日志
      if (row.More == "7") {
        this.operationLog(row);
      }
      //   订单收损
      if (row.More == "8") {
        this.lossOperation(row);
      }
      //   订单收损完结
      if (row.More == "9") {
        this.endOfLoss(row);
      }
    },
    //   订单收损完结
    endOfLoss(row){
      if (this.superManage) {
        this.endOfLossfun(row)
      }else{
        if (this.userInfo.EmName != row.EnterName) {
          this.ValidateOperator();
        } else {
          this.endOfLossfun(row)
        }
      }
      
    },
    endOfLossfun(row){
      let tips = '一旦确认订单收损完结，你将无法对订单执行任何操作，包括订单相关的财务单据。'
      this.$confirm(tips, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
      }).then(() => {
          this.apipost('/api/Order/SetOrderLossFinish', {
              OrderId: row.OrderId,
          }, res => {
              if (res.data.resultCode == 1) {
                  this.$message.success(res.data.message);
                  this.MsgBus.$emit("closeGetList");
              }else{
                this.$message.warning(res.data.message);
              }
          })
      }).catch(() => {
          this.emptyMore()
          this.$message({
              type: 'info',
              message: '已取消'
          });
      });
    },
    // 收损
    lossOperation(row){
      if (this.superManage) {
        this.lossOperationfun(row)
      }else{
        if (this.userInfo.EmName != row.EnterName) {
          this.ValidateOperator();
        } else {
          this.lossOperationfun(row)
        }
      }
    },
    lossOperationfun(row){
      this.MsgBus.$emit(
          "lossOrderBoxOpen",
          row.GuestId,
          row,
          true
      );
    },
    // 订单完结
    orderCompleted(row){
      if (this.superManage) {
        this.orderCompletedfun(row)
      }else{
        if (this.userInfo.EmName != row.EnterName) {
          this.ValidateOperator();
        } else {
          this.orderCompletedfun(row)
        }
      }
      
    },
    orderCompletedfun(row){
      let tips = '一旦确认订单完结，你将无法对订单执行任何操作，包括订单相关的财务单据。'
      this.$confirm(tips, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
      }).then(() => {
          this.apipost('/api/Order/SetOrderFinish', {
              OrderId: row.OrderId,
          }, res => {
              if (res.data.resultCode == 1) {
                  this.$message.success(res.data.message);
                  this.MsgBus.$emit("closeGetList");
              }else{
                this.$message.warning(res.data.message);
              }
          })
      }).catch(() => {
          this.emptyMore()
          this.$message({
              type: 'info',
              message: '已取消'
          });
      });
    },
    // 转换订单
    convertOrder(row) {
      if (this.superManage) {
        this.convertOrderfun(row)
      }else{
        if (this.userInfo.EmName != row.EnterName) {
          this.ValidateOperator();
        } else {
          this.convertOrderfun(row)
        }
      }
    },
    convertOrderfun(row){
      if (row.OrderStatus != '2') {
        this.MsgBus.$emit(
          "convertOrderTicketOrderBoxOpen",
          row.GuestId,
          row,
          true
        );
      }else{
        this.$confirm('抱歉,该订单已取消,不能转交', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.emptyMore()
        }).catch(() => {
          this.emptyMore()
        });
      }
    },
    // 验证操作员
    ValidateOperator() {
      this.$message({
        type: "warning",
        message: "抱歉,该订单您没有操作权限!",
      });
      this.emptyMore()
    },
    // 制作单据
    makeAdocument(row, index, num) {
      let list = row.OrderType && row.OrderType.split(",");

      if (list != null && list.length > 1 && num == 1) {
        this.dataList.forEach((item) => {
          return (item.cost = false);
        });
        this.dataList.forEach((item) => {
          return (item.actuallyReceived = false);
        });
        this.dataList[index].actuallyReceived = true;
      } else if (list != null && list.length > 1 && num == 3) {
        this.dataList.forEach((item) => {
          return (item.actuallyReceived = false);
        });
        this.dataList.forEach((item) => {
          return (item.cost = false);
        });
        this.dataList[index].cost = true;
      } else {
        this.makeAdocumentFun(row, index, num);
      }
    },
    makeAdocumentFun(row, index, num) {
      
      if (this.superManage) {
        this.makeAdocumentFunction(row, index, num)
      }else{
        if (this.userInfo.EmName != row.EnterName) {
          this.ValidateOperator();
        } else {
          this.makeAdocumentFunction(row, index, num)
        }
      }
    },
    makeAdocumentFunction(row, index, num){
      let type;
      type = num == 1 ? 1 : 2; // 1收款 2退款 3成本
      let href;
      let url = this.domainManager().erpRoutingUrl;
      let data;
      let list = row.OrderType && row.OrderType.split(",");
      if (row.OrderStatus != "2") {
          if (list && list.length > 1) {
            let typeList = row.selectedType.split(",");
            if (num == 1 && typeList.length >= 2) {
              let $this = this;
              row.ReFinanceId2 = num;
              this.MsgBus.$emit("BillMakingOrderBoxOpen", $this.ID, row, true);
            }
            if ((typeList.length == 1 && num == "1") || num == "3") {
              data = [
                {
                  path: "ChoiceAddFinancialDocuments",
                  type: type,
                  OtherType: 55,
                  ReFinanceId: row.OrderId,
                  ReFinanceId2: num,
                  GuestId: row.GuestId,
                  RelevanceFrId: row.selectedType, // 单据类型
                },
              ];
              href =
                url +
                "automaticLogin?token=" +
                this.getLocalStorage().token +
                "&data=" +
                JSON.stringify(data);
              window.open(href);
              for (let i = 0; i < this.dataList.length; i++) {
                this.dataList[i].checkList = [];
                this.dataList[i].selectedType = "";
                this.dataList[i].actuallyReceived = false;
                this.dataList[i].cost = false;
              }
            }
            if (num == "2") {
              data = [
                {
                  path: "ChoiceAddFinancialDocuments",
                  type: type,
                  OtherType: 55,
                  ReFinanceId: row.OrderId,
                  ReFinanceId2: num,
                  GuestId: row.GuestId,
                },
              ];
              href =
                url +
                "automaticLogin?token=" +
                this.getLocalStorage().token +
                "&data=" +
                JSON.stringify(data);
              window.open(href);
              for (let i = 0; i < this.dataList.length; i++) {
                this.dataList[i].checkList = [];
                this.dataList[i].selectedType = "";
                this.dataList[i].actuallyReceived = false;
                this.dataList[i].cost = false;
              }
            }
          } else {
            if (num == 1 || num == 2) {
              data = [
                {
                  path: "ChoiceAddFinancialDocuments",
                  type: type,
                  OtherType: 55,
                  ReFinanceId: row.OrderId,
                  ReFinanceId2: num,
                  GuestId: row.GuestId,
                  RelevanceFrId: row.OrderType, // 单据类型
                },
              ];
            }
            if (num == 3) {
              data = [
                {
                  path: "ChoiceAddFinancialDocuments",
                  type: type,
                  OtherType: 55,
                  ReFinanceId: row.OrderId,
                  ReFinanceId2: num,
                  GuestId: row.GuestId,
                },
              ];
            }
            href =
              url +
              "automaticLogin?token=" +
              this.getLocalStorage().token +
              "&data=" +
              JSON.stringify(data);
            window.open(href);
            for (let i = 0; i < this.dataList.length; i++) {
              this.dataList[i].checkList = [];
              this.dataList[i].selectedType = "";
              this.dataList[i].actuallyReceived = false;
              this.dataList[i].cost = false;
            }
          }
        }
    },
    // 操作日志
    operationLog(row) {
      this.MsgBus.$emit("logTicketOrderBoxOpen", row.GuestId, row, true);
    },
    // 修改签证状态
    AmendVisa(row){
      if (this.superManage) {
        this.AmendVisafun(row);
      } else {
        if (this.userInfo.EmName != row.EnterName) {
          this.ValidateOperator();
        } else {
          this.AmendVisafun(row);
        }
      }
    },
    AmendVisafun(row){
      this.MsgBus.$emit("AmendVisaOrderBoxOpen", row.GuestId, row, true);
    },
    // 出签凭证详情
    CheckOutDetails(row){
      let $this = this;
      this.MsgBus.$emit(
        "CheckOutDetailsOrderBoxOpen",
        $this.ID,
        row,
        true
      );
    },
    // 修改出票状态
    modifyStatus(row) {
      if (this.superManage) {
        this.ModifyStatusfun(row);
      } else {
        if (this.userInfo.EmName != row.EnterName) {
          this.ValidateOperator();
        } else {
          this.ModifyStatusfun(row);
        }
      }
    },
    ModifyStatusfun(row) {
      if (
        row.TicketStatus == 3 ||
        row.TicketStatus == 4 ||
        row.OrderStatus == "2"
      ) {
        this.$confirm('该订单已经无法修改出票状态', "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }).then(() => {
          this.emptyMore()
        }).catch(() => {
          this.emptyMore()
        })
      } else {
        this.MsgBus.$emit("reviseTicketOrderBoxOpen", row.GuestId, row, true);
      }
    },
    // 取消订单
    cancelOrder(row) {
      if (this.superManage) {
        this.cancelOrderfun(row);
      } else {
        if (this.userInfo.EmName != row.EnterName) {
          this.ValidateOperator();
        } else {
          this.cancelOrderfun(row);
        }
      }
    },
    cancelOrderfun(row) {
      if (
        row.OrderStatus != "2" &&
        row.IncomeFinance.length == 0 &&
        row.BackFinance.length == 0 &&
        row.PayFinance.length == 0
      ) {
        let tips = "此操作将取消该订单，是否继续取消?";
        this.$confirm(tips, "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(() => {
            this.apipost(
              "/api/Order/SetGuestOrderState",
              {
                OrderId: row.OrderId,
                Type: "1",
              },
              (res) => {
                if (res.data.resultCode == 1) {
                  this.MsgBus.$emit("closeGetList");
                  this.emptyMore()
                  this.$message.success(res.data.message);
                }
              }
            );
          })
          .catch(() => {
            this.emptyMore()
            this.$message({
              type: "info",
              message: "已取消",
            });
          });
      } else {
        this.$confirm('该订单已经无法取消', "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }).then(() => {
          
        }).catch(() => {})
        this.emptyMore()
      }
    },
    // 编辑订单
    editOrder(row) {
      if (this.superManage) {
        this.editOrderfun(row);
      } else {
        if (this.userInfo.EmName != row.EnterName) {
          this.ValidateOperator();
        } else {
          this.editOrderfun(row);
        }
      }
    },
    editOrderfun(row) {
      if (row.TicketStatus == 1 && row.OrderStatus == 1) {
        this.MsgBus.$emit(
          "editOrderTicketOrderBoxOpen",
          row.GuestId,
          row,
          true
        );
      } else {
        this.$confirm('该订单已经无法编辑', "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }).then(() => {
          
        }).catch(() => {})
        this.emptyMore()
      }
    },
    // 编辑订单金额
    editOrderAmount(row) {
      if (this.superManage) {
        this.editOrderAmountfun(row);
      } else {
        if (this.userInfo.EmName != row.EnterName) {
          this.ValidateOperator();
        } else {
          this.editOrderAmountfun(row);
        }
      }
    },
    editOrderAmountfun(row) {
      if (row.TicketStatus == 1 && row.OrderStatus == 1) {
        this.MsgBus.$emit("editTicketOrderBoxOpen", row.GuestId, row, true);
      } else {
        this.$confirm('该订单已经无法编辑金额', "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }).then(() => {
          
        }).catch(() => {})
        this.emptyMore()
      }
    },
    openDetails(item) {
      let href;
      let url = this.domainManager().erpRoutingUrl;
      let data = [
        {
          path: "FinancialDocumentsDetail",
          id: item.FrID,
        },
      ];
      href =
        url +
        "automaticLogin?token=" +
        this.getLocalStorage().token +
        "&data=" +
        JSON.stringify(data);
      window.open(href);
    },
    // 获取出票状态枚举
    GetTicketStatusEnumList() {
      this.msg.GuestId = row.GuestId;
      this.apipost("/api/Order/GetTicketStatusEnumList", {}, (res) => {
        if (res.data.resultCode == 1) {
          this.ticketingStatusList = res.data.data;
          let data = {
            Name: "全部",
            Id: "0",
          };
          this.ticketingStatusList.unshift(data);
        } else {
          this.$message.error(res.data.message);
        }
      });
    },
  },
};
</script>
<style>
    li {
        list-style-type: none;
    }
    
    .classorder ul {
        padding: 0px;
    }
    
    .classorder .price-popup {
        border-radius: 4px;
    }
    
    .classorder .el-range-editor .el-range-input {
        background: none;
    }
    
    .classorder .el-range-editor.el-input__inner {
        background-color: transparent;
    }
    
    .classorder .q-mb-md {
        margin-bottom: 0;
    }
    
    .classorder .stics {
        padding: 10px 20px;
        background: #dddee0;
        border-radius: 4px;
        font-size: 14px;
        color: #000000;
        font-weight: bold;
    }
    
    .classorder .stics .stics-name {
        color: #2d2d2d;
        font-weight: 600;
        margin-right: 10px;
    }
    
    .classorder .tis {
        margin: 10px 0;
        align-items: center;
    }
    
    .classorder .tis .tis-k {
        width: 10px;
        height: 10px;
        margin-right: 8px;
    }
    
    .classorder .tis span {
        font-size: 14px;
        color: #2d2d2d;
        font-weight: 600;
        margin-right: 20px;
    }
    
    .classorder table {
        padding: 10px 0;
        width: 100%;
        background-color: #ededed;
        border-collapse: collapse;
        border: 1px solid #d2d2d2;
        font-size: 12px;
    }
    
    .enrollTotalSearchTable td {
        background-color: #ffffff;
        padding: 9px 15px;
        color: #333333;
        border: 1px solid rgba(138, 138, 138, 0.09);
        text-align: left;
    }
    
    .classorder table ._color_666 {
        color: #666666;
    }
    
    .classorder table tr._color_666 th {
        padding: 9px 15px;
    }
    
    .classorder table td {
        background-color: #ffffff;
        padding: 9px 15px;
        color: #333333;
    }
    
    .classorder table ._color_666 {
        color: #666666;
    }
    
    .classorder table tr._color_666 th {
        padding: 9px 15px;
    }
    
    .classorder .enrollTotalSearchTable {
        width: 100%;
        font-size: 14px;
        color: #333;
        border-bottom: 1px solid #cccccc;
        border-right: 1px solid #cccccc;
        border-collapse: collapse;
    }
    
    .classorder .enrollTotalSearchTable tr {}
    
    .classorder .enrollTotalSearchTable tr th {
        background: #dddee0;
        height: 30px;
        font-size: 12px;
        text-align: left;
    }
    
    .classorder .enrollTotalSearchTable tr {
        background: #fff;
        text-align: left;
    }
    
    .classorder .enrollTotalSearchTable tbody tr:last-child {
        border-bottom: 2px solid #ddd;
    }
    
    .classorder .enrollTotalSearchTable tr:first-child td:first-child {
        border-bottom: 2px solid #ddd;
    }
    
    .classorder .enrollTotalSearchTable tr td {
        height: 46px;
        padding: 10px;
    }
    
    .classorder .enrollTotalSearchTable tr td>img {
        width: 32px;
        height: 32px;
        border-radius: 16px;
        vertical-align: middle;
        margin-right: 5px;
    }
    
    .classorder .enrollTotalSearchTable tr td p {
        line-height: 20px;
    }
    
    .classorder .remarks {
        font-size: 14px;
        color: #2d2d2d;
    }
    
    .classorder .remarks-b {
        height: 34px;
        background: #f0f5fb;
        margin-top: 10px;
        padding: 15px;
        font-size: 12px;
        color: #999999;
        position: relative;
        overflow: hidden;
        display: -webkit-box;
        line-height: 20px;
        -webkit-line-clamp: 4;
        -webkit-box-orient: vertical;
    }
    
    .classorder .remarks-b-b {
        text-align: right;
        position: absolute;
        right: 0px;
        bottom: 0px;
    }
    
    .classorder .on-left {
        margin-right: 5px;
    }
    
    .classorder .finance {
        padding: 1px 10px;
        align-items: center;
        justify-content: center;
        border-radius: 4px;
        margin: 5px 3px 3px 0;
    }
    
    .classorder .order_OfferId {
        font-size: 18px;
        color: #2961fe;
        margin-bottom: 10px;
        font-weight: bold;
        text-decoration: underline;
        cursor: pointer;
    }
    
    .takeContract {
        cursor: pointer;
        color: rgb(41, 97, 254);
    }
    
    .Contract_Table {
        width: 100%;
        border-collapse: collapse;
    }
    
    .Contract_Table th,
    .Contract_Table td {
        padding: 5px;
        color: #000;
        text-align: center;
    }
    
    .table-body {
        overflow-x: hidden;
        overflow-y: auto;
    }
    
    .classorder .redstyle {
        color: var(--q-color-negative);
    }
    
    .order_OferTitle {
        font-size: 14px;
        color: #333333;
        margin-bottom: 10px;
    }
    
    .tatusText.grey {
        color: grey;
    }
    
    .tatusText.success {
        color: #21BA45;
    }
    
    .tatusText.error {
        color: #F2C037;
    }
    
    .tatusText.cancel {
        color: #FFB300;
    }
    .tatusText.Black {
        color: Black;
    }
    
    .ToBeReceived.red {
        color: #fd397a;
    }
    
    .ToBeReceived.blue {
        color: #409eff;
    }
    
    .documents-text {
        display: flex;
        justify-content: space-between;
    }
    
    .documents-left {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        margin: 2px 0;
    }
    
    .documents-left span {
        margin-right: 10px;
        border-radius: 3px;
        padding: 2px 6px;
        margin-bottom: 3px;
    }
    
    .documents-left span:hover {
        cursor: pointer;
    }
    
    .documents-left span.one {
        background-color: rgba(41, 97, 254, 0.2);
        color: rgb(41, 97, 254);
    }
    
    .documents-left span.two {
        background-color: rgba(242, 140, 29, 0.2);
        color: rgb(242, 140, 29);
    }
    
    .documents-left span.three {
        background-color: rgba(63, 196, 255, 0.2);
        color: rgb(63, 196, 255);
    }
    
    .documents-left.num span {
        background-color: rgba(41, 97, 254, 0);
        color: rgb(41, 97, 254);
        padding: 0;
    }
    
    .documents-right {
        margin-right: 20px;
        position: relative;
    }
    
    .OrderId-text {
        font-size: 19px;
        /* text-decoration:underline; */
        font-weight: bold;
        color: #2961fe;
        margin-bottom: 10px;
        cursor: pointer;
    }
    
    .CreateByName-text {
        margin-bottom: 10px;
    }
    
    .colorblue {
        color: #2961fe;
    }
    
    .enedit-box {
        display: flex;
        align-items: center;
    }
    
    .select-right {
        margin-left: 5px;
    }
    
    .Credentials {
        color: #2961FE;
    }
    
    .TicketVoucher-box {
        display: flex;
    }
    
    .TicketVoucher-box span {
        flex-shrink: 0;
    }
    
    .TicketVoucher-box i {
        margin-left: 5px;
    }
    .agreement-IncomeMoney-box{
        position: relative;
    }
    .agreement-Cancel{
        text-align: right;
        color: #409eff;
    }
    .agreement-Cancel span:first-child{
        color: #999999;
        margin-right: 20px;
    }
    .agreement-Cancel span:hover{
        cursor: pointer;
    }
    .float-flag-shape{
        position: absolute; 
        top:20px;
        border: 1px solid #fff;
        height: 0; 
        width: 0;
        border-top: 6px solid transparent;
        border-left: 10px solid #fff;
        border-bottom: 3px solid transparent;
        right:-11px;
    }
    .el-checkbox-group,.el-radio-group{
        display: flex !important;
        margin-bottom: 10px !important;
    }
    .font-color-link{
        cursor: pointer;
    }
    .OrderType-text{
        font-size: 11px;
        font-weight: 100;
        margin-left: 5px;
        border-radius: 3px;
        display: inline-block;
        padding: 0 1px;
    }
    .line-through{
      text-decoration: line-through;
    }
    .OrderType-text.one{
        color: rgb(41, 97, 254);
        background-color: rgba(41, 97, 254,.2);
    }
    .OrderType-text.two{
        color: rgb(242, 140, 29);
        background-color: rgba(242, 140, 29,.2);
    }
    .OrderType-text.three{
        color: rgb(63, 196, 255);
        background-color: rgba(63, 196, 255,.2);
    }
    .OrderType-text.four{
        color: rgb(255,111,0);
        background-color: rgba(255,111,0,.2);
    }
    .OrderType-text.five{
        color: rgb(197,225,165);
        background-color: rgba(97,225,165,.2);
    }
li {
  list-style-type: none;
}

.classorder ul {
  padding: 0px;
}

.classorder .price-popup {
  border-radius: 4px;
}

.classorder .el-range-editor .el-range-input {
  background: none;
}

.classorder .el-range-editor.el-input__inner {
  background-color: transparent;
}

.classorder .q-mb-md {
  margin-bottom: 0;
}

.classorder .stics {
  padding: 10px 20px;
  background: #dddee0;
  border-radius: 4px;
  font-size: 14px;
  color: #000000;
  font-weight: bold;
}

.classorder .stics .stics-name {
  color: #2d2d2d;
  font-weight: 600;
  margin-right: 10px;
}

.classorder .tis {
  margin: 10px 0;
  align-items: center;
}

.classorder .tis .tis-k {
  width: 10px;
  height: 10px;
  margin-right: 8px;
}

.classorder .tis span {
  font-size: 14px;
  color: #2d2d2d;
  font-weight: 600;
  margin-right: 20px;
}

.classorder table {
  padding: 10px 0;
  width: 100%;
  background-color: #ededed;
  border-collapse: collapse;
  border: 1px solid #d2d2d2;
  font-size: 12px;
}
.enrollTotalSearchTable td {
  background-color: #ffffff;
  padding: 9px 15px;
  color: #333333;
  border: 1px solid rgba(138, 138, 138, 0.09);
  text-align: left;
}

.classorder table ._color_666 {
  color: #666666;
}

.classorder table tr._color_666 th {
  padding: 9px 15px;
}

.classorder table th {
  background-color: #ededed;
  height: 34px;
  text-indent: 0;
  padding: 0 5px;
}

.classorder table td {
  background-color: #ffffff;
  padding: 9px 15px;
  color: #333333;
}

.classorder table ._color_666 {
  color: #666666;
}

.classorder table tr._color_666 th {
  padding: 9px 15px;
}

.classorder .enrollTotalSearchTable {
  width: 100%;
  font-size: 14px;
  color: #333;
  border-bottom: 1px solid #cccccc;
  border-right: 1px solid #cccccc;
  border-collapse: collapse;
}

.classorder .enrollTotalSearchTable tr {
}

.classorder .enrollTotalSearchTable tr th {
  background: #dddee0;
  height: 30px;
  font-size: 12px;
  text-align: left;
}

.classorder .enrollTotalSearchTable tr {
  background: #fff;
  text-align: left;
}

.classorder .enrollTotalSearchTable tbody tr:last-child {
  border-bottom: 2px solid #ddd;
}

.classorder .enrollTotalSearchTable tr:first-child td:first-child {
  border-bottom: 2px solid #ddd;
}

.classorder .enrollTotalSearchTable tr td {
  height: 46px;
  padding: 10px 5px;
}

.classorder .enrollTotalSearchTable tr td > img {
  width: 32px;
  height: 32px;
  border-radius: 16px;
  vertical-align: middle;
  margin-right: 5px;
}

.classorder .enrollTotalSearchTable tr td p {
  line-height: 20px;
}

.classorder .remarks {
  font-size: 14px;
  color: #2d2d2d;
}

.classorder .remarks-b {
  height: 34px;
  background: #f0f5fb;
  margin-top: 10px;
  padding: 15px;
  font-size: 12px;
  color: #999999;
  position: relative;
  overflow: hidden;
  display: -webkit-box;
  line-height: 20px;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

.classorder .remarks-b-b {
  text-align: right;
  position: absolute;
  right: 0px;
  bottom: 0px;
}

.classorder .on-left {
  margin-right: 5px;
}

.classorder .finance {
  padding: 1px 10px;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  margin: 5px 3px 3px 0;
}

.classorder .order_OfferId {
  font-size: 18px;
  color: #2961fe;
  margin-bottom: 10px;
  font-weight: bold;
  text-decoration: underline;
  cursor: pointer;
}

.takeContract {
  cursor: pointer;
  color: rgb(41, 97, 254);
}

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

.Contract_Table th,
.Contract_Table td {
  padding: 5px;
  color: #000;
  text-align: center;
}

.table-body {
  overflow-x: hidden;
  overflow-y: auto;
}

.classorder .redstyle {
  color: var(--q-color-negative);
}

.order_OferTitle {
  font-size: 14px;
  color: #333333;
  margin-bottom: 10px;
}

.tatusText.grey {
  color: grey;
}

.tatusText.success {
  color: #21ba45;
}

.tatusText.error {
  color: #f2c037;
}

.tatusText.Black {
  color: Black;
}

.ToBeReceived.red {
  color: #fd397a;
}

.ToBeReceived.blue {
  color: #409eff;
}

.documents-text {
  display: flex;
  justify-content: space-between;
}

.documents-left {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  margin: 2px 0;
}

.documents-left span {
  margin-right: 10px;
  border-radius: 3px;
  padding: 2px 6px;
}

.documents-left span:hover {
  cursor: pointer;
}

.documents-left span.one {
  background-color: rgba(41, 97, 254, 0.2);
  color: rgb(41, 97, 254);
}

.documents-left span.two {
  background-color: rgba(242, 140, 29, 0.2);
  color: rgb(242, 140, 29);
}

.documents-left span.three {
  background-color: rgba(63, 196, 255, 0.2);
  color: rgb(63, 196, 255);
}

.documents-left.num span {
  background-color: rgba(41, 97, 254, 0);
  color: rgb(41, 97, 254);
  padding: 0;
}

.documents-right {
  margin-right: 20px;
  position: relative;
}

.OrderId-text {
  font-size: 19px;
  /* text-decoration:underline; */
  font-weight: bold;
  color: #2961fe;
  margin-bottom: 10px;
  cursor: pointer;
}
.OrderId-text .text-underline{
    margin-right: 5px;
}
.OrderId-text .text-underline:hover{
    text-decoration: underline;
}

.CreateByName-text {
  margin-bottom: 10px;
}

.colorblue {
  color: #2961fe;
}

.enedit-box {
  display: flex;
  align-items: center;
}

.select-right {
  margin-left: 5px;
}

.Credentials {
  color: #2961fe;
}

.TicketVoucher-box {
  display: flex;
}

.TicketVoucher-box span {
  flex-shrink: 0;
}

.TicketVoucher-box i {
  margin-left: 5px;
}
.agreement-IncomeMoney-box {
  position: relative;
}
.agreement-IncomeMoney-pop {
  position: absolute;
  top: -20px;
  left: -350px;
  z-index: 1;
  background: #fff;
  padding: 10px 19px 10px 19px;
  box-shadow: 5px 5px 10px 5px #ccc;
}
.agreement-Cancel {
  text-align: right;
  color: #409eff;
}
.agreement-Cancel span:first-child {
  color: #999999;
  margin-right: 20px;
}
.agreement-Cancel span:hover {
  cursor: pointer;
}
.float-flag-shape {
  position: absolute;
  top: 20px;
  border: 1px solid #fff;
  height: 0;
  width: 0;
  border-top: 6px solid transparent;
  border-left: 10px solid #fff;
  border-bottom: 3px solid transparent;
  right: -11px;
}
.el-checkbox-group,
.el-radio-group {
  display: flex !important;
  margin-bottom: 10px !important;
}
.font-color-link {
  cursor: pointer;
}
.Order-list-Status{
  width: 70px;
  border-radius: 2px;
  text-align: center
}
.Order-list-Status.one{
  background: rgba(2, 196, 153, 0.2);
  color: #02C499;
}
.Order-list-Status.two{
  background: rgba(0, 0, 0, 0.2);
  color: #333;
}
.Order-list-Status.three{
  color: rgb(63, 196, 255);
  background-color: rgba(63, 196, 255,.2);
}
.Order-list-Status.four{
    color: rgb(255,111,0);
    background-color: rgba(255,111,0,.2);
}
.Order-list-Status.five{
    color: rgb(33,186,69);
    background-color: rgba(33,186,69,.2);
}
.Order-list-Status.six{
    color: rgb(102,187,106);
    background-color: rgba(102,187,106,.2);
}
</style>
