import { defineStore } from "pinia";

export const useGlobal = defineStore("global", {
  state: () => ({
    // 是否监听叫号
    isCallNumber: true,
    orderStatus: [
      {
        type: "unpaid",
        label: "待支付",
      },
      {
        type: "in_production",
        label: "制作中",
      },
      {
        type: "wait_out",
        label: "待取餐",
      },
      {
        type: "done",
        label: "订单完成",
      },
      {
        type: "refunding",
        label: "申请退单",
      },
      {
        type: "refund",
        label: "退单",
      },
      {
        type: "part_refund",
        label: "部分退单",
      },
      {
        type: "cancelled",
        label: "取消订单",
      },
    ],
    orderType: [
      {
        type: "cash",
        label: "收银",
      },
      {
        type: "miniapp",
        label: "小程序",
      },
    ],
    platformType: [
      {
        type: "WX",
        label: "微信小程序",
      },
      {
        type: "ALI",
        label: "支付宝小程序",
      },
      {
        type: "PC",
        label: "收银机客户端",
      },
      {
        type: "WEB",
        label: "PC管理端",
      },
      {
        type: "APP",
        label: "APP管理端",
      },
      {
        type: "H5",
        label: "收款码",
      },
    ],
    dineMode: [
      {
        type: "dine-in",
        label: "堂食",
      },
      {
        type: "take-out",
        label: "外带",
      },
      {
        type: "take-away",
        label: "外卖",
      },
    ],
    payType: [
      {
        type: "main_scan",
        label: "主扫",
      },
      {
        type: "back_scan",
        label: "被扫",
      },
      {
        type: "wechat_mini",
        label: "微信小程序",
      },
      {
        type: "alipay_mini",
        label: "支付宝小程序",
      },
      {
        type: "vip_pay",
        label: "会员支付",
      },
      {
        type: "cash_pay",
        label: "现金支付",
      },
      {
        type: "credit_pay",
        label: "挂账支付",
      },
    ],
    bizCodes: [
      {
        type: "freeln",
        label: "霸王餐",
      },
      {
        type: "cashIn",
        label: "现金充值",
      },
      {
        type: "wechatIn",
        label: "微信小程序充值",
      },
      {
        type: "alipayIn",
        label: "支付宝小程序充值",
      },
      {
        type: "awardIn",
        label: "充值奖励",
      },
      {
        type: "rechargeRefund",
        label: "充值退款",
      },
      {
        type: "orderPay",
        label: "订单消费",
      },
      {
        type: "orderRefund",
        label: "订单退款",
      },
      {
        type: "adminIn",
        label: "管理员充值",
      },
      {
        type: "adminOut",
        label: "管理员消费",
      },
    ],
    refundType: [
      {
        type: "cash",
        label: "手动退款",
      },
      {
        type: "payBack",
        label: "原路退回",
      },
    ],
  }),
  actions: {
    // 更新状态
    updateData(state) {
      this.isCallNumber = state;
    },
  },
});
