// 获取商户应收账款列表
import request from '@/utils/request';

// 创建服务区商品审批流程
export async function handleCreateCommodityProInst(params?: any) {
  const data = await request('/BusinessProcess/CreateCommodityProInst', {
    method: 'POST',
    data: {
      ...params,
      requestEncryption: true
    },
  })

  if (data.Result_Code !== 100) {
    return data
  }
  return data;
}

// 重新发起审批流程
export async function handleReapplyCommodityProInst(params?: any) {
  const data = await request('/BusinessProcess/ReapplyCommodityProInst', {
    method: 'POST',
    data: {
      ...params,
      requestEncryption: true
    },
  })

  if (data.Result_Code !== 100) {
    return data
  }
  return data;
}


// 审核服务区商品审批流程
export async function handleApproveCommodityProInst(params?: any) {
  const data = await request('/BusinessProcess/ApproveCommodityProInst', {
    method: 'POST',
    data: {
      ...params,
      requestEncryption: true
    },
  })

  if (data.Result_Code !== 100) {
    return data;
  }
  return data;
}

// 驳回服务区商品审批流程
export async function handleRejectCommodityProInst(params?: any) {
  const data = await request('/BusinessProcess/RejectCommodityProInst', {
    method: 'POST',
    data: {
      ...params,
      requestEncryption: true
    },
  })

  if (data.Result_Code !== 100) {
    return data;
  }
  return data;
}

// 审批流程详情
export async function handleGetBUSINESSAPPROVALDetail(params?: any) {
  const data = await request('/BusinessProcess/GetBUSINESSAPPROVALDetail', {
    method: 'GET',
    params: {
      ...params,

    },
  })

  if (data.Result_Code !== 100) {
    return data;
  }
  return data;
}

// 获取审批流程里面的商品
export async function handleGetCOMMODITYRUNNINGList(params?: any) {
  const data = await request('/Commodity/GetCOMMODITY_RUNNINGList', {
    method: 'POST',
    data: {
      ...params,
      requestEncryption: true
    },
  })

  if (data.Result_Code !== 100) {
    return data;
  }
  return data;
}

// 获取办结之后的商品
export async function handleGetApprovalCommodityList(params?: any) {
  const data = await request('/Commodity/GetApprovalCommodityList', {
    method: 'POST',
    data: {
      ...params,
      requestEncryption: true
    },
  })

  if (data.Result_Code !== 100) {
    return data;
  }
  return data;
}

// 删除商品审批流程
export async function handleDeleteCommodityProInst(params?: any) {
  const data = await request('/BusinessProcess/DeleteCommodityProInst', {
    method: 'POST',
    data: {
      ...params,
      requestEncryption: true
    },
  })

  if (data.Result_Code !== 100) {
    return data;
  }
  return data;
}


// 同步编辑申请流程时的商品
export async function handleSynchroCOMMODITY_RUNNING(params?: any) {
  const data = await request('/Commodity/SynchroCOMMODITY_RUNNING', {
    method: 'POST',
    data: {
      ...params,
      requestEncryption: true
    },
  })

  if (data.Result_Code !== 100) {
    return data;
  }
  return data;
}

// 删除审批过程中的商品
export async function handleDeleteCOMMODITY_RUNNING(params?: any) {
  const data = await request('/Commodity/DeleteCOMMODITY_RUNNING', {
    method: 'POST',
    data: {
      ...params,
      requestEncryption: true
    },
  })

  if (data.Result_Code !== 100) {
    return data;
  }
  return data;
}

