cashier-web/src/views/order/index/config/config.ts

124 lines
3.0 KiB
TypeScript

import type { statusType } from "@/api/order/order";
export const statusOptions: statusOptions[] = [
{ label: "全部", value: "" },
{ label: "待支付", value: "unpaid" },
{ label: "制作中", value: "in-production" },
{ label: "待取餐", value: "wait-out" },
{ label: "订单完成", value: "done" },
{ label: "申请退单", value: "refunding" },
{ label: "退单", value: "refund" },
{ label: "部分退单", value: "part-refund" },
{ label: "取消订单", value: "cancelled" },
];
// /**
// * 主扫
// */
// MAIN_SCAN("main_scan", "主扫"),
// /**
// * 被扫
// */
// BACK_SCAN("back_scan", "被扫"),
// /**
// * 微信小程序
// */
// WECHAT_MINI("wechat_mini", "微信小程序"),
// /**
// * 支付宝小程序
// */
// ALIPAY_MINI("alipay_mini", "支付宝小程序"),
// /**
// * 会员支付
// */
// VIP_PAY("vip_pay", "会员支付"),
// /**
// * 现金支付
// */
// CASH_PAY("cash_pay", "现金支付"),
// /**
// * 挂账支付
// */
// CREDIT_PAY("credit_pay", "挂账支付"),
// /**
// * h5支付
// */
// H5_PAY("h5_pay", "H5支付");
export const payTypeOptions: payTypeOptions[] = [
{ label: "全部", value: "" },
{
label: "主扫",
value: "main_scan",
},
{
label: "被扫",
value: "back_scan",
},
{
label: "微信小程序",
value: "wechat_mini",
},
{
label: "支付宝小程序",
value: "alipay_mini",
},
{ label: "会员支付", value: "vip_pay" },
{ label: "现金支付", value: "cash_pay" },
{ label: "挂账支付", value: "credit_pay" },
{ label: "H5支付", value: "h5_pay" },
];
export const options: { [key in optionsType]: options[] } = {
status: statusOptions,
payType: payTypeOptions,
platformType: [
{ label: 'PC管理端', value: 'WEB' },
{ label: 'APP管理端', value: 'APP' },
{ label: '支付宝小程序', value: 'ALI' },
{ label: '微信小程序', value: 'WX' },
{ label: '支付宝小程序', value: 'ALI' },
{ label: '收银机客户端', value: 'PC' },
],
sendType: [
{ label: '快递', value: 'post' },
{ label: '外卖', value: 'takeaway' },
{ label: '自提', value: 'takeself' },
{ label: '堂食', value: 'table' },
],
dineMode: [
{ label: '堂食', value: 'dine-in' },
{ label: '外带', value: 'take-out' },
{ label: '外卖', value: 'take-away' },
]
}
export type optionsType = string;
export function returnOptions(type: optionsType) {
return options[type];
}
export function returnOptionsLabel(optionsType: optionsType, value: string | number) {
const options = returnOptions(optionsType);
if (!options) {
return "";
}
const option = options.find((item) => item.value === value);
return option ? option.label : "";
}
export interface options {
label: string;
value: string | number;
[property: string]: any;
}
export interface statusOptions extends options {
value: statusType;
}
export type payTypeValue = string
export interface payTypeOptions extends options {
value: payTypeValue;
}