// 营销模块 运营中心

// 获取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 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
  }
}
// 积分返现-列表查询
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'
}
