import 'package:forui/forui.dart'; import 'package:pj_supermarket_cloud/common/index.dart'; /// 设备类型 enum SysType implements BaseEnum { SUPERMARKET("1", "超市", "智慧超市", "supermarket"), CANTEEN("2", "食堂", "智慧食堂", "canteen"), ; @override final String code; @override final String title; final String cnStr; final String usStr; const SysType(this.code, this.title, this.cnStr, this.usStr); } /// 订单类型 enum OrderType implements BaseEnum { BELOW("1", "线下购买"), RESERVE("2", "线上订餐"), FOREIGN_TICKET("3", "外来人员"), STRIDE_DEPT("4", "跨单位"), ZY("5", "正元公务餐"), ; @override final String code; @override final String title; const OrderType(this.code, this.title); } /// 付款方式 enum OrderPayType implements BaseEnum { WALLET_DEFAULT("1", "普通钱包支付"), WALLET_QR_CODE("2", "钱包二维码支付"), WALLET_QR_CODE_SCAN("22", "钱包扫一扫支付"), WALLET_CARD("3", "钱包饭卡支付"), FACE("4", "人脸识别支付"), STRIDE_DEPT_QR_CODE("5", "跨单位二维码支付"), FOREIGN_TICKET_QR_CODE("6", "外来人员二维码支付"), RESERVE_QR_CODE("7", "线上订餐二维码支付"), CASH("8", "现金支付"), WECHANT_SELF_QR_CODE_PAY("10", "微信付款码支付"), ALI_SELF_QR_CODE_PAY("11", "支付宝付款码支付"), ZYY("12", "中医院"), RMYY("13", "人民医院"), CSXFK("13", "超市消费卡"), ACT_CANCEL("50", "活动核销"), ; @override final String code; @override final String title; const OrderPayType(this.code, this.title); // 是否是外部人员支付 static bool isStrideOrForeign(OrderPayType payType) { return [ OrderPayType.STRIDE_DEPT_QR_CODE, OrderPayType.FOREIGN_TICKET_QR_CODE, ].contains(payType); } // 是否是自付款(微信、支付宝) static bool isExternalPay(OrderPayType payType) { return [ OrderPayType.WECHANT_SELF_QR_CODE_PAY, OrderPayType.ALI_SELF_QR_CODE_PAY, ].contains(payType); } } /// 订单状态 enum OrderStatus implements BaseEnum { // 查询使用 TOTAL("-1", "全部", true), CREATE("1", "未付款", true), PAY("5", "已付款", true), OFFLINE_CREATE("2", "离线(未支付)", false), OFFLINE_PAY("6", "离线(本地支付)", true), REFUND("10", "退款", true), CANCEL("20", "已核销", false), ; @override final String code; @override final String title; @override final bool visible; const OrderStatus(this.code, this.title, this.visible); static List visibleList() { return OrderStatus.values.where((e) => e.visible).toList(); } static List successPayCodes() { return [ OrderStatus.PAY.code, OrderStatus.CANCEL.code, ]; } } // 打印状态 enum PrintStatus implements BaseEnum { NONE("10", "未打印"), SUCCESS("20", "打印成功"), SYNC("30", "同步成功"), ERROR("40", "打印失败"), ; @override final String code; @override final String title; const PrintStatus(this.code, this.title); } enum ProductHourType implements BaseEnum { TOTAL("-1", "查询全部"), MORNING("1", "早餐"), NOON("2", "中餐"), NIGHT("3", "晚餐"), ; @override final String code; @override final String title; // 使用 getter 方法动态获取图标 SvgAsset get icon { switch (this) { case ProductHourType.TOTAL: return FAssets.icons.calendar; case ProductHourType.MORNING: return FAssets.icons.sunrise; case ProductHourType.NOON: return FAssets.icons.sun; case ProductHourType.NIGHT: return FAssets.icons.sunMoon; } } const ProductHourType(this.code, this.title); } enum WalletType implements BaseEnum { EAT("1", "饭卡钱包"), PAY("2", "消费钱包"), ; @override final String code; @override final String title; const WalletType(this.code, this.title); } /// 商品性质 enum ProductNature implements BaseEnum { DEFAULT("1", "普通商品"), WEIGHT("2", "电子称称重商品"), ; @override final String code; @override final String title; const ProductNature(this.code, this.title); } /// 优惠类型 enum DiscountsType implements BaseEnum { JZ_DISCOUNT("1", "9折优惠"), ; @override final String code; @override final String title; const DiscountsType(this.code, this.title); }