/**
 * Web唐明明
 * 匆匆数载恍如梦，岁月迢迢华发增。
 * 碌碌无为枉半生，一朝惊醒万事空。
 * moduleName: 商城
 */

import { request } from '../index'

// 商城
const mall = () =>{
	return request({
		url: 'mall'
	})
}

// 商品详情
const goods = id => {
	return request({
		url: 'mall/goods/' + id
	})
}

// 套餐列表
const meals = (id, categoryId) => {
	return request({
		url: 'mall/meals/' + id,
		data: {
			category_id: categoryId
		}
	})
}

// 商品列表
const lists = data => {
	return request({
		url: 'mall/goods',
		data
	})
}

// 确认订单
const buy = data => {
	return request({
		url: 'mall/buy/goods',
		data
	})
}

// 商品下单
const verify = data => {
	return request({
		url: 'mall/buy/goods',
		method: 'POST',
		data
	})
}

// 商城二级分类
const classify = id => {
	return request({
		url: 'mall/categories/' + id + '/children'
	})
}

export {
	mall,
	goods,
	meals,
	lists,
	buy,
	verify,
	classify
}
