
/*
 * 商城
 */
import {req} from "../request"

const index    = () => req({url: "shop/index"}) //商城首页
const pushData = data => req({url: "goods/push", data: data}) //商城为您推荐
const first    = () => req({url: "shop/category/first"})  //商城分类-左侧
const second   = data => req({url: "shop/category/second", data: data}) //商城分类-右侧
const hotData  = data => req({url: "goods/hot", data: data}) //优惠热卖更多
const freeData = data => req({url: "goods/free", data: data}) //免费券专区更多
const hotkey   = data => req({url: "shop/hotkey", data: data}) //热门关键字
const lists    = data => req({url: "goods/lists", data: data}) //全部商品列表

const details  = (goods_id) => req({url: "goods/" + goods_id + '/show'}) //商品详情
const grant    = data => req({url: "coupons/grant", method: "POST", data: data}) //优惠券领取
const jionCar  = data => req({url: "carts/jion", method: "POST", data: data}) //加入购物车
const carKist  = () => req({url: "carts/index"}) //购物车列表
const carRemove= data => req({url: "carts/remove", method: "POST", data: data}) //购物车移除商品
const carClear = () => req({url: "carts/clear", method: "POST"}) //清空购物车
const increment= (id) => req({url: "carts/" + id + "/increment", method: "POST"}) //购物车增加数量
const decrement= (id) => req({url: "carts/" + id + "/decrement", method: "POST"}) //购物车减少数量

const coupon  = data => req({url: "coupons", data: data}) //店铺优惠券列表
const coupons  = data => req({url: "user/coupons", data: data}) //我的优惠券
const couponDetails  = (user_coupon_id) => req({url: "user/coupons/" + user_coupon_id}) //我的优惠券详情
const couponsGoods  = data => req({url: "user/coupons/goods", data: data}) //可领取的商品

const orderSystem   = data => req({url: "orders/goods/create", data: data}) //商品确认订单
const orderBuy      = data => req({url: "orders/goods/buy", method: "POST", data: data}) //商品确认提交

const cartSystem    = data => req({url: "orders/carts/create",data: data}) //购物车确认订单
const cartBuy       = data => req({url: "orders/carts/buy", method: "POST", data: data}) //购物车确认订单
const wechat        = data => req({url: "payments/wechat", method: "POST", data: data}) //购物车确认订单

export default({
    index,
    pushData,
    first,
    second,
    hotData,
    freeData,
    hotkey,
    lists,
    details,
    grant,
    jionCar,
    carKist,
    carRemove,
    carClear,
    increment,
    decrement,
    coupon,
    coupons,
    couponDetails,
    couponsGoods,
    orderSystem,
    orderBuy,
    cartSystem,
    cartBuy,
    wechat
})
