/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许，不可做商业用途！
*
* 版权所有，侵权必究！
*/
import request from '@/utils/request'

export function getShopProtocol () {
  return request({
    url: '/mall4cloud_admin/ua/supplier_user_register/get_supplier_protocol',
    method: 'get'
  })
}

// 检查统一信用码是否已存在
export function checkForDuplicateCreditCode (param) {
  return request({
    url: '/mall4cloud_admin/mp/supplier_company/check_credit_code',
    method: 'GET',
    params: param
  })
}

// 查询基本信息
export function getBasicInfo () {
  return request({
    url: '/mall4cloud_admin/s/apply_supplier/supplier_detail',
    method: 'get'
  })
}

// 储存工商信息
export function saveBasicInfo (data) {
  return request({
    url: '/mall4cloud_admin/s/apply_supplier/supplier_detail/storage',
    method: 'post',
    data
  })
}

// 获取工商信息
export function getCompanyInfo () {
  return request({
    url: '/mall4cloud_admin/s/apply_supplier/supplier_company',
    method: 'get'
  })
}

// 储存工商信息
export function saveCompanyInfo (data) {
  return request({
    url: '/mall4cloud_admin/s/apply_supplier/supplier_company/storage',
    method: 'post',
    data
  })
}

export function getSignCategoryList () {
  return request({
    url: '/mall4cloud_product/s/apply_supplier/category/list_by_supplier',
    method: 'get'
  })
}

export function signCategory (data) {
  return request({
    url: '/mall4cloud_product/s/apply_supplier/category/signing',
    method: 'post',
    data
  })
}

export function getPlatformCategory () {
  return request({
    url: '/mall4cloud_product/s/apply_supplier/category/platform_categories',
    method: 'get'
  })
}

export function getPlatformBrand (params) {
  return request({
    url: '/mall4cloud_product/mp/brand/list_by_params',
    method: 'get',
    params
  })
}

export function getBankCartInfoList () {
  return request({
    url: '/mall4cloud_admin/s/apply_supplier/supplier_bank_card/list_by_supplierId',
    method: 'get'
  })
}

export function saveBankCartInfo (data) {
  return request({
    url: '/mall4cloud_admin/s/apply_supplier/supplier_bank_card/save_and_apply_supplier',
    method: 'post',
    data
  })
}

// 根据银行卡id获取新行卡账号信息
export function getBankCartInfo (supplierBankCardId) {
  return request({
    url: '/mall4cloud_admin/s/apply_supplier/supplier_bank_card',
    method: 'GET',
    params: {
      supplierBankCardId
    }
  })
}

// 保存银行卡信息
export function addBankCart (data) {
  return request({
    url: '/mall4cloud_admin/s/apply_supplier/supplier_bank_card',
    method: 'post',
    data
  })
}

// 更新银行卡信息
export function updateBankCart (data) {
  return request({
    url: '/mall4cloud_admin/s/apply_supplier/supplier_bank_card',
    method: 'PUT',
    data
  })
}

// 删除银行卡信息
export function deleteBankCart (supplierBankCardId) {
  return request({
    url: '/mall4cloud_admin/s/apply_supplier/supplier_bank_card',
    method: 'DELETE',
    params: {
      supplierBankCardId
    }
  })
}

// 设置主账号
export function setMainAccount (supplierBankCardId) {
  return request({
    url: '/mall4cloud_admin/s/apply_supplier/supplier_bank_card/set_primary',
    method: 'PUT',
    params: {
      supplierBankCardId
    }
  })
}

// 取消主账号
export function setNotMainAccount (supplierBankCardId) {
  return request({
    url: '/mall4cloud_admin/s/apply_supplier/supplier_bank_card/set_not_primary',
    method: 'PUT',
    params: {
      supplierBankCardId
    }
  })
}

export function getSignBrandList () {
  return request({
    url: '/mall4cloud_product/s/apply_supplier/brand/list_signing',
    method: 'get'
  })
}

export function signBrand (data) {
  return request({
    url: '/mall4cloud_product/s/apply_supplier/brand/signing',
    method: 'post',
    data
  })
}

// 获取供应商审核信息
export function getAuditingInfo () {
  return request({
    url: '/mall4cloud_admin/s/apply_supplier/supplier_apply/get_auditing_info',
    method: 'get'
  })
}

export function deleteSigningCategory (params) {
  return request({
    url: '/mall4cloud_product/s/apply_supplier/category/delete_signing_category',
    method: 'DELETE',
    params
  })
}

export function addSigningCategory (data) {
  return request({
    url: '/mall4cloud_product/s/apply_supplier/category/add_signing_category',
    method: 'POST',
    data
  })
}

export function getApplySigningBrand (name) {
  return request({
    url: '/mall4cloud_product/s/apply_supplier/brand/list_apply_signing_brand',
    method: 'get',
    params: { status: 1, name }
  })
}

export function addSigningBrand (data) {
  return request({
    url: '/mall4cloud_product/s/apply_supplier/brand/add_signing_brand',
    method: 'post',
    data
  })
}

export function deleteSigningBrand (params) {
  return request({
    url: '/mall4cloud_product/s/apply_supplier/brand/delete_signing_brand',
    method: 'DELETE',
    params
  })
}

// 申请变更工商信息
export function applyChangeCompanyInfo (data) {
  return request({
    url: '/mall4cloud_admin/s/supplier_company_auditing/apply_change_company_info',
    method: 'POST',
    data
  })
}

// 查看申请审核情况
export function getAuditInfo () {
  return request({
    url: '/mall4cloud_admin/s/supplier_company_auditing/auditInfo',
    method: 'get'
  })
}

// 撤销申请
export function setRevoke () {
  return request({
    url: '/mall4cloud_admin/s/supplier_company_auditing/revoke',
    method: 'PUT'
  })
}

// 获取企业信息（通联支付）
export function getAllinpayCompanyInfo () {
  return request({
    url: '/mall4cloud_payment/s/apply_supplier/allinpay/company/get_company_info',
    method: 'GET'
  })
}

// 绑定手机号（通联支付）
export function bindAllinpayPhone (data) {
  return request({
    url: '/mall4cloud_payment/s/apply_supplier/allinpay/company/bind_phone',
    method: 'POST',
    data
  })
}

// 解绑手机号（通联支付）
export function unbindAllinpayPhone (data) {
  return request({
    url: '/mall4cloud_payment/s/apply_supplier/allinpay/company/unbind_phone',
    method: 'PUT',
    data
  })
}

// 获取对公账户银行列表（通联支付）
export function getBankList () {
  return request({
    url: '/mall4cloud_admin/ua/public_bank/list',
    method: 'GET'
  })
}

// 批量保存银行卡信息（通联支付）
export function saveAllinpayBankCartInfo (data) {
  return request({
    url: '/mall4cloud_admin/s/apply_supplier/supplier_bank_card/allinpay_save_and_apply_supplier',
    method: 'POST',
    data
  })
}

// 企业绑定银行卡（通联支付）
export function bindAllinpayCorporateBankCart (data) {
  return request({
    url: '/mall4cloud_payment/s/apply_supplier/allinpay/company/bind_company_account',
    method: 'POST',
    data
  })
}

// 请求绑定银行卡（通联支付）（法人账户）
export function requestBindAllinpayLegalBankCart (data) {
  return request({
    url: '/mall4cloud_payment/s/apply_supplier/allinpay/company/apply_bind_bank_card',
    method: 'POST',
    data
  })
}

// 解绑银行卡（通联支付）
export function unbindAllinpayBankCart (data) {
  return request({
    url: '/mall4cloud_payment/s/apply_supplier/allinpay/company/unbind_bank_card',
    method: 'PUT',
    data
  })
}

// 账户协议签约（通联支付）
export function getAllinpaySignContract (data) {
  return request({
    url: '/mall4cloud_payment/s/apply_supplier/allinpay/company/sign_acct_protocol',
    method: 'POST',
    data
  })
}

// 更新店铺账户协议编号 (通联支付)
export function updateShopAccountProtocolNo (params) {
  return request({
    url: '/mall4cloud_admin/s/apply_supplier/supplier_company/update_acct_protocol_no',
    method: 'PUT',
    params
  })
}

// 创建会员（通联支付）
export function createAllinpayMember () {
  return request({
    url: '/mall4cloud_admin/s/apply_supplier/supplier_detail/create_allinpay_member',
    method: 'POST'
  })
}

// 更新银行卡信息（通联独有，防止有银行卡没有同步到数据库）
export function updateAllinpayBankCartInfo () {
  return request({
    url: '/mall4cloud_admin/s/apply_supplier/supplier_bank_card/refresh',
    method: 'POST'
  })
}

// 更新影印件状态 (通联支付)
export function updateIdCardStatus (params) {
  return request({
    url: '/mall4cloud_admin/mp/supplier_company/update_id_card_status',
    method: 'PUT',
    params
  })
}

// 重新上传影印件 (通联支付)
export function reUploadIdCard (data) {
  return request({
    url: '/mall4cloud_admin/mp/supplier_company/upload_id_card',
    method: 'PUT',
    data
  })
}
