import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MerchantItemVO, MerchantItemForm, MerchantItemQuery } from '@/api/system/physical/merchantItem/types';

/**
 * 查询商城货品管理列表
 * @param query
 * @returns {*}
 */

export const listMerchantItem = (query?: MerchantItemQuery): AxiosPromise<MerchantItemVO[]> => {
  return request({
    url: '/physical/merchantItem/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询商城货品管理详细
 * @param id
 */
export const getMerchantItem = (id: string | number): AxiosPromise<MerchantItemVO> => {
  return request({
    url: '/physical/merchantItem/' + id,
    method: 'get'
  });
};

/**
 * 新增商城货品管理
 * @param data
 */
export const addMerchantItem = (data: MerchantItemForm) => {
  return request({
    url: '/physical/merchantItem',
    method: 'post',
    data: data
  });
};

/**
 * 修改商城货品管理
 * @param data
 */
export const updateMerchantItem = (data: MerchantItemForm) => {
  return request({
    url: '/physical/merchantItem',
    method: 'put',
    data: data
  });
};

/**
 * 删除商城货品管理
 * @param id
 */
export const delMerchantItem = (id: string | number | Array<string | number>) => {
  return request({
    url: '/physical/merchantItem/' + id,
    method: 'delete'
  });
};
/**
 * 查询商品列表
 */
export const selectPhysicalMerchantProductList = (): AxiosPromise<MerchantItemVO> => {
  return request({
    url: '/physical/merchantItem/selectPhysicalMerchantProductList',
    method: 'get'
  });
};
