/*
  * 手太欠
  * 愿这世界都如故事里一样 美好而动人~
*/

import { req } from "../request"

// 购物车数量
const count = () => req({
    url: "mall/carts/count"
})

// 加入购物车
const add = data => req({
    url     : "mall/carts",
    method  : "POST",
    data
})

// 购物车列表
const list = () => req({
    url: "mall/carts"
})

// 购物车数量变更
const putNum = (cart_id, data) => req({
    url     : "mall/carts/" + cart_id,
    method  : "PUT",
    data
})

// 删除产品
const del = cart_id => req({
    url     : "mall/carts/" + cart_id,
    method  : "DELETE"
})

// 购物车确认订单
const buyCarts = (data) => req({
    url     : "mall/buy/carts",
    data
})

// 购物车下单
const postCarts = (data) => req({
    url     : "mall/buy/carts",
    method  : "POST",
    data
})

export default ({
    count,
    add,
    list,
    putNum,
    del,
    buyCarts,
    postCarts
})