import request from '@/utils/request'
import { URL } from '@/config'

export function getList(params) {
  return request({
    url: URL.shop.store.activity.base.getList,
    method: 'get',
    params,
  })
}

export function doCodeCreate(data) {
  return request({
    url: URL.shop.store.activity.base.doCodeCreate,
    method: 'post',
    data,
  })
}

export function getCodeList(params) {
  return request({
    url: URL.shop.store.activity.base.getCodeList,
    method: 'get',
    params,
  })
}

export function exportFile(params) {
  return request({
    url: URL.shop.store.activity.base.exportFile,
    method: 'get',
    params,
  })
}

export function doCodeDelete(data) {
  return request({
    url: URL.shop.store.activity.base.doCodeDelete,
    method: 'post',
    data,
  })
}

export function getActivityBuyItems(params) {
  return request({
    url: URL.shop.store.activity.base.getActivityBuyItems,
    method: 'get',
    params,
  })
}

export function listReductionRule(params) {
  return request({
    url: URL.shop.store.activity.base.listReductionRule,
    method: 'get',
    params,
  })
}

export function listItem(params) {
  return request({
    url: URL.shop.store.activity.base.listItem,
    method: 'get',
    params,
  })
}

export function getListBarginRule(params) {
  return request({
    url: URL.shop.store.activity.base.getListBarginRule,
    method: 'get',
    params,
  })
}

export function doEdit(data) {
  return request({
    url: URL.shop.store.activity.base.doEdit,
    method: 'post',
    data,
  })
}

/**
 * @name 商家端添加拼团
 * @param {*} data 
 * @api { api_url + '/admin/shop/shop-store-activity-base/update'}
 * @param {
 *      group_fixed_discount: 0                                                 固定折扣
 *      group_fixed_amount: 0                                                   优惠固定金额
 *      group_discount_type: 1                                                  优惠方式
 *      group_sale_price: 399                                                   拼团单价
 *      activity_starttime: 2024-10-01 00:00:00                                 开始时间
 *      activity_endtime: 2024-10-29 00:00:00                                   结束时间
 *      activity_type_id: 1123                                                  活动类型ID
 *      product_item_name: BINNIFA客厅音响无线立体环绕K歌观影一体家庭影院Live3D     商品名称
 *      item_id: 273                                                            商品编号
 *      activity_title: 1                                                       活动标题
 *      group_days_limit: 123                                                   成团天数限制
 *      activity_intro: 123                                                     活动介绍
 *      group_buy_limit: 1                                                      商品限购
 *      group_quantity: 1                                                       拼团人数
 *}
 * @returns 
 */

export function Update(data) {
  return request({
    url: URL.shop.store.activity.base.Update,
    method: 'post',
    data,
  })
}

export function doDelete(data) {
  return request({
    url: URL.shop.store.activity.base.doDelete,
    method: 'post',
    data,
  })
}

export function getListsLotteryItems(params) {
  return request({
    url: URL.shop.store.activity.base.getListsLotteryItems,
    method: 'get',
    params,
  })
}

export function getActivityLotteryHistorys(params) {
  return request({
    url: URL.shop.store.activity.base.getActivityLotteryHistorys,
    method: 'get',
    params,
  })
}

export function listBarginItem(params) {
  return request({
    url: URL.shop.store.activity.base.listBarginItem,
    method: 'get',
    params,
  })
}

export function saveLotteryItem(data) {
  return request({
    url: URL.shop.store.activity.base.saveLotteryItem,
    method: 'post',
    data,
  })
}

export function removeItem(data) {
  return request({
    url: URL.shop.store.activity.base.removeItem,
    method: 'post',
    data,
  })
}

export function removeLotteryItem(data) {
  return request({
    url: URL.shop.store.activity.base.removeLotteryItem,
    method: 'post',
    data,
  })
}

export function addRule(data) {
  return request({
    url: URL.shop.store.activity.base.addRule,
    method: 'post',
    data,
  })
}

export function removeRule(data) {
  return request({
    url: URL.shop.store.activity.base.removeRule,
    method: 'post',
    data,
  })
}

export function addActivityBuyItems(data) {
  return request({
    url: URL.shop.store.activity.base.addActivityBuyItems,
    method: 'post',
    data,
  })
}

export function removeActivityBuyItems(data) {
  return request({
    url: URL.shop.store.activity.base.removeActivityBuyItems,
    method: 'post',
    data,
  })
}

export function addItem(data) {
  return request({
    url: URL.shop.store.activity.base.addItem,
    method: 'post',
    data,
  })
}

export function getCouponsList(data) {
  return request({
    url: URL.shop.store.activity.base.getCouponsList,
    method: 'post',
    data,
  })
}

export function editState(data) {
  return request({
    url: URL.shop.store.activity.base.editState,
    method: 'post',
    data,
  })
}
//保存单件折折扣率,A+B活动商品数量
export function cellRateEdit(data) {
  return request({
    url: URL.shop.store.activity.base.cellRateEdit,
    method: 'post',
    data,
  })
}

export function cellPriceQuantityEdit(data) {
  return request({
    url: URL.shop.store.activity.base.cellPriceQuantityEdit,
    method: 'post',
    data,
  })
}

export function cellEditRule(data) {
  return request({
    url: URL.shop.store.activity.base.cellEditRule,
    method: 'post',
    data,
  })
}

export function cellEditDoubleRule(data) {
  return request({
    url: URL.shop.store.activity.base.cellEditDoubleRule,
    method: 'post',
    data,
  })
}

export function cellEditReplace(data) {
  return request({
    url: URL.shop.store.activity.base.cellEditReplace,
    method: 'post',
    data,
  })
}

export function cellEdit(data) {
  return request({
    url: URL.shop.store.activity.base.cellEdit,
    method: 'post',
    data,
  })
}
