import { request } from '../../boot/axios';
import { Pagination } from '../class';
import {
  MoveSearchEntity,
  TransferDetailSearchEntity,
  TransferDetailMarketSearchEntity
} from './model/move';
const pathName = 'transfer/';
const pathTransferDetailName = 'transferDetail/';

class MoveApi {
  getPage = (val: Pagination<MoveSearchEntity>) => {
    return request.postForPage(`${pathName}transferPage`, val);
  };
  add = (val: any) => {
    return request.post(`${pathName}add`, val);
  };
  edit = (val: any) => {
    return request.post(`${pathName}updateAll`, val);
  };
  // 删除 调拨单
  remove = (val: string) => {
    return request.delete(`${pathName}delAll/` + val);
  };
  // 修改调拨单状态
  executeTransfer = (val: any) => {
    return request.post(`${pathName}executeTransfer`, val);
  };
  // 获取调拨移动类型
  getMoveType = (val: any) => {
    return request.post(`${pathName}getMoveType`, val);
  };
}
const moveApi = new MoveApi();

class TransferDetailApi {
  getPage = (val: Pagination<TransferDetailSearchEntity>) => {
    return request.postForPage(
      `${pathTransferDetailName}transferDetailPage`,
      val
    );
  };
  // 修改调拨单状态
  transferDetailList = (val: any) => {
    return request.post(`${pathTransferDetailName}transferDetailList`, val);
  };
  // 调拨下架
  pick = (val: any) => {
    return request.post(`${pathTransferDetailName}pick`, val);
  };
  // 调拨上架
  push = (val: any) => {
    return request.post(`${pathTransferDetailName}push`, val);
  };
  // 确认转换
  change = (val: any) => {
    return request.post(`${pathTransferDetailName}change`, val);
  };
  // 查询销售订单详情
  tfdMarketList = (val: TransferDetailMarketSearchEntity) => {
    return request.post(`${pathTransferDetailName}tfdMarketList`, val);
  };
  // 查询销售订单行详情
  tfdMarketRowList = (val: any) => {
    return request.post(`${pathTransferDetailName}tfdMarketRowList`, val);
  };
}
const transferDetailApi = new TransferDetailApi();
export { moveApi, transferDetailApi };
