import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PartnerMerchantVO, PartnerMerchantForm, PartnerMerchantQuery } from './types';

export function listPartnerMerchant(query: PartnerMerchantQuery): AxiosPromise<PartnerMerchantVO[]> {
  return request({
    url: '/customer/partnerInfo/list',
    method: 'get',
    params: query
  });
}

export function getPartnerMerchant(id: string | number): AxiosPromise<PartnerMerchantVO> {
  return request({
    url: '/customer/partnerInfo/' + id,
    method: 'get'
  });
}

export function addPartnerMerchant(data: PartnerMerchantForm) {
  return request({
    url: '/customer/partnerInfo',
    method: 'post',
    data: data
  });
}

export function updatePartnerMerchant(data: PartnerMerchantForm) {
  return request({
    url: '/customer/partnerInfo',
    method: 'put',
    data: data
  });
}

export function delPartnerMerchant(ids: string | number | Array<string | number>) {
  return request({
    url: '/customer/partnerInfo/' + ids,
    method: 'delete'
  });
}

export function exportPartnerMerchant(query: PartnerMerchantQuery) {
  return request({
    url: '/customer/partnerInfo/export',
    method: 'post',
    data: query
  });
}

// 伙伴商协同平台首页数据
export function partnerInfoIndexData() {
  return request({
    url: '/customer/partnerInfo/partnerInfoIndexData',
    method: 'get'
  });
}
