/*
 * @Author: wj 1454560336@qq.com
 * @Date: 2023-11-09 11:35:30
 * @LastEditors: wenjie 1454560336@qq.com
 * @LastEditTime: 2024-10-10 16:51:51
 * @FilePath: \admin-manage\src\api\goods.js
 * @Description: 
 * 
 * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved. 
 */
import request from '@/utils/request'
// 商品列表
export function goodsList(params) {
  return request({
    url: '/zswl-cloud-shop/goodsInfo/search',
    method: 'get',
    params
  })
}

// 2.0查看商品
export function detail(params) {
  return request({
    url: '/zswl-cloud-shop/goodsInfo/detail',
    method: 'get',
    params
  })
}

// 查看商品
export function get(params) {
    return request({
      url: '/zswl-cloud-shop/goodsCoupon/get',
      method: 'get',
      params
    })
}


// 申请上下架
export function apply(params) {
    return request({
      url: '/zswl-cloud-shop/goodsCoupon/apply',
      method: 'get',
      params
    })
}
// 上下架
export function operateByAdmin(params) {
    return request({
      url: '/zswl-cloud-shop/goodsInfo/operateByAdmin',
      method: 'get',
      params
    })
}
// 审核列表
export function checkList(params) {
    return request({
      url: '/zswl-cloud-shop/goodsCoupon/checkList',
      method: 'get',
      params
    })
}

// 查看商品审核详情
export function getCheckDetail(params) {
    return request({
      url: '/zswl-cloud-shop/goodsCoupon/getCheckDetail',
      method: 'get',
      params
    })
}

// 审核
export function check(data) {
    return request({
      url: '/zswl-cloud-shop/goodsInfo/check',
      method: 'post',
      data
    })
}

// // 添加-修改 优惠券
// export function addOrUpdate(data) {
//   return request({
//     url: '/zswl-cloud-shop/goodsCoupon/addOrUpdate',
//     method: 'post',
//     data
//   })
// }

// 购买设置
export function goodsSet(data) {
  return request({
    url: '/zswl-cloud-shop/goodsInfoSet/addOrUpdate',
    method: 'post',
    data
  })
}

// 兑换码库存
export function search(params) {
  return request({
    url: '/zswl-cloud-shop/exchangeCodeData/search',
    method: 'get',
    params
  })
}


// 获取优惠券类型
export function getGoodsCoupon(params) {
  return request({
    url: '/zswl-cloud-shop/goodsCoupon/getGoodsCoupon',
    method: 'get',
    params
  })
}


// 获取全部商品
export function allCouponByShop(params) {
  return request({
    url: '/zswl-cloud-shop/goodsCoupon/allCouponByShop',
    method: 'get',
    params
  })
}

// 获取全部商品分类
export function getGoodsType(params) {
  return request({
    url: '/zswl-cloud-shop/goodsCate/search',
    method: 'get',
    params
  })
}

// 添加修改商品分类
export function addOrUpdateGoodsType(data) {
  return request({
    url: '/zswl-cloud-shop/goodsCate/addOrUpdate',
    method: 'post',
    data
  })
}

// 删除商品分类
export function delGoodsType(params) {
  return request({
    url: '/zswl-cloud-shop/goodsCate/del',
    method: 'get',
    params
  })
}

// 获取商品分类
export function getData(params) {
  return request({
    url: '/zswl-cloud-shop/goodsCate/data',
    method: 'get',
    params
  })
}


// 获取商品标签列表
export function getLabelList(params) {
  return request({
    url: '/zswl-cloud-shop/labelInfo/search',
    method: 'get',
    params
  })
}

// 获取商品标签详情
export function getLabelDetail(params) {
  return request({
    url: '/zswl-cloud-shop/labelInfo/get',
    method: 'get',
    params
  })
}

// 获取商品标签详情
export function delLabel(params) {
  return request({
    url: '/zswl-cloud-shop/labelInfo/del',
    method: 'get',
    params
  })
}

// 获取商品标签详情
export function addOrUpdateLabel(data) {
  return request({
    url: '/zswl-cloud-shop/labelInfo/addOrUpdate',
    method: 'post',
    data
  })
}


// 产品库
export function goodsStoreList(params) {
  return request({
    url: '/productcenterserver/product/data/list',
    method: 'get',
    params
  })
}

// 编辑产品库
export function upsertProduct(data) {
  return request({
    url: '/productcenterserver/product/data/upsert',
    method: 'post',
    data
  })
}

// 首页商品黑名单列表
export function listHidden(params) {
  return request({
    url: '/productcenterserver/product/data/listHidden',
    method: 'get',
    params
  })
}

// 首页商品列表
export function homeGoodsList(params) {
  return request({
    url: '/productcenterserver/product/data/listfront',
    method: 'get',
    params
  })
}

// 首页商品拉黑
export function setHidden(data) {
  return request({
    url: '/productcenterserver/product/data/setHidden',
    method: 'post',
    data
  })
}

// 首页商品展示类型
export function listShowTypes(data) {
  return request({
    url: '/productcenterserver/product/data/listShowTypes',
    method: 'post',
    data
  })
}

// 获取配置了的行政区
export function listSetTypesRegions(data) {
  return request({
    url: '/productcenterserver/product/data/listSetTypesRegions',
    method: 'post',
    data
  })
}

// 首页商品所有类型
export function listAllTypes(data) {
  return request({
    url: '/productcenterserver/product/data/listAllTypes',
    method: 'post',
    data
  })
}

// 删除区域配置
export function removeType(data) {
  return request({
    url: '/productcenterserver/product/data/deleteRegionShowType?regionCode='+data,
    method: 'post',
  })
}


// 设置首页商品展示类型
export function setShowTypes(data) {
  return request({
    url: '/productcenterserver/product/data/setShowTypes',
    method: 'post',
    data
  })
}


// 设置首页商品排序
export function setTop(params) {
  return request({
    url: '/productcenterserver/product/data/setTop',
    method: 'post',
    params
  })
}

// 商品类型查询
export function getGoodsList(data) {
	return request({
		// url: `/productcenterserver/search/v2/group?productType=${data.productType}&page=${data.page}&size=${data.size}`,//这个是不用传区域 可能查出来是多区域的
		url: `/productcenterserver/search/v2/find?regionCode=${data.regionCode||'520100'}&productType=${data.productType}&page=${data.page}&size=${data.size}&title=${data.title}`,
		method:'post',
		data
	}) 
}