// 团购商品  套餐推广接口集合
import request from "@/utils/request";
import { Order_BaseUrl, Market_BaseUrl } from "@/api/config";
const baseWareURL = Order_BaseUrl + "/admin/ware";
const baseOrderURL = Order_BaseUrl + "/admin/gbOrder";

/**
 * 拼团商品-统计
 * @param {*} data 
 * @returns 
 */
export function wareCount(params) {
  return request({
    url: `${baseWareURL}/ware/count`,
    method: "get",
    params,
  });
}

/**
 * 拼团商品-活动开关
 * @param {*} data 
 * @returns 
 */
export function upShopConfig(data) {
  return request({
    url: `${baseWareURL}/upShopConfig`,
    method: "post",
    data,
  });
}

/**
 * 拼团商品-新增
 * @param {*} data 
 * @returns 
 */
export function addGbWare(data) {
  return request({
    url: `${baseWareURL}/addGbWare`,
    method: "post",
    data,
  });
}

/**
 * 拼团商品-修改
 * @param {*} data 
 * @returns 
 */
export function updateGbWareById(data) {
  return request({
    url: `${baseWareURL}/updateGbWareById`,
    method: "post",
    data,
  });
}

/**
 * 拼团商品-列表
 * @param {*} data 
 * @returns 
 */
export function getGbWarePage(params) {
  return request({
    url: `${baseWareURL}/getGbWarePage`,
    method: "get",
    params,
  });
}

/**
 * 拼团商品-修改状态
 * @param {*} data 
 * @returns 
 */
export function editOnlineStatus(data) {
  return request({
    url: `${baseWareURL}/editOnlineStatus`,
    method: "post",
    data,
  });
}

/**
 * 拼团商品-删除
 * @param {*} data 
 * @returns 
 */
export function deleteGbWare(id) {
  return request({
    url: `${baseWareURL}/deleteGbWare/${id}`,
    method: "DELETE"
  });
}

/**
 * 拼团商品:订单列表
 * @param {*} data 
 * @returns 
 */
export function gbOrderPage(params) {
  return request({
    url: `${baseOrderURL}/page`,
    method: "get",
    params,
  });
}

/**
 * 退单/同意退单
 * @param {*} data 
 * @returns 
 */
export function orderAgreeRefund(data) {
  return request({
    url: `${baseOrderURL}/agreeRefund`,
    method: "post",
    data,
  });
}

/**
 * 驳回退单
 * @param {*} data 
 * @returns 
 */
export function orderRejectRefund(data) {
  return request({
    url: `${baseOrderURL}/rejectRefund`,
    method: "post",
    data,
  });
}

/**
 * 拼团商品:核销
 * @param {*} data 
 * @returns 
 */
export function orderCheckout(data) {
  return request({
    url: `${baseOrderURL}/checkout`,
    method: "post",
    data,
  });
}

/**
 * 套餐推广:添加套餐
 * @param {*} data 
 * @returns 
 */
export function packageAddEdit(data) {
  return request({
    url: `${Market_BaseUrl}/admin/package`,
    method: data.id ? 'put' : 'post',
    data,
  });
}

/**
 * 套餐推广:获取套餐列表
 * @param {*} data 
 * @returns 
 */
export function packageGet(params) {
  return request({
    url: `${Market_BaseUrl}/admin/package`,
    method: 'get',
    params,
  });
}

/**
 * 套餐推广:获取套餐推广开关
 * @param {*} data 
 * @returns 
 */
export function packageSwitchGet() {
  return request({
    url: `${Market_BaseUrl}/admin/package/switch`,
    method: 'get'
  });
}

/**
 * 套餐推广:修改套餐推广开关
 * @param {*} data 
 * @returns 
 */
export function packageSwitchPut(data) {
  return request({
    url: `${Market_BaseUrl}/admin/package/switch`,
    method: 'put',
    data
  });
}

/**
 * 套餐推广:删除套餐
 * @param {*} data 
 * @returns 
 */
export function packageDel(id) {
  return request({
    url: `${Market_BaseUrl}/admin/package/${id}`,
    method: 'DELETE'
  });
}

/**
 * 套餐推广:确认删除套餐
 * @param {*} data 
 * @returns 
 */
export function packageSureDel(id) {
  return request({
    url: `${Market_BaseUrl}/admin/package/${id}`,
    method: 'DELETE'
  });
}

/**
 * 套餐推广:修改套餐推广开关
 * @param {*} data 
 * @returns 
 */
export function packageOnline(data) {
  return request({
    url: `${Market_BaseUrl}/admin/package/online`,
    method: 'put',
    data
  });
}

/**
 * 套餐推广:获取套餐推广订单列表
 * @param {*} data 
 * @returns 
 */
export function packageOrder(params) {
  return request({
    url: `${Market_BaseUrl}/admin/package/order`,
    method: 'GET',
    params
  });
}

/**
 * 套餐推广:订单统计
 * @param {*} data 
 * @returns 
 */
export function packageOrderStat(params) {
  return request({
    url: `${Market_BaseUrl}/admin/package/order/stat`,
    method: 'GET',
    params
  });
}

/**
 * 套餐推广:确认退单
 * @param {*} data 
 * @returns 
 */
export function packageConfirmRefund(data) {
  return request({
    url: `${Order_BaseUrl}/admin/ppOrder/confirmRefund`,
    method: 'post',
    data
  });
}

/**
 * 套餐推广:驳回退单
 * @param {*} data 
 * @returns 
 */
export function packageRejectRefund(data) {
  return request({
    url: `${Order_BaseUrl}/admin/ppOrder/rejectRefund`,
    method: 'post',
    data
  });
}

/**
 * 套餐推广:核销
 * @param {*} data 
 * @returns 
 */
export function packageCheckout(data) {
  return request({
    url: `${Order_BaseUrl}/admin/ppOrder/checkout`,
    method: 'post',
    data
  });
}

