// 首页
import request from '@/utils/request'

// 开放-查询分类专区
export function selectTypeList(params) {
    return request({
        url: '/h5/home/selectTypeList',
        headers:{isToken:false},
        method: 'get',
        params: params
    })
}

// 开放-查询商品列表
export function selectPreferredList(params) {
    return request({
        url: '/h5/home/selectPreferredList',
        headers:{isToken:false},
        method: 'get',
        params: params
    })
}

// 开放-查询商品详情/{id}
export function getCommodity4H5Open(id) {
    return request({
        url: '/h5/home/getCommodity4H5Open/'+id,
        headers:{isToken:false},
        method: 'get',
    })
}

// 需token-查询商品详情/{id} 
export function getCommodity4H5(id) {
    return request({
        url: '/h5/home/getCommodity4H5/'+id,
        method: 'get',
    })
}

// 开放-查询销量前十商品
export function selectSalesTop10(params) {
    return request({
        url: '/h5/home/selectSalesTop10',
        headers:{isToken:false},
        method: 'get',
        params: params
    })
}

//增加收藏
export function addCollection(data) {
    return request({
        url: '/h5/order/addCollection',
        method: 'post',
        data: data
    })
}

//商品详情-移除收藏
export function delCollection(id) {
    return request({
        url: '/h5/order/delCollection/' + id,
        method: 'delete',
    })
}

//用户领取优惠券
export function receiveCoupon(data) {
    return request({
        url: '/h5/order/receiveCoupon',
        method: 'post',
        data: data
    })
}

//增加购物车
export function addShoppingCar(data) {
    return request({
        url: '/h5/order/addShoppingCar',
        method: 'post',
        data: data
    })
}

//提交订单
export function submitOrder(data) {
    return request({
        url: '/h5/order/submitOrder',
        method: 'post',
        data: data
    })
}

//订单支付
export function aiPay(data) {
    return request({
        url: '/h5/order/aiPay',
        method: 'post',
        data: data
    })
}

// 查询订单详情
export function getOrderDetail(id) {
    return request({
        url: '/h5/personal/getOrderDetail/'+id,
        method: 'get',
    })
}

//订单確認
export function confirm(data) {
    return request({
        url: '/h5/order/confirm',
        method: 'post',
        data: data
    })
}

//订单キャンセル
export function cancel(data) {
    return request({
        url: '/h5/order/cancel',
        method: 'post',
        data: data
    })
}