// 营销模块 运营中心

// 获取Banner列表
export const getBannerList = {
  url: '/banner/bannerPermission/list',
  method: 'GET'
  // dealReqData: ({ pageNum, pageSize }) => {
  //   return { pageNum, pageSize }
  // }
}

// 添加Banner
export const addBanner = {
  url: '/banner/bannerPermission/save',
  method: 'POST',
  dealReqData: ({ bannerName, bannerImage, bannerType, url, number, displayOrder }) => {
    return { bannerName, bannerImage, bannerType, url, number, displayOrder }
  }
}
// 编辑banner
export const updateBanner = {
  url: '/banner/bannerPermission/update',
  method: 'PUT'
  // dealReqData: ({ id, goodsNo, sort, bannerUrl }) => {
  //   goodsNo = goodsNo.trim()
  //   return { id, goodsNo, sort, bannerUrl }
  // }
}
// banner详情
export const bannerDetail = {
  url: `/banner/bannerPermission`,
  method: 'GET',
  dealUrl: (url, operationBannerId) => {
    return `${url}/${operationBannerId}`
  }
}
// 显示或隐藏Banner
export const hideOrShowBanner = {
  url: '/banner/bannerPermission/banner/hideOrShow',
  method: 'PUT',
  dealReqData: ({ id }) => {
    return { id }
  }
}

// 删除Banner
export const deleteBanner = {
  url: '/banner/bannerPermission/delete',
  method: 'DELETE',
  dealUrl: (url, operationBannerId) => {
    return `${url}/${operationBannerId}`
  }
}

// 获取推荐商品列表
export const getRecommendList = {
  url: '/banner/bannerPermission/recommend/page',
  method: 'GET',
  dealReqData: ({ pageNum, pageSize }) => {
    return { pageNum, pageSize }
  }
}

// 添加推荐商品
export const addRecommend = {
  url: '/banner/bannerPermission/recommend/add',
  method: 'POST',
  dealReqData: ({ goodsNo, sort }) => {
    goodsNo = goodsNo.trim()
    return { goodsNo, sort }
  }
}

// 编辑推荐商品
export const updateRecommend = {
  url: '/banner/bannerPermission/recommend/update',
  method: 'PUT',
  dealReqData: ({ id, goodsNo, sort }) => {
    goodsNo = goodsNo.trim()
    return { id, goodsNo, sort }
  }
}

// 删除推荐商品
export const deleteRecommend = {
  url: '/banner/bannerPermission/recommend/delete',
  method: 'DELETE',
  dealReqData: ({ id }) => {
    return { id }
  }
}

// 楼层列表查询
export const getFloorList = {
  url: '/floor/floorPermission/list',
  method: 'GET'
}

// 楼层商品列表查询
export const getFloorGoodsList = {
  url: '/floor-goods/floorGoodsPermission/list',
  method: 'GET',
  dealReqData: ({ operationFloorId }) => {
    return { operationFloorId }
  }
}

// 楼层商品新增
export const addFloorGoods = {
  url: '/floor-goods/floorGoodsPermission/save',
  method: 'POST'
}

// 楼层商品删除
export const delFloorGoods = {
  url: '/floor-goods/floorGoodsPermission/delete',
  method: 'DELETE',
  dealUrl: (url, { operationFloorId, goodsId }) => {
    return `${url}/${operationFloorId}/${goodsId}`
  }
}

// 功能区列表查询
export const getRibbonList = {
  url: '/function/functionPermission/list',
  method: 'GET'
}

// 功能区新增
export const addRibbon = {
  url: '/function/functionPermission/save',
  method: 'POST'
}

// 功能区编辑
export const updateRibbon = {
  url: '/function/functionPermission/update',
  method: 'PUT'
}

// 功能区详情
export const ribbonDetail = {
  url: '/function/functionPermission',
  method: 'GET',
  dealUrl: (url, operationFunctionId) => {
    return `${url}/${operationFunctionId}`
  }
}

// 功能区列表删除
export const deleteRibbon = {
  url: '/function/functionPermission/delete',
  method: 'DELETE',
  dealUrl: (url, operationFunctionId) => {
    return `${url}/${operationFunctionId}`
  }
}

// 关键字列表
export const getKeywordList = {
  url: '/keyword/keywordPermission/list',
  method: 'GET'
}

// 关键字新增
export const addKeyword = {
  url: '/keyword/keywordPermission/save',
  method: 'POST'
}

// 关键字删除
export const deleteKeyword = {
  url: '/keyword/keywordPermission/delete',
  method: 'DELETE',
  dealUrl: (url, operationKeywordId) => {
    return `${url}/${operationKeywordId}`
  }
}
// 优惠券列表查询
export const couponList = {
  url: '/coupon/couponPermission/list',
  method: 'GET',
  dealReqData: ({ pageNum, pageSize, couponId, name, status }) => {
    return { pageNum, pageSize, couponId, name, status }
  }
}

// 添加优惠券
export const addcoupon = {
  url: '/coupon/couponPermission/save',
  method: 'POST',
  dealReqData: (couponSaveDTO) => {
    return couponSaveDTO
  }
}
// 修改优惠券
export const updateCoupon = {
  url: '/coupon/couponPermission/update',
  method: 'PUT',
  dealReqData: (couponSaveDTO) => {
    return couponSaveDTO
  }
}
// 优惠券详情
export const couponDetail = {
  url: `/coupon/couponPermission`,
  method: 'GET'
}
// 删除优惠券
export const deleteCoupon = {
  url: `/coupon/couponPermission/delete`,
  method: 'DELETE',
  dealUrl: (url, couponId) => {
    return `${url}/${couponId}`
  }
}
// 商品优惠券-主键查询
export const geteCouponId = {
  url: `/coupon/couponPermission`,
  method: 'GET',
  dealUrl: (url, couponId) => {
    return `${url}/${couponId}`
  }
}
// 批量删除优惠券
export const batchDelete = {
  url: `/coupon/couponPermission/batchDelete`,
  method: 'DELETE',
  // dealReqData: (couponIdList) => {
  //   return { couponIdList }
  // }
  dealUrl: (url, couponIdList) => {
    return `${url}?couponIdList=${couponIdList}`
  }
}
// 根据商品编号或id查询商品信息
export const queryByNameOrId = {
  url: `/goods/goodsList/queryByNameOrId`,
  method: 'GET',
  dealReqData: (goods) => {
    return goods
  }
}
// 根据商品编号或id查询商品信息
export const listByNameOrId = {
  url: `/goods/listByNameOrId`,
  method: 'GET',
  dealReqData: (goods) => {
    return goods
  }
}
// 积分返现-列表查询
export const recurrencePermissionList = {
  url: '/memberIntegralRecurrence/recurrencePermission/list',
  method: 'GET'
}
// 运营中心-积分返现-编辑
export const updateCouponUpdate = {
  url: '/memberIntegralRecurrence/recurrencePermission/update',
  method: 'PUT',
  dealReqData: (paramList) => {
    return paramList
  }
}
// 积分返现--分页查询
export const integralReturnPage = {
  url: '/integralReturnMerchant/page',
  method: 'GET'
}

// 积分返现--新增
export const addIntegralReturn = {
  url: '/integralReturnMerchant/add',
  method: 'POST',
  dealReqData: ({ name, num, returnCondition, conditionVal, effectiveStartTime, effectiveEndTime, remarks, goodsRange, categoryList, goodsList }) => {
    return { name, num, returnCondition, conditionVal, effectiveStartTime, effectiveEndTime, remarks, goodsRange, categoryList, goodsList }
  }
}

// 积分返现--编辑
export const editIntegralReturn = {
  url: '/integralReturnMerchant/edit',
  method: 'PUT'
}

// 积分返现--详情
export const detailIntegralReturn = {
  url: '/integralReturnMerchant/detail',
  method: 'GET',
  dealUrl: (url, returnId) => {
    return `${url}?returnId=${returnId}`
  }
}

// 积分返现--删除
export const deleteIntegralReturn = {
  url: '/integralReturnMerchant/delete',
  method: 'DELETE',
  dealUrl: (url, returnId) => {
    return `${url}/${returnId}`
  }
}

// 积分返现--下架
export const offShelfIntegralReturn = {
  url: '/integralReturnMerchant/offShelf',
  method: 'PUT',
  dealUrl: (url, returnId) => {
    return `${url}?returnId=${returnId}`
  }
}

// 积分返现--批量删除
export const deleteBatchIntegralReturn = {
  url: '/integralReturnMerchant/deleteBatch',
  method: 'DELETE'
}
// 根据商品编号或名称查询商品信息
export const integralReturnQueryByNameOrId = {
  url: '/integralReturnMerchant/queryByNameOrId',
  method: 'GET'
}

// 推广佣金
export const popularizeCommissionList = {
  url: '/popularizeCommission/list',
  method: 'GET'
}

// 保存推广佣金
export const popularizeCommissionSave = {
  url: '/popularizeCommission/save',
  method: 'POST'
}

// 购赠活动
// -购赠活动列表
export const purchaseGiftEventList = {
  url: '/buyreward',
  method: "GET"
}

// -新增购赠活动
export const addPurchaseGiftEvent = {
  url: '/buyreward',
  method: "POST",
  dealReqData: ({ name, rewardGoodId, rewardSkuId, rewardNum, condGoodId, condSkuId, condNum, startDate, endDate, comm }) => {
    return { name, rewardGoodId, rewardSkuId, rewardNum, condGoodId, condSkuId, condNum, startDate, endDate, comm }
  }
}

// -更新购赠活动
export const updatePurchaseGiftEvent = {
  url: "/buyreward",
  method: "PUT",
  dealReqData: ({ id, activityId, name, rewardGoodId, rewardSkuId, rewardNum, condGoodId, condSkuId, condNum, startDate, endDate, comm }) => {
    return { id, activityId, name, rewardGoodId, rewardSkuId, rewardNum, condGoodId, condSkuId, condNum, startDate, endDate, comm }
  }
}

// -关闭购赠活动
export const closePurchaseGiftEvent = {
  url: "/buyreward",
  method: "POST",
  dealUrl: (url, activityId) => {
    return `${url}/${activityId}/close`
  }
}

// -查询购赠活动领取记录
export const purchaseGiftEventRecordList = {
  url: '/buyreward/record',
  method: "GET"
}


// 集齐活动
// -查询集齐活动
export const getCollectEventList = {
  url: "/collectionreward",
  method: "GET"
}
// -新增集齐活动
export const addCollectEvent = {
  url: "/collectionreward",
  method: "POST",
  dealReqData: ({ condGoods, rewardGoods, name, comm, startDate, endDate, }) => {
    return { condGoods, rewardGoods, name, comm, startDate, endDate }
  }
}
// -更新集齐活动
export const updateCollectEvent = {
  url: "/collectionreward",
  method: "PUT",
  dealReqData: ({ id, activityId, condGoods, rewardGoods, name, comm, startDate, endDate, }) => {
    return { id, activityId, condGoods, rewardGoods, name, comm, startDate, endDate }
  }
}
// -获取活动的商品 type	商品类型，1：条件商品， 2：奖励商品
export const getCollectEventGoodsList = {
  url: "/collectionreward/goods",
  method: "GET"
}
// -查询活动的记录
export const getCollectEventRecordList = {
  url: "/collectionreward/record",
  method: "GET"
}
// -取消活动
export const cancelCollectEvent = {
  url: "/collectionreward",
  method: "POST",
  dealUrl: (url, activityId) => {
    return `${url}/${activityId}/close`
  }
}

// 空投活动
// 模板下载   
export const AerialDeliveryExcel = {
  url: "/aerialDelivery/excel/download",
  method: "POST"
}
// 列表查询
export const getAerialDeliveryList = {
  url: "/aerialDelivery/list",
  method: "GET"
}
// 补发
export const AerialDeliveryReissue = {
  url: "/aerialDelivery/reissue",
  method: "POST"
}
// 新增
export const AerialDeliverySave = {
  url: "/aerialDelivery/save",
  method: "POST"
}
// 主键查询
export const getAerialDeliveryId = {
  url: "/aerialDelivery",
  method: "GET",
  dealUrl: (url, {aerialDeliveryId}) => {
    return `${url}/${aerialDeliveryId}`
  }
}
// 空投记录-列表查询
export const getAerialDeliveryRecordList = {
  url: "/aerialDeliveryRecord/list",
  method: "GET"
}
// 运营中心-店铺推荐-列表查询
export const getShopList= {
  url: "/shop/list",
  method: "GET"
}
// 运营中心-店铺推荐-新增
export const insertShopSave = {
  url: "/shop/save",
  method: "POST",
  dealReqData: ({ displayOrder, shopId }) => {
    return { displayOrder, shopId }
  }
}
// 运营中心-店铺推荐-删除
export const deleteShopRecommend = {
  url: '/shop/delete',
  method: 'DELETE',
  dealUrl: (url, { shopId }) => {
    return `${url}/${shopId}`
  }
}



// 优惠券空投活动-
// 列表查询
export const getCouponDeliveryList = {
  url: "/couponDelivery/list",
  method: "GET"
}
// 补发
export const CouponDeliveryReissue = {
  url: "/couponDelivery/reissue",
  method: "POST"
}
// 新增
export const CouponDeliverySave = {
  url: "/couponDelivery/save",
  method: "POST"
}

// 空投记录-列表查询
export const getCouponDeliveryRecordList = {
  url: "/couponDeliveryRecord/list",
  method: "GET"
}