import request from '@/assets/js/utils/request'

/**
 * 获取商品列表/搜索商品
 * @param params
 */
export function getList(data) {
  return request({
    url: '/bidprocurement/shopmall-product/product/products/productsList',
    method: 'post',
    data
  })
}

/**
 * 保存商品
 */
export function saveShop(params) {
  return request({
    url: '/example/saveshop',
    method: 'post',
    data: {
      params
    }
  })
}
/**
 * 修改库存数量
 * @param shopId
 * @param count
 */
export function updateStockCount(shopId, count) {
  return request({
    url: '/example/updatestockcount',
    method: 'post',
    data: {
      shopId,
      count
    }
  })
}

/**
 * 商品下架
 * @param shopId
 */
export function undercarriage(shopId) {
  return request({
    url: '/example/undercarriage',
    method: 'post',
    data: {
      shopId
    }
  })
}
/**
 * 商品分类删除管理接口
 * @param shopId
 */
export function deleteGoodsClassParam(id) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptGoodsClassParamController/deleteGoodsClassParam/' + id,
    method: 'get'
  })
}

/**
 * 获取参数管理列表
 * @param shopId
 */
export function getParamPageList(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptGoodsClassParamController/getParamPageList',
    method: 'post',
    data
  })
}

/**
 * 商品分类详情接口
 * @param id
 */
export function toDetail(id) {
  return request({
    url: '/bidprocurement/shopmall-product/product/goodsClass/toDetail',
    method: 'get',
    params: {
      id
    }
  })
}

/**
 * 新增商品参数
 * @param 设置商品参数
 */
export function addParamInfo(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptGoodsClassParamController/addParamInfo',
    method: 'post',
    data
  })
}
/**
 * 获取参数详细信息
 * @param 参数ID
 */
export function getGoodsClassParam(id) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptGoodsClassParamController/getGoodsClassParam/' + id,
    method: 'get'
  })
}

/**
 * 参数启用和禁用
 * @param 设置商品参数
 */
export function paramOnOrOff(id, useStatus) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptGoodsClassParamController/paramOnOrOff',
    method: 'get',
    params: {
      id,
      useStatus
    }
  })
}

/**
 * 编辑商品参数
 * @param 设置商品参数
 */
export function editParamInfo(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptGoodsClassParamController/addParamInfo',
    method: 'post',
    data
  })
}
/**
 * 商品需要设置的参数
 * @param 商品ID
 */
export function getProductParams(id) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptGoodsClassParamController/getProductParams?productId=' + id,
    method: 'post'
  })
}
/**
 * 保存商品参数
 * @param 参数对象
 */
export function editProductParams(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptGoodsClassParamController/editProductParams',
    method: 'post',
    data
  })
}

/**
 * @param 商品对比信息接口
 */
export function productContrast(ids) {
  return request({
    url: '/bidprocurement/shopmall-search/search/products/productContrast',
    method: 'post',
    data: {
      ids
    }
  })
}

export function addPictrueShop(shopId) {
  return request({
    url: '/example/undercarriage',
    method: 'post',
    data: {
      shopId
    }
  })
}
// 商品详细信息
export function productDetails(shopId) {
  return request({
    url: '/bidprocurement/shoppingmall-search/search/shptProductEsProductController/productDetails/' +
            shopId,
    method: 'get'
  })
}
// 商品详情页之商家在售
export function salesOfBusinesProducts(shopId) {
  return request({
    url: '/bidprocurement/shoppingmall-search/search/shptProductEsProductController/salesOfBusinesProducts?id=' +
            shopId,
    method: 'get'
  })
}
// 商品详情页之同类商品热卖
export function redHotProducts(shopId) {
  return request({
    url: '/bidprocurement/shoppingmall-search/search/shptProductEsProductController/redHotProducts?id=' +
            shopId,
    method: 'get'
  })
}
// 商品详情页之店铺信息
export function getProductShopInfo(shopId) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptProductsController/getProductShopInfo?id=' +
            shopId,
    method: 'get'
  })
}
// 添加收藏信息
export function addMarkInfo(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptFootMarkController/addMarkInfo',
    method: 'post',
    data
  })
}

// 添加收藏商家信息
export function addshopMarkInfo(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptFootMarkController/addshopMarkInfo',
    method: 'post',
    data
  })
}

// 添加收藏商家信息
export function hasMarked(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptFootMarkController/hasMarked?type=' + data.type + '&id=' + data.id,
    method: 'get'
  })
}

// 添加购物车购物车详情信息
export function saveShoppingCart(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptCartController/saveShoppingCart',
    method: 'post',
    data
  })
}

// 供应商-商品管理-获取所有的商品信息
export function productsList(data) {
  return request({
    url: '/bidprocurement/shopmall-product/product/products/productsList',
    method: 'post',
    data
  })
}
// 商品管理添加或编辑商品信息
export function addOrEditProductsInfo(data) {
  return request({
    url: '/bidprocurement/shopmall-product/product/products/addOrEditProductsInfo',
    method: 'post',
    data
  })
}

/**
 * 删除商品
 * @param shopId
 */
export function deleteProducts(id) {
  return request({
    url: '/bidprocurement/shopmall-product/product/products/deleteProducts',
    method: 'get',
    params: {
      id
    }
  })
}

/**
 * 商品上下架
 * @param shopId
 */
export function productUporDown(id, state) {
  return request({
    url: '/bidprocurement/shopmall-product/product/products/productUporDown',
    method: 'get',
    params: {
      id,
      state
    }
  })
}

// 商品审核
export function auditProducts(data) {
  return request({
    url: '/bidprocurement/shopmall-product/product/products/auditProducts',
    method: 'post',
    data
  })
}

/* -----门户商品接口start-----*/
// 查询分类json树
export function getgoodsclassTree(pid) {
  return request({
    // url: '/bidprocurement/shopmall-search/search/esProduct/getgoodsclassTree',
    url: '/bidprocurement/shoppingmall-search/search/shptProductEsProductController/getGoodsClassTree',
    method: 'get',
    params: {
      pid
    }
  })
}
// 首页商品列表
export function homePageProductList(data) {
  return request({
    url: '/bidprocurement/shoppingmall-search/search/shptProductRelatedController/homePageProductList',
    method: 'post',
    data
  })
}
// 简单搜索
export function simpleSearch(data) {
  return request({
    url: '/bidprocurement/shoppingmall-search/search/shptProductEsProductController/simpleSearch',
    method: 'post',
    data
  })
}
// 复杂搜索
export function searchProduct(data) {
  return request({
    url: '/bidprocurement/shoppingmall-search/search/shptProductEsProductController/searchProduct',
    method: 'post',
    data
  })
}
// 获取购物车分页信息
export function getCartList(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptCartController/getCartList',
    method: 'post',
    data
  })
}
/* -----门户商品接口end-----*/
// 获取搜索的相关品牌、分类及筛选属性
export function searchScreen(data) {
  return request({
    url: '/bidprocurement/shoppingmall-search/search/shptProductRelatedController/searchScreen',
    method: 'post',
    data
  })
}
// 查询供应商信息
export function getDepartInfo(id) {
  return request({
    url: '/bidprocurement/shoppingmall-search/search/shptProductEsProductController/getDepartInfo',
    method: 'get',
    params: {
      id
    }
  })
}
/**
 * @param 商品对比信息接口
 */
export function productDetailsBatch(id) {
  return request({
    url: '/bidprocurement/shoppingmall-search/search/shptProductEsProductController/productDetailsBatch?id=' + id,
    method: 'get'
  })
}
// 校验库存
export function productCheckStock(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptProductsController/productCheckStock',
    method: 'post',
    data
  })
}
// 获取区域校验地址信息
export function getCheckAreaInfo(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptMailingAddressController/getCheckAreaInfo?userId=' + data,
    method: 'get'
  })
}
// 保存校验地址
export function saveCheckAreaInfo(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptMailingAddressController/saveCheckAreaInfo',
    method: 'post',
    data
  })
}
// 购物车比价
export function productCompareInfo(compareIds) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shopmallCart/productCompareInfo?compareIds=' + compareIds,
    method: 'get'
  })
}
// 查询商品的配送区域是否限制
export function getSkuAreaLimit(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/shptTask/shptTaskCommonFeignClient/getSkuAreaLimit?skuId=' + data.skuId + '&userId=' + data.userId + '&type=' + data.type,
    method: 'get'
  })
}
// 京东商品验证是否可售性
export function productCheck(data) {
  return request({
    url: '/bidprocurement/shopmall-task/taskProductClient/productCheck/' + data.skuIds + '/' + data.queryExts,
    method: 'get'
  })
}

// --------2021-0611-商品管理 -商品审核-------------
//  商品审核列表
export function getProductAuditList(data) {
  return request({
    url: '/bidprocurement/shoppingmall-search/search/shptProductEsProductController/searchAuditProduct',
    method: 'post',
    data
  })
}
//  提交商品审核
export function saveProductAudit(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptProductsController/saveProductAudit',
    method: 'post',
    data
  })
}
//  商品审核流程获取
export function getProductAuditSteps(id) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptProductsController/getProductAuditSteps/' + id,
    method: 'get'
  })
}
//  获取商品详细信息
export function getProductDetails(id) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptProductsController/getProductDetails/' + id,
    method: 'get'
  })
}
//  获取商品详细信息
export function updateProductSock(id, newInventory) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptProductsController/updateProductSock?productId=' + id + '&newInventory=' + newInventory,
    method: 'post'
  })
}
// 商品管理添加或编辑商品信息
export function addOrUpdateProductsInfo(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptProductsController/addOrUpdateProductsInfo',
    method: 'post',
    data
  })
}
//  商品列表查询
export function searchSupplierProduct(data) {
  return request({
    url: '/bidprocurement/shoppingmall-search/search/shptProductEsProductController/searchSupplierProduct',
    method: 'post',
    data
  })
}
// 商品管理上架 state  =1上架 0下架
export function updateProductState(params) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptProductsController/updateProductState',
    method: 'post',
    params
  })
}
// 商品管理-商品删除接口
export function deleteProduct(params) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptProductsController/deleteProduct',
    method: 'post',
    params
  })
}
/* -----协议接口start------ */
// 获取协议列表
export function getProtocolList(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/ShptProtocolController/getProtocolList',
    method: 'post',
    data
  })
}
// 供应商协议列表
export function listGYSProtocolPages(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/ShptProtocolController/listGYSProtocolPages',
    method: 'post',
    data
  })
}
// 协议启用或停用状态设置
export function updateProtocolStatus(id, status) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/ShptProtocolController/updateProtocolStatus?id=' + id + '&status=' + status,
    method: 'get'
  })
}
// 获取协议详细信息
export function getProtocoDetails(id) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/ShptProtocolController/getProtocoDetails?id=' + id,
    method: 'get'
  })
}
// 删除协议信息
export function deleteprotocol(id) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/ShptProtocolController/deleteprotocol?id=' + id,
    method: 'get'
  })
}
// 添加或更新协议信息
export function doAddOrUpdateProtocol(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/ShptProtocolController/doAddOrUpdateProtocol',
    method: 'post',
    data
  })
}
// 协议录入-选择供应商接口
export function getOrganizationList(data) {
  return request({
    url: '/bidprocurement/common-user/user/depart/queryDepartList',
    method: 'post',
    data
  })
}
/* -----协议接口end------ */
/* -----商品分类接口start----- */
// 查询分类json树
export function getGoodsclassTree() {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptGoodsClassController/getGoodsclassTree',
    method: 'get'
  })
}
// 新增商品-商品分类选择 参数 departId传空值即可
export function getSupplierAvailableClassTree(pid) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptGoodsClassController/getSupplierAvailableClassTree',
    method: 'get',
    params: {
      pid
    }
  })
}
// 获取分类管理列表
export function getGoodsClassListTree(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptGoodsClassController/getGoodsClassListTree',
    method: 'post',
    data
  })
}
// 添加商品分类信息
export function saveGoodClass(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptGoodsClassController/saveGoodClass',
    method: 'post',
    data
  })
}
// 更新商品分类信息
export function updateGoodClass(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptGoodsClassController/updateGoodClass',
    method: 'post',
    data
  })
}
// 商品分类 启用或禁用
export function updateGoodClassUseStatus(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptGoodsClassController/updateGoodClassUseStatus',
    method: 'post',
    data
  })
}
// 删除商品分类信息
export function doDeleteGoodsClass(id) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptGoodsClassController/doDeleteGoodsClass/' + id,
    method: 'get'
  })
}
// 获取商品分类详细信息
export function getGoodsClassDetails(id) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptGoodsClassController/getGoodsClassDetails?id=' + id,
    method: 'get'
  })
}
/* -----商品分类接口end----- */
/* -----获取客服列表接口----- */
export function getShptCustomerList(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptCustomerController/getShptCustomerList',
    method: 'post',
    data
  })
}
/* -----广告管理API接口start----- */
// 广告管理/首页轮播图图片列表
export function getShptAdvertisementPictureList(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptAdvertisementPictureController/getShptAdvertisementPictureList',
    method: 'post',
    data
  })
}
// 广告管理列表
export function getShptAdvertisementList(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptAdvertisementController/getShptAdvertisementList',
    method: 'post',
    data
  })
}
// 新增/编辑广告位
export function doAddOrUpdateAdvertisement(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptAdvertisementController/doAddOrUpdateAdvertisement',
    method: 'post',
    data
  })
}
// 获取广告位详细信息
export function getAdvertisementDetails(id) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptAdvertisementController/getAdvertisementDetails?id=' + id,
    method: 'get'
  })
}
// 广告位启用或停用状态设置
export function advertisementStatus(id, useStatus) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptAdvertisementController/advertisementStatus?id=' + id + '&useStatus=' + useStatus,
    method: 'post'
  })
}
// 删除广告位
export function deleteAdvertisement(id) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptAdvertisementController/deleteAdvertisement?id=' + id,
    method: 'post'
  })
}
// 获取广告模块所有字典
export function getAdvertisementType() {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptAdvertisementController/getAdvertisementType',
    method: 'post'
  })
}
/* -----广告API接口end----- */
/* -----广告列表API接口start----- */
// 获取广告列表
export function getAdvertisementPictureList(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptAdvertisementPictureController/getShptAdvertisementPictureList',
    method: 'post',
    data
  })
}
// 新增/修改广告
export function doAddOrUpdateAdvertisementPicture(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptAdvertisementPictureController/doAddOrUpdateAdvertisementPicture',
    method: 'post',
    data
  })
}
// 获取广告详细信息
export function getAdvertisementPictureDetails(id) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptAdvertisementPictureController/getAdvertisementPictureDetails?id=' + id,
    method: 'get'
  })
}
// 广告启用或停用状态设置
export function advertisementPictureStatus(id, useStatus) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptAdvertisementPictureController/advertisementPictureStatus?ids=' + id + '&useStatus=' + useStatus,
    method: 'get'
  })
}
// 删除广告
export function deleteAdvertisementPicture(id) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptAdvertisementPictureController/deleteAdvertisementPicture?id=' + id,
    method: 'post'
  })
}
/* -----广告列表API接口end----- */
/* -----电子超市供应商接口start----- */
// 查询供应商是否已经同步到电子超市
export function checkSupplierExist(departId) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptTsDepartStoreController/checkSupplierExist?departId=' + departId,
    method: 'get'
  })
}
// 将供应商信息同步到电子超市
export function saveSupplier(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptTsDepartStoreController/saveSupplier',
    method: 'post',
    data
  })
}
// 查询供应商详情
export function getSupplierDetail() {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptTsDepartStoreController/getSupplierDetail',
    method: 'get'
  })
}
// 修改供应商信息
export function editSupplier(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptTsDepartStoreController/editSupplier',
    method: 'post',
    data
  })
}
/* -----电子超市供应商接口end----- */
