<template>
  <div id="order_list" class="app-container">
    <div v-loading.fullscreen.lock="loadingFull" />
    <template>
      <el-tabs v-model="listQuery.order_status" @tab-click="handleTagToggle">
        <el-tab-pane name="-1"><span slot="label">全部订单 <span class="num">{{ num_1 }}</span></span></el-tab-pane>
        <el-tab-pane name="6"><span slot="label">待付款 <span class="num">{{ num_2 }}</span></span></el-tab-pane>
        <el-tab-pane name="0"><span slot="label">待订单审核 <span class="num">{{ num_3 }}</span></span></el-tab-pane>
        <el-tab-pane name="1"><span slot="label">待财务审核 <span class="num">{{ num_4 }}</span></span></el-tab-pane>
        <el-tab-pane name="2"><span slot="label">待发货审核 <span class="num">{{ num_5 }}</span></span></el-tab-pane>
        <el-tab-pane name="3"><span slot="label">待收货 <span class="num">{{ num_6 }}</span></span></el-tab-pane>
        <el-tab-pane name="4"><span slot="label">已完成 <span class="num">{{ num_7 }}</span></span></el-tab-pane>
        <el-tab-pane name="5"><span slot="label">已作废 <span class="num">{{ num_8 }}</span></span></el-tab-pane>
      </el-tabs>
    </template>
    <div class="search-container">
      <div class="search-flex">
        <div v-if="!highSearchFlag">
          <el-date-picker v-model="listQuery.time" value-format="yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" class="filter-item" style="width:400px" />
          <el-input v-model="listQuery.order_no" placeholder="订单编号" class="filter-item filter-input" style="display: inline-block; width: 240px;" @keydown.native.enter="listQuery.page_index = 1;getList()" />
          <el-input v-model="listQuery.search_name" placeholder="备注昵称/姓名/手机号" class="filter-item filter-input" style="display: inline-block; width: 300px;" @keydown.native.enter="listQuery.page_index = 1;getList()" />
          <!-- <el-select v-model="listQuery.activity_id" style="width: 400px">
            <el-option label="全部" value="" />
            <el-option v-for="item in activitys" :key="item.id" :label="item.title" :value="item.id" />
          </el-select> -->
          <el-button type="primary" icon="el-icon-search" class="filter-item" @click="listQuery.page_index = 1;getList()">搜索</el-button>
          <el-button type="primary" @click="clearSearch">清除</el-button>
          <el-button type="primary" @click="dialog.export = true;">高级搜索</el-button>
        </div>
        <div v-else>
          <el-button type="primary" @click="resetSeniorSearch();highSearchFlag = false">清除搜索</el-button>
          <el-button type="primary" @click="dialog.export = true;">继续搜索</el-button>
        </div>
        <el-button v-permit="0" :roles-permit="roles" type="primary" icon="el-icon-edit" class="filter-item" @click="handleAddOrder">代下单</el-button>
      </div>
      <div>
        <!-- <el-button
        v-permit="1"
        type="primary"
        icon="el-icon-edit"
        class="filter-item"
        :roles-permit="roles"
      >
        添加代理
      </el-button> -->
        <el-button v-permit="0" :roles-permit="roles" type="primary" class="bg1" @click="machExamine(0)">订单审核</el-button>
        <el-button v-permit="1" :roles-permit="roles" type="primary" class="bg2" @click="machExamine(1)">财务审核</el-button>
        <el-button v-permit="2" :roles-permit="roles" type="primary" class="bg3" @click="machExamine(2)">发货审核</el-button>
        <!-- <el-button v-permit="3" :roles-permit="roles" type="primary" @click="showMergeOrder">合并订单</el-button> -->
        <!-- <el-button v-permit="[0,1,2]" :roles-permit="roles" type="primary" icon="el-icon-download" @click="dialog.export_order = true">导出</el-button> -->
        <!-- <el-button v-permit="2" :roles-permit="roles" type="primary" icon="el-icon-upload2" @click="dialog.lead_order = true">导入</el-button> -->
        <!-- <el-button v-permit="2" :roles-permit="roles" type="primary" icon="el-icon-refresh" @click="dialog.import_wuliunew = true">物流更新</el-button> -->
        <!-- <el-button v-permit="[0,1,2]" :roles-permit="roles" type="primary" :loading="downloadLoading" icon="el-icon-document" class="filter-item" @click="exportOrder">导出订单信息</el-button>
        <el-button v-permit="[0,1,2]" :roles-permit="roles" type="primary" :loading="downloadLoading" icon="el-icon-document" class="filter-item" @click="exporOrdertOrder">导出拆单信息</el-button> -->
        <!-- <el-button v-permit="2" :roles-permit="roles" type="primary" :loading="downloadLoading" icon="el-icon-document" class="filter-item" @click="exportTemp">物流模板</el-button>
        <el-button v-permit="2" :roles-permit="roles" type="primary" :loading="downloadLoading" icon="el-icon-document" class="filter-item">导入物流</el-button> -->
        <!-- <el-button v-permit="[0,1,2]" :roles-permit="roles" type="primary" @click="exportOrder">导出订单数据</el-button>
        <el-button v-permit="[0,1,2]" :roles-permit="roles" type="primary" @click="exporOrdertOrder">导出拆单数据</el-button> -->
        <!-- <el-button v-permit="[0,1,2]" :roles-permit="roles" type="primary" icon="el-icon-download" @click="dialog.export_order = true">导出</el-button> -->
        <el-popover
          placement="bottom"
          width="230"
          trigger="hover"
        >
          <el-button type="primary" @click="dialog.import_wuliu = true">导入单号</el-button>
          <el-button type="primary" @click="dialog.import_wuliunew = true">修改单号</el-button>
          <!-- <el-button type="primary" @click="dialog.import_gift = true">上传赠品</el-button> -->
          <el-button slot="reference" v-permit="2" :roles-permit="roles" type="primary" icon="el-icon-upload2">导入</el-button>
        </el-popover>
        <el-popover
          placement="bottom"
          width="330"
          trigger="hover"
        >
          <el-button type="primary" @click="exportOrder">订单明细</el-button>
          <el-button type="primary" @click="exportMoney">订单金额</el-button>
          <el-button type="primary" @click="exporOrdertOrder">拆单明细</el-button>
          <!-- <el-button slot="reference" type="primary" :loading="downloadLoading" icon="el-icon-document" class="filter-item">导出</el-button> -->
          <el-button slot="reference" v-permit="[0,1,2]" :roles-permit="roles" type="primary" icon="el-icon-download">导出</el-button>
          <!-- <el-button slot="reference" v-permit="5" :roles-permit="roles" type="primary" @click="delNum">删除单号<i class="el-icon-right el-icon--right" /></el-button> -->
        </el-popover>
      </div>
    </div>
    <!-- 合并订单 -->
    <el-dialog
      title="合并订单"
      :visible.sync="mergeOrderVis"
      :close-on-click-modal="false"
      :before-close="cancelMergeOrderInfo"
    >
      <el-form label-width="80px">
        <el-form-item label="订单1:">
          <el-input v-model="mergeOrderForm.master_num" type="span" placeholder="请输入待合并的订单1" />
        </el-form-item>
        <el-form-item label="订单2:">
          <el-input v-model="mergeOrderForm.slave_num" type="span" placeholder="请输入待合并的订单2" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="getMergeOrderInfo">合并</el-button>
          <el-button @click="cancelMergeOrderInfo">取消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
    <!-- 确认合并 -->
    <el-dialog
      title="确认合并"
      :visible.sync="sureMergeVis"
      :close-on-click-modal="false"
      :before-close="cancelToMergeOrder"
    >
      <el-form v-if="mergeOrdersInfo.order_master && mergeOrdersInfo.order_slave" label-width="100px">
        <el-form-item label="订单详情:">
          <div class="merger_order_container">
            <div class="flex">
              <p class="order_nav">订单号</p>
              <div class="order_main">
                <p>{{ mergeOrdersInfo.order_master.order_num }}</p>
              </div>
              <div class="order_main">
                <p>{{ mergeOrdersInfo.order_slave.order_num }}</p>
              </div>
            </div>
            <div class="flex">
              <p class="order_nav">收货地址</p>
              <div class="order_main">
                <p>{{ mergeOrdersInfo.order_master.get_address.username || '' }}</p>
                <p>{{ mergeOrdersInfo.order_master.get_address.mobile || '' }}</p>
                <p>
                  {{ `${mergeOrdersInfo.order_master.get_address.province || ''}` }}
                  {{ `${mergeOrdersInfo.order_master.get_address.city || ''}` }}
                  {{ `${mergeOrdersInfo.order_master.get_address.town || ''}` }}
                  {{ `${mergeOrdersInfo.order_master.get_address.address || ''}` }}
                </p>
              </div>
              <div class="order_main">
                <p>{{ mergeOrdersInfo.order_slave.get_address.username || '' }}</p>
                <p>{{ mergeOrdersInfo.order_slave.get_address.mobile || '' }}</p>
                <p>
                  {{ `${mergeOrdersInfo.order_slave.get_address.province || ''}` }}
                  {{ `${mergeOrdersInfo.order_slave.get_address.city || ''}` }}
                  {{ `${mergeOrdersInfo.order_slave.get_address.town || ''}` }}
                  {{ `${mergeOrdersInfo.order_slave.get_address.address || ''}` }}
                </p>
              </div>
            </div>
            <div class="flex">
              <p class="order_nav">订单详情</p>
              <div class="order_main">
                <p
                  v-for="item in mergeOrdersInfo.order_master.goods_detail"
                  :key="item.id"
                >
                  {{ item.name }}-({{ item.size }})-({{ item.num }}{{ item.unit }})
                </p>
              </div>
              <div class="order_main">
                <p
                  v-for="item in mergeOrdersInfo.order_slave.goods_detail"
                  :key="item.id"
                >
                  {{ item.name }}-({{ item.size }})-({{ item.num }}{{ item.unit }})
                </p>
              </div>
            </div>
            <div class="flex">
              <p class="order_nav">下单时间</p>
              <div class="order_main">
                <p>{{ mergeOrdersInfo.order_master.created_at }}</p>
              </div>
              <div class="order_main">
                <p>{{ mergeOrdersInfo.order_slave.created_at }}</p>
              </div>
            </div>
          </div>
        </el-form-item>
        <el-form-item label="设置主订单:">
          <el-radio-group v-model="mergeOrderForm.main">
            <el-radio :label="mergeOrdersInfo.order_master.order_num">{{ mergeOrdersInfo.order_master.order_num }}</el-radio>
            <el-radio :label="mergeOrdersInfo.order_slave.order_num">{{ mergeOrdersInfo.order_slave.order_num }}</el-radio>
          </el-radio-group>
          <div>
            <i class="el-icon-warning">合并结果将保留主订单</i>
          </div>
        </el-form-item>
        <el-form-item label="备注:">
          <el-input v-model="mergeOrderForm.remark" type="spanarea" autosize />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="submitToMergeOrder">合并订单</el-button>
          <el-button @click="cancelToMergeOrder">取消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
    <div class="table-wrapper">
      <el-table id="table" ref="listTable" :height="tableHeight + 'px'" :data="table" :header-cell-style="{ background: '#f8fbfc' }" class="tableBorder table-fixed" border stripe @selection-change="orderMulSelect">
        <el-table-column type="selection" width="50" align="center" :selectable="selectEnable" :show-overflow-tooltip="true" />
        <el-table-column prop="order_num" label="订单编号" width="210">
          <template slot-scope="{ row }">
            <span style="cursor:pointer;color:#1890FF;" @click="toOrderWxamine(row)">{{ row.order_num }}</span>
            <!-- <el-button type="span" @click="toOrderWxamine(row)">{{ row.order_num }}</el-button> -->
            <br>
            <span v-if="row.get_store" class="tag sub-tag">{{ row.get_store.name.slice(0,2) }}</span>
            <p v-if="row.order_type === 1" class="tag sub-tag">代下单</p>
            <p v-if="row.is_back === 1" class="tag return-tag">退回</p>
            <p :class=" row.track_status === 0?'tag red-tag':'tag sub-tag'" @click="toDelivery(row.id)">{{ row.track_status | trackStatus }}</p>
            <p v-if="row.is_merge === 1" class="tag sub-tag" @click="goDetail(row.id)">合并</p>
          </template>
        </el-table-column>
        <el-table-column prop="created_at" align="center" label="下单时间" width="160" :show-overflow-tooltip="true" />
        <!-- <el-table-column label="所属政委" width="150" align="center">
          <template slot-scope="{ row: { get_user } }">
            {{ get_user && get_user.warea && get_user.warea.admin_name }}
          </template>
        </el-table-column> -->
        <el-table-column prop="get_user" label="备注昵称" align="center" width="150" :show-overflow-tooltip="true">
          <template slot-scope="{ row }">{{ row.get_user && row.get_user.name }}</template>
        </el-table-column>
        <el-table-column prop="get_user" label="下单人姓名" align="center" width="120" :show-overflow-tooltip="true">
          <template slot-scope="{ row }">{{ row.get_user && row.get_user.realname }}</template>
        </el-table-column>
        <el-table-column prop="status" align="center" label="订单状态" width="110" :show-overflow-tooltip="true">
          <template slot-scope="{ row }">
            <el-tag v-if="row.is_deleted === 1 || row.apply_status === 1" :type="row.is_deleted === 1 ? 'info' : 'warning'">{{ row.is_deleted === 1 ? '已作废' : '申请作废' }}</el-tag>
            <el-tag v-else :color="orderStatus(row.status).color" style="color:#ffffff;">{{ orderStatus(row.status).name }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="pay_status" align="center" label="支付状态" width="90" :show-overflow-tooltip="true">
          <template slot-scope="{ row }">
            <span :style="`color: ${payStatus(row.pay_status).color}`">{{ payStatus(row.pay_status).name }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="status" align="center" label="发货状态" width="120">
          <template slot-scope="{ row: { is_deleted } }">
            <el-tag v-if="is_deleted === 1" type="info">已作废</el-tag>
            <el-tag v-else-if="status < 3" effect="plain">待发货</el-tag>
            <el-tag v-else :color="orderStatus(status).color" style="color:#ffffff;">{{ orderStatus(status).name }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="total" label="数量合计" align="center" width="80" :show-overflow-tooltip="true">
          <template slot-scope="{ row }">
            <span style="cursor:pointer;color:#1890FF;" @click="toDialogOrderWxamine(row)">{{ row.total }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="money" label="订单总额" align="center" width="120" :show-overflow-tooltip="true">
          <template slot-scope="{ row }">{{ `￥${row.money}` }}</template>
        </el-table-column>
        <el-table-column prop="get_address" label="收货人" align="center" width="120" :show-overflow-tooltip="true">
          <template slot-scope="{ row }">{{ row.get_address && row.get_address.username }}</template>
        </el-table-column>
        <el-table-column prop="get_address" label="联系方式" align="center" width="120" :show-overflow-tooltip="true">
          <template slot-scope="{ row }">{{ row.get_address && row.get_address.mobile }}</template>
        </el-table-column>
        <el-table-column prop="get_address" label="收货地址" align="center" width="200" :show-overflow-tooltip="true">
          <template slot-scope="{ row: { get_address } }">{{ get_address && get_address.province+get_address.city+get_address.town+get_address.address }}</template>
        </el-table-column>
        <!-- <el-table-column
          prop="get_store"
          label="体验店订单"
          width="150"
          align="center"
        >
          <span slot-scope="{ row: { get_store } }">{{ (get_store && get_store.name) || '' }}</span>
        </el-table-column> -->
        <el-table-column prop="remark" label="订单备注" align="center" width="160" :show-overflow-tooltip="true" />
        <!-- <el-table-column prop="name" align="center" label="商品信息" width="98">
          <template slot-scope="{ row }">
            <el-button type="span" style="padding: 0" @click="handleSeeAllGoods(row)">查看详情</el-button>
          </template>
        </el-table-column> -->
        <el-table-column label="操作" width="50" align="center" fixed="right" :show-overflow-tooltip="true">
          <template slot="header">
            <i class="el-icon-s-operation" style="transform:rotate(90deg)" />
          </template>
          <template slot-scope="{ row }">
            <el-popover
              placement="left"
              width="60"
              trigger="hover"
            >
              <div class="popover">
                <i class="el-icon-document cursor" @click="toOrderWxamine(row)">订单详情</i>
                <i class="el-icon-truck cursor" @click="toDelivery(row.id)">发货详情</i>
                <i v-if="row.status === 2" v-permit="2" :roles-permit="roles" class="el-icon-s-promotion cursor" @click="handleOrderSpend(row)">发货</i>
                <i v-if="row.express" class="el-icon-truck cursor" @click="showExpress(row)">物流详情</i>
                <i v-if="row.status === 1 && (row.pay_status === 1 || row.pay_status === 0)" v-permit="1" :roles-permit="roles" class="el-icon-s-finance cursor" @click="accountBalance(row)">添加收款记录</i>
                <!-- <i class="el-icon-s-promotion cursor" @click="handleStoreOrder(row)">体验店订单</i>
                <i class="el-icon-s-release cursor" @click="cancelStoreOrder(row)">取消体验店订单</i> -->
                <i v-if="row.is_deleted !== 1 && row.status === 0" class="el-icon-delete-solid cursor" @click="setVoidOrder(row)">作废订单</i>
              </div>
              <i slot="reference" class="el-icon-more cursor" />
            </el-popover>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <!-- 分页 -->
    <pagination v-if="!highSearchFlag" :total="tableTotal" :limit="listQuery.page_size" :page="listQuery.page_index" @pagination="changePagination" @update:limit="changePagination" />
    <pagination v-else :total="exportForm.total" :limit="exportForm.page_size" :page="exportForm.page_index" @pagination="SeniorChangePagination" @update:limit="SeniorChangePagination" />
    <!-- 作废 -->
    <el-dialog
      title="订单作废确认"
      :visible.sync="visible.void"
      :show-close="false"
      :close-on-click-modal="false"
      class="dialog_remark dialog_void"
      width="520px"
    >
      <p>确认将订货单<span class="red">{{ voidOrderInfo.order_num }}</span>作废 ？ 订单作废后状态不可回退 ，<span class="red">如有关联的出库单将一并作废，相应的库存将退回原有仓库。</span> 如确定作废,请填写作废原因 :</p>
      <el-form>
        <el-form-item label="常用作废原因: ">
          <el-select v-model="voidTypeId">
            <el-option
              v-for="item in voidList"
              :key="item.id"
              :label="item.content"
              :value="item.id"
            />
          </el-select>
          <el-popover
            v-model="visible.add_void"
            placement="bottom-end"
          >
            <el-input
              v-model="addVoidContent"
              type="spanarea"
              resize="none"
              :autosize="{ minRows: 6, maxRows: 8}"
              placeholder="请添写常用作废原因"
            />
            <div style="float:right;margin-top: 15px;">
              <el-button plain size="mini" @click="resetAddVoid">取消</el-button>
              <el-button type="primary" size="mini" @click="submitAddVoid">添加</el-button>
            </div>
            <template slot="reference">
              <el-button type="span" style="margin-left: 10px;">添加其他常用原因</el-button>
            </template>
          </el-popover>
        </el-form-item>
        <el-form-item label="其他作废原因: ">
          <el-input
            v-model="remark.void"
            type="spanarea"
            resize="none"
            :autosize="{ minRows: 6, maxRows: 8}"
          />
        </el-form-item>
      </el-form>
      <div class="dialog_btn_box">
        <el-button size="small" @click="visible.void = false">取消</el-button>
        <el-button size="small" type="primary" @click="submitOrderVoid">确定</el-button>
      </div>
    </el-dialog>
    <!-- 修改收货地址 -->
    <el-dialog title="修改收货信息" :visible.sync="visible.address">
      <change-address :form="update.address" @update:cancel="visible.address = false" @update:success="()=>{ visible.address = false; getList() }" />
    </el-dialog>
    <!-- 查看订单全部商品 -->
    <el-drawer :title="`订单: ${orderInfo.ordersn}`" :visible.sync="visible.goods" direction="rtl">
      <div v-if="visible.goods" class="orderInfo">
        <p>收货信息</p>
        <el-form label-width="100px">
          <el-form-item label="收货人姓名:">{{ orderInfo.address.username }}</el-form-item>
          <el-form-item label="收货人手机:">{{ orderInfo.address.mobile }}</el-form-item>
          <el-form-item label="收货人地址:">{{ orderInfo.address.address }}</el-form-item>
          <el-form-item label="订单备注:">{{ orderInfo.desc ? orderInfo.desc : '代理未填写备注' }}</el-form-item>
          <el-form-item label="下单时间:">{{ orderInfo.created_at }}</el-form-item>
          <el-form-item label="当前订单状态:">{{ orderStatus(orderInfo.status).name }}</el-form-item>
        </el-form>
        <p>商品详情:</p>
        <ul class="orderGoodsList">
          <li v-for="item in orderInfo.ordergoods" :key="item.id" class="orderGoodsItem">
            <div class="orderGoodsHeader">
              <el-image :src="item.imgurl" fit="cover" style="width:60px;height:60px;margin-right:15px;" />
              <p>{{ item.goodsname }}</p>
            </div>
            <div v-for="(btem, i) in item.goodssku" :key="i" class="orderGoodsSku">
              <p>{{ `${btem.type}+${btem.size}` }}</p>
              <p>数量: {{ btem.num }}件</p>
              <p>总价: {{ Number(btem.price)*Number(btem.num) }}</p>
            </div>
          </li>
        </ul>
      </div>
    </el-drawer>
    <!-- 修改物流 -->
    <el-dialog
      title="发货"
      :visible.sync="dialog.spending"
      :show-close="false"
      :close-on-click-modal="false"
      class="dialog_spending"
    >
      <el-form ref="spendform" label-width="80px" :model="spendForm" :rules="spendRules">
        <el-form-item label="物流日期" prop="track_time">
          <el-date-picker
            v-model="spendForm.track_time"
            type="datetime"
            placeholder="选择日期时间"
            value-format="yyyy-MM-dd"
          />
        </el-form-item>
        <el-form-item label="物流公司" prop="track_company">
          <el-select v-if="toggle.company" v-model="spendForm.track_company" placeholder="请选择">
            <el-option label="德邦物流" value="德邦物流" />
            <el-option label="中通快递" value="中通快递" />
            <el-option label="中国邮政快递" value="中国邮政快递" />
          </el-select>
          <el-input v-else v-model="spendForm.track_company" type="span" />
          <br>
          <span v-if="toggle.company" class="handCompony" @click="toggle.company = false">手动填写</span>
          <span v-else class="handCompony" @click="toggle.company = true">选择公司</span>
        </el-form-item>
        <el-form-item label="物流单号" prop="track_number">
          <el-input v-model="spendForm.track_number" type="span" />
        </el-form-item>
        <el-form-item label="物流备注">
          <el-input v-model="spendForm.track_remark" type="spanarea" />
        </el-form-item>
        <el-form-item label="自动收货" prop="day">
          <el-input v-model="spendForm.day" type="number" min="1">
            <span slot="append">天</span>
          </el-input>
        </el-form-item>
        <el-form-item>
          <el-button size="small" @click="dialog.spending = false">取消</el-button>
          <el-button size="small" type="primary" @click="submitOrderSpend">确定</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
    <!-- 高级搜索 -->
    <el-dialog
      title="高级搜索"
      :visible.sync="dialog.export"
      :show-close="false"
      :close-on-click-modal="false"
      class="dialog_export"
      top="50px"
    >
      <el-form label-width="80px">
        <el-form-item label="订单编号">
          <el-input v-model="exportForm.order_num" type="span" placeholder="请输入订货单号" style="width: 400px" />
        </el-form-item>
        <el-form-item label="下单人">
          <el-input v-model="exportForm.name" type="span" placeholder="请输入备注昵称/姓名/手机号" style="width: 400px" />
        </el-form-item>
        <el-form-item label="下单时间">
          <el-date-picker
            v-model="exportForm.time"
            value-format="yyyy-MM-dd HH:mm"
            format="yyyy-MM-dd HH:mm"
            type="datetimerange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
          />
        </el-form-item>
        <el-form-item label="活动名称">
          <el-select v-model="exportForm.activity_id" style="width: 400px">
            <el-option label="全部" value="" />
            <el-option v-for="item in activitys" :key="item.id" :label="item.title" :value="item.id" />
          </el-select>
        </el-form-item>
        <el-form-item label="收货信息">
          <el-input v-model="exportForm.address" type="span" placeholder="收货人/收货电话" style="width: 400px" />
        </el-form-item>
        <el-form-item label="收货地址">
          <VDistpicker :province="exportForm.provice" :city="exportForm.city" :area="exportForm.area" @province="province => exportForm.provice = province.value" @city="city => exportForm.city = city.value" @area="area => exportForm.area = area.value" />
        </el-form-item>
        <el-form-item label="商品信息">
          <el-input v-model="exportForm.good" type="span" placeholder="输入商品名称" style="width: 400px" />
        </el-form-item>
        <el-form-item label="订单状态">
          <div style="display:flex;">
            <div style="margin-right:20px">
              <el-checkbox v-model="checkAll" :indeterminate="isIndeterminate" @change="handleCheckAllChange">全选</el-checkbox>
            </div>
            <el-checkbox-group v-model="exportForm.order_status" @change="handleCheckedCitiesChange">
              <el-checkbox v-for="(item,index) in statusTree" :key="index" :value="item.id" :label="item.id">{{ item.label }}</el-checkbox>
            </el-checkbox-group>
          </div>
        </el-form-item>
        <el-form-item label="支付状态">
          <div style="display:flex;">
            <div style="margin-right:20px">
              <el-checkbox v-model="checkAlls" :indeterminate="isIndeterminates" @change="handleCheckAllChanges">全选</el-checkbox>
            </div>
            <el-checkbox-group v-model="exportForm.pay_status" @change="handleCheckedCitiesChanges">
              <el-checkbox v-for="(item,index) in paystatusTree" :key="index" :value="item.id" :label="item.id">{{ item.label }}</el-checkbox>
            </el-checkbox-group>
          </div>
        </el-form-item>
        <el-form-item label="下单方式">
          <el-radio-group v-model="exportForm.type">
            <el-radio :label="-1">全部</el-radio>
            <el-radio :label="0">自主下单</el-radio>
            <el-radio :label="1">代下单</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item>
          <el-button @click="dialog.export = false">取消</el-button>
          <el-button type="primary" @click="highSearchFlag = true;submitExport()">搜索</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
    <el-dialog
      title="物流详情"
      :visible.sync="dialog.express"
      :show-close="false"
      width="80%"
      top="66px"
      class="dialog_export"
    >
      <iframe :src="express" frameborder="0" style="width: 100%; height: 456px" />
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialog.express = false">取 消</el-button>
        <el-button type="primary" @click="dialog.express = false">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 添加收款记录 -->
    <el-dialog
      title="添加收款记录"
      :visible.sync="dialog.receive"
      :show-close="false"
      :close-on-click-modal="false"
      class="dialog_receive"
    >
      <p class="title_1">待支付：{{ parseMoney(addRechargeItem && addRechargeItem.no_pay_money) }}</p>
      <div class="title_2">
        <span>订单金额：{{ parseMoney(addRechargeItem && addRechargeItem.money) }}</span>
        <span>已付款：{{ parseMoney(addRechargeItem && addRechargeItem.pay_money) }}</span>
        <span>{{ addRechargeItem && addRechargeItem.order_num }}</span>
      </div>
      <el-form ref="rechargeform" label-width="80px" :model="rechargeForm" :rules="rechargeRules">
        <div class="pay_form">
          <p class="fixedH2">账户余额</p>
          <div class="pay_from_body balance_body">
            <el-form-item label="付款金额" style="width: 300px;margin-bottom: 0;" prop="money">
              <el-input v-model="rechargeForm.money" type="span" />
            </el-form-item>
            <span class="balance">余额: {{ parseMoney(agentBanlance) }}</span>
          </div>
        </div>
        <div class="pay_form">
          <p class="fixedH2 morefixedH">线下付款</p>
          <div class="pay_from_body">
            <el-form-item label="付款金额" style="width: 300px" prop="p_money">
              <el-input v-model="rechargeForm.p_money" type="span" />
            </el-form-item>
            <el-form-item label="备注">
              <el-input v-model="rechargeForm.remark" type="spanarea" style="width: 300px" />
            </el-form-item>
          </div>
        </div>
        <el-form-item>
          <el-button size="small" @click="resetDialogRecharge">取消</el-button>
          <el-button size="small" type="primary" @click="handleSubmitRecharge">确定</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
    <!-- 体验店订单 -->
    <el-dialog
      title="选择体验店"
      :visible.sync="dialog.store"
      :show-close="false"
      :close-on-click-modal="false"
      class="dialog_receive"
    >
      <el-radio v-for="item in storeList" :key="item.id" v-model="storeOrder.store_id" :label="item.id">{{ item.name }}</el-radio>
      <br>
      <div style="margin-top:15px">
        <el-button @click="resetStoreOrder">取消</el-button>
        <el-button type="primary" @click="addStoreOrder">确定</el-button>
      </div>
    </el-dialog>
    <el-dialog title="导入单号" :visible.sync="dialog.import_wuliu" :before-close="resetImport">
      <div class="upload-main" style="height:400px">
        <!-- <div class="upload-container">
          <el-button type="span" class="download" style="color: #606266; cursor: auto">导入类型</el-button>
          <el-select v-model="export_type" style="width: 400px">
            <el-option value="0" label="物流模板" />
            <el-option value="1" label="拆单物流" />
          </el-select>
        </div> -->
        <div class="upload-container">
          <!-- <el-button v-if="export_type === '0'" type="span" class="download" @click="exportTemp">物流模板</el-button> -->
          <el-button type="span" class="download" @click="exportTemp">拆单模板</el-button>
          <el-upload action="" :show-file-list="false" :http-request="handleImport">
            <div>
              <div style="position:relative">
                <el-input v-model="import_name" type="span" class="input">
                  <i slot="append" class="el-icon-upload2" />
                </el-input>
                <i class="block" />
              </div>
            </div>
          </el-upload>
        </div>
        <div class="upload-container">
          <p style="color: red">单次最多上传5000条</p>
        </div>
        <div class="upload-container">
          <el-button size="small" style="margin-right:10px" @click="resetImport">取消</el-button>
          <!-- <el-button v-if="export_type === '0'" size="small" type="primary" @click="importTemp">导入</el-button> -->
          <el-button size="small" type="primary" @click="importTempChaiDan">导入</el-button>
        </div>
      </div>
    </el-dialog>
    <!-- 更新物流 -->
    <el-dialog title="修改单号" :visible.sync="dialog.import_wuliunew" :before-close="resetImportnew">
      <div class="upload-main" style="height:400px">
        <div class="upload-container">
          <el-button type="span" class="download" @click="exportTempnew">物流模板</el-button>
          <el-upload action="" :show-file-list="false" :http-request="handleImportnew">
            <div>
              <div style="position:relative">
                <el-input v-model="importnew_name" type="span" class="input">
                  <i slot="append" class="el-icon-upload2" />
                </el-input>
                <i class="block" />
              </div>
            </div>
          </el-upload>
        </div>
        <div class="upload-container">
          <!-- <p style="color: red">单次最多上传5000条</p> -->
        </div>
        <div class="upload-container">
          <el-button size="small" style="margin-right:10px" @click="resetImportnew">取消</el-button>
          <el-button size="small" type="primary" @click="importTempwuliu">导入</el-button>
        </div>
      </div>
    </el-dialog>
    <!-- 上传赠品 -->
    <el-dialog title="上传赠品" :visible.sync="dialog.import_gift" :before-close="resetImportgift">
      <div class="upload-main" style="height:400px">
        <div class="upload-container">
          <el-button type="span" class="download" @click="exportgift">下载模板</el-button>
          <el-upload action="" :show-file-list="false" :http-request="handleImportgift">
            <div>
              <div style="position:relative">
                <el-input v-model="importn_gift" type="span" class="input">
                  <i slot="append" class="el-icon-upload2" />
                </el-input>
                <i class="block" />
              </div>
            </div>
          </el-upload>
        </div>
        <div class="upload-container">
          <!-- <p style="color: red">单次最多上传5000条</p> -->
        </div>
        <div class="upload-container">
          <el-button size="small" style="margin-right:10px" @click="resetImportgift">取消</el-button>
          <el-button size="small" type="primary" @click="importTempGift">导入</el-button>
        </div>
      </div>
    </el-dialog>
    <!-- 发货详情 -->
    <el-dialog title="发货详情" :visible.sync="dialog.import_delivery" width="50%">
      <div>
        <div style="font-weight:bold;margin:0 0 20px 10px;font-size:18px">已上传数量：<span style="color:#FF4949">{{ deliveryTotal }}</span></div>
        <div v-for="(item,index) in deliveryList" :key="index" class="deliveryList">
          <div class="deliveryList_title">
            <div class="bold">第{{ item.number }}次发货，共{{ item.get_express.length }}箱</div>
            <div class="kuaidi">{{ item.express_com }}</div>
            <div class="time">{{ item.created_at }}</div>
          </div>
          <el-table
            :data="item.get_express"
            stripe
            border
            :header-cell-style="{ background: '#f8fbfc' }"
            style="width: 100%"
          >
            <el-table-column
              label="箱数"
              align="center"
              width="100"
            >
              <template slot-scope="scope">
                {{ scope.$index+1 }}
              </template>
            </el-table-column>
            <el-table-column
              prop="express_number"
              label="单号"
              align="center"
              width="180"
            />
            <el-table-column
              prop="remark"
              label="备注"
              align="center"
              width="140"
              :show-overflow-tooltip="true"
            />
            <el-table-column
              prop="note"
              label="货物信息"
              align="center"
              width="180"
              :show-overflow-tooltip="true"
            />
            <el-table-column
              prop="is_gift"
              align="center"
              label="类型"
            >
              <template slot-scope="{ row }">
                <el-tag :type="row.is_gift == 0?'':'warning'">{{ row.is_gift == 0?'货物':'礼品' }}</el-tag>
              </template>
            </el-table-column>
            <el-table-column
              align="center"
              label="操作"
              width="220"
            >
              <template slot-scope="{ row }">
                <!-- <el-button size="small" :type="row.is_gift==0?'':'warning'" @click="handleToogleExpand(row)">{{ row.is_gift==0?'货物详情':'礼品详情' }}</el-button> -->
                <el-button size="small" type="primary" @click="handleWuliu(row.id)">物流查询</el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </div>
    </el-dialog>
    <!-- 货物详情 -->
    <el-dialog :title="gift?'礼品详情':'货物详情'" :visible.sync="dialog.import_detail" width="40%" :before-close="closeDetail">
      <div class="PanKuContainer">
        <div v-if="gift === true" style="padding: 30px;">
          <div v-for="(item,index) in gift_liste" :key="index" class="boxe">
            <div class="box_left">
              <el-image style="width: 100px; height: 100px" :src="item.imgurl" />
            </div>
            <div class="boxe_right">
              <div class="name">
                {{ item.name }}
              </div>
              <div class="num">
                数量：{{ item.nums }}
              </div>
            </div>
          </div>
        </div>
        <div
          v-else
          class="goodList"
          :style="{ paddingBottom: `${ status ? '100px' : '0px' }` }"
        >
          <div
            v-for="(item, i) in infoList"
            :key="i"
            class="goodItem"
          >
            <div class="skuContainer">
              <div
                class="header"
                :class="item.toggle ? 'open' : ''"
                @click="item.toggle = !item.toggle"
              >
                <div class="top">
                  <div
                    class="avatar"
                    :style="{ backgroundImage: `url(${item.imgurl})` }"
                  />
                  <div class="info">
                    <div class="name">{{ item.name }}</div>
                    <div class="fixed">一年零一天不满意退钱</div>
                  </div>
                </div>
              </div>
              <div v-if="item.toggle" class="skuList">
                <div class="skuHeader">
                  <div class="type">规格</div>
                  <div class="size">尺码</div>
                  <div class="num">数量</div>
                </div>
                <div
                  v-for="(btem, bi) in item.spec"
                  :key="bi"
                  class="skuItem"
                >
                  <div class="type color">{{ btem.sex ? '男款' : '女款' }}</div>
                  <div class="size color">{{ btem.size }}</div>
                  <div class="num color">{{ btem.num }}</div>
                </div>
              </div>
              <div class="dataAll">
                <div class="sex">
                  男款:{{ item.men }}{{ unit }}
                  /
                  女款:{{ item.women }}{{ unit }}
                </div>
                <div class="num">
                  合计：<span class="spec">{{ item.total }}{{ unit }}</span>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </el-dialog>
    <!-- 发货详情 -->
    <el-dialog title="物流详情" :visible.sync="dialog.import_wuliuDetail" width="40%">
      <div class="wuliuDetail">
        <el-steps direction="vertical" :active="1">
          <el-step v-for="(item,index) in wuliuList" :key="index" icon="el-icon-truck" :title="happenTimeFun(item.AcceptTime)" :description="item.AcceptStation" />
        </el-steps>
      </div>
    </el-dialog>
    <el-dialog title="导出数据" :visible.sync="dialog.export_order" width="520px">
      <el-form label-width="120">
        <el-form-item label="导出类型">
          <el-button type="primary" @click="exportOrder">订单明细</el-button>
          <el-button type="primary" @click="exporOrdertOrder">拆单明细</el-button>
          <el-button type="primary" @click="exportMoney">订单金额</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
    <el-dialog title="导入" :visible.sync="dialog.lead_order" width="520px">
      <el-form label-width="120">
        <el-form-item label="导入类型">
          <el-button type="primary" @click="dialog.import_wuliu = true">导入单号</el-button>
          <el-button type="primary" @click="dialog.import_wuliunew = true">修改单号</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
    <el-dialog v-if="order_examine_dialog" title="订单详情" :visible.sync="order_examine_dialog" width="80%" top="50px">
      <examine :order-num="examine_order_num" />
    </el-dialog>
    <el-dialog title="合并订单详情" :visible.sync="dialog.order" width="50%" top="50px">
      <el-scrollbar style="height:100%" class="titleTop">
        <div>
          <div v-for="(item,index) in titleList" :key="index" class="titleTop-name">
            {{ item }}
          </div>
        </div>
        <div class="list">
          <div v-for="(item, i) in list" :key="i">
            <div v-for="(str, indexe) in item" :key="indexe" class="list-item">
              <span>{{ str }}</span>
            </div>
          </div>
        </div>
      </el-scrollbar>
    </el-dialog>
  </div>
</template>

<script>
import { getList, orderPass, orderreJect, downOrder, toExport, orderSpend, UpdateExpress, UploadOrderGift, highSearch, machAuditOrder, getStore, addStoreOrder, cancelStoreOrder, toMergeOrder, mergeOrderInfo, downList, GetOrderDetail } from '@/api/order/list'
import { cancelOrder } from '@/api/order/common'
import { getGoodDetail, goodsDetail, expressSearch } from '@/api/order/delivery '
import { orderStatus, payStatus } from '@/filters/common'
import ChangeAddress from './components/ChangeAddress'
import { formatter } from '@/filters/index'
import { activityList } from '@/api/giftB'
import * as examine_api from '@/api/order/examine'
// import { sendOrder } from "@/api/studio/order";
// 验证金额
const isMoney = /^\d+(\.\d{1,2})?$/
import { accountBalance, addRecharge } from '@/api/order/examine'
// money
import { parseMoney } from '@/utils/index'
import VDistpicker from 'v-distpicker'
import examine from './examine2'
const giftList = {
  '订单编号': '',
  '快递公司': '',
  '快递单号': '',
  '快递公司代码': '',
  '备注': '',
  '赠品1': '',
  '赠品2': '',
  '赠品3': ''
}
const newList = {
  '订单编号': '',
  '快递公司': '',
  '旧快递单号': '',
  '新快递单号': ''
}
const wuliuList = {
  '订单编号': '',
  '下单时间': '',
  '寄件人': '瞳年视界',
  '备注昵称': '',
  '下单人姓名': '',
  '下单人手机号': '',
  '收件人': '',
  '电话': '',
  '收件人省': '',
  '收件人市': '',
  '收件人区': '',
  '收件人街道地址': '',
  '眼贴': '',
  '精装透灰': '',
  '精装透粉': '',
  '儿童蓝色': '',
  '儿童粉色': '',
  '平光镜': '',
  '老花100度': '',
  '老花150度': '',
  '老花200度': '',
  '老花250度': '',
  '老花300度': '',
  '精男老花100度': '',
  '精男老花150度': '',
  '精男老花200度': '',
  '精男老花250度': '',
  '精男老花300度': '',
  '精女老花100度': '',
  '精女老花150度': '',
  '精女老花200度': '',
  '精女老花250度': '',
  '精女老花300度': '',
  // '数据求和': '',
  '备注': '',
  '赠品': '',
  '快递单号': '',
  '快递公司': '',
  '发货状态': '',
  '未发明细': ''
}
const moduleList = {
  '订单编号': '',
  '下单时间': '',
  '寄件人': '瞳年视界',
  '备注昵称': '',
  '下单人姓名': '',
  '下单人手机号': '',
  '收件人': '',
  '电话': '',
  '收件人省': '',
  '收件人市': '',
  '收件人区': '',
  '收件人街道地址': '',
  '眼贴': '',
  '精装透灰': '',
  '精装透粉': '',
  '儿童蓝色': '',
  '儿童粉色': '',
  '平光镜': '',
  '老花100度': '',
  '老花150度': '',
  '老花200度': '',
  '老花250度': '',
  '老花300度': '',
  '精男老花100度': '',
  '精男老花150度': '',
  '精男老花200度': '',
  '精男老花250度': '',
  '精男老花300度': '',
  '精女老花100度': '',
  '精女老花150度': '',
  '精女老花200度': '',
  '精女老花250度': '',
  '精女老花300度': '',
  // '数据求和': '',
  '备注': '',
  '赠品': ''
}
export default {
  name: 'OrderList',
  components: { ChangeAddress, VDistpicker, examine },
  // examine
  filters: {
    trackStatus(v) {
      if (v === 0) {
        return '未发货'
      } else if (v === 1) {
        return '部分发货'
      } else {
        return '全部发货'
      }
    }
  },
  data() {
    const receiveMoney = (rule, value, cb) => {
      if (!value) {
        this.rechargeForm.money = 0
        cb()
      }
      if (!isMoney.test(value)) {
        return cb(new Error('请输入正确的金额'))
      } else {
        value = Number(value)
        if (value === 0 && Number(this.rechargeForm.p_money) === 0) {
          return cb(new Error('余额金额和线下付款金额不能都为0'))
        } else {
          if (value > this.agentBanlance) {
            return cb(new Error('充值金额不能大于余额'))
          } else {
            if (value + Number(this.rechargeForm.p_money) > Number(this.addRechargeItem.no_pay_money)) {
              return cb(new Error('充值金额不能大于待支付金额'))
            } else {
              cb()
            }
          }
        }
      }
    }
    const receivePMoney = (rule, value, cb) => {
      if (!value) {
        this.rechargeForm.p_money = 0
        cb()
      }
      if (!isMoney.test(value)) {
        return cb(new Error('请输入正确的金额'))
      } else {
        value = Number(value)
        if (value === 0 && Number(this.rechargeForm.money) === 0) {
          return cb(new Error('线下付款金额和余额金额不能都为0'))
        } else {
          if (value + Number(this.rechargeForm.money) > Number(this.addRechargeItem.no_pay_money)) {
            return cb(new Error('充值金额不能大于待支付金额'))
          } else {
            cb()
          }
        }
      }
    }
    return {
      status: false,
      gift: false,
      infoList: [],
      gift_liste: [],
      wuliuList: [],
      unit: '件',
      order_id: '',
      num_1: 0, num_2: 0, num_3: 0, num_4: 0, num_5: 0, num_6: 0, num_7: 0, num_8: 0,
      role: this.$store.state.user.name,
      roles: this.$route.meta.buttonAuthList ? this.$route.meta.buttonAuthList : [],
      authList: this.$route.meta.authList,
      isRoot: this.$store.getters.role === 'root',
      gift_list: [],
      listQuery: {
        order_status: '0',
        order_no: '',
        page_index: 1,
        page_size: 20,
        time: '',
        search_name: '',
        activity_id: ''
      },
      tableHeight: 0,
      toggle: {
        company: false
      },
      titleList: [],
      list: [],
      table: [],
      tableTotal: 0,
      visible: {
        address: false,
        goods: false,
        void: false,
        add_void: false,
        order: false
      },
      update: {
        address: {}
      },
      orderInfo: {
        ordersn: '',
        name: '',
        desc: '',
        ordergoods: [],
        address: {
          username: '',
          mobile: '',
          address: ''
        }
      },
      loadingFull: false,
      downloadLoading: false,
      temp: [
        { '订单编号': '', '物流单号': '', '物流公司': '', '物流日期': '', '物流备注': '' }
      ],
      dialog: {
        spending: false,
        lead_order: false,
        export: false,
        import_gift: false,
        express: false,
        receive: false,
        store: false,
        order: false,
        import_detail: false,
        import_delivery: false,
        import_wuliu: false,
        import_wuliuDetail: false,
        import_wuliunew: false,
        export_order: false,
        export_order_type: '0'
      },
      deliveryList: [],
      express: '',
      spendForm: {
        order_num: '',
        day: 15,
        track_number: '',
        track_company: '',
        track_remark: '',
        track_time: ''
      },
      spendRules: {
        day: [
          { required: true, message: '请填写自动收货时间', trigger: 'blur' }
        ],
        track_number: [
          { required: true, message: '请填写物流单号', trigger: 'blur' }
        ],
        track_company: [
          { required: true, message: '请填写物流公司', trigger: 'blur' }
        ],
        track_time: [
          { required: true, message: '请选择发货时间', trigger: 'blur' }
        ]
      },
      statusTree: [
        {
          id: 0,
          label: '待订单审核'
        },
        {
          id: 1,
          label: '待财务审核'
        },
        {
          id: 2,
          label: '待发货审核'
        },
        {
          id: 3,
          label: '待收货'
        },
        {
          id: 4,
          label: '已完成'
        },
        {
          id: 5,
          label: '已作废'
        }
      ],
      paystatusTree: [
        {
          id: 0,
          label: '未付款'
        },
        {
          id: 1,
          label: '部分付款'
        },
        {
          id: 2,
          label: '已付款'
        },
        {
          id: 3,
          label: '待退款'
        }
      ],
      isIndeterminate: false,
      isIndeterminates: false,
      checkAlls: false,
      checkAll: false,
      oreder_status: [],
      checkedCities: [],
      // allOreder_status:[],
      exportForm: {
        order_num: '',
        name: '',
        time: '',
        good: '',
        address: '',
        status: [],
        order_status: [],
        pay_status: [],
        type: -1,
        page_size: 10,
        page_index: 1,
        total: 0,
        provice: '',
        city: '',
        area: '',
        activity_id: ''
      },
      highSearchFlag: false,
      orderMulSelection: [],
      chooseList: [],
      kefuNum: 0,
      caiwuNum: 0,
      wuliuNum: 0,
      exportMulSelection: [],
      rechargeForm: {
        money: 0,
        p_money: 0,
        remark: ''
      },
      rechargeRules: {
        money: [
          { validator: receiveMoney, trigger: 'blur' }
        ],
        p_money: [
          { validator: receivePMoney, trigger: 'blur' }
        ]
      },
      agentBanlance: 0,
      addRechargeItem: {},
      storeList: [],
      storeOrder: {
        order_id: '',
        store_id: ''
      },
      activitys: [],
      expressData: {},
      import_name: '',
      importnew_name: '',
      importn_gift: '',
      import_file: null,
      export_type: '0',
      order_examine_dialog: false,
      examine_order_num: '',
      mergeOrderVis: false,
      mergeOrderForm: {
        master_num: '',
        slave_num: '',
        remark: '',
        main: ''
      },
      deliveryTotal: '',
      mergeOrdersInfo: {
        order_master: null,
        order_slave: null
      },
      sureMergeVis: false,
      needMergeOrderList: [],
      voidOrderInfo: {},
      voidList: [],
      voidTypeId: '',
      addVoidContent: '',
      remark: {
        void: ''
      }
    }
  },
  watch: {
    status(a) {
      this.unit = a ? '件' : '套'
    },
    'listQuery.time'(a, b) {
      if (!a && b) {
        this.listQuery.time = []
        this.getList()
      }
    },
    'dialog.export_order'(a, b) {
      if (!a) {
        this.dialog.export_order_type = '0'
      }
    },
    'visible.void'(a) {
      if (a) {
        this.getVoidList()
      } else {
        this.resetVoidRemark()
      }
    }
  },
  created() {
    this.orderStatus = orderStatus
    this.payStatus = payStatus
    this.parseMoney = parseMoney
    this.activityList(() => {
      this.getList()
    })
    this.getStore()
  },
  mounted() {
    this.$nextTick(() => {
      this.tableHeight = document.getElementsByClassName('table-wrapper')[0].offsetHeight
    })
  },
  methods: {
    selectEnable(row, rowIndex) {
      if (row.is_deleted === 0 && row.apply_status === 1) {
        return false
      } else {
        return true
      }
    },
    // 跳转到发货详情页面
    toDelivery(id) {
      getGoodDetail({ id }).then(res => {
        this.deliveryList = res.data.list
        this.deliveryTotal = res.data.total
        if (this.deliveryList.length > 0) {
          this.dialog.import_delivery = true
        } else {
          this.$message.error('暂无发货信息')
        }
      })
    },
    // 查看货物详情
    handleToogleExpand(row) {
      this.dialog.import_detail = true
      if (row.is_gift === 0) {
        this.gift = false
        this.status = row.status ? Boolean(Number(row.status)) : false
        this.order_id = row.id
        this.getRuKuInfo()
      } else {
        this.gift = true
        this.gift_liste = JSON.parse(row.notes)
      }
    },
    // 物流查询
    handleWuliu(id) {
      expressSearch({ id }).then(res => {
        if (res.data.Traces.length < 1) {
          this.$message.error('暂无物流信息')
        } else {
          this.dialog.import_wuliuDetail = true
          this.wuliuList = res.data.Traces.reverse()
        }
      })
    },
    // 获取详情
    getRuKuInfo() {
      const _this = this
      goodsDetail({ id: _this.order_id }).then(res => {
        if (res.code === 200) {
          Object.keys(res.data).forEach(k => {
            if (res.data[k].spec.length > 0) {
              res.data[k].toggle = true
              res.data[k].attr = _this.changeKey(k)
              res.data[k].men = res.data[k].spec.filter(({ sex }) => sex).reduce((a, b) => a + Number(b.num), 0)
              res.data[k].women = res.data[k].spec.filter(({ sex }) => !sex).reduce((a, b) => a + Number(b.num), 0)
              res.data[k].total = res.data[k].spec.reduce((a, b) => a + Number(b.num), 0)
              _this.infoList.push(res.data[k])
            }
          })
        }
      }).catch(() => {})
    },
    closeDetail() {
      this.dialog.import_detail = false
      this.infoList = []
    },
    changeKey(k) {
      let out = ''
      switch (k) {
        case 'hard':
          out = '精装版'
          break
        case 'new_old':
          out = '纯棉老人版'
          break
        case 'old':
          out = '老人版'
          break
        case 'simple':
          out = '简约版'
          break
        default:
          out = '简约版'
          break
      }
      return out
    },
    // 合并订单详情
    goDetail(id) {
      if (this.isRoot === true || this.roles.indexOf(4) !== -1) {
        this.id = id
        this.dialog.order = true
        this.GetDetail()
      }
    },
    happenTimeFun(num) { // 时间戳数据处理
      const date = new Date(num)
      // 时间戳为10位需*1000，时间戳为13位的话不需乘1000
      const y = date.getFullYear()
      const MM = (date.getMonth() + 1) < 10 ? ('0' + (date.getMonth() + 1)) : (date.getMonth() + 1)// 月补0
      const d = date.getDate() < 10 ? ('0' + date.getDate()) : date.getDate()// 天补0
      const h = date.getHours() < 10 ? ('0' + date.getHours()) : date.getHours()// 小时补0
      const m = date.getMinutes() < 10 ? ('0' + date.getMinutes()) : date.getMinutes()// 分钟补0
      const s = date.getSeconds() < 10 ? ('0' + date.getSeconds()) : date.getSeconds()// 秒补0
      return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s
    },
    GetDetail() {
      GetOrderDetail({ id: this.id }).then(res => {
        if (res.code === 200) {
          this.list = res.data
          const list = this.list
          const titleList = ['款式尺码']
          for (var i = 0; i < list.length; i++) {
            titleList[i + 1] = '订单' + (i + 1)
          }
          titleList.push('合并')
          titleList.splice(list.length - 1, 2)
          this.titleList = titleList
        } else {
          this.$message.error(res.message)
        }
      }).catch(() => {
        this.$message.error('获取合并订单失败')
      })
    },
    handleCheckAllChange(val) {
      const all = this.statusTree.map(item => {
        return item.id
      })
      this.exportForm.order_status = val ? all : []
      this.isIndeterminate = false
    },
    handleCheckedCitiesChange(value) {
      const checkedCount = value.length
      this.checkAll = checkedCount === this.statusTree.length
      this.isIndeterminate = checkedCount > 0 && checkedCount < this.statusTree.length
    },
    handleCheckAllChanges(val) {
      const all = this.paystatusTree.map(item => {
        return item.id
      })
      this.exportForm.pay_status = val ? all : []
      this.isIndeterminates = false
    },
    handleCheckedCitiesChanges(value) {
      const checkedCount = value.length
      this.checkAlls = checkedCount === this.paystatusTree.length
      this.isIndeterminates = checkedCount > 0 && checkedCount < this.paystatusTree.length
    },
    // 获取订单作废原因
    getVoidList() {
      const loading = this.$loading()
      examine_api.getVoidList().then(res => {
        loading.close()
        if (res.code === 200) {
          this.voidList = res.data
        } else {
          this.$message.error(res.message || '获取订单作废原因失败')
        }
      }).catch(() => {
        loading.close()
        this.$message.error('获取订单作废原因失败')
      })
    },
    // 作废订单
    setVoidOrder(row) {
      Object.assign(this.voidOrderInfo, row)
      this.visible.void = true
    },
    resetVoidRemark() {
      this.voidList = []
      this.remark.void = ''
      this.voidTypeId = ''
      this.voidOrderInfo = {}
      this.visible.void = false
    },
    // 作废
    submitOrderVoid() {
      if (!this.voidTypeId && !this.remark.void) {
        this.$message.error('请选择作废原因或填写作废原因')
        return false
      }
      const content = this.voidTypeId && this.voidList.length > 0 ? this.voidList.find(({ id }) => +id === this.voidTypeId).content : ''
      // if (!this.remark.void) {
      //   this.$message.error('请填写作废信息')
      //   return false
      // }
      this.loadingFull = true
      examine_api.toDelete({
        order_num: this.voidOrderInfo.order_num,
        remark: `${content}${this.remark.void}`
      }).then(res => {
        this.loadingFull = false
        if (res.code === 200) {
          this.resetVoidRemark()
          this.getList()
          this.$message.success(res.message)
        } else {
          this.$message.error(res.message)
        }
      }).catch(e => {
        this.loadingFull = false
      })
    },
    // 添加订单作废原因
    submitAddVoid() {
      if (!this.addVoidContent) {
        this.$message.error('请添加作废原因')
        return false
      }
      const loading = this.$loading()
      examine_api.addVoid({
        content: this.addVoidContent
      }).then(res => {
        loading.close()
        if (res.code === 200) {
          this.resetAddVoid()
          this.getVoidList()
        } else {
          this.$message.error(res.message || '添加作废原因失败')
        }
      }).catch(() => {
        loading.close()
        this.$message.error('添加作废原因失败')
      })
    },
    resetAddVoid() {
      this.visible.add_void = false
      this.addVoidContent = ''
    },
    // 合并订单
    showMergeOrder() {
      const len = this.needMergeOrderList.length
      if (len !== 2) {
        this.$message.error('请选择2个订单')
        return false
      }
      this.mergeOrderForm.master_num = this.needMergeOrderList[0].order_num
      this.mergeOrderForm.slave_num = this.needMergeOrderList[1].order_num
      this.mergeOrderVis = true
    },
    // 提交合并
    submitToMergeOrder() {
      if (!this.mergeOrderForm.main) {
        this.$message.error('请选择主订单')
        return false
      }
      this.$confirm(`确认将2个订单合并为1个,并将订单:${this.mergeOrderForm.main}设为主订单?`, '提示', {
        confirmButtonspan: '确定',
        cancelButtonspan: '取消',
        type: 'warning'
      }).then(() => {
        this.loadingFull = true
        toMergeOrder(this.mergeOrderForm).then(res => {
          this.loadingFull = false
          if (res.code === 200) {
            this.$message.success('订单合并成功')
            this.cancelToMergeOrder()
            this.cancelMergeOrderInfo()
            this.getList()
          } else {
            this.$message.error(res.message || '订单合并失败')
          }
        }).catch(() => {
          this.loadingFull = false
          this.$message.error('订单合并失败')
        })
      }).catch(() => {})
    },
    // 取消合并
    cancelToMergeOrder() {
      this.mergeOrdersInfo = {
        order_master: null,
        order_slave: null
      }
      this.mergeOrderForm.remark = ''
      this.mergeOrderForm.main = ''
      this.sureMergeVis = false
      this.mergeOrderVis = true
    },
    // 取消合并详情
    cancelMergeOrderInfo() {
      this.mergeOrderForm = {
        master_num: '',
        slave_num: '',
        remark: '',
        main: ''
      }
      this.mergeOrderVis = false
    },
    // 获取合并订单信息
    getMergeOrderInfo() {
      this.loadingFull = true
      mergeOrderInfo({
        master_num: this.mergeOrderForm.master_num,
        slave_num: this.mergeOrderForm.slave_num
      }).then(res => {
        this.loadingFull = false
        if (res.code === 200) {
          this.mergeOrdersInfo = res.data
          this.mergeOrderVis = false
          this.sureMergeVis = true
        } else {
          this.$message.error(res.message || '获取合并订单失败')
        }
      }).catch(() => {
        this.loadingFull = false
        this.$message.error('获取合并订单失败')
      })
    },
    toDialogOrderWxamine(item) {
      this.order_examine_dialog = true
      this.examine_order_num = item.order_num
    },
    cancelStoreOrder(item) {
      this.$confirm('确定取消店铺订单?', '提示').then(() => {
        cancelStoreOrder({
          order_id: item.id
        }).then(res => {
          if (res.code === 200) {
            this.$message.success('成功')
            this.getList()
          } else {
            this.$message.error(res.message || '取消店铺订单失败')
          }
        })
      })
    },
    toExportOrder() {
      const type = this.dialog.export_order_type
      if (type === '0') {
        this.exportOrder()
      } else {
        this.exporOrdertOrder()
      }
    },
    // 导入
    handleImport(params) {
      const file = params.file
      if (!file) return
      this.import_name = file.name
      this.import_file = file
    },
    handleImportnew(params) {
      const file = params.file
      if (!file) return
      this.importnew_name = file.name
      this.import_file = file
    },
    handleImportgift(params) {
      const file = params.file
      if (!file) return
      this.importn_gift = file.name
      this.import_file = file
    },
    // 重置导入
    resetImport() {
      this.import_name = ''
      this.import_file = null
      this.dialog.import_wuliu = false
      this.export_type = '0'
    },
    resetImportnew() {
      this.importnew_name = ''
      this.import_file = null
      this.dialog.import_wuliunew = false
      // this.export_type = '0'
    },
    resetImportgift() {
      this.importn_gift = ''
      this.import_file = null
      this.dialog.import_gift = false
      // this.export_type = '0'
    },
    showExpress({ express }) { // 显示物流详情
      if (express) {
        this.dialog.express = true
        this.express = express
      }
    },
    exportTemp() {
      import('@/vendor/Export2Excel').then(excel => {
        excel.export_json_to_excel({
          header: Object.keys(wuliuList),
          data: [],
          filename: '拆单模板',
          bookType: 'xlsx'
        })
      })
    },
    exportTempnew() {
      import('@/vendor/Export2Excel').then(excel => {
        excel.export_json_to_excel({
          header: Object.keys(newList),
          data: [],
          filename: '更新物流模板',
          bookType: 'xlsx'
        })
      })
    },
    exportgift() {
      // const data = [1,2,3,4]
      // const data = ["123456","中通快递","58745454","ZTO","VC","1","2","1"]
      import('@/vendor/Export2Excel').then(excel => {
        excel.export_json_to_excel({
          header: Object.keys(giftList),
          data: [],
          filename: '赠品上传模板',
          bookType: 'xlsx'
        })
      })
    },
    importTempChaiDan() {
      if (!this.import_file) {
        this.$message.error('请上传导入文件')
        return false
      }
      const formdata = new FormData()
      formdata.append('file', this.import_file)
      // console.log(typeof (formdata), 'formdata')
      this.loadingFull = true
      try {
        this.$request(orderSpend(formdata), () => {
          this.getList()
          this.$message.success('上传成功')
          this.dialog.lead_order = false
        })
        // this.$request(sendOrder(formdata), () => {
        //   this.getList()
        //   this.$message.success('上传成功')
        // })
      } catch (e) {
        this.$message.error('导入拆单失败')
      } finally {
        this.loadingFull = false
      }
    },
    importTempGift() {
      if (!this.import_file) {
        this.$message.error('请上传导入文件')
        return false
      }
      const formdata = new FormData()
      formdata.append('file', this.import_file)
      // console.log(typeof (formdata), 'formdata')
      this.loadingFull = true
      try {
        this.$request(UploadOrderGift(formdata), () => {
          this.getList()
          this.$message.success('上传成功')
          this.dialog.import_gift = false
        })
        this.resetImportgift()
        // this.$message.success('上传成功')
        this.getList()
        // this.$request(sendOrder(formdata), () => {
        //   this.getList()
        //   this.$message.success('上传成功')
        // })
      } catch (e) {
        // this.$message.error('导入失败')
      } finally {
        this.loadingFull = false
      }
    },
    importTempwuliu() {
      if (!this.import_file) {
        this.$message.error('请上传导入文件')
        return false
      }
      const formdata = new FormData()
      formdata.append('file', this.import_file)
      // console.log(typeof (formdata), 'formdata')
      this.loadingFull = true
      try {
        this.$request(UpdateExpress(formdata), () => {
          this.getList()
          this.$message.success('上传成功')
          this.dialog.lead_order = false
        })
        this.resetImportnew()
        // this.$message.success('上传成功')
        this.getList()
        // this.$request(sendOrder(formdata), () => {
        //   this.getList()
        //   this.$message.success('上传成功')
        // })
      } catch (e) {
        // this.$message.error('导入失败')
      } finally {
        this.loadingFull = false
      }
    },
    // importTemp() {
    //   if (!this.import_file) {
    //     this.$message.error('请上传导入文件')
    //     return false
    //   }
    //   const _this = this
    //   const reader = new FileReader()
    //   reader.onload = async({ target: { result }}) => {
    //     const workbook = XLSX.read(result, { type: 'array' })
    //     const list = XLSX.utils.sheet_to_json(workbook.Sheets[workbook.SheetNames[0]])
    //     const a = []
    //     const b = []
    //     const c = []
    //     const d = []
    //     const e = []
    //     const f = []
    //     list.map(item => {
    //       a.push(item['订单编号'])
    //       b.push(item['物流单号'])
    //       c.push(item['物流公司'])
    //       d.push(item['物流日期'])
    //       e.push(item['物流备注'])
    //       f.push(15)
    //     })
    //     _this.$request(orderSpend({
    //       order_num: a,
    //       day: f,
    //       track_number: b,
    //       track_company: c,
    //       track_remark: e,
    //       track_time: d
    //     }), () => {
    //       _this.getList()
    //       _this.$message.success('上传成功')
    //     })
    //   }
    //   reader.readAsArrayBuffer(this.import_file)
    // },
    pass(order_num, status, row) {
      this.$confirm('此操作将通过审核, 是否继续?', '提示').then(() => {
        this.$request(orderPass({ order_num, status }), data => {
          this.$message.success('操作成功')
          row.status++
        })
      }).catch(() => {})
    },
    reject(order_num, status, row) {
      this.$confirm('此操作将驳回审核, 是否继续?', '提示').then(() => {
        this.$request(orderreJect({ order_num, status }), data => {
          this.$message.success('操作成功')
          row.status += 5
        })
      }).catch(() => {})
    },
    handleTagToggle(tab) { // 选项卡切换
      this.listQuery.status = tab.name
      this.chooseList = []
      this.getList()
    },
    async getList() { // 获取列表
      this.loadingFull = true
      try {
        const { order_status, order_no, page_index, page_size, time, search_name, activity_id } = this.listQuery
        const res = await getList({
          order_status,
          order_no,
          page_index,
          page_size,
          start_time: time.length > 0 ? time[0] : '',
          end_time: time.length > 0 ? time[1] : '',
          search_name,
          activity_id
        })
        const { message, code } = res
        if (code === 200) {
          const { data } = res
          const { list, total, num_1, num_2, num_3, num_4, num_5, num_6, num_7, num_8 } = data
          this.tableTotal = total
          this.table = list
          this.num_1 = num_1
          this.num_2 = num_2
          this.num_3 = num_3
          this.num_4 = num_4
          this.num_5 = num_5
          this.num_6 = num_6
          this.num_7 = num_7
          this.num_8 = num_8
        } else {
          this.$message.error(message)
        }
      } catch (e) {
        // console.log(`获取订单列表失败:${e}`)
      }
      this.loadingFull = false
    },
    // 分页页码变化
    changePagination(data) {
      const { page, limit } = data
      this.listQuery.page_size = limit
      this.listQuery.page_index = page
      this.getList()
    },
    // 删除单号
    delNum() {
      this.$router.push({
        name: 'order_delnum'
      })
    },
    // 代下单
    handleAddOrder() {
      this.$router.push({
        name: 'order_add'
      })
    },
    // 取消订单
    handleCancelOrder(row) {
      this.$confirm('是否确认取消该订单?', '取消订单', {
        confirmButtonspan: '确定',
        cancelButtonspan: '取消',
        type: 'warning'
      }).then(() => {
        const { id } = row
        this.cancelOrder(id)
      })
    },
    // 取消订单
    async cancelOrder(id) {
      const res = await cancelOrder({ id })
      try {
        const { message, code } = res
        if (code === 200) {
          this.$message.success(message)
          if (!this.highSearchFlag) {
            this.getList()
          } else {
            this.submitExport()
          }
        } else {
          this.$message.error(message)
        }
      } catch (e) {
        // console.log(`取消订单失败:${e}`)
      }
    },
    // 更改收货人信息
    handleUpdataAddress(row) {
      const { address } = row
      this.update.address = address
      this.visible.address = true
    },
    // 查看订单全部商品
    handleSeeAllGoods(row) {
      this.orderInfo = row
      this.visible.goods = true
    },
    // 导出订单明细
    async exportOrder() {
      if (this.chooseList.length) {
        this.$request(downOrder({ id: this.chooseList.map(e => e.id) }), ({ list }) => {
          import('@/vendor/Export2Excel').then(excel => {
            excel.export_json_to_excel({
              header: Object.keys(list[0]),
              data: list.map(listItem => Object.keys(list[0]).map(j => listItem[j])),
              filename: `${formatter(new Date(), 'yyyy-MM-dd')}订单`,
              bookType: 'xlsx'
            })
            this.dialog.export_order = false
          })
        })
      } else {
        let query = {}
        if (!this.highSearchFlag) {
          const { order_status, order_no, page_index, page_size, search_name, time, activity_id } = this.listQuery
          query = {
            order_status, order_no, page_index, page_size, search_name,
            start_time: time.length > 0 ? time[0] : '',
            end_time: time.length > 0 ? time[1] : '',
            activity_id
          }
        } else {
          let order_status
          let pay_status
          try {
            order_status = this.exportForm.order_status
            if (order_status.indexOf(-1) !== -1) order_status = [-1]
            pay_status = this.exportForm.pay_status
            if (pay_status.indexOf(-1) !== -1) pay_status = [-1]
          } catch (e) {
            order_status = []
            pay_status = []
          }
          const { page_index, page_size, order_num, time, name, address, good, type, provice, city, area, activity_id } = this.exportForm
          query = {
            page_index,
            page_size,
            order_no: order_num,
            start_time: time.length > 0 ? time[0] : '',
            end_time: time.length > 0 ? time[1] : '',
            user_name: name,
            receive_info: address,
            goods_info: good,
            order_status,
            pay_status,
            order_type: type,
            provice: provice || '',
            city: city || '',
            area: area || '',
            activity_id
          }
        }
        this.$request(downOrder(query), ({ list }) => {
          import('@/vendor/Export2Excel').then(excel => {
            excel.export_json_to_excel({
              header: Object.keys(list[0]),
              data: list.map(listItem => Object.keys(list[0]).map(j => listItem[j])),
              filename: `${formatter(new Date(), 'yyyy-MM-dd')}订单`,
              bookType: 'xlsx'
            })
            this.dialog.export_order = false
          })
        })
      }
    },
    // 订单金额
    exportMoney() {
      if (this.chooseList.length) {
        // this.$request(downList({ id: this.chooseList.map(e => e.id) }), (res) => {
        //   this.expressData = res
        //   const exportData = this.getExportModule()
        //   import('@/vendor/Export2Excel').then(excel => {
        //     excel.export_json_to_excel({
        //       header: Object.keys(moduleList),
        //       data: exportData.map(listItem => Object.keys(exportData[0]).map(j => listItem[j])),
        //       filename: `${new Date().toLocaleDateString()}快递单导出`,
        //       bookType: 'xlsx',
        //       isCSV: true
        //     })
        //     this.dialog.export_order = false
        //   })
        // })
        this.$request(downList({ id: this.chooseList.map(e => e.id) }), (res) => {
          const exportData = res.list
          import('@/vendor/Export2Excel').then(excel => {
            const header = ['序号', '订单编号', '下单时间', '备注昵称', '下单人姓名', '订单状态', '支付状态', '数量合计', '订单总额', '所属者姓名', '所属者手机号', '收货人', '联系方式', '收货地址', '订单备注']
            const exportK = ['index', 'order_num', 'created_at', 'name', 'realname', 'status', 'pay_status', 'total', 'money', 'belong_realname', 'belong_mobile', 'username', 'mobile', 'address', 'remark']
            const exportV = exportData.map((item, i) => {
              const obj = {
                index: i + 1,
                created_at: item.created_at || '',
                name: item.get_user.name || '',
                order_num: item.order_num || '',
                realname: item.get_user.realname || '',
                status: orderStatus(item.status).name || '',
                pay_status: payStatus(item.pay_status).name,
                total: item.total || '',
                money: item.money || '',
                username: item.get_address.username || '',
                mobile: +item.get_address.mobile,
                belong_realname: item.belong_user && item.belong_user.realname,
                belong_mobile: item.belong_user && item.belong_user.mobile,
                address: item.get_address.province + item.get_address.city + item.get_address.town + item.get_address.address,
                remark: item.remark || ''
              }
              return obj
            })
            const exportD = exportV.map(item => exportK.map(k => item[k]))
            excel.export_json_to_excel({
              header,
              data: exportD,
              filename: `${formatter(new Date(), 'yyyy-MM-dd')}订单金额`,
              autoWidth: true,
              bookType: 'xlsx'
            })
            this.dialog.export_order = false
          })
        })
      } else {
        let query = {}
        if (!this.highSearchFlag) {
          const { order_status, order_no, page_index, page_size, search_name, time, activity_id } = this.listQuery
          query = {
            order_status, order_no, page_index, page_size, search_name,
            start_time: time.length > 0 ? time[0] : '',
            end_time: time.length > 0 ? time[1] : '',
            activity_id
          }
        } else {
          let order_status
          let pay_status
          try {
            order_status = this.exportForm.order_status
            if (order_status.indexOf(-1) !== -1) order_status = [-1]
            pay_status = this.exportForm.pay_status
            if (pay_status.indexOf(-1) !== -1) pay_status = [-1]
          } catch (e) {
            order_status = []
            pay_status = []
          }
          const { page_index, page_size, order_num, time, name, address, good, type, provice, city, area, activity_id } = this.exportForm
          query = {
            page_index,
            page_size,
            order_no: order_num,
            start_time: time.length > 0 ? time[0] : '',
            end_time: time.length > 0 ? time[1] : '',
            user_name: name,
            receive_info: address,
            goods_info: good,
            order_status,
            pay_status,
            order_type: type,
            provice: provice || '',
            city: city || '',
            area: area || '',
            activity_id
          }
        }
        this.$request(downList(query), (res) => {
          const exportData = res.list
              import('@/vendor/Export2Excel').then(excel => {
                const header = ['序号', '订单编号', '下单时间', '备注昵称', '下单人姓名', '订单状态', '支付状态', '数量合计', '订单总额', '所属者姓名', '所属者手机号', '收货人', '联系方式', '收货地址', '订单备注']
                const exportK = ['index', 'order_num', 'created_at', 'name', 'realname', 'status', 'pay_status', 'total', 'money', 'belong_realname', 'belong_mobile', 'username', 'mobile', 'address', 'remark']
                // if(+this.collect == false) {
                //     header.splice(12,1)
                //     exportK.splice(12,1)
                //   }
                const exportV = exportData.map((item, i) => {
                  const obj = {
                    index: i + 1,
                    created_at: item.created_at || '',
                    order_num: item.order_num,
                    name: item.get_user.name || '',
                    realname: item.get_user.realname || '',
                    status: orderStatus(item.status).name || '',
                    pay_status: payStatus(item.pay_status).name,
                    total: item.total || '',
                    money: item.money || '',
                    username: item.get_address.username || '',
                    mobile: +item.get_address.mobile,
                    belong_realname: item.belong_user && item.belong_user.realname,
                    belong_mobile: item.belong_user && item.belong_user.mobile,
                    address: item.get_address.province + item.get_address.city + item.get_address.town + item.get_address.address,
                    remark: item.remark || ''
                  }
                  return obj
                })
                const exportD = exportV.map(item => exportK.map(k => item[k]))
                excel.export_json_to_excel({
                  header,
                  data: exportD,
                  filename: `${formatter(new Date(), 'yyyy-MM-dd')}订单金额`,
                  autoWidth: true,
                  bookType: 'xlsx'
                })
                this.dialog.export_order = false
              })
        })
      }
    },
    // 导出拆单
    async exporOrdertOrder() {
      if (this.chooseList.length) {
        this.$request(toExport({ id: this.chooseList.map(e => e.id) }), (res) => {
          this.expressData = res
          const exportData = this.getExportModule()
          import('@/vendor/Export2Excel').then(excel => {
            excel.export_json_to_excel({
              header: Object.keys(moduleList),
              data: exportData.map(listItem => Object.keys(exportData[0]).map(j => listItem[j])),
              filename: `${new Date().toLocaleDateString()}快递单导出`,
              bookType: 'xlsx',
              isCSV: true
            })
            this.dialog.export_order = false
          })
        })
      } else {
        let query = {}
        if (!this.highSearchFlag) {
          const { order_status, order_no, page_index, page_size, search_name, time, activity_id } = this.listQuery
          query = {
            order_status, order_no, page_index, page_size, search_name,
            start_time: time.length > 0 ? time[0] : '',
            end_time: time.length > 0 ? time[1] : '',
            activity_id
          }
        } else {
          let order_status
          let pay_status
          try {
            order_status = this.exportForm.order_status
            if (order_status.indexOf(-1) !== -1) order_status = [-1]
            pay_status = this.exportForm.pay_status
            if (pay_status.indexOf(-1) !== -1) pay_status = [-1]
          } catch (e) {
            order_status = []
            pay_status = []
          }
          const { page_index, page_size, order_num, time, name, address, good, type, provice, city, area, activity_id } = this.exportForm
          query = {
            page_index,
            page_size,
            order_no: order_num,
            start_time: time.length > 0 ? time[0] : '',
            end_time: time.length > 0 ? time[1] : '',
            user_name: name,
            receive_info: address,
            goods_info: good,
            order_status,
            pay_status,
            order_type: type,
            provice: provice || '',
            city: city || '',
            area: area || '',
            activity_id
          }
        }
        this.$request(toExport(query), (res) => {
          this.expressData = res
          const exportData = this.getExportModule()
          import('@/vendor/Export2Excel').then(excel => {
            excel.export_json_to_excel({
              header: Object.keys(moduleList),
              data: exportData.map(listItem => Object.keys(exportData[0]).map(j => listItem[j])),
              filename: `${new Date().toLocaleDateString()}快递单导出`,
              bookType: 'xlsx',
              isCSV: true
            })
            this.dialog.export_order = false
          })
        })
      }
    },
    getSize(name) {
      return name === '透明浅灰' ? '精装透灰' : name === '透明浅粉' ? '精装透粉' : name === '儿童蓝色' ? '儿童蓝色' : '儿童粉色'
    },
    getHunSize(name) {
      return name === '透明浅灰' ? '精装透灰' : name === '透明浅粉' ? '精装透粉' : name === '儿童蓝色' ? '儿童蓝色' : name === '儿童粉色' ? '儿童粉色' : name
    },
    getExportModule() {
      const data = this.expressData
      const that = this
      const out = []
      for (const i in data) {
        const item = data[i]
        const info = item.data
        let a = 0
        let b = 0
        let c = 0
        let d = 0
        let e = 0
        let f = 0
        while (b < item['眼贴'].length) {
          const obj = Object.assign({}, moduleList)
          obj['订单编号'] = i
          obj['下单时间'] = info.created_at
          obj['备注昵称'] = info.u_nickname
          obj['下单人姓名'] = info.u_name
          obj['下单人手机号'] = info.u_mobile
          obj['收件人'] = info.username
          obj['电话'] = info.mobile
          obj['收件人省'] = info.province
          obj['收件人市'] = info.city
          obj['收件人区'] = info.town
          obj['收件人街道地址'] = info.address
          obj['备注'] = info.remark
          obj['赠品'] = info.gift.map(item => `${item.name}${item.num}`).join(';')
          // let num_all = 0
          obj['眼贴'] = item['眼贴'][b].num
          // num_all += item['眼贴'][b].num
          // obj['数据求和'] = num_all
          out.push(obj)
          b++
        }
        while (e < item['精装'].length) {
          const obj = Object.assign({}, moduleList)
          obj['订单编号'] = i
          obj['下单时间'] = info.created_at
          obj['备注昵称'] = info.u_nickname
          obj['下单人姓名'] = info.u_name
          obj['下单人手机号'] = info.u_mobile
          obj['收件人'] = info.username
          obj['电话'] = info.mobile
          obj['收件人省'] = info.province
          obj['收件人市'] = info.city
          obj['收件人区'] = info.town
          obj['收件人街道地址'] = info.address
          obj['备注'] = info.remark
          obj['赠品'] = info.gift.map(item => `${item.name}${item.num}`).join(';')
          const size = that.getSize(item['精装'][e].size)
          obj[size] = item['精装'][e].num
          out.push(obj)
          e++
        }
        while (c < item['老花'].length) {
          const obj = Object.assign({}, moduleList)
          obj['订单编号'] = i
          obj['下单时间'] = info.created_at
          obj['备注昵称'] = info.u_nickname
          obj['下单人姓名'] = info.u_name
          obj['下单人手机号'] = info.u_mobile
          obj['收件人'] = info.username
          obj['电话'] = info.mobile
          obj['收件人省'] = info.province
          obj['收件人市'] = info.city
          obj['收件人区'] = info.town
          obj['收件人街道地址'] = info.address
          obj['备注'] = info.remark
          obj['赠品'] = info.gift.map(item => `${item.name}${item.num}`).join(';')
          // let num_all = 0
          const size = item['老花'][c].size
          obj[size] = item['老花'][c].num
          // num_all += item['老花'][c].num
          // obj['数据求和'] = num_all
          out.push(obj)
          c++
        }
        while (a < item['平光'].length) {
          const obj = Object.assign({}, moduleList)
          obj['订单编号'] = i
          obj['下单时间'] = info.created_at
          obj['备注昵称'] = info.u_nickname
          obj['下单人姓名'] = info.u_name
          obj['下单人手机号'] = info.u_mobile
          obj['收件人'] = info.username
          obj['电话'] = info.mobile
          obj['收件人省'] = info.province
          obj['收件人市'] = info.city
          obj['收件人区'] = info.town
          obj['收件人街道地址'] = info.address
          obj['备注'] = info.remark
          obj['赠品'] = info.gift.map(item => `${item.name}${item.num}`).join(';')
          // let num_all = 0
          obj['平光镜'] = item['平光'][a].num
          // num_all += item['平光'][a].num
          // obj['数据求和'] = num_all
          out.push(obj)
          a++
        }
        while (f < item['精装老花'].length) {
          const obj = Object.assign({}, moduleList)
          obj['订单编号'] = i
          obj['下单时间'] = info.created_at
          obj['备注昵称'] = info.u_nickname
          obj['下单人姓名'] = info.u_name
          obj['下单人手机号'] = info.u_mobile
          obj['收件人'] = info.username
          obj['电话'] = info.mobile
          obj['收件人省'] = info.province
          obj['收件人市'] = info.city
          obj['收件人区'] = info.town
          obj['收件人街道地址'] = info.address
          obj['备注'] = info.remark
          obj['赠品'] = info.gift.map(item => `${item.name}${item.num}`).join(';')
          // let num_all = 0
          const size = item['精装老花'][f].size
          obj[size] = item['精装老花'][f].num
          // num_all += item['老花'][c].num
          // obj['数据求和'] = num_all
          out.push(obj)
          f++
        }
        while (d < item['混合'].length) {
          const obj = Object.assign({}, moduleList)
          obj['订单编号'] = i
          obj['下单时间'] = info.created_at
          obj['备注昵称'] = info.u_nickname
          obj['下单人姓名'] = info.u_name
          obj['下单人手机号'] = info.u_mobile
          obj['收件人'] = info.username
          obj['电话'] = info.mobile
          obj['收件人省'] = info.province
          obj['收件人市'] = info.city
          obj['收件人区'] = info.town
          obj['收件人街道地址'] = info.address
          obj['备注'] = info.remark
          obj['赠品'] = info.gift.map(item => `${item.name}${item.num}`).join(';')
          // let num_all = 0
          for (let j = 0; j < item['混合'][d].length; j++) {
            const size = that.getHunSize(item['混合'][d][j].size)
            obj[size] = item['混合'][d][j].num
            // num_all += item['混合'][d][j].num
          }
          // obj['数据求和'] = num_all
          out.push(obj)
          d++
        }
      }
      return out
    },
    getExportMoney() {},
    formatJson(filterVal, jsonData) {
      return jsonData.map(v => filterVal.map(j => {
        return v[j]
      }))
    },
    // 订单编号
    toOrderWxamine(row) {
      this.$router.push({
        name: 'order_examine',
        params: { order: row.order_num }
      })
    },
    // 发货
    submitOrderSpend() {
      this.$refs.spendform.validate((valid) => {
        if (valid) {
          this.loadingFull = true
          orderSpend({
            order_num: [this.spendForm.order_num],
            day: [this.spendForm.day],
            track_number: [this.spendForm.track_number],
            track_company: [this.spendForm.track_company],
            track_remark: [this.spendForm.track_remark],
            track_time: [this.spendForm.track_time]
          }).then(res => {
            this.loadingFull = false
            if (res.code === 200) {
              if (!this.highSearchFlag) {
                this.getList()
              } else {
                this.submitExport()
              }
              this.resetOrderSpend()
              this.$message.success(res.message)
            } else {
              this.$message.error(res.message)
            }
          }).catch(e => {
            this.loadingFull = false
          })
        } else {
          return false
        }
      })
    },
    resetOrderSpend() {
      this.spendForm = {
        order_num: '',
        day: 15,
        track_number: '',
        track_company: '',
        track_remark: '',
        track_time: ''
      }
      this.dialog.spending = false
    },
    handleOrderSpend(row) {
      this.spendForm.order_num = row.order_num
      this.dialog.spending = true
    },
    // 多选
    orderMulSelect(val) {
      // 批量审核
      this.caiwuNum = 0
      this.kefuNum = 0
      this.wuliuNum = 0
      this.chooseList = val
      const arr = []
      val.filter(item => {
        return (item.is_deleted !== 1) && (item.status === 0 || item.status === 1 || item.status === 2)
      }).map(item => {
        arr.push(item.id)
        if (item.status === 0) {
          this.kefuNum += 1
        } else if (item.status === 1) {
          this.caiwuNum += 1
        } else {
          this.wuliuNum += 1
        }
      })
      this.orderMulSelection = arr
      this.needMergeOrderList = val

      // 导出订单
      // this.exportMulSelection = []
      // val.map(item => {
      //   this.exportMulSelection.push(item.id)
      // })
    },
    // 批量代理审核
    machExamine(type) {
      if (type === 0 && this.kefuNum === 0) {
        this.$message.error(`暂无符合客服订单待审核`)
      } else if (type === 1 && this.caiwuNum === 0) {
        this.$message.error(`暂无符合财务订单待审核`)
      } else if (type === 2 && this.wuliuNum === 0) {
        this.$message.error(`暂无符合物流订单待审核`)
      } else {
        let msg = ''
        if (type === 0) {
          msg = `当前有${this.kefuNum}个客服订单待审核`
        } else if (type === 1) {
          msg = `当前有${this.caiwuNum}个财务订单待审核`
        } else {
          msg = `当前有${this.wuliuNum}个发货订单待审核`
        }
        this.$confirm(msg, '提示', {
          confirmButtonspan: '确定',
          cancelButtonspan: '取消',
          type: 'warning'
        }).then(() => {
          this.loadingFull = true
          machAuditOrder({
            data: this.orderMulSelection,
            status: type
          }).then(res => {
            this.loadingFull = false
            if (res.code === 200) {
              if (!this.highSearchFlag) {
                const index = Math.ceil(this.tableTotal / this.listQuery.page_size)
                if (this.listQuery.page_index === index) {
                  this.listQuery.page_index = this.listQuery.page_index - 1
                  this.getList()
                } else {
                  this.getList()
                }
              } else {
                this.submitExport()
              }
              this.resetMulSelect()
              this.$message.success(res.message)
            } else {
              this.$message.error(res.message)
            }
          }).catch(e => {
            this.loadingFull = false
          })
        })
      }
    },
    // 重置
    resetMulSelect() {
      this.kefuNum = 0
      this.caiwuNum = 0
      this.wuliuNum = 0
      this.orderMulSelection = []
    },
    // 高级搜索分页
    SeniorChangePagination(data) {
      const { page, limit } = data
      this.exportForm.page_size = limit
      this.exportForm.page_index = page
      this.submitExport()
    },
    // 高级搜索
    submitExport() {
      // let order_status = this.$refs.status_tree.getCheckedKeys()
      let order_status = this.exportForm.order_status
      if (order_status.indexOf(-1) !== -1) order_status = [-1]
      // let pay_status = this.$refs.pay_status_tree.getCheckedKeys()
      let pay_status = this.exportForm.pay_status
      if (pay_status.indexOf(-1) !== -1) pay_status = [-1]
      const { page_index, page_size, order_num, time, name, address, good, type, provice, city, area, activity_id } = this.exportForm
      this.loadingFull = true
      highSearch({
        page_index,
        page_size,
        order_no: order_num,
        start_time: time.length > 0 ? time[0] : '',
        end_time: time.length > 0 ? time[1] : '',
        user_name: name,
        receive_info: address,
        goods_info: good,
        order_status,
        pay_status,
        order_type: type,
        provice: provice || '',
        city: city || '',
        area: area || '',
        activity_id
      }).then(res => {
        this.loadingFull = false
        if (res.code === 200) {
          this.dialog.export = false
          this.table = res.data.list
          this.exportForm.total = res.data.total ? res.data.total : 0
        } else {
          this.$message.error(res.message)
        }
      }).catch(e => {
        this.loadingFull = false
      })
    },
    // 重置高级搜索
    resetSeniorSearch() {
      this.exportForm = {
        order_num: '',
        name: '',
        time: '',
        good: '',
        address: '',
        status: [],
        order_status: [],
        pay_status: [],
        type: -1,
        page_size: 10,
        page_index: 1,
        provice: '',
        city: '',
        area: '',
        activity_id: ''
      }
      // this.$refs.status_tree.setCheckedKeys([])
      // this.$refs.pay_status_tree.setCheckedKeys([])
      this.dialog.export = false
      this.listQuery.page_index = 1
      this.listQuery.page_size = 10
      this.getList()
    },
    // 获取余额
    async accountBalance(row) {
      this.loadingFull = true
      this.addRechargeItem = row
      await accountBalance({
        order_id: row.id
      }).then(res => {
        this.loadingFull = false
        if (res.code === 200) {
          this.agentBanlance = res.data
          if (this.agentBanlance > 0) {
            if (this.agentBanlance > row.no_pay_money) {
              this.rechargeForm.money = row.no_pay_money
            } else {
              this.rechargeForm.money = this.agentBanlance
            }
          }
          this.dialog.receive = true
        } else {
          this.$message.error(res.message)
        }
      }).catch(e => {
        this.loadingFull = false
      })
    },
    // 提交添加收款
    handleSubmitRecharge() {
      this.$refs.rechargeform.validate((valid) => {
        if (valid) {
          if (Number(this.rechargeForm.money) === 0 && Number(this.rechargeForm.p_money) === 0) {
            this.$message.error('充值金额不能都为0')
            return false
          }
          this.loadingFull = true
          addRecharge({
            order_id: this.addRechargeItem.id,
            money: this.rechargeForm.money,
            p_money: this.rechargeForm.p_money,
            remark: this.rechargeForm.remark
          }).then(res => {
            this.loadingFull = false
            if (res.code === 200) {
              this.resetDialogRecharge()
              if (!this.highSearchFlag) {
                this.getList()
              } else {
                this.submitExport()
              }
              this.$message.success(res.message)
            } else {
              this.$message.error(res.message)
            }
          }).catch(e => {
            this.loadingFull = false
          })
        } else {
          return false
        }
      })
    },
    // 重置添加收款
    resetDialogRecharge() {
      this.rechargeForm = {
        money: 0,
        p_money: 0,
        remark: ''
      }
      this.agentBanlance = 0
      this.addRechargeItem = {}
      this.dialog.receive = false
    },
    clearSearch() {
      this.listQuery = {
        order_no: '',
        page_index: 1,
        page_size: 20,
        time: '',
        search_name: '',
        activity_id: ''
      }
      this.getList()
    },
    async getStore() {
      this.loadingFull = true
      await getStore().then(res => {
        this.loadingFull = false
        if (res.code === 200) {
          this.storeList = res.data.list
        }
      }).catch(e => {
        this.loadingFull = false
      })
    },
    handleStoreOrder(row) {
      this.storeOrder.order_id = row.id
      this.dialog.store = true
    },
    resetStoreOrder() {
      this.storeOrder = {
        order_id: '',
        store_id: ''
      }
      this.dialog.store = false
    },
    async addStoreOrder() {
      if (!this.storeOrder.store_id) {
        this.$message.error('请选择体验店')
      } else {
        this.loadingFull = true
        await addStoreOrder(this.storeOrder).then(res => {
          this.loadingFull = false
          if (res.code === 200) {
            this.resetStoreOrder()
            if (!this.highSearchFlag) {
              this.getList()
            } else {
              this.submitExport()
            }
            this.$message.success(res.message)
          } else {
            this.$message.error(res.message)
          }
        }).catch(e => {
          this.loadingFull = false
        })
      }
    },
    async activityList(cb) {
      this.loadingFull = true
      await activityList().then(res => {
        this.loadingFull = false
        if (res.code === 200) {
          this.activitys = res.data
          res.data.map(item => {
            if (item.is_ing === 1) {
              // this.listQuery.activity_id = item.id
              this.exportForm.activity_id = item.id
            }
          })
        }
        cb && cb()
      }).catch(e => {
        this.loadingFull = false
        cb && cb()
      })
    }
  }
}
</script>

<style lang="scss" scoped>
  .deliveryList {
    margin-bottom: 20px;
    &_title {
      display: flex;
      align-items: center;
      padding: 30px;
      width: 100%;
      height: 70px;
      background-color: #EEF1F9;
      border-radius: 20px 20px 0 0;
      .bold {
        font-weight: bold;
        font-size: 20px;
        margin-right: 20px;
      }
      .kuaidi,.time{
        font-size: 15px;
        margin-right: 15px;
      }
    }
    .demo-table-expand {
      font-size: 0;
    }
    .demo-table-expand label {
      width: 90px;
      color: #99a9bf;
    }
    .demo-table-expand .el-form-item {
      margin-right: 0;
      margin-bottom: 0;
      width: 50%;
    }
  }
  .PanKuContainer {
		width: 100%;
		flex: 1;
		background-color: #F9F9FB;
		padding: 15px;
     .boxe {
      width: 500px;
      height: 120px;
      margin-bottom: 15px;
      border-radius: 12px;
      background-color: #fff;
      padding: 30px;
      display: flex;
      align-items: center;
      &_left {
        width: 90px;
        height: 72px;
        border-radius: 16px;
        overflow: hidden;
        image {
          width: 90px;
          height: 72px;
        }
      }
      &_right {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        margin-left: 20px;
        height: 72px;
        padding: 10px 0;
        .name {
          font-size: 16px;
          font-weight: bold;
          color: #333333;
        }
        .num {
          font-size: 14px;
          color: #999999;
        }
      }
    }
    .btn {
			width: 70px;
			height: 28px;
			border-radius: 8px;
			background-color: #EA4A41;
			color: #FFFFFF;
			font-size: 14px;
			line-height: 28px;
			text-align: center;
			text-align: center;
		}
		.reviseBtn {
			// position: fixed;
			// bottom: 0;
			// left: 0;
			// right: 0;
			height: 50px;
			display: flex;
			align-items: center;
			justify-content: space-between;
			background: #FFFFFF;
			color: #FFFFFF;
			font-size: 16px;
			padding: 0 15px;
			.type {
				color: #999999;
				font-size: 14px;
				margin-right: 5px;
			}
			.all {
				color: #333333;
				font-size: 14px;
			}
			.num {
				font-size: 20px;
				color: #EA4A41;
			}
			.unit {
				font-size: 14px;
				color: #EA4A41;
			}
			.submitBtn {
				width: 96px;
				height: 34px;
				line-height: 34px;
				text-align: center;
				border-radius: 34px;
				background: linear-gradient(to right, #F97C55, #F44545);
				color: #FFFFFF;
				font-size: 14px;
			}
		}
		.goodList {
			width: 100%;
			.goodItem {
				width: 100%;
				margin-bottom: 15px;
				box-sizing: border-box;
				.top {
					width: 100%;
					display: flex;
					align-items: stretch;
					justify-content: space-between;
					margin-top: 20px;
					.avatar {
						width: 90px;
						height: 72px;
						background-color: #eeeeee;
						background-position: center;
						background-size: cover;
						background-repeat: no-repeat;
						border-radius: 8px;
					}
					.info {
            margin-top: 10px;
						display: flex;
						// justify-content: center;
						flex-direction: column;
						flex: 1;
						overflow: hidden;
						margin-left: 10px;
						.name {
							color: #333333;
							font-size: 16px;
							line-height: 22px;
							margin-bottom: 10px;
              font-weight: bold;
						}
						.fixed {
							font-size: 14px;
							height: 24px;
							line-height: 24px;
							box-sizing: border-box;
							text-align: center;
              width: 162px;
							border-radius: 8px;
							background: #FFF4F3;
							color: #FB231F;
						}
					}
				}
				.skuContainer {
					width: 100%;
					background-color: #ffffff;
					box-sizing: border-box;
					border-radius: 24px;
					overflow: hidden;
					.header {
						width: 100%;
						height: 100px;
						padding: 0 15px;
						box-sizing: border-box;
						display: flex;
						align-items: center;
						justify-content: flex-start;
						border-bottom: 1px solid #EEEEEE;
						.icon {
							width: 15px;
							height: 15px;
							border-radius: 50%;
							background-color: rgba(234, 74, 65, 0.36);
							margin-right: 5px;
							display: flex;
							align-items: center;
							justify-content: center;
							&::before {
								content: "";
								display: block;
								width: 9px;
								height: 9px;
								border-radius: 50%;
								background-color: #EA4A41;
							}
						}
						.name {
							color: #333333;
							font-size: 16px;
							line-height: 22px;
						}
						&::after {
							display: block;
							content: "";
							margin-left: auto;
							width: 20px;
							height: 20px;
							background-image: url("../../assets/arrow.png");
							background-position: center;
							background-size: cover;
							background-repeat: no-repeat;
						}
						&.open {
							&::after {
								transform: rotate(90deg) !important;
							}
						}
					}
					.skuList{
						width: 100%;
						.skuHeader, .skuItem {
							width: 100%;
							height: 50px;
							padding: 0 15px;
							box-sizing: border-box;
							display: flex;
							align-items: center;
							justify-content: space-between;
							border-bottom: 1px solid #EEEEEE;
							.type, .size, .num {
								flex: 1;
								overflow: hidden;
								display: flex;
								align-items: center;
								justify-content: center;
							}
              .color {
                font-weight: bold;
                color: #333;
              }
							.type {
								justify-content: flex-start;
							}
							.size{
								justify-content: center;
							}
							.num {
								justify-content: flex-end;
							}
						}
						.skuHeader {
							color: #999999;
							font-size: 14px;
							line-height: 20px;
						}
					}
					.dataAll {
						width: 100%;
						height: 58px;
						padding: 0 15px;
						box-sizing: border-box;
						display: flex;
						align-items: center;
						justify-content: space-between;
						.sex {
							color: #333333;
							font-size: 14px;
						}
						.num {
							color: #999999;
							font-size: 14px;
							.spec {
								color: #EA4A41 !important;
								font-size: 20px !important;
								font-weight: bolder;
							}
						}
					}
				}
			}
		}
	}
  .el-scrollbar__wrap {
    overflow-x: hidden;
  }
  .titleTop {
		// width: 60px;
		white-space: nowrap;
		&-name {
			background-color: #eee;
      line-height: 60px;
			display: flex;
			color: #333;
			font-size: 20px;
			font-weight: bold;
			display: inline-block;
			text-align: center;
			width: 160px;
		}
	}
	.list {
		display: flex;
    font-size: 16px;
		&-item {
			width: 160px;
			font-weight: bold;
			line-height: 60px;
			text-align: center;
			border-right: 1px solid #eee;
			border-bottom: 1px solid #eee;
		}
	}
  .merger_order_container {
    width: 100%;
    margin-bottom: 15px;
    border: 1px solid #cccccc;
    .flex {
      display: flex;
      justify-content: space-between;
      align-items: stretch;
      border-bottom: 1px solid #cccccc;
      &:nth-last-of-type(1) {
        border-bottom: none;
      }
    }
    .order_main {
      flex: 1;
      border-left: 1px solid #cccccc;
      padding: 0 10px;
    }
    .order_nav {
      width: 150px;
      span-align: center;
    }
  }

  .table-wrapper {
    width: 100%;
    flex: 1;
  }

  /deep/ .pagination-container {
    margin: 0 !important;
  }

  .search-container {
    margin: 5px 0;
    button{
      margin-right: 10px;
    }

    .search-flex {
      display: flex;
      justify-content: flex-start;
      flex-wrap: wrap;
    }

    /deep/ .bg1 {
      background: #F97547 !important;
      border-color: #F97547 !important;
    }

    /deep/ .bg2 {
      background: #13C19F !important;
      border-color: #13C19F !important;
    }

    /deep/ .bg3 {
      background: #FFAA1D !important;
      border-color: #FFAA1D !important;
    }
  }

  .cursor {
    cursor: pointer;
  }

  .popover {
    .cursor {
      cursor: pointer;
      display: block;
      margin-bottom: 10px;

      &:nth-last-of-type(1) {
        margin-bottom: 0;
      }
    }
  }
  .el-table {
    >>> .el-table__body-wrapper::-webkit-scrollbar {
      width: 10px;
      height: 10px;
    }

    >>> .el-table__body-wrapper::-webkit-scrollbar-thumb {
      border-radius: 10px;
      background: #c0c0c0;
      box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
    }

    >>> .el-table__body-wrapper::-webkit-scrollbar-track {
      border-radius: 10px;
      background: #ededed;
      box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
    }
  }
  .nomgb {
    margin-bottom: 0;
  }

  .el-button {
    margin: 2px 0;
  }
  >>> .el-drawer {
    width: 100%!important;
  }
  .el-tabs {
    >>> .el-tabs__nav-wrap, >>> .el-tabs__nav-scroll {
      overflow: visible;
    }
    >>> .el-tabs__nav-wrap::after {
      height: 0;
    }
    >>> .el-tabs__header {
      margin-bottom: 0px;
    }
    >>> .el-tabs__item {
      > span {
        position: relative;
      }
    }
    >>> .num {
      top: -12px;
      right: 0;
      height: 18px;
      padding: 0 6px;
      color: white;
      font-size: 12px;
      min-width: 18px;
      line-height: 18px;
      span-align: center;
      position: absolute;
      border-radius: 18px;
      background: #ff4949;
      transform: translateX(90%);
    }
  }
  .infoList{
    list-style: none;
    padding: 0;
    margin: 0;

    p{
      margin: 0;
    }

    .infoItem{
      display: flex;
      justify-content: flex-start;
      align-items: flex-start;

      .info_lebel{
        width: 60px;
        span-align: right;
      }

      .info_val{
        width: calc(100% - 70px);
        padding-left: 10px;
        span-align: left;
      }
    }
  }
  .goodsList{
    list-style: none;
    padding: 0;
    margin: 0;
    span-align: left;
    p{
      margin: 0;
    }
    .goodsItem{
      display: flex;
      width: 100%;
      justify-content: flex-start;
      border-bottom: 1px solid #ccc;
      margin-bottom: 5px;
      padding: 5px 0;
      &:nth-last-of-type(1){
        border-bottom: none;
      }
      .goodsMian{
        display: flex;
        justify-content: space-around;
        flex-direction: column;
      }
      .goodsImg{
        display: block;
        width: 65px;
        height: 65px;
        margin-right: 10px;
      }
    }
  }
  .addMember{
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .orderInfo{
    padding: 0 20px;
    .el-form-item {
      margin-bottom: 0px;
    }
    .orderGoodsList{
      list-style: none;
      padding-left: 20px;
    }
    .orderGoodsItem{
      margin-bottom: 20px;
    }
    .orderGoodsHeader{
      display: flex;
      justify-content: flex-start;
      align-items: center;
      margin-bottom: 15px;
    }
    .orderGoodsSku{
      font-size: 12px !important;
      color: #333 !important;
      display: flex;
      justify-content: space-around;
      align-items: center;
      p{
        width: calc(100% / 3);
        margin: 0;
        margin-bottom: 8px;
      }
    }
  }
  .tag {
    padding: 2px;
    margin-right: 2px;
    font-size: 12px;
    line-height: 1;
    border-radius: 2px;
    font-family: simsun;
    color: #fff;
    display: inline;
    cursor: pointer;
  }

  .sub-tag {
    font-size: 12px;
    color: #00a7f2;
    border: 1px solid rgba(0,167,242,.4);
  }
  .red-tag {
    font-size: 12px;
    color: #F97547;
    border: 1px solid #ED6C46;
  }
  .return-tag {
    color: #8c7ee4;
    border: 1px solid rgba(140,123,231,.4);
    display: inline-block;
  }

  .handCompony {
    font-size: 12px;
    color: #409EFF;
    cursor: pointer;
  }

  .dialog_receive {
    p {
      margin: 0;
    }

    .title_1 {
      font-size: 24px;
      color: #f96868;
      margin-bottom: 15px;
    }

    .title_2 {
      display: flex;
      justify-content: flex-start;
      align-items: center;
      margin-bottom: 20px;

      span {
        margin-right: 20px;
      }

      span:nth-last-of-type(1){
        display: flex;
        justify-content: flex-start;
        align-items: center;

        &::before {
          content: "";
          display: block;
          width: 2px;
          height: 20px;
          background: #cccccc;
          margin-right: 15px;
        }
      }
    }

    .pay_form {
      display: table;
      margin-bottom: 20px;

      .fixedH2{
        display: table-cell;
        width: 80px;
        background-color: #eef1f9;
        span-align: center;
        vertical-align: middle;
        padding: 15px 0;
        margin-right: 20px;
      }

      .pay_from_body {
        display: table-cell;
        vertical-align: middle;
      }

      .balance_body {
        display: flex;
        justify-content: flex-start;
        align-items: center;

        .balance {
          margin-left: 10px;
          color: #c1cbd5!important;
        }
      }
    }
  }
  #order_list {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 84px);
    /deep/ .el-tree-node, /deep/ .el-tree-node__children {
      display: flex;
    }
    /deep/ .el-tree-node__expand-icon, /deep/ .expanded {
      display: none;
    }
  }
  .upload-main {
    display: flex;
    justify-content: center;
    flex-direction: column;
  }
  .upload-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;

    .download {
      width: 100px;
      span-align: right;
      margin-right: 12px;
    }

    .input {
      width: 400px;

      .el-input__inner {
        border: none !important;
      }
    }

    .block {
      position: absolute;
      top: 0px;
      bottom: 0px;
      left: 0;
      right: 0;
      z-index: 99;
      border: 1px solid #DCDFE6;
    }

    .block:hover{
      border-color: #409EFF;
    }
  }
  .store_order {
    display: inline-block;
  }
</style>
