SystemRuleUtil.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // 系统检查方法
  2. // 商品分类
  3. const systemMenus = [1, 2, 3]; // 好评,折扣,点单必读
  4. const menuTips = {
  5. 1: ["systemClassification1", "systemClassification2"],
  6. 2: ["systemClassification3", "systemClassification4"],
  7. 3: ["systemClassification5", "systemClassification6"],
  8. };
  9. // 好评,折扣,点单必读
  10. export function getClassificationByName(name) {
  11. if (name === "好评") {
  12. return 1;
  13. } if (name === "折扣") {
  14. return 2;
  15. } if (name === "点单必读") {
  16. return 3;
  17. }
  18. return 0
  19. }
  20. // 商品分类
  21. export class ClassificationUtil {
  22. constructor(classification) {
  23. const { name, id, goodsIds, isOpen, type } = classification || {};
  24. this.name = name || "";
  25. this.id = id || "";
  26. this.goodsIds = goodsIds || "";
  27. this.isOpen = isOpen || false;
  28. this.allInfo = classification || {};
  29. this.type = type || "";
  30. }
  31. checkSystem() {
  32. return systemMenus.indexOf(this.type) !== -1;
  33. }
  34. getMenuTipsList() {
  35. return menuTips[this.type] || [];
  36. }
  37. getType() {
  38. return this.type;
  39. }
  40. }
  41. // 账单类别
  42. // const FinancialTypes = ["BUY", "INCOME", "REFUND", "WITHDRAW"];
  43. // BUY("购买"),
  44. // INCOME("收入"),
  45. // REFUND("退款"),
  46. // WITHDRAW("提现");