
import {
    myRequestPhp
} from './requestPhp.js'


const pre = ""
const apiType = "php"
/**
 * 获取供应链tab
 */
export function getSupplyChainTab(data) {
    return myRequestPhp({
        url: `${pre}mer/store/product/gong_lst_filter`,
         method: 'GET',
             data,
             apiType
    })
    
}
/**
 * 获取供应链tab
 */
// export function getSupplyChainTab(data) {
//     return myRequestPhp({
//         url: `${pre}mer/store/product/gong_lst_filter`,
//         method: 'GET',
//         data,
//         apiType
//     })
// }

/**
 * 供应链列表
 * page: 1
 limit: 20
 keyword:
     type: 1   2
 spec_type: 商品规格 null 0 1
 * @param {*} data 
 * @returns 
 */
export function getSupplyChainList(data) {
    return myRequestPhp({
        url: `${pre}mer/store/product/gong_lst`,
        method: 'GET',
        data,
        apiType
    })
}
// 供应链修改价格
/**
 *{
     "skuArr": [{
         "sku_id": "Se88f891b5d",
         "edit_price": "10.5"
     }],
     "type": 1
 }
 * @param {*} id 
 * @param {*} data 
 * @returns 
 */
export function editSupplyChainPrice(id,data) {
     return myRequestPhp({
         url: `${pre}mer/store/product/edit_price/${id}`,
         method: 'POST',
         data,
         apiType
     })
}
/**
 * @description 供应链商品 -- 修改销售价
 */
/**
 * @description 供应链商品 -- 上下架
 */
export function postchangeshow(data) {
     return myRequestPhp({
         url: `${pre}mer/store/product/change_show`,
         method: 'POST',
         data,
         apiType
     })
}



/**商品模块    */

// 商品列表tab

export function getGoodsTab(data) {
    return myRequestPhp({
        url: `${pre}mer/store/product/lst_filter`,
        method: 'GET',
        data,
        apiType
    })
}


/**商品列表  
 * 
 * page = 1 & limit = 20 & mer_cate_id = & cate_id = & keyword = & type = 1 & is_gift_bag = & p_type =
  */

export function getProductList(data) {
    return myRequestPhp({
        url: `${pre}mer/store/product/lst`,
        method: 'GET',
        data,
        apiType
    })
}
// 平台商品分类
export function getGoodsClassCategory(data) {
    return myRequestPhp({
        url: `${pre}mer/store/category/list`,
        method: 'GET',
        data,
        apiType
    })
}






// 商品评价

/**
 * is_reply:
     nickname:
     keyword:
     order_sn:
     status:
     date:
     page: 1
 limit: 20
 *  */
export function getGoodsEvaluate(data) {
    return myRequestPhp({
        url: `${pre}mer/store/reply/lst`,
        method: 'GET',
        data,
        apiType
    })
}


// 商品评价回复获取规则
export function reviewGoodsEvaluateReply(id) {
    return myRequestPhp({
        url: `${pre}mer/store/reply/form/${id}`,
        method: 'GET',
        apiType
    })
}

//商品评价回复
export function reviewGoodsReplyApi(id,data) {
    return myRequestPhp({
        url: `${pre}mer/store/reply/reply/${id}.html`,
        method: 'POST',
        data,
        apiType
    })
}


/**
 * @description 商品列表 -- 上下架
 */

export function changeshowApi(id, data) {
     return myRequestPhp({
         url: `${pre}mer/store/product/status/${id}`,
         method: 'POST',
         data,
         apiType
     })
}
/**
 * @description 商品列表--删除
 */
export function destoryApi(id,data) {
     return myRequestPhp({
         url: `${pre}mer/store/product/destory/${id}`,
         method: 'DELETE',
         data,
         apiType
     })
}

/**
 * @description 商品列表 -- 删除
 */
export function productDeleteApi(id,data) {
     return myRequestPhp({
         url: `${pre}mer/store/product/delete/${id}`,
         method: 'DELETE',
         data,
         apiType
     })
}

/***
 * @description 商品列表 -- 恢复商品
 */
export function productRestoreApi(id,data) {
      return myRequestPhp({
          url: `${pre}mer/store/product/restore/${id}`,
          method: 'POST',
          data,
          apiType
      })
}



export function Addseckill(data) {
     return myRequestPhp({
         url: `${pre}mer/store/product/seckill`,
         method: 'POST',
         data,
         apiType
     })
}




/** 
 * 文件上传
*/

export function uploadFile(data) {
    const params = new FormData()
    params.append('file', data.file)
     return myRequestPhp({
         url: `${pre}mer/upload/image/0/file`,
         method: 'POST',
         contentType: "application/x-www-form-urlencoded",
         data: params,
         apiType
     })
}

/**
 * 获取商品分类
 */
export function getGoodsClass(data) {
    return myRequestPhp({
        url: `${pre}mer/store/category/select`,
        method: 'GET',
        data,
        apiType
    })
}
/**
 * 品牌选择
 */
export function getBrandSelect(data) {
    return myRequestPhp({
        url: `${pre}mer/store/category/brandlist`,
        method: 'GET',
        data,
        apiType
    })
}


/**
 * @description 商品列表 -- 运费模板筛选
 */
export function shippingListApi(data) {
    return myRequestPhp({
        url: `${pre}mer/store/shipping/list`,
        method: 'GET',
        data,
        apiType
    })
}

/**
 * 添加商品
 */
export function addProduct(data) {
    return myRequestPhp({
        url: `${pre}mer/store/product/create`,
        method: 'POST',
        data,
        apiType
    })
}

/**
 * 商品详情
 */
export function productDetailApi(data) {
    return myRequestPhp({
        url: `${pre}mer/gong/goods/detail`,
        method: 'POST',
        data,
        apiType
    })
}


/** 
 * 在线选品 --- filter
*/

export function statusFilterApi(data) {
    return myRequestPhp({
        url: `${pre}mer/gong/goods/status_filter`,
        method: 'GET',
        data,
        apiType
    })
}
/**
 * page: 1
 limit: 12
 * @param {*} data 
 * @returns 
 */
export function categoryFilterApi(data) {
    return myRequestPhp({
        url: `${pre}mer/gong/category`,
        method: 'GET',
        data,
        apiType
    })
}

// 在线选品列表
/**
 * page: 1
 limit: 20
 title:
     cate_ids:
     profit:
     price:
     type:
 * @param {*} data 
 * @returns 
 */
export function productSelectListApi(data) {
    return myRequestPhp({
        url: `${pre}mer/gong/goods/lst`,
        method: 'GET',
        data,
        apiType
    })
}
/**
 * @description 商品列表 -- 加入选品库
 */
export function joinselectionlibraryApi(data) {
    return myRequestPhp({
        url: `${pre}mer/gong/goods/join_selection_library`,
        method: 'POST',
        data,
        apiType
    })
}
export function Postjoinselectionlibrary(data) {
    return request.post(``, data)
}
// /**
//  * @description 配置状态
//  */
// export function productConfigApi() {
//     return request.get(`store/product/config`)
// }

