filter.wxs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. var formatNumber = function(n){
  2. n = n.toString()
  3. return n[1] ? n : '0' + n
  4. }
  5. var formatTime = function (number, format) {
  6. var formateArr = ['Y', 'M', 'D', 'h', 'm', 's'];
  7. var returnArr = [];
  8. var date = getDate(number);
  9. returnArr.push(date.getFullYear());
  10. returnArr.push(formatNumber(date.getMonth() + 1));
  11. returnArr.push(formatNumber(date.getDate()));
  12. returnArr.push(formatNumber(date.getHours()));
  13. returnArr.push(formatNumber(date.getMinutes()));
  14. returnArr.push(formatNumber(date.getSeconds()));
  15. returnArr.forEach(function(item,index) {
  16. format = format.replace(formateArr[index], item);
  17. })
  18. return format;
  19. }
  20. var nodeTime = function(n) {
  21. var n_year = getDate(n).getFullYear();
  22. var today_year = getDate().getFullYear();
  23. if(n_year < today_year){
  24. return formatTime(n, 'Y-M-D h:m')
  25. }else{
  26. return formatTime(n, 'M-D h:m')
  27. }
  28. }
  29. var wantDrinkNum = function(n) {
  30. if(n >= 99) {
  31. return '99+'
  32. }else{
  33. return n
  34. }
  35. }
  36. var orderStatus = function(stu) {
  37. switch (stu) {
  38. case 1:
  39. return "待支付";
  40. break;
  41. case 2:
  42. return "进行中";
  43. break;
  44. case 3:
  45. return "取消支付";
  46. break;
  47. case 10:
  48. return "已完成";
  49. break;
  50. case 11:
  51. return "申请退款";
  52. break;
  53. case 12:
  54. return "部分退款";
  55. break;
  56. case 13:
  57. return "全额退款";
  58. break;
  59. case 99:
  60. return "订单异常";
  61. break;
  62. }
  63. }
  64. var unitTypeText = function(stu) {
  65. switch (stu) {
  66. case 0:
  67. return "天";
  68. break;
  69. case 1:
  70. return "个月";
  71. break;
  72. case 3:
  73. return "升";
  74. break;
  75. }
  76. }
  77. var blindBoxStatus = function(stu) {
  78. switch (stu) {
  79. case 0:
  80. return "已完成";
  81. break;
  82. case 1:
  83. return "待开放";
  84. break;
  85. case 2:
  86. return "认购中";
  87. break;
  88. case 3:
  89. return "待分配";
  90. break;
  91. case 4:
  92. return "待发货";
  93. break;
  94. case 5:
  95. return "已发货";
  96. break;
  97. case 11:
  98. return "申请退款";
  99. break;
  100. case 12:
  101. return "已退款";
  102. break;
  103. }
  104. }
  105. module.exports = {
  106. formatTime: formatTime,
  107. wantDrinkNum: wantDrinkNum,
  108. orderStatus: orderStatus,
  109. unitTypeText: unitTypeText,
  110. blindBoxStatus: blindBoxStatus,
  111. nodeTime: nodeTime
  112. };