import {
	POST
} from './Request.js';
let app = getApp();
let base = app.globalData.url;
let hsgCrest = app.globalData.hsgUrl+'/crest';
let hsgOrder = app.globalData.hsgUrl+'/order';

//新增门店图片
export const insertStoreImg = params => {
	return POST('POST', `${base}/storeImg/insertStoreImg`, params).then(res => res.data);
}

//查询门店图片列表
export const getBsStoreImgByList = params => {
	return POST('GET', `${base}/storeImg/getBsStoreImgByList`, params).then(res => res.data);
}

//删除门店图片
export const deleteStoreImg = params => {
	return POST('GET', `${base}/storeImg/deleteStoreImg`, params).then(res => res.data);
}

//根据id查询门店图片详情
export const getStoreImgById = params => {
	return POST('GET', `${base}/storeImg/getStoreImgById`, params).then(res => res.data);
}

//新增门店产品
export const insertStoreProduct = params => {
	return POST('POST', `${base}/storeProduct/insertStoreProduct`, params).then(res => res.data);
}
//编辑门店产品
export const editStoreProduct = params => {
	return POST('POST', `${base}/storeProduct/editStoreProduct`, params).then(res => res.data);
}

//门店产品列表
export const getStoreProductByList = params => {
	return POST('GET', `${base}/storeProduct/getStoreProductByList`, params).then(res => res.data);
}

//查询门店产品详情
export const getStoreProductById = params => {
	return POST('GET', `${base}/storeProduct/getStoreProductById`, params).then(res => res.data);
}

/* =======团购产品================= */
// 新增配置团购基本内容
export const insertGroupContent = params => {
	return POST('POST', `${base}/storeGroup/insertGroupContent`, params).then(res => res.data);
}
// 配置团购产品详情
export const editGroupContentDetail = params => {
	return POST('POST', `${base}/storeGroup/editGroupContentDetail`, params).then(res => res.data);
}
//修改配置团购基本内容
export const editGroupContent = params => {
	return POST('POST', `${base}/storeGroup/editGroupContent`, params).then(res => res.data);
}

//新增团购规则内容
// export const insertGroupServeRule = params => {
// 	return POST('POST', `${base}/storeGroup/insertGroupServeRule`, params).then(res => res.data);
// }

//编辑团购规则内容
export const editGroupServeRule = params => {
	return POST('POST', `${base}/storeGroup/editGroupServeRule`, params).then(res => res.data);
}

//删除团购产品详情单个产品
export const deleteGroupDetail = params => {
	return POST('GET', `${base}/storeGroup/deleteGroupDetail`, params).then(res => res.data);
}
//上下架团购
export const upDownGroup = params => {
	return POST('GET', `${base}/storeGroup/upDownGroup`, params).then(res => res.data);
}

//根据门店id 查询门店团购内容
export const getStoreGroupList = params => {
	return POST('GET', `${base}/storeGroup/getStoreGroupList`, params).then(res => res.data);
}

//根据团购id 查询门店内容详情
export const getStoreGroupDetailList = params => {
	return POST('GET', `${base}/storeGroup/getStoreGroupDetailList`, params).then(res => res.data);
}

//根据团购id查询门店规则内容
export const findGroupServeRuleByGroup = params => {
	return POST('GET', `${base}/storeGroup/findGroupServeRuleByGroup`, params).then(res => res.data);
}

//查询团购内容
export const findStoreGroupContent = params => {
	return POST('GET', `${base}/storeGroup/findStoreGroupContent`, params).then(res => res.data);
}

//新增门店扩展信息
export const editStoreExtMsg = params => {
	return POST('POST', `${base}/storeGroup/editStoreExtMsg`, params).then(res => res.data);
}

//查询门店扩展信息
export const findStoreExtMsgByStoreId = params => {
	return POST('POST', `${base}/storeGroup/findStoreExtMsgByStoreId`, params).then(res => res.data);
}

//查询获取团购内容code
export const getGroupContentByCode = params => {
	return POST('GET', `${hsgCrest}/group/getGroupContentByCode`, params).then(res => res.data);
}

//核销团购码
export const gorOrderNotify = params => {
	return POST('GET', `${hsgOrder}/groupOrder/gorOrderNotify`, params).then(res => res.data);
}

/* =分类配置= */
export const editCategory = params => {
	return POST('POST', `${base}/storeProductCategory/editCategory`, params).then(res => res.data);
}

//删除分类
export const delCategory = params => {
	return POST('POST', `${base}/storeProductCategory/delCategory`, params).then(res => res.data);
}

//向上排序
export const sortUp = params => {
	return POST('POST', `${base}/storeProductCategory/sortUp`, params).then(res => res.data);
}
// 向下排序
export const sortDown = params => {
	return POST('POST', `${base}/storeProductCategory/sortDown`, params).then(res => res.data);
}
//查询分类详情
export const getCategory = params => {
	return POST('GET', `${base}/storeProductCategory/getCategory`, params).then(res => res.data);
}
// 查询分类列表
export const getCategoryList = params => {
	return POST('GET', `${base}/storeProductCategory/getCategoryList`, params).then(res => res.data);
}
// 一次性查询全部分类
export const getALLCategory = params => {
	return POST('GET', `${base}/storeProductCategory/getALLCategory`, params).then(res => res.data);
}
//【菜单】查询门店分类及产品
export const getStoreProduct = params => {
	return POST('GET', `${base}/storeProductCategory/getStoreProduct`, params).then(res => res.data);
}


/* ==桌台信息== */
//生成桌台
export const generateTable = params => {
	return POST('POST', `${base}/mealTable/generateTable`, params).then(res => res.data);
}

//编辑桌台
export const editTable = params => {
	return POST('POST', `${base}/mealTable/editTable`, params).then(res => res.data);
}

// 删除桌台
export const delTable = params => {
	return POST('POST', `${base}/mealTable/delTable`, params).then(res => res.data);
}

// 查询桌台详情
export const getTable = params => {
	return POST('GET', `${base}/mealTable/getTable`, params).then(res => res.data);
}

// 查询桌台列表
export const getTableList = params => {
	return POST('GET', `${base}/mealTable/getTableList`, params).then(res => res.data);
}

// 开台
export const startTable = params => {
	return POST('POST', `${base}/mealTable/startTable`, params).then(res => res.data);
}
//关台
export const endTable = params => {
	return POST('POST', `${base}/mealTable/endTable`, params).then(res => res.data);
}

// 查询桌台当前订单
export const queryCurrentOrder = params => {
	return POST('GET', `${base}/mealTableOrder/queryCurrentOrder`, params).then(res => res.data);
}
// 操作订单产品
export const operateOrderProduct = params => {
	return POST('POST', `${base}/mealTableOrder/operateOrderProduct`, params).then(res => res.data);
}

//查询订单列表
export const queryOrderList = params => {
	return POST('GET', `${base}/mealTableOrder/queryOrderList`, params).then(res => res.data);
}
//查询订单详情
export const queryOrderDetail = params => {
	return POST('GET', `${base}/mealTableOrder/queryOrderDetail`, params).then(res => res.data);
}