import request from "@/utils/request.js";

/**
 * 商户登录
 * @param {*} data
 * @returns
 */
export function login(data) {
  return request({
    method: "post",
    url: "/account/admin/auth/login",
    data,
  });
}

/**
 * 退出登录
 * @param {*} data
 * @returns
 */
export function logout(data) {
  return request({
    method: "post",
    url: "/account/admin/auth/logout",
    data,
  });
}

/**
 * 验证码获取
 * @param {*} params
 * @returns
 */
export function captcha(params) {
  return request({
    method: "get",
    url: "/account/admin/auth/captcha",
    params,
  });
}

/**
 * 店铺详情
 * @param {*} params
 * @returns
 */
export function shopInfo_detail(params) {
  return request({
    method: "get",
    url: "/account/admin/shopInfo/detail",
    params,
  });
}

/**
 * 获取当前店铺拓展通过key
 * @param {*} params
 * @returns
 */
export function shopExtendDetail(params) {
  return request({
    method: "get",
    url: "/account/admin/shopExtend/detail",
    params,
  });
}

/**
 * 获取店铺用户列表
 * @param {*} params
 * @returns
 */
export function shopUserList(params) {
  return request({
    method: "get",
    url: "/account/admin/shopUser",
    params,
  });
}

/**
 * 获取台桌区域
 * @param {*} params
 * @returns
 */
export function shopArea(params) {
  return request({
    method: "get",
    url: "/account/admin/shopArea",
    params,
  });
}

/**
 * 获取台桌列表
 * @param {*} params
 * @returns
 */
export function shopTable(params) {
  return request({
    method: "get",
    url: "/account/admin/shopTable",
    params,
  });
}

/**
 * 支付方式列表
 * @param {*} params
 * @returns
 */
export function getPayType(params) {
  return request({
    method: "get",
    url: "/account/admin/payType",
    params,
  });
}

/**
 * 当前登录员工信息
 */
export function shopStaffInfo() {
  return request({
    method: "get",
    url: "/account/admin/shopStaff/info",
  });
}

/**
 * 获取店铺用户充值记录
 */
export function shopUserChargeFlow(params) {
  return request({
    method: "get",
    url: "/account/admin/shopUser/flow",
    params,
  });
}

/**
 * 获取店铺用户充值记录
 */
export function addShopUser(data) {
  return request({
    method: "post",
    url: "/account/admin/shopUser",
    data,
  });
}

/**
 * 获取叫号队列
 */
export function callTableQueue(params) {
  return request({
    method: "get",
    url: "/account/admin/callTable/queue",
    params,
  });
}

/**
 * 获取叫号配置
 */
export function callTableConfig(params) {
  return request({
    method: "get",
    url: "/account/admin/callTable/config",
    params,
  });
}

/**
 * 修改叫号配置
 */
export function callTableConfigPut(data) {
  return request({
    method: "put",
    url: "/account/admin/callTable/config",
    data,
  });
}

/**
 * 叫号桌型新增
 */
export function addCallTable(data) {
  return request({
    method: data.id ? "put" : "post",
    url: "/account/admin/callTable",
    data,
  });
}

/**
 * 叫号桌型删除
 */
export function delCallTable(data) {
  return request({
    method: "delete",
    url: "/account/admin/callTable",
    data,
  });
}

/**
 * 获取桌型列表
 */
export function getCallTable(params) {
  return request({
    method: "get",
    url: "/account/admin/callTable",
    params,
  });
}

/**
 * 新增叫号号码
 */
export function takeNumber(data) {
  return request({
    method: "post",
    url: "/account/admin/callTable/takeNumber",
    data,
  });
}

/**
 * 获取桌型列表
 */
export function callRecord(params) {
  return request({
    method: "get",
    url: "/account/admin/callTable/callRecord",
    params,
  });
}

/**
 * 执行叫号
 */
export function callTableCall(data) {
  return request({
    method: "post",
    url: "/account/admin/callTable/call",
    data,
  });
}

/**
 * 修改叫号队列状态
 */
export function callTableCallState(data) {
  return request({
    method: "put",
    url: "/account/admin/callTable/updateState",
    data,
  });
}

/**
 * 收银机-交班数据统计
 */
export function handoverTotal(params) {
  return request({
    method: "get",
    url: "/account/admin/handoverRecord/total",
    params,
  });
}

/**
 * 收银机-交班
 */
export function handover(isPrint) {
  return request({
    method: "post",
    url: "/account/admin/handoverRecord/handover?isPrint=" + isPrint,
  });
}

/**
 * 收银机-交班记录-详情
 */
export function handoverData(id) {
  return request({
    method: "get",
    url: `/account/admin/handoverRecord/detail/${id}`,
  });
}

/**
 * 交班记录-分页
 */
export function handoverRecordPage(params) {
  return request({
    method: "get",
    url: `/account/admin/handoverRecord/page`,
    params,
  });
}

/**
 * 收银机-交班/关班-网络打印机打印交班小票
 */
export function handoverNetworkPrint(id) {
  return request({
    method: "post",
    url: `/account/admin/handoverRecord/network/print/${id}`,
  });
}

/**
 * 打印机列表
 */
export function printerList(subType = "") {
  return request({
    method: "get",
    url: "/account/admin/printer/getPrintLocal",
    params: {
      name: "",
      subType: subType,
      connectionType: "",
      page: 1,
      size: 100,
    },
  });
}

/**
 * 打印机详情
 */
export function printerDetail(params) {
  return request({
    method: "get",
    url: "/account/admin/printer/detail",
    params,
  });
}

/**
 * 新增打印机
 */
export function printerAdd(data, method = "post") {
  return request({
    method: method,
    url: "/account/admin/printer",
    data,
  });
}

/**
 * 查找优惠券 生成订单后使用
 */
export function findCoupon(params) {
  return request({
    method: "get",
    url: "/market/admin/coupon/findCoupon",
    params,
  });
}

/**
 * 002-获取订单可用积分及抵扣金额（支付页面使用）
 */
export function calcUsablePoints(params) {
  return request({
    method: "get",
    url: "/market/admin/points/userPoints",
    params,
  });
}

/**
 * 003-根据积分计算可抵扣金额
 */
export function calcDeductionAmount(params) {
  return request({
    method: "get",
    url: "/account/admin/points/memberPoints/calcDeductionAmount",
    params,
  });
}

/**
 * 获取店铺用户详情
 */
export function shopUserDetail(params) {
  return request({
    method: "get",
    url: "/account/admin/shopUser/detail",
    params,
  });
}

/**
 * 获取当前员工已拥有页面路径
 */
export function shopPagePermissionMine(params) {
  return request({
    method: "get",
    url: "/account/admin/shopPagePermission/mine",
    params,
  });
}

/**
 * 台桌清台
 */
export function shopTableClear(data) {
  return request({
    method: "put",
    url: "/account/admin/shopTable/clear",
    data,
  });
}
