index.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // components/zyh_card/zyh_card.js
  2. Component({
  3. options: {
  4. observers: true
  5. },
  6. /**
  7. * 组件的属性列表
  8. */
  9. properties: {
  10. // 预约时间-label
  11. labelTitle: {
  12. type: String,
  13. value: "预约时间"
  14. },
  15. // 预约时间-value
  16. valueTitle: {
  17. type: String,
  18. value: "****-**-** **:**-**:**"
  19. },
  20. // 姓名
  21. labelName: {
  22. type: String,
  23. value: "****: ***"
  24. },
  25. // 姓名
  26. labelPhone: {
  27. type: String,
  28. value: "****: ****"
  29. },
  30. // 类型
  31. type: {
  32. type: Number,
  33. value: 1
  34. }
  35. },
  36. /**
  37. * 组件的初始数据
  38. */
  39. data: {
  40. classType: "wait",
  41. text: "待审"
  42. },
  43. /**
  44. * 组件的方法列表
  45. */
  46. methods: {
  47. onClick(e) {
  48. this.triggerEvent("click")
  49. },
  50. //通过类型判断样式
  51. compareType(type) {
  52. var classType = "";
  53. var text = "";
  54. switch (type) {
  55. case 0:
  56. classType = "wait";
  57. text = "待审";
  58. break;
  59. case 2:
  60. classType = "pass";
  61. text = "同意";
  62. break;
  63. case 1:
  64. classType = "reject";
  65. text = "已拒";
  66. break;
  67. case 3:
  68. classType = "entrance";
  69. text = "入场";
  70. break;
  71. default:
  72. break;
  73. }
  74. this.setData({
  75. classType: classType,
  76. text: text
  77. });
  78. }
  79. },
  80. observers: {
  81. type: function(type) {
  82. this.compareType(type);
  83. }
  84. }
  85. });