<template>
  <div class="order-tool">
    <!-- <el-dropdown split-button type="text" @click="handle('addOrder')" @command="handleCommand">
      新增订单
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item command="loadOrder">手工下载</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown> -->
    <el-button type="text" @click="handle('addOrder')">新增订单</el-button>
    <el-button type="text" @click="handle('importOrder')">导入订单</el-button>
    <div class="split"></div>
    <el-dropdown split-button type="text" @click="handle('smt')" @command="handleCommand">
      审核
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item command="reSmt">反审核</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
    <!-- <el-button type="text">设快递</el-button>
    <el-dropdown split-button type="text" class="dropdown">
      设快递单号
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item>批量设置快递单号</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown> -->
    <div class="split"></div>
    <el-button type="text" @click="handle('changeQues')">转异常</el-button>
    <el-button type="text" @click="handle('changeNormal')">转正常</el-button>
    <el-button type="text" @click="handle('cancelOrder')">取消订单<i class="el-icon-info"
        title="只有[待付款,发货中,异常,已付款待审核,等供销商|外仓发货,已客审待财审]才可以取消订单"></i></el-button>
    <!-- <el-dropdown split-button type="text" class="dropdown" @click="handle('cancelOrder')" @command="handleCommand">
      取消订单
      <i class="el-icon-info" title="只有[待付款,发货中,异常,已付款待审核,等供销商|外仓发货,已客审待财审]才可以取消订单"></i>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item command="reCancelOrder">反取消订单</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown> -->
    <div class="split"></div>
    <el-dropdown split-button type="text" class="dropdown" @click="handle('addGift')" @command="handleCommand">
      添加赠品
      <el-dropdown-menu slot="dropdown">
        <!-- <el-dropdown-item command="addProduct">添加商品</el-dropdown-item> -->
        <!-- <el-dropdown-item command="addGift">添加赠品</el-dropdown-item> -->
        <el-dropdown-item command="updateFreight">改运费</el-dropdown-item>
        <el-dropdown-item command="updateTag">改标签</el-dropdown-item>
        <el-dropdown-item command="updateRmk">改备注</el-dropdown-item>
        <el-dropdown-item command="updateSalesman">设定业务员</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
    <el-button type="text" @click="handle('producePurchase')" title="选取已审核数据">生成采购单</el-button>
    <el-button type="text" @click="handle('orderFile')">订单归档</el-button>
    <div class="split"></div>
    <el-button type="text" @click="handle('autoMerge')">自动合并<i class="el-icon-info"
        title="自动合并条件：已付款，已审核，同一个买家/分销商，同一个发货地址，未合并，未拆分"></i></el-button>
    <el-button type="text" @click="handle('autoSplit')">自动拆分<i class="el-icon-info"
        title="自动拆分条件：已付款，已审核，未合并"></i></el-button>
    <el-button type="text" @click="handle('batchSendGoods')">发货<i class="el-icon-info"
        title="发货条件：已审核，待付款，已付款待审核"></i></el-button>
    <el-button type="text" @click="handle('autoAudit')">智能审核<i class="el-icon-info"
        title="条件：未发货，未审核的订单"></i></el-button>
  </div>
</template>

<script lang="ts">
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
@Component
export default class OrderTool extends Vue {

  handleCommand(n: string) {
    this.$emit(n)
  }

  handle(n: string) {
    this.$emit(n)
  }
}
</script>

<style lang="scss" scoped>
.order-tool {
  height: 40px;
  display: flex;
  align-items: center;
  width: 100%;

  .order-tool-btn {
    color: #333;
  }

  .split {
    height: 10px;
    width: 1px;
    background-color: #CCC;
    margin: 0 8px;
  }

  .dropdown {
    padding-left: 8px;
  }
}
</style>