<!--订单列表-->
<template>
  <div class="classorder">
    <table class="enrollTotalSearchTable" border="0" cellspacing="0" cellpadding="0" style="">
      <tr>
        <th width="12%">单号</th>
        <th width="8%">人数</th>
        <th width="8%">单价</th>
        <th width="8%">成交</th>
        <th width="8%">应收总额</th>
        <th width="8%">实收</th>
        <th width="8%">优惠</th>
        <th width="8%">退款</th>
        <th width="8%">待收金额</th>
        <th width="8%">状态</th>
        <th>操作</th>
      </tr>
      <tr>
        <td v-show="dataList && dataList.length==0" :colspan="11" align="center">暂无数据</td>
      </tr>
      <tbody v-for="(item,index) in dataList" :key="index">
        <tr>
          <td :rowspan="3" style="text-align: left">
            <div
              style="font-size: 18px;color: #2961FE;margin-bottom: 20px;font-weight: bold;text-decoration: underline;cursor: pointer"
              @click="goOrderdetails(item,1)">{{item.OrderId}}
            </div>
            <div>{{item.EnterName}}</div>
            <div style="margin-top: 10px">{{item.CreateTime}}</div>
            <template v-if="isShowClass">
              <div style="margin-top: 30px;margin-bottom: 10px">班级</div>
              <div style="font-weight: bold;color:#2961FE;cursor:pointer;" @click="getClassInfo(item)">
                {{item.ClassName}}</div>
            </template>
            <template v-if="item.IsCommissionGive==1">
              <div style="margin-top:30px;">提成：{{item.CommissionMoney}}</div>
            </template>
            <template>
              <div style="margin-top:30px;color:red;" v-if="item.ExtraRewardMoney>0">额外奖励：{{item.ExtraRewardMoney}}
              </div>
              <div style="color:red" v-if="item.ExtraDeductMoney>0">额外扣除：{{item.ExtraDeductMoney}}</div>
            </template>
          </td>
          <td style="border:none">{{item.GuestNum}}人</td>
          <td style="border:none">{{item.Class_Price.toFixed(2)}}</td>
          <td :style="{color:item.Class_Price!=item.Unit_Price?'var(--q-color-negative)':'','border':'none'}">
            {{item.Unit_Price.toFixed(2)}}
          </td>
          <td style="border:none">{{item.PreferPrice.toFixed(2)}}</td>
          <td style="border:none">{{item.Income.toFixed(2)}}</td>
          <td style="color:var(--q-color-negative);border:none">{{item.DiscountMoney.toFixed(2)}}</td>
          <td style="border:none">{{item.Refund.toFixed(2)}}</td>
          <td style="color:#2961FE;border:none">{{item.DueInMoney.toFixed(2)}}</td>
          <td style="border:none">
            <div style="background: rgba(2, 196, 153, 0.2);width: 80px;border-radius: 2px;text-align: center">
              <span style="color: #02C499">{{item.OrderStateName}}</span>
            </div>
          </td>
          <td style="border:none">
            <q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" label="编辑"
              @click="editOrder(item)" />
            <q-btn-dropdown flat size="xs" color="dark" label="更多" style="margin-left:10px;">
              <q-list>
                <q-item clickable v-close-popup>
                  <q-item-section @click="gostudent(item)">
                    <q-item-label>学生名单</q-item-label>
                  </q-item-section>
                </q-item>
                <q-item clickable v-close-popup v-if="isShowClass">
                  <q-item-section @click="transferOrder(item,1)">
                    <q-item-label>转交订单</q-item-label>
                  </q-item-section>
                </q-item>
                <q-item clickable v-close-popup v-if="!isShowClass">
                  <q-item-section @click="transferOrder(item,2)">
                    <q-item-label>修改销售</q-item-label>
                  </q-item-section>
                </q-item>
                <q-item clickable v-close-popup v-if="isShowClass">
                  <q-item-section @click="editOrderRemark(item,1)">
                    <q-item-label>销售备注</q-item-label>
                  </q-item-section>
                </q-item>
                <q-item clickable v-close-popup v-if="!isShowClass">
                  <q-item-section @click="editOrderRemark(item,2)">
                    <q-item-label>教务备注</q-item-label>
                  </q-item-section>
                </q-item>
                <q-item clickable v-close-popup v-if="!isShowClass">
                  <q-item-section @click="editOrderRemark(item,3)">
                    <q-item-label>校长备注</q-item-label>
                  </q-item-section>
                </q-item>
                <q-item clickable v-close-popup v-if="!isShowClass">
                  <q-item-section @click="editOrderRemark(item,4)">
                    <q-item-label>总经理备注</q-item-label>
                  </q-item-section>
                </q-item>

                <q-item clickable v-close-popup v-if="!isShowClass&&item.IsCommissionGive==1">
                  <q-item-section @click="upDateMoney(item,1)">
                    <q-item-label>修改提成</q-item-label>
                  </q-item-section>
                </q-item>
                <q-item clickable v-close-popup v-if="!isShowClass">
                  <q-item-section @click="upDateMoney(item,2)">
                    <q-item-label>额外奖励</q-item-label>
                  </q-item-section>
                </q-item>

                <q-item clickable v-close-popup>
                  <q-item-section @click="CancelOrder(item)">
                    <q-item-label>取消订单</q-item-label>
                  </q-item-section>
                </q-item>
                <q-item clickable v-close-popup v-close-popup v-if="isShowClass">
                  <q-item-section>
                    <q-item-label @click="showBackClassForm(item)">退课</q-item-label>
                  </q-item-section>
                </q-item>
                <q-item clickable v-close-popup v-close-popup v-if="isShowClass">
                  <q-item-section>
                    <q-item-label @click="showContinueClass(item)">续课</q-item-label>
                  </q-item-section>
                </q-item>
              </q-list>
            </q-btn-dropdown>
          </td>
        </tr>
        <tr>
          <td :colspan="11" style="text-align: left">
            <div class="row" v-if="item.GuestList.length>0">
              学生名单：
              <span v-for="(x,j) in item.GuestList" :index="j" v-if="x.GuestState==1"
                style="color:#2961FE;margin-right: 5px">{{x.GuestName}} </span>
            </div>
            <div class="row" v-if=" item.GuestList.length>0&&getTkshow(item.GuestList)">
              退课名单：
              <span v-for="(x,j) in item.GuestList" :index="j" v-if="x.GuestState==2"
                style="color:var(--q-color-negative);margin-right: 5px">{{x.GuestName}} </span>
            </div>
            <span v-if="item.GuestList.length==0">暂无</span>
          </td>
        </tr>
        <tr>
          <td :colspan="11" style="height: 168px;text-align: left">
            <div class="col row remarks q-gutter-x-md">
              <div class="col">
                <div>销售备注：</div>
                <div class="remarks-b">
                  <div v-if="item.SaleRemark!=null||item.SaleRemark!=''">
                    <div>{{item.SaleRemark}}</div>
                    <div class="remarks-b-b">
                      <span class="iconfont icon-xiangxia" style="color: #2961FE;font-size: 10px"
                        v-if="item.SaleRemarkList&&item.SaleRemarkList.length>0"></span>
                      <q-popup-proxy>
                        <q-banner>
                          <div style="width: 500px;">
                            <div>销售备注</div>
                            <div v-for="(xq,jq) in item.SaleRemarkList" :index="jq"
                              style=" margin-top: 10px;background: #e6e6e6;padding: 5px;font-size: 12px">
                              <div>{{xq.Content}}</div>
                              <div style="text-align: right">{{xq.CreateBy}} {{xq.CreateTime}}</div>
                            </div>
                          </div>
                        </q-banner>
                      </q-popup-proxy>
                    </div>
                  </div>
                  <span v-if="item.SaleRemark==null||item.SaleRemark==''">暂无</span>
                </div>
              </div>
              <div class="col">
                <div>教务备注：</div>
                <div class="remarks-b ">
                  <div v-if="item.TeacherRemark!=null||item.TeacherRemark!=''">
                    <div>{{item.TeacherRemark}}</div>
                    <div class="remarks-b-b">
                      <span class="iconfont icon-xiangxia" style="color: #2961FE;font-size: 10px"
                        v-if="item.TeacherRemarkList&&item.TeacherRemarkList.length>0"></span>
                      <q-popup-proxy>
                        <q-banner>
                          <div style="width: 500px;">
                            <div>教务备注</div>
                            <div v-for="(xq,jq) in item.TeacherRemarkList" :index="jq"
                              style=" margin-top: 10px;background: #e6e6e6;padding: 5px;font-size: 12px">
                              <div>{{xq.Content}}</div>
                              <div style="text-align: right">{{xq.CreateBy}} {{xq.CreateTime}}</div>
                            </div>
                          </div>
                        </q-banner>
                      </q-popup-proxy>
                    </div>
                  </div>
                  <span v-if="item.TeacherRemark==null||item.TeacherRemark==''">暂无</span>
                </div>
              </div>
              <div class="col">
                <div>校长备注：</div>
                <div class="remarks-b ">
                  <div v-if="item.RectorRemark!=null ||item.RectorRemark!=''">
                    <div>{{item.RectorRemark}}</div>
                    <div class="remarks-b-b">
                      <span class="iconfont icon-xiangxia" style="color: #2961FE;font-size: 10px"
                        v-if="item.RectorRemarkList&&item.RectorRemarkList.length>0"></span>
                      <q-popup-proxy>
                        <q-banner>
                          <div style="width: 500px;">
                            <div>校长备注</div>
                            <div v-for="(xq,jq) in item.RectorRemarkList" :index="jq"
                              style=" margin-top: 10px;background: #e6e6e6;padding: 5px;font-size: 12px">
                              <div>{{xq.Content}}</div>
                              <div style="text-align: right">{{xq.CreateBy}} {{xq.CreateTime}}</div>
                            </div>
                          </div>
                        </q-banner>
                      </q-popup-proxy>
                    </div>
                  </div>
                  <span v-if="item.RectorRemark==null||item.RectorRemark==''">暂无</span>
                </div>
              </div>
              <div class="col">
                <div>总经理备注：</div>
                <div class="remarks-b ">
                  <div v-if="item.DirectorRemark!=null||item.DirectorRemark!=''">
                    <div>{{item.DirectorRemark}}</div>
                    <div class="remarks-b-b">
                      <span class="iconfont icon-xiangxia" style="color: #2961FE;font-size: 10px"
                        v-if="item.DirectorRemarkList&&item.DirectorRemarkList.length>0"></span>
                      <q-popup-proxy>
                        <q-banner>
                          <div style="width: 500px;">
                            <div>总经理备注</div>
                            <div v-for="(xq,jq) in item.DirectorRemarkList" :index="jq"
                              style=" margin-top: 10px;background: #e6e6e6;padding: 5px;font-size: 12px">
                              <div>{{xq.Content}}</div>
                              <div style="text-align: right">{{xq.CreateBy}} {{xq.CreateTime}}</div>
                            </div>
                          </div>
                        </q-banner>
                      </q-popup-proxy>
                    </div>
                  </div>
                  <span v-if="item.DirectorRemark==null||item.DirectorRemark==''">暂无</span>
                </div>
              </div>
              <div class="col">
                <div class="row" style="justify-content: space-between">
                  <span>收款单据：</span>
                  <q-btn flat size="xs" icon="edit" v-if="isShowClass" style="font-weight:400;color: #02C499" label="修改"
                    @click="chanceType(item,1)" />
                </div>
                <div class="row wrap">
                  <div class="finance row" v-for="(x,j) in item.FinanceList" :index="j"
                    :style="{
                      background:x.ColorState==1 ? 'rgba(41, 97, 254, 0.2)':(x.ColorState==2 ? 'rgba(2, 196, 153, 0.2)':(x.ColorState==3 ? 'rgba(242, 140, 29, 0.2)':'rgba(63, 196, 255, 0.2)')),
                      color: x.ColorState==1 ? '#2961FE':(x.ColorState==2 ? '#02C499':(x.ColorState==3 ? '#F28C1D':'#3FC4FF'))}">
                    <span style="cursor: pointer" @click="goOrderdetails(item,4)">{{x.FrID}}</span>
                  </div>
                </div>
                <div class="row" style="justify-content: space-between">
                  <span>付款单据：</span>
                  <q-btn flat size="xs" icon="edit" v-if="isShowClass" style="font-weight:400;color: #02C499" label="修改"
                    @click="chanceType(item,2)" />
                </div>
                <div class="row wrap">
                  <div class="finance row" v-for="(x,j) in item.RefundFinanceList" :index="j"
                    :style="{
                      background:x.ColorState==1 ? 'rgba(41, 97, 254, 0.2)':(x.ColorState==2 ? 'rgba(2, 196, 153, 0.2)':(x.ColorState==3 ? 'rgba(242, 140, 29, 0.2)':'rgba(63, 196, 255, 0.2)')),
                      color: x.ColorState==1 ? '#2961FE':(x.ColorState==2 ? '#02C499':(x.ColorState==3 ? '#F28C1D':'#3FC4FF'))}">
                    <span style="cursor: pointer" @click="goOrderdetails(item,4)">{{x.FrID}}</span>
                  </div>
                </div>
              </div>
            </div>
          </td>
        </tr>
      </tbody>
      <tbody v-if="cancelList&&cancelList.length>0">
        <tr>
          <td :colspan="11">
            <span style="color:red;cursor:pointer;font-weight:bold;" @click='isShowCancel=!isShowCancel'>取消订单</span>
          </td>
        </tr>
      </tbody>
      <tbody v-if="cancelList&&cancelList.length>0 && isShowCancel" v-for="(item,index) in cancelList"
        :key="index+10000">
        <tr>
          <td :rowspan="3" style="text-align: left">
            <div style="font-size: 18px;color: #2961FE;margin-bottom: 20px;font-weight: bold"
              @click="goOrderdetails(item)">{{item.OrderId}}</div>
            <div>{{item.EnterName}}</div>
            <div style="margin-top: 10px">{{item.CreateTime}}</div>
            <template v-if="isShowClass">
              <div style="margin-top: 30px;margin-bottom: 10px">班级</div>
              <div style="font-weight: bold;color:#2961FE;" @click="getClassInfo(item)">{{item.ClassName}}</div>
            </template>
          </td>
          <td style="border:none">{{item.GuestNum}}人</td>
          <td style="border:none">{{item.Class_Price.toFixed(2)}}</td>
          <td :style="{color:item.Class_Price!=item.Unit_Price?'var(--q-color-negative)':'','border':'none'}">
            {{item.Unit_Price.toFixed(2)}}
          </td>
          <td style="border:none">{{item.PreferPrice.toFixed(2)}}</td>
          <td style="border:none">{{item.Income.toFixed(2)}}</td>
          <td style="color:var(--q-color-negative);border:none">{{item.DiscountMoney.toFixed(2)}}</td>
          <td style="border:none">{{item.Refund.toFixed(2)}}</td>
          <td style="color:#2961FE;border:none">{{item.DueInMoney.toFixed(2)}}</td>
          <td style="border:none">
            <div style="background: rgba(2, 196, 153, 0.2);width: 80px;border-radius: 2px;text-align: center">
              <span style="color: #02C499">{{item.OrderStateName}}</span>
            </div>
          </td>
          <td style="border:none;">
            <q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400;display:none;" label="编辑"
              @click="editOrder(item)" />
            <q-btn-dropdown flat size="xs" color="dark" label="更多" style="margin-left:10px;display:none;">
              <q-list>
                <q-item clickable v-close-popup>
                  <q-item-section @click="gostudent(item)">
                    <q-item-label>学生名单</q-item-label>
                  </q-item-section>
                </q-item>
              </q-list>
            </q-btn-dropdown>
          </td>
        </tr>
        <tr>
          <td :colspan="11" style="text-align: left">
            <div class="row" v-if="item.GuestList.length>0">
              学生名单：
              <span v-for="(x,j) in item.GuestList" :index="j" v-if="x.GuestState==1"
                style="color:#2961FE;margin-right: 5px">{{x.GuestName}} </span>
            </div>
            <div class="row" v-if=" item.GuestList.length>0&&getTkshow(item.GuestList)">
              退课名单：
              <span v-for="(x,j) in item.GuestList" :index="j" v-if="x.GuestState==2"
                style="color:var(--q-color-negative);margin-right: 5px">{{x.GuestName}} </span>
            </div>
            <span v-if="item.GuestList.length==0">暂无</span>
          </td>
        </tr>
        <tr>
          <td :colspan="11" style="height: 168px;text-align: left">
            <div class="col row remarks q-gutter-x-md">
              <div class="col">
                <div>销售备注：</div>
                <div class="remarks-b">
                  <div v-if="item.SaleRemark!=null||item.SaleRemark!=''">
                    <div>{{item.SaleRemark}}</div>
                    <div class="remarks-b-b">
                      <span class="iconfont icon-xiangxia" style="color: #2961FE;font-size: 10px"
                        v-if="item.SaleRemarkList&&item.SaleRemarkList.length>0"></span>
                      <q-popup-proxy>
                        <q-banner>
                          <div style="width: 500px;">
                            <div>销售备注</div>
                            <div v-for="(xq,jq) in item.SaleRemarkList" :index="jq"
                              style=" margin-top: 10px;background: #e6e6e6;padding: 5px;font-size: 12px">
                              <div>{{xq.Content}}</div>
                              <div style="text-align: right">{{xq.CreateBy}} {{xq.CreateTime}}</div>
                            </div>
                          </div>
                        </q-banner>
                      </q-popup-proxy>
                    </div>
                  </div>
                  <span v-if="item.SaleRemark==null||item.SaleRemark==''">暂无</span>
                </div>
              </div>
              <div class="col">
                <div>教务备注：</div>
                <div class="remarks-b ">
                  <div v-if="item.TeacherRemark!=null||item.TeacherRemark!=''">
                    <div>{{item.TeacherRemark}}</div>
                    <div class="remarks-b-b">
                      <span class="iconfont icon-xiangxia" style="color: #2961FE;font-size: 10px"
                        v-if="item.TeacherRemarkList&&item.TeacherRemarkList.length>0"></span>
                      <q-popup-proxy>
                        <q-banner>
                          <div style="width: 500px;">
                            <div>教务备注</div>
                            <div v-for="(xq,jq) in item.TeacherRemarkList" :index="jq"
                              style=" margin-top: 10px;background: #e6e6e6;padding: 5px;font-size: 12px">
                              <div>{{xq.Content}}</div>
                              <div style="text-align: right">{{xq.CreateBy}} {{xq.CreateTime}}</div>
                            </div>
                          </div>
                        </q-banner>
                      </q-popup-proxy>
                    </div>
                  </div>
                  <span v-if="item.TeacherRemark==null||item.TeacherRemark==''">暂无</span>
                </div>
              </div>
              <div class="col">
                <div>校长备注：</div>
                <div class="remarks-b ">
                  <div v-if="item.RectorRemark!=null ||item.RectorRemark!=''">
                    <div>{{item.RectorRemark}}</div>
                    <div class="remarks-b-b">
                      <span class="iconfont icon-xiangxia" style="color: #2961FE;font-size: 10px"
                        v-if="item.RectorRemarkList&&item.RectorRemarkList.length>0"></span>
                      <q-popup-proxy>
                        <q-banner>
                          <div style="width: 500px;">
                            <div>校长备注</div>
                            <div v-for="(xq,jq) in item.RectorRemarkList" :index="jq"
                              style=" margin-top: 10px;background: #e6e6e6;padding: 5px;font-size: 12px">
                              <div>{{xq.Content}}</div>
                              <div style="text-align: right">{{xq.CreateBy}} {{xq.CreateTime}}</div>
                            </div>
                          </div>
                        </q-banner>
                      </q-popup-proxy>
                    </div>
                  </div>
                  <span v-if="item.RectorRemark==null||item.RectorRemark==''">暂无</span>
                </div>
              </div>
              <div class="col">
                <div>总经理备注：</div>
                <div class="remarks-b ">
                  <div v-if="item.DirectorRemark!=null||item.DirectorRemark!=''">
                    <div>{{item.DirectorRemark}}</div>
                    <div class="remarks-b-b">
                      <span class="iconfont icon-xiangxia" style="color: #2961FE;font-size: 10px"
                        v-if="item.DirectorRemarkList&&item.DirectorRemarkList.length>0"></span>
                      <q-popup-proxy>
                        <q-banner>
                          <div style="width: 500px;">
                            <div>总经理备注</div>
                            <div v-for="(xq,jq) in item.DirectorRemarkList" :index="jq"
                              style=" margin-top: 10px;background: #e6e6e6;padding: 5px;font-size: 12px">
                              <div>{{xq.Content}}</div>
                              <div style="text-align: right">{{xq.CreateBy}} {{xq.CreateTime}}</div>
                            </div>
                          </div>
                        </q-banner>
                      </q-popup-proxy>
                    </div>
                  </div>
                  <span v-if="item.DirectorRemark==null||item.DirectorRemark==''">暂无</span>
                </div>
              </div>
              <div class="col">
                <div class="row" style="justify-content: space-between">
                  <span>收款单据：</span>
                  <q-btn flat size="xs" icon="edit" v-if="isShowClass" style="font-weight:400;color: #02C499" label="修改"
                    @click="chanceType(item,1)" />
                </div>
                <div class="row wrap">
                  <div class="finance row" v-for="(x,j) in item.FinanceList" :index="j"
                    :style="{
                      background:x.ColorState==1 ? 'rgba(41, 97, 254, 0.2)':(x.ColorState==2 ? 'rgba(2, 196, 153, 0.2)':(x.ColorState==3 ? 'rgba(242, 140, 29, 0.2)':'rgba(63, 196, 255, 0.2)')),
                      color: x.ColorState==1 ? '#2961FE':(x.ColorState==2 ? '#02C499':(x.ColorState==3 ? '#F28C1D':'#3FC4FF'))}">
                    <span style="cursor: pointer" @click="goOrderdetails(item,4)">{{x.FrID}}</span>
                  </div>
                </div>
                <div class="row" style="justify-content: space-between">
                  <span>付款单据：</span>
                  <q-btn flat size="xs" icon="edit" v-if="isShowClass" style="font-weight:400;color: #02C499" label="修改"
                    @click="chanceType(item,2)" />
                </div>
                <div class="row wrap">
                  <div class="finance row" v-for="(x,j) in item.RefundFinanceList" :index="j"
                    :style="{
                      background:x.ColorState==1 ? 'rgba(41, 97, 254, 0.2)':(x.ColorState==2 ? 'rgba(2, 196, 153, 0.2)':(x.ColorState==3 ? 'rgba(242, 140, 29, 0.2)':'rgba(63, 196, 255, 0.2)')),
                      color: x.ColorState==1 ? '#2961FE':(x.ColorState==2 ? '#02C499':(x.ColorState==3 ? '#F28C1D':'#3FC4FF'))}">
                    <span style="cursor: pointer" @click="goOrderdetails(item,4)">{{x.FrID}}</span>
                  </div>
                </div>
              </div>
            </div>
          </td>
        </tr>
      </tbody>
      <!--取消订单-->
    </table>
    <!--修改订单-->
    <editorder-form v-if="isShowEditOrderForm" :save-obj="orderObj" @close="closeOrderSaveForm"
      @success="refreshClassOrder"></editorder-form>

    <!--修改订单备注-->
    <orderremark-form v-if="isShowRemarkOrderForm" :save-obj="orderObj" :remarkType="remarkType"
      @close="closeRemarkForm" @success="refreshClassOrder"></orderremark-form>

    <!--转交订单-->
    <transOrder-form v-if="isShowTransOrderForm" :save-obj="orderObj" :employeeList="EmployeeList"
      @close="closeTransOrderForm" @success="refreshClassOrder"></transOrder-form>
    <myOrder-form v-if="isShowmyorderForm" :save-obj="myorderObjOption" @close="closeMOSaveForm"></myOrder-form>
    <!--班级详情-->
    <classinfo-form v-if="isShowClassInfo" :seting-obj="classObjOption" @close="closeClass" @success="refreshClass">
    </classinfo-form>

    <!--退课申请-->
    <backclass-form v-if="isShowBackClassForm" :save-obj="orderObj" @close="closeBackClassForm"
      @success="refreshClassOrder"></backclass-form>
    <!-- 修改提成和额外奖励 -->
    <money-form v-if="isShowMoney" :data="moneyObj" :type="CommonType" @close="closeMoneyForm" @success="refreshMoney">
    </money-form>

    <!--续课申请-->
    <continueclass-form v-if="isShowContinueClass" :save-obj="orderObj" @close="closeContinueClassForm"
      @success="refreshClassOrder"></continueclass-form>
  </div>
</template>

<script>
  import editorderForm from '../sale/editorder-form' //修改订单
  import orderremarkForm from '../sale/orderremark-form' //订单备注
  import transOrderForm from '../sale/transOrder-form' //转交订单
  import backclassForm from '../sale/backclass-form' //退课申请
  import moneyForm from '../sale/money-form' //修改提成和额外奖励
  import myOrderForm from '../../components/sale/myOrder-form'
  import classinfoForm from '../../components/course/classinfo-form';
  import continueclassForm from '../sale/continueclass-form' //续课申请
  import {
    cancelClassOrder, //取消订单
  } from '../../api/sale/sale'

  import {
    queryEmployee //员工列表
  } from '../../api/users/user'
  export default {
    components: {
      editorderForm,
      orderremarkForm,
      transOrderForm,
      myOrderForm,
      classinfoForm,
      backclassForm,
      moneyForm,
      continueclassForm
    },
    props: {
      //正常订单
      dataList: {
        type: Array,
        default: null
      },
      //取消订单
      cancelList: {
        type: Array,
        default: null
      },
      isShowClass: {
        type: Boolean
      },
      Comtype: {
        type: Number
      }
    },
    data() {
      return {
        isShowEditOrderForm: false, //是否显示订单修改
        isShowRemarkOrderForm: false, //是否线下修改订单备注
        isShowTransOrderForm: false, //是否显示转交订单
        isShowBackClassForm: false, //是否显示退课申请
        isShowContinueClass: false, //是否显示续课申请
        orderObj: {}, //订单信息
        isShowCancel: false, //是否显示取消订单
        remarkType: 0, //备注类型
        isShowmyorderForm: false, //显示详情
        myorderObjOption: {}, //详情的数据
        classObjOption: null,
        isShowClassInfo: false, //是否显示课程信息
        isShowMoney: false, //是否显示修改提成和额外奖励
        moneyObj: {},
        CommonType: -1, //用于判断是修改提成还是额外奖励
        EmployeeList: [], //员工列表
      }
    },
    created() {
      this.Employee()
    },
    mounted() {},
    methods: {
      getTkshow(data) {
        let Tkshow = false;
        if (data.length > 0) {
          data.forEach(x => {
            if (x.GuestState == 2) {
              Tkshow = true
            }
          });
        }
        return Tkshow
      },
      //显示续课申请
      showContinueClass(item) {
        this.orderObj = item;
        this.isShowContinueClass = true;
      },
      //关闭续课申请
      closeContinueClassForm() {
        this.orderObj = {};
        this.isShowContinueClass = false;
      },
      //显示退课申请
      showBackClassForm(item) {
        this.orderObj = item;
        this.isShowBackClassForm = true;
      },
      //关闭退课申请
      closeBackClassForm() {
        this.orderObj = {};
        this.isShowBackClassForm = false;
      },
      Employee() {
        var qMsg = {
          EmployeeName: ''
        }
        queryEmployee(qMsg).then(res => {
          if (res.Code == 1) {
            this.EmployeeList = res.Data;
          }
        }).catch(() => {

        })
      },
      //获取财务单据
      getOrderFinanceList(msg, type) {
        this.apipost('sellorder_post_GetOrderFinanceListForEdu', {
          OrderIds: msg
        }, res => {
          if (res.data.resultCode === 1) {
            let data = res.data.data;
            if (type == 1) {
              if (this.dataList) {
                this.dataList.forEach(x => {
                  data.forEach(j => {
                    if (x.OrderId == j.OrderId) {
                      x.FinanceList = j.FinanceList
                      x.RefundFinanceList = j.RefundFinanceList
                    }
                  })
                })
              }
            } else if (type == 2) {
              if (this.cancelList.length > 0) {
                this.cancelList.forEach(x => {
                  data.forEach(j => {
                    if (x.OrderId == j.OrderId) {
                      x.FinanceList = j.FinanceList
                      x.RefundFinanceList = j.RefundFinanceList
                    }
                  })
                })
              }
            }
            this.$forceUpdate()
          } else {
            this.$message.error(res.data.message);
          }
        }, err => {})
      },
      goOrderdetails(item, tab) {
        item.tab = tab
        this.myorderObjOption = item;
        this.isShowmyorderForm = true;
      },
      closeMOSaveForm() {
        this.isShowmyorderForm = false;
      },
      //订单转交
      transferOrder(item, type) {
        item.type = type
        this.orderObj = item;
        this.isShowTransOrderForm = true;
      },
      //关闭转订单弹窗
      closeTransOrderForm() {
        this.isShowTransOrderForm = false;
      },
      //跳转到学生名单
      gostudent(item) {
        var tempStr = '/sale/studentList?OrderId=' + item.OrderId + '&ClassId=' + item.ClassId;
        this.$router.push({
          path: tempStr,
          query: {
            isShow: this.Comtype
          }
        });
      },
      //修改订单备注
      editOrderRemark(item, Type) {
        this.orderObj = item;
        this.remarkType = Type;
        this.isShowRemarkOrderForm = true;
      },
      //关闭备注
      closeRemarkForm() {
        this.isShowRemarkOrderForm = false;
      },
      //关闭订单修改
      closeOrderSaveForm() {
        this.isShowEditOrderForm = false;
      },
      //显示修改订单
      editOrder(item) {
        this.orderObj = item;
        this.isShowEditOrderForm = true;
      },
      //刷新页面
      refreshClassOrder() {
        this.isShowEditOrderForm = false;
        //调用父页面成功方法
        this.$emit('success');
      },
      //关闭修改提成和额外奖励
      closeMoneyForm() {
        this.moneyObj = {};
        this.isShowMoney = false;
      },
      //修改提成和额外奖励后刷新
      refreshMoney() {
        this.isShowMoney = false;
        this.$emit('success');
      },
      //取消订单
      CancelOrder(item) {
        let that = this
        this.$q.dialog({
          title: '提示信息',
          message: '<span style="color: var(--q-color-negative)">是否取消此订单</span>',
          cancel: true,
          persistent: true,
          html: true,
          ok: "确定",
          cancel: "取消",
        }).onOk(() => {
          cancelClassOrder({
            OrderId: item.OrderId
          }).then(res => {
            if (res.Code == 1) {
              that.$q.notify({
                icon: 'iconfont icon-chenggong',
                color: 'accent',
                timeout: 2000,
                message: '操作成功',
                position: 'top'
              })
              //调用父页面成功方法
              this.$emit('success');
            }
          })
        }).onCancel(() => {

        });
      },
      chanceType(obj, type) {
        let TCIDARR = []
        TCIDARR.push(obj.ClassId)
        let orderObj = {
          OrderID: obj.OrderId,
          OrderSource: 17,
          Obj: {},
          SourceID: 0,
          TCIDList: TCIDARR
        }
        this.$router.push({
          path: '/financial/financalDocument/ChoiceAddFinancialDocuments',
          query: {
            "Type": type,
            "companyID": obj.ClassSchoolId,
            "path": "",
            'blank': 'y',
            'orderObj': JSON.stringify(orderObj),
            'tradeWay': obj.tradeWay,
          }
        });
      },
      getClassInfo(obj) { //打开班级详情组件
        this.classObjOption = obj;
        this.classObjOption.School_Id = this.classObjOption.ClassSchoolId
        this.isShowClassInfo = true;
      },
      //关闭班级信息弹窗
      closeClass() {
        this.isShowClassInfo = false
      },
      //刷新
      refreshClass() {

      },
      //修改提成-奖励
      upDateMoney(item, type) {
        this.moneyObj = item;
        this.CommonType = type;
        this.isShowMoney = true;
      }
    }
  }

</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;
  }

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

  .classorder table td {
    background-color: #ffffff;
    padding: 9px 15px;
    color: #333333;
    border: 1px solid rgba(138, 138, 138, 0.09);
    text-align: center;

  }

  .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: 15px;
  }

  .classorder table td {
    background-color: #ffffff;
    padding: 9px 15px;
    color: #333333;
    /*border: 1px solid #d2d2d2;*/
  }

  .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 {
    /* border-bottom: 2px solid #333; */
  }

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

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

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

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

  .classorder .enrollTotalSearchTable tr td {
    height: 66px;
    padding: 10px;
    /*border-top: 1px solid #cccccc;*/
    /*border-left: 1px solid #cccccc;*/
  }

  .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 {
    width: 100%;
    height: 94px;
    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;
  }

</style>
