import request from '@/utils/request'
import useStorage from '@/utils/useStroage.js'

/**
 * 登录
 * @param {Object} data
 */
export function login(data) {
	return request('/login/wx/merchant/login', data, 'post')
}

/**
 * 桌台列表
 * @param {Object} areaId
 */
export function tableList(areaId) {
	return request('/table/list', {
		shopId: useStorage.get('userInfo').shopId,
		areaId: areaId
	}, 'post')
}

/**
 * 区域列表
 * @param {Object} data
 */
export function areaList(data) {
	return request('/table/area', {
		shopId: useStorage.get('userInfo').shopId
	})
}

/**
 * 绑定桌码
 * @param {Object} data
 */
export function tableBinding(data) {
	return request('/table/binding', data, 'post')
}

/**
 * 登录获取openid
 * @param {Object} data
 */
export function wxlogin(data) {
	return request('/login/wx/business/login', data)
}

/**
 * 获取预警消息订阅二维码
 * @param {Object} data
 */
export function subQrCode() {
	return request(`/user/subQrCode?shopId=${useStorage.get('userInfo').shopId}`)
}