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

export function categoryTree(params) {
  return request({
    url: URL.shop.base.product.category.categoryTree,
    method: 'get',
    params,
  })
}

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

/**
 * @name 获取商品信息
 * @param {
 *  pageNum:1
 *  pageSize:20
 * }
 *  
 * @returns {
 *     "item_id": 319,    
 *     "item_name": "",
 *     "product_id": 224,                       产品编号
 *     "course_category_id": 0,                 课程类别编号
 *     "color_id": 0,                           颜色标识
 *     "item_is_default": 1,                    是否默认值
 *     "item_number": "001",                    货号
 *     "item_barcode": "",                      商品条码
 *     "item_cost_price": 160,                  项目成本价
 *     "item_platform_price": 0,                项目平台价格
 *     "item_advice_price": 266,                项目报价
 *     "item_unit_price": 266,                  项目单价
 *     "item_market_price": 300,                项目市场价格
 *     "item_unit_points": 0,                   项目单位点数
 *     "item_unit_sp": 0,                       项目单位sp
 *     "item_quantity": 0,                      项目数量
 *     "item_quantity_frozen": 0,               项目数量冻结
 *     "item_warn_quantity": 0,                 项目警告数量
 *     "item_spec": "[]",                       物品规格
 *     "spec_item_ids": "",                     规格项id
 *     "item_enable": 1001,                     项目启动
 *     "item_is_change": 0,                     项目变更？
 *     "item_weight": 0,                        物品重量
 *     "item_fx_commission": 0,                 项目佣金
 *     "item_rebate": 0,                        项目备注
 *     "item_title": "",                        项目标题
 *     "item_freetime": 0,                      项目空闲时间
 *     "item_src_id": 317,                      项目记录id
 *     "category_id": 212,                      分类id
 *     "store_id": 3,                           存储id
 *     "item_unit_price_1001": 0,
 *     "item_unit_price_1002": 0,
 *     "item_unit_price_1003": 0,
 *     "item_unit_price_1004": 0,
 *     "item_unit_price_1005": 0,
 *     "item_unit_price_1006": 0,
 *     "item_unit_price_1007": 0,
 *     "item_unit_price_1008": 0,               
 *     "item_unit_price_1009": 0,               项目单价1009
 *     "item_purchase_price": 0,                物品购买价格
 *     "item_purchase_rate": 0,                 物品购买率
 *     "item_sales_rate": 0,                    物品销售率
 *     "version": 0,                            版本
 *     "payment_type_id": 0,                    付款类型id
 *     "product_transport_id": "10",            产品运输id
 *     "item_spec_name": "",
 *     "product_item_name": "12313 ",           货品名称
 *     "spec_info": "",                         规范信息
 *     "product_name": "12313",                 产品名称
 *     "product_tips": "",                      产品建议
 *     "product_commission_rate": 0,            产品佣金率
 *     "product_fx_enable": 0,                  产品启用状态
 *     "product_dist_enable": 1,                产品分类
 *     "transport_type_id": 6,                  
 *     "product_tags": "1404",                  产品标签
 *     "product_state_id": 1001,                产品状态
 *     "product_inventory_lock": 1001,          产品位置
 *     "kind_id": 1202,
 *     "is_virtual": 1,
 *     "product_image": "https://lancer-bbc-1326467824.cos.ap-shanghai.myqcloud.com/lancer-bbc/mall/images/media/plantform/20240528b2cf057dba77436b8dd5bc642fcd72f9.jpg",
 *     "product_buy_limit": 0                   产品限购
 * }
 */

export function getTree(data) {
  return request({
    url: URL.shop.base.product.category.getTree,
    method: 'get',
    data,
  })
}

export function get(params) {
  return request({
    url: URL.shop.base.product.category.get,
    method: 'get',
    params,
  })
}

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

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