import request from "@/benyun/utils/request";

//查询数据
export function query(params: any) {
  return request({
    url: "/omsOrder/shop/page",
    method: "get",
    params: params,
  });
}

//新增数据
export function save(data: any) {
  return request({
    url: "/omsOrder/shop/save",
    method: "POST",
    data: data,
  });
}

//修改数据
export function update(data: any) {
  return request({
    url: "/omsOrder/shop/update",
    method: "POST",
    data: data,
  });
}

//点三店铺列表查询
export function dian3ShopQuery(data: any) {
  return request({
    url: "/omsOrder/shop/query",
    method: "POST",
    data: data,
  });
}

//删除数据
export function del(data: any) {
  return request({
    url: "/omsOrder/omsShop/delete",
    method: "POST",
    params: data,
  });
}

//店铺授权
export function shopAuth(data: any) {
  return request({
    url: "/omsOrder/shop/auth",
    method: "GET",
    params: data,
  });
}

//授权签名
export function shopSign(data: any) {
  return request({
    url: "/omsOrder/shop/buildSign",
    method: "POST",
    params: data,
  });
}

//修改授权状态
export function shopState(data: any) {
  return request({
    url: "/omsOrder/shop/edit",
    method: "POST",
    data: data,
  });
}

//通过点3授权成功回调店铺id新增店铺
export function shopAdd(data: any) {
  return request({
    url: "/omsOrder/shop/add",
    method: "POST",
    params: data,
  });
}

//同步聚水潭店铺
export function uploadWaterShop(data: { pageIndex: number; pageSize: number }) {
  return request({
    url: "/omsOrder/waterShop/uploadWaterShop",
    method: "POST",
    data,
  });
}

export interface IShopResponse<T> {
  code: number;
  data: {
    countId: number;
    current: number;
    maxLimit: number;
    optimizeCountSql: boolean;
    orders: Array<any>;
    pages: number;
    records: T[];
    searchCount: boolean;
    size: number;
    total: number;
  };
  msg: string;
}
