<template>
  <div class="pointOrderList">
    <div class="head-title">
      订单列表
      <el-button @click="ExportFile" style="float:right;margin-top: -5px;margin-right:20px" size="small" type="primary">
        导出</el-button>
    </div>
    <div class="content">
      <div>
        <span>下单时间：</span>
        <el-date-picker v-model="dateList" @change="msg.pageIndex=1,getList()" size="small" type="datetimerange"
          range-separator="至" value-format="yyyy-MM-dd HH:mm:ss" start-placeholder="开始日期" end-placeholder="结束日期">
        </el-date-picker>
        <span style="margin-left:15px">用户：</span>
        <el-select class="w120" @change="msg.pageIndex=1,getList()" v-model="msg.UserId" size="small"
          :filter-method="ChangeListName" filterable placeholder="请选择">
          <el-option label="不限" :value="0"></el-option>
          <el-option v-for="item in userList" :key="item.Id" :label="item.Name" :value="item.Id">
          </el-option>
        </el-select>
        <span style="margin-left:15px">教师：</span>
        <el-select class="w120" @change="msg.pageIndex=1,getList()" filterable v-model="msg.TeacherId" size="small"
          placeholder="请选择">
          <el-option label="全部老师" :value="0"></el-option>
          <el-option v-for="item in teacherList" :key="item.ID" :label="item.Name" :value="item.ID">
          </el-option>
        </el-select>
        <span style="margin-left:15px">订单号：</span>
        <el-input @clear="msg.pageIndex=1,getList(),msg.ID=0" @keyup.enter.native="msg.pageIndex=1,getList()" clearable
          style="margin-top:10px;width:200px" class="input-with-select" placeholder="请输入订单号" v-model="msg.ID"
          size="small">
        </el-input>

      </div>

      <div>
        <el-tabs style="margin-top:20px" v-model="msg.OrderStaus" @tab-click="handleClick">
          <el-tab-pane label="全部" name="0"></el-tab-pane>
          <el-tab-pane v-for="(item,index) in orderStatusList" :key="index" :label="item.Name" :name="item.Id.toString()">
          </el-tab-pane>
        </el-tabs>
        <div class="app-order-title">
          <div style="width: 55%;">订单信息</div>
          <div style="width: 39%;">实付点数</div>
          <div style="width: 6%;">操作</div>
        </div>
        <div v-loading="loading" class="point-order-list">
          <el-card v-for="(item,index) in tableData" :key="index" class="app-order-item" shadow="never">
            <div slot="header" class="clearfix">
              <div flex="cross:center" class="app-order-head">
                <div class="app-order-time">{{item.CreateDate}}</div>
                <div class="app-order-user">
                  <span class="app-order-time" style="margin-right: 5px">订单号：</span>{{item.ID}}

                </div>
                <div flex="cross:center" class="app-order-user">

                  <span>{{item.UserName}}({{item.UserId}})</span>
                </div>
                <div v-if="item.BuyerMessage && item.BuyerMessage!=''" flex="cross:center" class="remark-box">
                  <el-tooltip class="item" effect="dark" :content="item.BuyerMessage" placement="top">
                    <img src="../../assets/img/userman/remark.png" alt="">
                  </el-tooltip>

                </div>
                <div flex="dir:left wrap:wrap" class="app-order-offline">
                  <el-tag v-if="item.OrderStaus==1" size="small" type="danger">{{item.OrderStatusName}}</el-tag>
                  <el-tag v-if="item.OrderStaus==2" size="small">{{item.OrderStatusName}}</el-tag>
                  <el-tag v-if="item.OrderStaus==3" size="small">{{item.OrderStatusName}}</el-tag>
                  <el-tag v-if="item.OrderStaus==4" size="small" type="success">{{item.OrderStatusName}}</el-tag>
                </div>
              </div>
            </div>
            <div class="app-order-body">
              <div class="goods-item" style="width: 74%;">
                <div class="goods">
                  <div>
                    <div flex="dir:left">
                      <div class="goods-info" style="width:45%;padding-right:20px;min-width:200px;">
                        <div class="goods-name">
                          <div class="app-ellipsis">
                            <div class="vue-line-clamp" style="font-size:14px;margin-bottom:5px;
                            word-break: break-all; -webkit-line-clamp: 2;font-size:14px;font-weight:bold;">
                              {{item.CourseName}}
                            </div>
                          </div>
                        </div>
                        <div style="margin-top: 10px;align-items: center;display: flex;flex-direction: row">
                          <img :src="item.TeacherLogo" alt="" style="width: 30px;height: 30px;border-radius: 50%">
                          <span style="margin:0 10px">{{item.TeacherName}}</span>
                          <el-tag size="small" v-if="item.CourseClassTypeName">{{item.CourseClassTypeName}}</el-tag>
                        </div>
                      </div>
                      <div flex="dir:left box:mean" style="width: 200px;">
                        <div flex="cross:center main:center"
                          style="display: flex;flex-direction: column;align-items: flex-start;width: 55%;min-width:200px;line-height:28px;">
                          <span>学习时间：{{item.StudyDate}}</span>
                          <span>学习时长：{{item.StudyDuration}}{{item.DurationUnit}}</span>
                          <span>总时长：{{ item.TotalStudyDuration}}{{item.DurationUnit}}</span>
                          <span>推送放假信息：{{item.IsSendRoom ==0 ? '否' :'是'}}</span>
                        </div>
                      </div>
                      <div style="min-width: 200px;width:30%;margin-top:3px;"
                        flex="dir:left box:mean">
                        <div style="font-size: 14px;">
                          <div style="width:71px;float:left;">房间信息：</div>
                          <div style="float:left;width:64%;">{{item.RoomInfo!=null ?item.RoomInfo:'无'}}</div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <div flex="cross:center" class="app-order-info" style="width: 17%;">
                <div flex="dir:top">
                  <div style="width:200px;text-align:left;margin:auto;line-height:28px;margin-top:-30px;padding-left:20px;">
                    <div>总点数：{{item.TotalPointNum}}</div>
                    <div>实际总点数：{{item.ActualPointNum}}</div>
                    <div>基础点数：{{item.BasePointNum}}</div>
                  </div>
                </div>
              </div>
              <div class="app-order-info" style="padding: 10px; border-right: 0px; width: 10%;">
                <el-button size="small" type="primary" v-if="item.OrderStaus==2" @click="editOrderIn(item)">确认</el-button>
                <el-button size="small" type="primary" v-if="item.OrderStaus==3" @click="sureWancheng(item)">确认完成</el-button>
              </div>
            </div>
            <div class="card-footer" v-if="item.Remark && item.Remark!=''">
              <div style="color:#E6A23C">商家备注：{{item.Remark}}</div>
            </div>
          </el-card>
          <el-card v-if="tableData.length==0" class="app-order-item" shadow="never">
            <div style="height:100px;line-height:100px;text-align:center">
              暂无订单信息
            </div>
          </el-card>
        </div>
        <el-pagination style="text-align:right" background @current-change="handleCurrentChange"
          :current-page.sync="msg.pageIndex" :page-size="msg.pageSize" layout="prev, pager, next" :total="total">
        </el-pagination>
      </div>
    </div>
    <!-- 订单取消 -->
    <el-dialog title="修改" :visible.sync="exitDig" width="600px">
      <el-form :model="exitMsg" ref="exitMsg" label-width="0">
        <p style="padding:10px 0" v-if="exitMsg.Type==3">填写取消理由：</p>
        <p style="padding:10px 0" v-if="exitMsg.Type==1">添加备注：</p>
        <template v-if="exitMsg.Type==2">
          <el-form-item label-width="80px" label="商品总价">
            <el-input size="small" v-model="exitMsg.Income"></el-input>
          </el-form-item>
          <el-form-item v-if="exitMsg.moneyType==2" label-width="80px" label="运费">
            <el-input size="small" v-model="exitMsg.Remark"></el-input>
          </el-form-item>
        </template>
        <el-form-item v-if="exitMsg.Type!=2">
          <el-input type="textarea" row="2" size="small" v-model="exitMsg.Remark"></el-input>
        </el-form-item>

      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="exitDig = false">取 消</el-button>
        <el-button size="small" type="primary" @click="submitForm('exitMsg')">确 定</el-button>
      </span>
    </el-dialog>
    <!--待处理-->
    <el-dialog custom-class="app-send" :title="pendMgs.Type==1?'同意':'拒绝'" :visible.sync="pendD" width="15%" class="tyi">
      <el-input v-if="pendMgs.Type==2" type="textarea" size="small" v-model="pendMgs.Remark" placeholder="拒绝理由">
      </el-input>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="pendD = false">取 消</el-button>
        <el-button size="small" type="primary" @click="pendingForm()">确 定</el-button>
      </span>
    </el-dialog>

    <!-- 选择导出信息 -->
    <el-dialog title="选择导出信息" :visible.sync="dialogVisible" width="960px">
      <el-form style="border: 1px solid #F0F2F7;" :model="addMsg" ref="addMsg" label-width="100px">
        <div
          style="box-sizing: border-box;background-color: #F3F5F6;width: 100%;padding-left: 20px;height: 50px;line-height: 50px;">
          <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选
          </el-checkbox>
        </div>
        <div style="margin: 15px 0;"></div>
        <div style="padding: 10px 25px 20px;">
          <el-checkbox-group v-model="checkedCities" @change="handleCheckedCitiesChange">
            <el-checkbox style="margin-bottom:10px;width:135px" v-for="city in cities" :label="city.Id"
              :key="city.Name">
              {{city.Name}}</el-checkbox>
          </el-checkbox-group>
        </div>
      </el-form>
      <div style="text-align:right;margin-top:20px">
        <el-button size="small" type="primary" @click="Export">导出</el-button>
      </div>
    </el-dialog>
    <!-- 多个物流信息 -->
    <el-dialog custom-class="sendDigClass" title="提示" :visible.sync="moresendDig" width="420px">
      <p style="padding: 10px 15px;">{{moresendtips}}</p>
      <div style="text-align:right;margin-top:20px">
        <el-button size="small" type="primary" @click="moresendDig=fasle">确定</el-button>
      </div>
    </el-dialog>
    <!-- 放入回收站 -->
    <el-dialog custom-class="hszDigClass" :visible.sync="hszDig" width="420px">
      <p style="padding: 10px 15px;" class="center">
        <i class="el-icon-warning" style="color:#E6A23C;font-size:24px"></i>
        <span style="font-size:20px">提示</span>
      </p>
      <p class="center" style="padding: 10px 15px;">{{hstips}}</p>
      <div style="text-align:center;margin-top:20px">
        <el-button size="small" @click="hszDig=fasle">取消</el-button>
        <el-button size="small" type="primary" @click="hszOk">确定</el-button>
      </div>
    </el-dialog>
    <!-- 订单取消 -->
    <el-dialog title="修改价格" :visible.sync="priceDig" width="600px">
      <el-form :model="priceMsg" ref="priceMsg" label-width="80px">
        <el-form-item label="商品总价">
          <el-input size="small" v-model="priceMsg.Income" @keyup.native="checkPrice(priceMsg,'Income')"></el-input>
        </el-form-item>
        <el-form-item v-if="priceType==2" label="运费">
          <el-input size="small" v-model="priceMsg.FreightMoney" @keyup.native="checkPrice(priceMsg,'FreightMoney')">
          </el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="priceDig = false">取 消</el-button>
        <el-button size="small" type="primary" @click="priceForm('priceMsg')">确 定</el-button>
      </span>
    </el-dialog>

    <!-- 商品、运费成本的修改 -->
    <el-dialog :title="cosType==1?'商品成本修改':'运费成本修改'" :visible.sync="costDig" width="600px">
      <el-form :model="costMsg" ref="costMsg" label-width="80px">
        <el-form-item :label="cosType==1?'商品成本':'运费成本'">
          <el-input size="small" v-model="costMsg.Money" step="1" min="0"
            onkeyup="this.value= this.value.match(/\d+(\.\d{0,3})?/) ? this.value.match(/\d+(\.\d{0,3})?/)[0] : ''">
          </el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="costDig = false">取 消</el-button>
        <el-button size="small" type="primary" @click="costForm('costMsg')">确 定</el-button>
      </span>
    </el-dialog>

    <!-- 修改房间信息 -->
    <el-dialog title="修改房间信息" :visible.sync="roomDialog" width="600px">
      <el-form label-width="80px">
        <el-form-item label="房间信息">
          <el-input type="textarea" :rows="4" v-model="sureMsg.RoomInfo">
          </el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="roomDialog = false">取 消</el-button>
        <el-button size="small" type="primary" @click="querenOrder()">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 确认完成-->
    <el-dialog title="修改点数" :visible.sync="sureDialog" width="400px">
      <el-form label-width="80px">
        <el-form-item label="点数">
          <el-input v-model="comMsg.ActualPointNum" @keyup.native="checkInteger(comMsg,'ActualPointNum')">
          </el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="sureDialog = false">取 消</el-button>
        <el-button size="small" type="primary" @click="querenScore()">确 定</el-button>
      </span>
    </el-dialog>



  </div>
</template>

<script>
  export default {
    name: "pointOrderList",
    data() {
      return {
        roomDialog:false, //修改房间信息弹窗
        sureDialog:false,
        importFileUrl: this.domainManager().UploadFileUrl,
        priceType: 1,
        priceMsg: {
          Income: '',
          FreightMoney: '',
        },
        priceDig: false,
        costDig: false, //商品、运费成本的修改
        costDig2: false, //商品、运费成本的修改
        cosType: 1,
        costMsg: {
          Id: 0,
          Money: 0,
        },
        CostMoney: { //设置司导订单 保险成本
          OrderDetailId: 0,
          InsuranceCostMoney: 0,
        },
        hstips: '是否放入回收站(可在回收站中恢复)?',
        orderStatusList: [],
        checkAll: false,
        checkedCities: [],
        cities: [],
        cityOptions: [],
        isIndeterminate: true,
        addMsg: {},
        dialogVisible: false,
        shDig: false,
        shMsg: {
          OrderId: 0,
          Consignee: '',
          Mobile: '',
          Province: '',
          City: '',
          District: '',
          ShoppingAddress: '',
        },
        shMsgrule: {
          Province: [{
            required: true,
            message: '请选择省',
            trigger: 'change'
          }],
          ShoppingAddress: [{
            required: true,
            message: '请输入详细地址',
            trigger: 'blur'
          }],
          Mobile: [{
            required: true,
            message: '请输入手机号',
            trigger: 'blur'
          }],
          Consignee: [{
            required: true,
            message: '请输入收件人',
            trigger: 'blur'
          }],
        },

        fhrules: {
          ExpressId: [{
            required: true,
            message: '请选择快递公司',
            trigger: 'change'
          }],
          ExpressNumber: [{
            required: true,
            message: '请输入快递单号',
            trigger: 'blur'
          }],
        },
        fhMsg: {
          Id: 0,
          OrderId: '',
          Type: 1,
          ExpressId: '',
          PostCode: '',
          ExpressNumber: '',
          Remark: '',
          OrderDetailIdList: [],
        },
        // 待处理
        pendMgs: {
          OrderId: 0,
          Type: 1,
          Remark: 0,
        },
        fahuoList: [],
        fhDig: false,
        pendD: false,
        exitMsg: {
          OrderId: 0,
          Type: 1,
          Remark: '',
          Income: '',
        },
        exitDig: false,
        activeName: 'first',
        dateList: [],
        msg: {
          pageIndex: 1,
          pageSize: 15,
          OrderStaus: 0,
          UserId: 0,
          TeacherId: 0,
          CourseId: 0,
          ID: 0,
          StartTime: '',
          EndTime: '',
        },

        provinceList: [],
        cityList: [],
        areaList: [],
        tableData: [],
        total: 0,
        teacherList: [],
        statusEnumList: [],
        loading: false,
        checkfhList: [],
        moresendDig: false,
        moresendtips: '',
        hszDig: false,
        hszMsg: {},
        btnLoad: false,
        upSupliDilog: false, // 修改供应商弹窗
        SuplierList: [], // 供应商下拉数据
        SupplierId: 0, //公用供应商id 给弹窗用
        CommonId: 0, //公用id 给弹窗用
        userList: [], //用户list
        usermsg: {
          pageIndex: 1,
          pageSize: 20,
          Name: '',
          Source: 0,
          MemberGrade: 0,
          Id: 0,
          Moblie: ''
        },
        sureMsg:{
          CourseId:0,
					TeacherId:0,
					RoomInfo:'',
					ID:0
        },
        comMsg:{
					ActualPointNum:0,
					ID:0
				},
      }
    },
    created() {
      if (this.$route.query.TypeId) {
        this.msgId = Number(this.$route.query.TypeId)
      }
      if (this.$route.query.ID) {
        this.msg.ID = this.$route.query.ID;
      }
      this.getList();
      this.getOrderStatus();
      this.getyonghuid()
      this.getTeacherList()

    },
    mounted() {},
    methods: {
      ChangeListName(val) {
        this.usermsg.Name = val;
        this.getyonghuid();
      },
      getyonghuid() {
        this.apipost("/api/user/GetMemberUserDropDownList", this.usermsg, res => {
          if (res.data.resultCode == 1) {
            let pageData = res.data.data.pageData;
            this.userList = pageData;
          }
        })
      },
      getTeacherList() {
        this.apipost("/api/Education/GetTeacherList", {}, res => {
          if (res.data.resultCode == 1) {
            this.teacherList = res.data.data;
          } else {
            this.Error(res.data.message);
          }
        })
      },
      // 订单操作
      priceForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            let cmd = '';
            if (this.priceType == 1) {
              cmd = '/api/order/SetOrderDetialMoneyInfo';
            } else {
              cmd = '/api/order/SetOrderMoneyOrFreightInfo';
            }
            this.apipost(cmd, this.priceMsg,
              res => {
                if (res.data.resultCode === 1) {
                  this.getList();
                  this.Success(res.data.message)
                  this.priceDig = false;

                } else {
                  this.Error(res.data.message);
                }
              },
              null
            );
          } else {
            return false;
          }
        });
      },
      // 修改价格
      EditPrice(item, num, list) {
        this.priceType = num;
        if (num == 1) {
          this.priceMsg = {
            OrderDetailId: list.Id,
            Income: list.Final_Price,
          }
        } else {
          this.priceMsg = {
            OrderId: item.OrderId,
            Income: item.Income,
            FreightMoney: item.FreightMoney
          }
        }
        this.priceDig = true;
      },

      hszOk() {
        this.apipost('/api/order/SetOrderOperation', this.hszMsg,
          res => {
            if (res.data.resultCode === 1) {
              this.getList();
              this.Success(res.data.message)
              this.hszDig = false;

            } else {
              this.Error(res.data.message);
            }
          },
          null
        );
      },
      pending(item, type) {
        this.pendD = true;
        this.pendMgs.OrderId = item.OrderId;
        this.pendMgs.Type = type;
        this.pendMgs.Remark = '';


      },
      // 待处理调用接口
      pendingForm() {
        this.loading = true;
        this.apipost('/api/order/SetOrderApplyForCancelAudit', this.pendMgs,
          res => {
            if (res.data.resultCode === 1) {
              this.pendD = false;
              this.loading = false;
              this.getList();
              this.Success(res.data.message)
            } else {
              this.Error(res.data.message);
              this.loading = false;

            }
          },

        );
      },
      // 确认完成
      qrEnd(item, num) {
        let msg = {
          OrderId: item.OrderId,
          Type: num
        };
        let that = this;
        let text
        if (num == 1) {
          text = '是否确定订单？'
        } else if (num == 2) {
          text = '是否出行？'
        } else if (num == 3) {
          text = '是否完成该订单？'
        }
        that.$confirm(text, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.apipost('/api/order/SetSDOrderConfirm', msg,
            res => {
              if (res.data.resultCode === 1) {
                this.getList();
                this.Success(res.data.message)

              } else {
                this.Error(res.data.message);
              }
            },
            null
          );
        }).catch(() => {

        });
      },
      // 放入回收站
      fRhsz(item, num) {
        if (num == 4) {
          this.hstips = "是否放入回收站(可在回收站中恢复)?"
        }
        if (num == 7) {
          this.hstips = "是否移出回收站?"
        }
        this.hszMsg = {
          OrderId: item.OrderId,
          Type: num
        };
        this.hszDig = true;
      },
      DeleteOrder(item) {
        let msg = {
          OrderId: item.OrderId,
          Type: 8
        };
        let that = this;
        that.$confirm('是否删除订单?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.apipost('/api/order/SetOrderOperation', msg,
            res => {
              if (res.data.resultCode === 1) {
                this.getList();
                this.Success(res.data.message)

              } else {
                this.Error(res.data.message);
              }
            },
            null
          );
        }).catch(() => {

        });
      },

      // 确认收货
      ConfirmSh(item) {
        let msg = {
          OrderId: item.OrderId,
          Type: 5
        };
        let that = this;
        that.$confirm('是否确认收货?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.apipost('/api/order/SetOrderOperation', msg,
            res => {
              if (res.data.resultCode === 1) {
                this.getList();
                this.Success(res.data.message)

              } else {
                this.Error(res.data.message);
              }
            },
            null
          );
        }).catch(() => {

        });
      },

      FhsubmitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            this.fhMsg.OrderDetailIdList = [];
            if (this.checkfhList.length == 0) {
              this.Error("至少选择一项！");
              return;
            }
            this.checkfhList.forEach(item => {
              this.fhMsg.OrderDetailIdList.push(item.Id);
            })
            if (this.fhMsg.Type == 2) {
              this.fhMsg.ExpressId = "";
              this.fhMsg.PostCode = "";
              this.fhMsg.ExpressNumber = "";
            }
            this.apipost('/api/order/SetOrderSendGoods', this.fhMsg,
              res => {
                if (res.data.resultCode === 1) {
                  this.getList();
                  this.fhDig = false;
                  this.Success(res.data.message)

                } else {
                  this.Error(res.data.message);
                }
              },
              null
            );
          } else {
            return false;
          }
        });
      },
      TableSelectChange(val) {
        this.checkfhList = val;

      },
      selectable(row, index) {
        return row.IsBindExpress === 2
      },
      // 发货
      fhBtn(item) {
        this.fhDig = true;
        this.fhMsg = {
          Id: 0,
          OrderId: item.OrderId,
          Type: 1,
          ExpressId: '',
          PostCode: '',
          ExpressNumber: '',
          Remark: '',
          OrderDetailIdList: [],
        }
        this.fahuoList = item.DetailList;

      },
      // 修改收货地址
      shsubmitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            this.apipost('/api/order/SetOrderShopingAddress', this.shMsg,
              res => {
                if (res.data.resultCode === 1) {
                  this.getList();
                  this.Success(res.data.message)
                  this.shDig = false;

                } else {
                  this.Error(res.data.message);
                }
              },
              null
            );
          } else {
            return false;
          }
        });
      },
      // 清空回收站
      ClearHsz() {
        let that = this;
        that.$confirm('此操作将清空回收站，是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.apipost('/api/order/SetOrderEmptyRecycleBin',
            res => {
              if (res.data.resultCode === 1) {
                this.getList();
                this.Success(res.data.message)

              } else {
                this.Error(res.data.message);
              }
            },
            null
          );
        }).catch(() => {

        });
      },
      Export() {
        this.msg.ExcelEnumIds = this.checkedCities;
        let msg = JSON.parse(JSON.stringify(this.msg));
        this.GetLocalFile(
          "/api/order/GetSDGoodspointOrderListToExcel",
          msg,
          "订单列表.xls"
        );
      },
      getDown() {
        this.cityOptions = [];
        this.apipost("/api/order/GetpointOrderListExportForSDEnumList", {}, res => {
          this.cities = res.data.data;
          let data = res.data.data;
          data.forEach(item => {
            this.cityOptions.push(item.Id)
          })

        })
      },
      handleCheckAllChange(val) {
        this.checkedCities = val ? this.cityOptions : [];
        this.isIndeterminate = false;
      },
      handleCheckedCitiesChange(value) {
        let checkedCount = value.length;
        this.checkAll = checkedCount === this.cities.length;
        this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length;
      },
      // 订单操作
      submitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            this.apipost('/api/order/SetOrderOperation', this.exitMsg,
              res => {
                if (res.data.resultCode === 1) {
                  this.getList();
                  this.Success(res.data.message)
                  this.exitDig = false;

                } else {
                  this.Error(res.data.message);
                }
              },
              null
            );
          } else {
            return false;
          }
        });
      },
      OrderExit(item, type) {
        this.exitMsg.OrderId = item.OrderId;
        this.exitMsg.Type = type;
        this.exitMsg.Remark = item.Remark;
        if (type == 3) {
          this.exitMsg.Remark = '';
        }
        this.exitDig = true;
      },
      // 强制取消
      OrderExit2(item) {
        let that = this;
        let text = '';
        if (item.OrderStatus == 1) {
          text = '确认取消?'
        } else if (item.OrderStatus == 2) {
          text = '确认取消?客人付款金额将原路退回。'
        }
        that.Confirm(text, function () {
          that.loading = true
          that.apipost(
            "/api/order/SetOrderForcedToCancel", {
              OrderId: item.OrderId
            },
            res => {
              if (res.data.resultCode == 1) {
                that.loading = false
                that.Success(res.data.message);
                that.getList();
              } else {
                that.Error(res.data.message);
                that.loading = false

              }
            },
          );
        });



      },
      handleClick(val) {
        this.msg.pageIndex = 1
        this.getList();
      },

      getList() {
        if (this.dateList && this.dateList.length > 0) {
          this.msg.StartTime = this.dateList[0];
          this.msg.EndTime = this.dateList[1];
        } else {
          this.msg.StartTime = '';
          this.msg.EndTime = '';
        }
        this.loading = true;
        this.apipost("/api/Point/GetPointOrderPageList", this.msg, res => {
          this.loading = false;
          if (res.data.resultCode == 1) {
            this.total = res.data.data.count;
            let pageData = res.data.data.pageData;
            this.tableData = pageData;
          }
        })
      },
      handleCurrentChange(val) {
        this.msg.pageIndex = val;
        this.getList();
      },
      getOrderStatus() {
        this.apipost("/api/Point/GetOrderStausEnumList", {}, res => {
          this.orderStatusList = res.data.data;
        })
      },




      costForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            let cmd = '';
            let msg = {}
            if (this.cosType == 1) {
              cmd = '/api/order/SetOrderCostMoney';
              msg = {
                Id: this.costMsg.Id,
                CostMoney: Number(this.costMsg.Money),
                EmpId: this.getLocalStorage().EmpId
              }
            } else if (this.cosType == 2) {
              cmd = '/api/order/SetOrderFreightCostMoney';
              msg = {
                Id: this.costMsg.Id,
                FreightCostMoney: Number(this.costMsg.Money),
                EmpId: this.getLocalStorage().EmpId
              }
            }
            this.apipost(cmd, msg,
              res => {
                if (res.data.resultCode === 1) {
                  this.getList();
                  this.Success(res.data.message)
                  this.costDig = false;
                } else {
                  this.Error(res.data.message);
                }
              },
              null
            );
          } else {
            return false;
          }
        });
      },
      costForm2(formName) { //成本修改
        this.$refs[formName].validate((valid) => {
          if (valid) {
            let cmd = '';
            let msg = {}
            cmd = '/api/order/SetOrderInsuranceCostMoney';
            msg = {
              OrderDetailId: this.CostMoney.OrderDetailId,
              InsuranceCostMoney: Number(this.CostMoney.InsuranceCostMoney),
            }

            this.apipost(cmd, msg,
              res => {
                if (res.data.resultCode === 1) {
                  this.getList();
                  this.Success(res.data.message)
                  this.costDig2 = false;
                } else {
                  this.Error(res.data.message);
                }
              },
              null
            );
          } else {
            return false;
          }
        });
      },
      //导出
      ExportFile(){
        this.GetLocalFile(
          "/api/Point/GetPointOrderListToExcel",
          {},
          "约课订单.xls"
        );
      },

      editOrderIn(item){
        this.roomDialog=true;
        this.sureMsg.CourseId = item.CourseId;
				this.sureMsg.TeacherId = item.TeacherId;
				this.sureMsg.ID = item.ID;
      },
      //确认订单
      querenOrder(){
        if(this.sureMsg.RoomInfo==''){
          this.Error('请填写房间信息');
          return;
        }
        this.apipost("/api/Point/GetConfirmTeacherCourseOrder", this.sureMsg, res => {
          if(res.data.resultCode==1){
            this.getList();
            this.roomDialog=false;
            this.Success(res.data.message);
          }else{
            this.Error(res.data.message);
          }
        })
      },
      //确认完成
      sureWancheng(item){
        this.sureDialog=true;
        this.comMsg.ActualPointNum = item.TotalPointNum;
        this.comMsg.ID = item.ID;
      },
      querenScore(){
        if(this.comMsg.ActualPointNum==''){
          this.Error('请填写分数');
          return;
        }
        this.apipost("/api/Point/GetCompleteTeacherCourseOrder", this.comMsg, res => {
          if(res.data.resultCode==1){
            this.getList();
            this.sureDialog=false;
            this.Success(res.data.message);
          }else{
            this.Error(res.data.message);
          }
        })
      }
    },
  };

</script>

<style>
  .pointOrderList .remark-box {
    padding-top: 3px;
    margin-left: 7px;
  }

  .pointOrderList .upload-demo {
    float: right;
    margin-top: -5px;
    margin-left: 20px;
  }

  .pointOrderList .pendSelect .el-input {
    width: 100px;
  }

  .hszDigClass .el-dialog__body {
    padding: 0 10px 20px 0;
  }

  .pointOrderList .tyi .el-dialog__body {
    padding: 0 20px
  }

  .sendDigClass .el-dialog__body {
    padding: 0 10px 10px 0;
  }

  .point-order-list .card-footer .seller-remark {
    margin-top: 10px;
    color: #E6A23C;
  }

  .app-send .el-table__header-wrapper th {
    background-color: #f5f7fa;
  }

  .app-send .title-box .text {
    background-color: #FEFAEF;
    color: #E6A23C;
    padding: 6px;
  }

  .app-send .title-box {
    margin: 15px 0;
  }


  .point-order-list .card-footer .address-box {
    margin-right: 10px;
  }

  .point-order-list .card-footer {
    background: #F3F5F6;
    padding: 10px 20px;
  }

  .point-order-list .app-order-info>div {
    width: 100%;
  }

  .app-order-icon {
    margin-right: 5%;
    margin-bottom: 10px;
    cursor: pointer;
  }

  .app-order-body {
    display: flex;
    flex-wrap: nowrap;
  }

  .point-order-list .app-order-info {
    display: flex;
    align-items: center;
    width: 15%;
    text-align: center;
    border-right: 1px solid #EBEEF5;
    justify-content: center;
  }

  .point-order-list .el-card__body {
    padding: 0;
  }

  .point-order-list .express-price {
    height: 30px;
    line-height: 30px;
  }

  .point-order-list .goods-item {
    border-right: 1px solid #EBEEF5;
  }

  .point-order-list .app-order-info {
    display: flex;
    align-items: center;
    width: 15%;
    text-align: center;
    border-right: 1px solid #EBEEF5;

  }

  .point-order-list .goods-item .goods .app-order-goods-price {
    height: 24px;
    margin-top: 3px;
    position: absolute;
    bottom: 20px;
    left: 125px;
  }

  .point-order-list .goods-item .goods-info .goods-name {
    margin-bottom: 5px;
    word-break: break-all;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }

  .point-order-list .goods-item .goods-info {
    width: 50%;
    margin-top: 5px;
  }

  .point-order-list .goods-image {
    height: 90px;
    width: 90px;
    margin-right: 15px;
    float: left;
  }

  .point-order-list .goods-item .goods {
    position: relative;
    padding: 20px;
    min-height: 130px;
    border-top: 1px solid #EBEEF5;
  }

  .point-order-list .goods-item .goods:first-of-type {
    border-top: 0;
  }

  .pointOrderList .point-order-list .app-order-item:hover .app-order-btnimg {
    display: block;
  }

  .pointOrderList .point-order-list .app-order-item:hover {
    border: 1px solid #3399FF;
  }

  .pointOrderList .app-order-btnimg {
    position: absolute;
    top: 20px;
    right: 25px;
    color: #7C868D;
    font-size: 18px;
    padding: 0;
    display: none;
  }

  .pointOrderList .app-order-offline {
    margin-left: 30px;
    margin-top: -2px;
  }

  .pointOrderList .app-order-user img {
    height: 20px;
    width: 20px;
    display: block;
    float: left;
    border-radius: 50%;
    margin-right: 10px;
  }

  .pointOrderList .point-order-list .app-order-time {
    color: #909399;
  }

  .pointOrderList .app-order-user {
    margin-left: 30px;
  }

  .pointOrderList .point-order-list .app-order-time {
    color: #909399;
  }

  .pointOrderList .point-order-list .app-order-item .el-card__header {
    padding: 0;
  }

  .pointOrderList .point-order-list .app-order-item {
    margin-top: 20px;
    min-width: 750px;
  }

  .pointOrderList .point-order-list .app-order-head {
    padding: 20px;
    background-color: #F3F5F6;
    color: #303133;
    min-width: 750px;
    display: flex;
    position: relative;
  }

  .pointOrderList .app-order-title div {
    text-align: center;
  }

  .pointOrderList .app-order-title {
    background-color: #F3F5F6;
    height: 40px;
    line-height: 40px;
    display: flex;
    min-width: 750px;
  }

  .pointOrderList .content {
    background: #fff;
    margin-top: 10px;
    padding: 20px;
    box-sizing: border-box;
  }

  .pointOrderList .el-dropdown-link {
    height: 30px;
    line-height: 30px;
    background-color: #409EFF;
    color: #fff;
    font-size: 12px;
    width: 60px;
    text-align: center;
    border-radius: 4px;
    cursor: pointer;
    display: inline-block;
  }
</style>
