SystemRuleUtil.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. } else if (name == "折扣") {
  14. return 2;
  15. } else if (name == "点单必读") {
  16. return 3;
  17. }
  18. }
  19. export class ClassificationUtil {
  20. constructor(classification) {
  21. let { name, id, goodsIds, isOpen, type } = classification || {};
  22. this.name = name || "";
  23. this.id = id || "";
  24. this.goodsIds = goodsIds || "";
  25. this.isOpen = isOpen || false;
  26. this.allInfo = classification || {};
  27. this.type = type || "";
  28. }
  29. checkSystem() {
  30. return systemMenus.indexOf(this.type) != -1;
  31. }
  32. getMenuTipsList() {
  33. return menuTips[this.type] || [];
  34. }
  35. getType() {
  36. return this.type;
  37. }
  38. }