<template>
  <div class="orderList afterSalesOrder">
    <div class="head-title">
      售后列表
      <el-button @click="dialogVisible=true" style="float:right;margin-top: -5px;" 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()" style="margin-right: 10px;"
          v-model="msg.OrderSource" size="small" placeholder="请选择">
          <el-option label="全部平台" :value="0"></el-option>
          <el-option v-for="item in platList" :key="item.Id" :label="item.Name" :value="item.Id">
          </el-option>
        </el-select>
        <el-input @clear="msg.pageIndex=1,getList()" clearable style="margin-left:15px;width:300px"
          @keyup.enter.native="msg.pageIndex=1,getList()" class="input-with-select" placeholder="请输入内容" v-model="msgVal"
          size="small">
          <el-select class="pendSelect" @change="ChangeId" v-model="msgId" slot="prepend" placeholder="请选择">
            <el-option v-for="item in option" :key="item.Id" :label="item.name" :value="item.Id">
            </el-option>
          </el-select>
        </el-input>
      </div>
      <div>
        <el-tabs style="margin-top:20px" v-model="activeName" @tab-click="handleClick">
          <el-tab-pane :dataId="0" label="全部" name="first"></el-tab-pane>
          <el-tab-pane v-for="item in orderTypeList" :key="item.Id" :dataId="item.Id" :label="item.Name"></el-tab-pane>
        </el-tabs>
        <div class="app-order-title">
          <div style="width: 50%;">商品信息</div>
          <div style="width: 8%;">售后类型</div>
          <div style="width: 8%;">订单状态</div>
          <div style="width: 8%;">金额</div>
          <div style="width: 8%;">申请理由</div>
          <div style="width: 18%;">操作</div>
        </div>
        <div v-loading="loading" class="app-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">订单号：</span>{{item.ReOrderNo}}
                </div>
                <div class="app-order-user">
                  <span class="app-order-time">原订单号：</span>{{item.OrderModel.OrderNo}}({{item.OrderModel.OrderId}})
                </div>
                <div flex="cross:center" class="app-order-user">
                  <img v-if="item.OrderModel.OrderSource==1" src="../../assets/img/userman/wx.png" alt="">
                  <span>{{item.UserName}}({{item.UserId}})</span>
                </div>
                <!-- <div flex="dir:left wrap:wrap" class="app-order-offline">
                                    <div class="express-send-box">
                                        <span class="el-tag el-tag--small el-tag--light">{{item.DeliveryMethodName}}</span>
                                    </div>
                                    <el-tag v-if="item.PaymentTime==''" style="margin-left:5px" size="small" type="warning">未付款</el-tag>
                                    <el-tag v-else style="margin-left:5px" size="small" type="warning">已付款</el-tag>

                                    <el-tag v-if="item.DeliveryTime=='' && item.ReceivingTime==''" style="margin-left:5px" size="small" type="success">未发货</el-tag>
                                    <el-tag v-if="item.DeliveryTime!='' && item.ReceivingTime==''" style="margin-left:5px" size="small" type="success">待发货</el-tag>

                                    <el-tag v-if="item.ReceivingTime!=''" style="margin-left:5px" size="small" type="success">已收货</el-tag>

                                    <el-tag v-if="item.ReceivingTime!=''" style="margin-left:5px" size="small" type="success">已完成</el-tag>

                                    <el-tag v-if="item.OrderStatus==7" style="margin-left:5px" size="small" type="danger">已取消</el-tag>

                                </div> -->
              </div>
            </div>
            <div class="app-order-body">
              <div class="goods-item" style="width: 50%;">
                <div class="goods">
                  <el-image :src="getIconLink(item.OrderDetailModel.CoverImagePath)" class="goods-image"
                    :preview-src-list="[getIconLink(item.OrderDetailModel.CoverImagePath)]"></el-image>
                  <div flex="dir:left">
                    <div class="goods-info">
                      <div class="goods-name">
                        <div class="app-ellipsis">
                          <div class="vue-line-clamp" style="word-break: break-all; -webkit-line-clamp: 2;">
                            {{item.OrderDetailModel.GoodsName}}
                          </div>
                        </div>
                      </div>
                      <div style="margin-bottom: 24px;">
                        <span style="margin-right: 10px;">
                          规格：
                          <el-tag :key="index2" v-for="(list,index2) in item.OrderDetailModel.SpecificationList"
                            style="top: 5px;position: relative;margin-right: 5px; max-width: 300px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;"
                            size="mini">
                            {{list}}
                          </el-tag>
                        </span>
                      </div>
                      <!-- <div class="app-order-goods-price">
                                                <span>货号：{{list.ProductCode}}</span>
                                            </div> -->
                    </div>
                    <div flex="dir:left box:mean" style="width: 250px;">
                      <div flex="cross:center main:center">
                        <span>小计：￥{{item.Income}}
                        </span>
                      </div>
                      <div flex="cross:center main:center">数量：x {{item.ReNumber}}</div>
                    </div>
                  </div>
                </div>
              </div>
              <div flex="cross:center" class="app-order-info" style="width: 8%;">
                <div>
                  <span v-if="item.Type==1">退货退款</span>
                  <span v-if="item.Type==2">换货</span>
                </div>
              </div>
              <div flex="main:center cross:center" class="app-box-info"
                style="width: 8%;border-right: 1px solid #EBEEF5;">
                <div>{{item.ReOrderStatusName}}</div>
              </div>
              <div flex="main:center cross:center" class="app-order-info"
                style="border-right:1px solid #EBEEF5; width: 8%;">
                <div flex="dir:top">
                  <div>实付金额:￥{{item.Income}}</div>
                  <div v-if="item.Type==1">申请退款:￥{{item.Refund}}</div>
                  <div>实际退款:￥{{item.RefundActual!=null ? item.RefundActual:0}}</div>
                </div>

              </div>
              <div flex="cross:center" class="app-order-info" style="width: 8%;">
                <el-tooltip class="item" effect="dark" :content="item.Remark" placement="top">
                  <div>{{item.Remark}}</div>
                </el-tooltip>

              </div>
              <div flex="main:center cross:center" class="app-order-info" style="width: 18%;">
                <el-tooltip class="item" effect="dark" content="同意" placement="top">
                  <img @click="agree(item,1)" v-if="item.ReOrderStatus==1" style="margin-right:5px"
                    src="../../assets/img/userman/pass.png" alt="">
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="拒绝" placement="top">
                  <img @click="setOrder(item,2)" v-if="item.ReOrderStatus==1" style="margin-right:5px"
                    src="../../assets/img/userman/nopass.png" alt="">
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="发货" placement="top">
                  <img v-if="item.Type==2 && item.ReOrderStatus==3" @click="fhOpenDig(item)" style="margin-right:5px"
                    src="../../assets/img/userman/confirm.png" alt="">
                </el-tooltip>
                <!-- 卖家收货 -->
                <el-tooltip class="item" effect="dark" content="收货" placement="top">
                  <img v-if="item.Type==1 && item.ReOrderStatus==3" @click="shouHuo(item)" style="margin-right:5px"
                    src="../../assets/img/userman/confirm.png" alt="">
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="打款" placement="top">
                  <img @click="dkOpenDig(item)" v-if="item.Type==1 && item.ReOrderStatus==4" style="margin-right:5px"
                    src="../../assets/img/userman/pay.png" alt="">
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="售后详情" placement="top">
                  <img @click="CommonJump('salesOrderDetails',{ReOrderId:item.ReOrderId})" style="margin-right:5px"
                    src="../../assets/img/userman/refund-detail.png" alt="">
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="订单详情" placement="top">
                  <img @click="CommonJump('orderDetails',{OrderId:item.OrderModel.OrderId})" style="margin-right:5px"
                    src="../../assets/img/userman/detail.png" alt="">
                </el-tooltip>
              </div>
            </div>
            <div class="card-footer">
              <div>
                <div flex="dir:left">
                  <div class="address-box">收货人: {{item.OrderModel.Consignee}}
                    电话：{{item.OrderModel.Mobile}} 地址：
                    {{item.OrderModel.DistrictAddress}}
                    {{item.OrderModel.ShoppingAddress}}</div>
                  <button @click="ExitshAdress(item.OrderModel)" type="button"
                    class="el-button el-button--text is-circle"><i class="el-icon-edit"></i></button>
                </div>
              </div>
              <div v-if="item.ReRemark && item.ReRemark!=''" class="seller-remark">商家备注：{{item.ReRemark}}</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"
          :page-size="msg.pageSize" :current-page.sync="msg.pageIndex" layout="prev, pager, next" :total="total">
        </el-pagination>
      </div>
    </div>
    <!-- 选择导出信息 -->
    <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 title="修改收货地址" :visible.sync="shDig" width="600px">
      <el-form :model="shMsg" :rules="shMsgrule" ref="shMsg" label-width="80px">
        <el-form-item label="收件人" prop="Consignee">
          <el-input size="small" v-model="shMsg.Consignee"></el-input>
        </el-form-item>
        <el-form-item label="电话" prop="Mobile">
          <el-input type="number" size="small" v-model="shMsg.Mobile"></el-input>
        </el-form-item>
        <el-form-item label="所在区域" prop="Province">
          <el-select size="small" @change="shMsg.City='',getCity(shMsg.Province)" v-model="shMsg.Province"
            style="width:144px" filterable placeholder="请选择">
            <el-option v-for="item in provinceList" :key="item.ID" :label="item.Name" :value="item.ID">
            </el-option>
          </el-select>
          <el-select size="small" @change="shMsg.District='',getArea(shMsg.City)" v-model="shMsg.City"
            style="width:144px" filterable placeholder="请选择">
            <el-option v-for="item in cityList" :key="item.ID" :label="item.Name" :value="item.ID">
            </el-option>
          </el-select>
          <el-select size="small" v-model="shMsg.District" style="width:144px" filterable placeholder="请选择">
            <el-option v-for="item in areaList" :key="item.ID" :label="item.Name" :value="item.ID">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="详细地址" prop="ShoppingAddress">
          <el-input size="small" v-model="shMsg.ShoppingAddress"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="shDig = false">取 消</el-button>
        <el-button size="small" type="primary" @click="shsubmitForm('shMsg')">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 打款 -->
    <el-dialog title="确认已收到货" :visible.sync="dkDig" width="600px">
      <div flex="main:center cross:center" style="text-align: center; font-size: 16px;">
        <i class="el-icon-warning" style="color: rgb(230, 162, 60); margin-right: 10px; font-size: 24px;"></i>
        <span class="span-label">确认收货后,退款金额</span>
        <el-input class="w100" size="small" v-model="dkMsg.Refund" style="margin:0 6px" type="number" min="1"
          placeholder="请输入内容"></el-input>
        <span class="span-label">元将直接返还给用户！</span>
      </div>
      <div style="text-align:right;margin-top:20px">
        <el-button size="small" @click="dkDig=false">取消</el-button>
        <el-button size="small" type="primary" @click="SaleForRefunds">确定</el-button>
      </div>
    </el-dialog>
    <!-- 发货 -->
    <el-dialog custom-class="app-send" title="发货" :visible.sync="fhDig" width="35%">
      <div class="title-box">
        <span class="text">选择发货商品</span>
        <span>(默认全选)</span>
      </div>
      <el-table ref="fahuoTable" :data="fahuoList" @selection-change="TableSelectChange" style="width: 100%">
        <!-- <el-table-column type="selection" width="55"> -->
        <!-- </el-table-column> -->
        <el-table-column prop="id" label="图片" width="60">
          <template slot-scope="scope">
            <img style="width:30px;height:30px" :src="domainManager().ImageUrl+scope.row.CoverImagePath" alt="">
          </template>
        </el-table-column>
        <el-table-column prop="GoodsName" label="名称" width="314">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.IsBindExpress==1" style="margin-left:5px" size="small" type="success">已发货</el-tag>
            <span>{{scope.row.GoodsName}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="ReNumber" label="数量" width="80">
        </el-table-column>
        <el-table-column prop="Specification" label="规格">
          <template slot-scope="scope">
            <span v-for="(item,index) in scope.row.SpecificationList" :key="index" style="margin-left:5px">
              {{item}}
            </span>
          </template>
        </el-table-column>
      </el-table>
      <div class="title-box"><span class="text">物流信息</span></div>
      <el-form :model="fhMsg" ref="fhMsg" :rules="fhrules" label-width="130px">
        <el-form-item label="物流快递">
          <el-radio v-model="fhMsg.Type" :label="1">快递</el-radio>
          <el-radio v-model="fhMsg.Type" :label="2">其他方式</el-radio>
        </el-form-item>
        <template v-if="fhMsg.Type==1">
          <el-form-item label="快递公司" prop="ExpressId">
            <el-select class="w200" size="small" v-model="fhMsg.ExpressId" filterable placeholder="请选择">
              <el-option v-for="item in ExpressList" :key="item.ID" :label="item.Name" :value="item.ID">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="收件人邮编">
            <el-input type="number" min="1" size="small" v-model="fhMsg.PostCode"></el-input>
          </el-form-item>
          <el-form-item label="快递单号" prop="ExpressNumber">
            <el-input size="small" v-model="fhMsg.ExpressNumber">
              <!-- <el-button slot="append"> 获取面单</el-button> -->
            </el-input>
          </el-form-item>
          <el-form-item label="商家留言">
            <el-input type="textarea" row="2" size="small" v-model="fhMsg.Remark"></el-input>
          </el-form-item>
        </template>
        <template v-if="fhMsg.Type==2">
          <el-form-item label="物流内容">
            <el-input type="textarea" row="2" size="small" v-model="fhMsg.Remark"></el-input>
          </el-form-item>
        </template>

      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="fhDig = false">取 消</el-button>
        <el-button size="small" type="primary" @click="FhsubmitForm('fhMsg')">确 定</el-button>
      </span>
    </el-dialog>
    <!--选择的商品列表-->
    <el-dialog title="收货地区选择" :visible.sync="regionshow" width="1024px">
      <template>
        <el-table :data="regionlist" border style="width: 100%">
          <el-table-column label="选择" width="55">
            <template slot-scope="scope">
              <el-radio v-model="SetOrderMsg.DeliveryId" :label="scope.row.ID"><i></i></el-radio>
            </template>
          </el-table-column>
          <el-table-column property="Name" label="收件人姓名" width="200">
          </el-table-column>
          <el-table-column property="Mobile" label="联系方式" width="200">
          </el-table-column>
          <el-table-column property="Address" label="详细地址" width="200">
          </el-table-column>
          <el-table-column property="Remarks" label="备注">
          </el-table-column>
        </el-table>
        <el-pagination style="text-align:right" background @current-change="handleCurrentChangere"
          v-if="regionlist&&regionlist.length>0" :current-page.sync="regionMsg.pageIndex"
          layout="total,prev, pager, next" :page-size="regionMsg.pageSize" :total="regiontotal">
        </el-pagination>
      </template>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="regionshow = false">取 消</el-button>
        <el-button size="small" type="primary" @click="regionsubmitForm()">确 定</el-button>
      </span>
    </el-dialog>

  </div>
</template>

<script>
  export default {
    name: "orderList",
    data() {
      return {
        orderStatusList: [],
        checkAll: false,
        checkedCities: [],
        cities: [],
        cityOptions: [],
        isIndeterminate: true,
        addMsg: {},
        dialogVisible: false,

        activeName: 'first',
        msgVal: '',
        dateList: [],
        msg: {
          pageIndex: 1,
          pageSize: 15,
          OrderSource: 0,
          OrderType: 0,
          DeliveryMethod: 0,
          OrderId: 0,
          StartTime: '',
          EndTime: '',
          OrderNo: '',
          UserName: '',
          UserId: 0,
          GoodsName: '',
          SelectStatus: 0,
          ReOrderNo: '',
          Consignee: '',
          Mobile: '',


        },
        platList: [],
        option: [{
            Id: 1,
            name: '订单号'
          },
          {
            Id: 2,
            name: '原订单号'
          },
          {
            Id: 3,
            name: '用户名'
          },
          {
            Id: 4,
            name: '用户ID'
          },
          {
            Id: 5,
            name: '商品名称'
          },
          {
            Id: 6,
            name: '收件人'
          },
          {
            Id: 7,
            name: '收件人电话'
          }
        ],
        msgId: 1,
        ExpressList: [],
        provinceList: [],
        cityList: [],
        areaList: [],
        tableData: [],
        total: 0,
        deliveryList: [],
        orderTypeList: [],
        loading: false,
        checkfhList: [],
        moresendDig: false,
        moresendtips: '',
        hszDig: false,
        hszMsg: {},
        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'
          }],
        },
        dkMsg: {},
        dkDig: false,
        fhrules: {
          ExpressId: [{
            required: true,
            message: '请选择快递公司',
            trigger: 'change'
          }],
          ExpressNumber: [{
            required: true,
            message: '请输入快递单号',
            trigger: 'blur'
          }],
        },
        fhMsg: {
          AfterSaleOrderId: '',
          Type: 1,
          ExpressId: '',
          PostCode: '',
          ExpressNumber: '',
          Remark: '',
        },
        fahuoList: [],
        fhDig: false,
        ExpressList: [],
        SetOrderMsg: {
          ReOrderId: 0,
          Type: 0,
          DeliveryId: '',
        },
        regionMsg: {
          pageIndex: 1,
          pageSize: 20,
          Name: '',
        },
        regionshow: false,
        regionlist: [],
        regiontotal: 0,
        IsHPSL: false,
      }
    },
    created() {

      this.getList();
      this.getplat();
      this.getDown();
      this.getOrderStatus();
      this.getDelivery();
      this.getOrderType();
      this.getProvince();
      this.getExpressInfo();
    },
    mounted() {},
    methods: {
      // 卖家收货
      shouHuo(item) {
        let that = this;
        that.$confirm("确认收货？", '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.apipost('/api/order/SetOrderReceivingForReturnsAndRefunds', {
              ReOrderId: item.ReOrderId
            },
            res => {
              if (res.data.resultCode === 1) {
                this.getList();
                this.Success(res.data.message)
              } else {
                this.Error(res.data.message);
              }
            },
            null
          );
        }).catch(() => {

        });
      },
      // 修改收货地址
      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;
          }
        });
      },
      FhsubmitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            if (this.fhMsg.Type == 2) {
              this.fhMsg.ExpressId = "";
              this.fhMsg.PostCode = "";
              this.fhMsg.ExpressNumber = "";
            }
            this.apipost('/api/order/SetOrderAfterSaleSendGoods', 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) {},
      // 发货
      fhOpenDig(item) {
        this.fhMsg.AfterSaleOrderId = item.ReOrderId;
        this.fahuoList = [];
        item.OrderDetailModel.ReNumber = item.ReNumber;
        this.fahuoList.push(item.OrderDetailModel);
        this.fhDig = true;
      },
      //审核同意 收货地址选择
      agree(item) {
        this.IsHPSL = false;
        let that = this;
        this.SetOrderMsg.ReOrderId = item.ReOrderId;
        this.SetOrderMsg.Type = 1;
        that.$confirm('同意,是否继续', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          if (item.TenantId == 29) {
            this.IsHPSL = true;
            this.regionsubmitForm();
          } else {
            this.regionshow = true;
            this.getLogisticsDeliveryPage()
          }

        }).catch(() => {

        });


      },
      //收货地址的列表
      getLogisticsDeliveryPage() {
        this.apipost("/api/MallBase/GetLogisticsDeliveryPage", this.regionMsg, res => {
          if (res.data.resultCode == 1) {
            this.regionlist = res.data.data.pageData;
            this.regiontotal = res.data.data.count;
          } else {
            this.Info(res.data.message);
          }
        })
      },
      handleCurrentChangere(val) {
        this.regionMsg.pageIndex = val;
        this.getLogisticsDeliveryPage();
      },
      regionsubmitForm() {
        if (this.SetOrderMsg.DeliveryId == '' && this.IsHPSL == false) {
          this.Error('请选择收货地址');
          return false
        }
        this.apipost('/api/order/SetOrderAfterSaleAudit', this.SetOrderMsg,
          res => {
            if (res.data.resultCode === 1) {
              this.regionshow = false
              this.regionMsg.pageIndex = 1;
              this.getList();
              this.Success(res.data.message)
            } else {
              this.Error(res.data.message);
            }
          },
          null
        );

      },
      // 售后订单审核
      setOrder(item) {
        this.SetOrderMsg.ReOrderId = item.ReOrderId;
        this.SetOrderMsg.Type = 2;
        this.SetOrderMsg.DeliveryId = '';
        let that = this;
        that.$confirm('拒绝,是否继续', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.apipost('/api/order/SetOrderAfterSaleAudit', this.SetOrderMsg,
            res => {
              if (res.data.resultCode === 1) {
                this.getList();
                this.Success(res.data.message)
              } else {
                this.Error(res.data.message);
              }
            },
            null
          );
        }).catch(() => {

        });

      },
      SaleForRefunds() {
        this.loading = true
        this.apipost('/api/order/SetOrderAfterSaleForRefunds', this.dkMsg,
          res => {
            if (res.data.resultCode === 1) {
              this.getList();
              this.Success(res.data.message)
              this.dkDig = false;
              this.loading = false
            } else {
              this.Error(res.data.message);
              this.loading = false

            }
          },
          null
        );


      },
      // 打款
      dkOpenDig(item) {
        this.dkMsg = {
          Refund: item.Refund,
          ReOrderId: item.ReOrderId
        };
        this.dkDig = true;
      },
      // 修改收货地址
      ExitshAdress(item) {
        this.shDig = true;
        this.shMsg = {
          OrderId: item.OrderId,
          Consignee: item.Consignee,
          Mobile: item.Mobile,
          Province: item.Province,
          City: item.City,
          District: item.District,
          ShoppingAddress: item.ShoppingAddress,
        }
        this.getCity(item.Province);
        this.getArea(item.City);
      },
      ChangeId(val) {

        let msgVal = this.msgVal;
        if (val == 1) {
          this.msg.ReOrderNo = msgVal;
          this.msg.OrderNo = '';
          this.msg.UserName = '';
          this.msg.UserId = '';
          this.msg.GoodsName = '';
          this.msg.Consignee = '';
          this.msg.Mobile = '';
        }
        if (val == 2) {
          this.msg.ReOrderNo = '';
          this.msg.OrderNo = msgVal;
          this.msg.UserName = '';
          this.msg.UserId = '';
          this.msg.GoodsName = '';
          this.msg.Consignee = '';
          this.msg.Mobile = '';
        }
        if (val == 3) {
          this.msg.ReOrderNo = '';
          this.msg.OrderNo = '';
          this.msg.UserName = msgVal;
          this.msg.UserId = '';
          this.msg.GoodsName = '';
          this.msg.Consignee = '';
          this.msg.Mobile = '';
        }
        if (val == 4) {
          this.msg.ReOrderNo = '';
          this.msg.OrderNo = '';
          this.msg.UserName = '';
          this.msg.UserId = msgVal;
          this.msg.GoodsName = '';
          this.msg.Consignee = '';
          this.msg.Mobile = '';
        }
        if (val == 5) {
          this.msg.ReOrderNo = '';
          this.msg.OrderNo = '';
          this.msg.UserName = '';
          this.msg.UserId = '';
          this.msg.GoodsName = msgVal;
          this.msg.Consignee = '';
          this.msg.Mobile = '';
        }
        if (val == 6) {
          this.msg.ReOrderNo = '';
          this.msg.OrderNo = '';
          this.msg.UserName = '';
          this.msg.UserId = '';
          this.msg.GoodsName = '';
          this.msg.Consignee = msgVal;
          this.msg.Mobile = '';
        }
        if (val == 7) {
          this.msg.ReOrderNo = '';
          this.msg.OrderNo = '';
          this.msg.UserName = '';
          this.msg.UserId = '';
          this.msg.GoodsName = '';
          this.msg.Consignee = '';
          this.msg.Mobile = msgVal;
        }
        // this.getList();
      },

      Export() {
        this.msg.ExcelEnumIds = this.checkedCities;
        let msg = JSON.parse(JSON.stringify(this.msg));
        this.GetLocalFile(
          "/api/order/GetGoodsOrderAfterListToExcel",
          msg,
          "售后订单.xls"
        );
      },
      getDown() {
        this.cityOptions = [];
        this.apipost("/api/order/GetOrderAfterSaleExportEnumList", {}, 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;
      },
      handleClick(val) {
        let dataId = val.$attrs.dataId;
        this.msg.SelectStatus = dataId;
        this.msg.pageIndex = 1
        this.getList();
      },

      getList() {
        this.ChangeId(this.msgId)
        if (!this.msgVal || this.msgVal == '') {
          this.msg.ReOrderNo = '';
          this.msg.OrderNo = '';
          this.msg.UserName = '';
          this.msg.UserId = '';
          this.msg.GoodsName = '';
          this.msg.Consignee = '';
          this.msg.Mobile = '';
        }

        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/order/GetGoodsOrderAfterPageList", 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/order/GetOrderStatusEnumList", {}, res => {
          this.orderStatusList = res.data.data;
        })
      },
      getDelivery() {
        this.apipost("/api/order/GetOrderDeliveryMethodEnumList", {}, res => {
          this.deliveryList = res.data.data;
        })
      },
      getOrderType() {
        this.apipost("/api/order/GetAfterSaleSelectStatusEnumList", {}, res => {
          this.orderTypeList = res.data.data;
        })
      },

      getplat() {
        this.apipost("/api/user/GetMemberUserSourceEnumList", {}, res => {
          this.platList = res.data.data;
        })
      },
      getArea(val) {
        this.apipost("/api/Destination/GetChildList", {
          Id: val
        }, res => {
          this.areaList = res.data.data;
        })
      },
      getCity(val) {
        this.apipost("/api/Destination/GetChildList", {
          Id: val
        }, res => {
          this.cityList = res.data.data;
          if (this.cityList.length > 0) {
            this.getArea(this.cityList[0].ID)
          }
        })
      },
      getProvince() {
        this.apipost("/api/Destination/GetChildList", {
          Id: 1
        }, res => {
          this.provinceList = res.data.data;
          if (this.provinceList.length > 0) {
            this.getCity(this.provinceList[0].ID)
          }
        })
      },
      // 快递公司
      getExpressInfo() {
        this.apipost("/api/MallBase/GetExpressInfo", {}, res => {
          if (res.data.resultCode == 1) {
            this.ExpressList = res.data.data;
          } else {
            this.Info(res.data.message);
          }
        })
      },

    },
  };

</script>

<style>
  .orderList .pendSelect .el-input {
    width: 100px;
  }

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

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

  .app-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;
  }

  .app-order-list .app-order-item .el-button {
    padding: 0;
  }

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

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

  .app-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;
  }

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

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

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

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

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

  }

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

  .app-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;
  }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

</style>
