You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

158 lines
3.3 KiB

2 years ago
2 years ago
2 years ago
2 years ago
  1. const bookingStatusMap = status => {
  2. switch (status) {
  3. case -1:
  4. return 'Cancelled'
  5. case 0:
  6. return 'Unpaid'
  7. case 1:
  8. return 'Awaiting Confirmation'
  9. case 2:
  10. return 'Confirmed'
  11. case 3:
  12. return 'Processing'
  13. case 4:
  14. return 'Completed'
  15. default:
  16. break
  17. }
  18. }
  19. const mybookingStatusMap = status => {
  20. switch (status) {
  21. case '04':
  22. return 'Cancelled'
  23. case 'Unpaid':
  24. return 'Unpaid'
  25. case '01':
  26. return 'Awaiting Confirmation'
  27. case 'Confirmed':
  28. return 'Confirmed'
  29. case '02':
  30. return 'Processing'
  31. case '03':
  32. return 'Completed'
  33. default:
  34. break
  35. }
  36. }
  37. const supplierStatusMap = status => {
  38. switch (status) {
  39. case -1:
  40. return 'Cancelled'
  41. case 0:
  42. return 'Considering'
  43. case 1:
  44. return 'Confirmed'
  45. case 2:
  46. return 'Processing'
  47. case 3:
  48. return 'Completed'
  49. default:
  50. break
  51. }
  52. }
  53. const paymentStatusMap = status => {
  54. switch (status) {
  55. case -99:
  56. return 'Refunded'
  57. case -98:
  58. return 'Refunding'
  59. case -97:
  60. return 'Hold'
  61. case -2:
  62. return 'Expired'
  63. case -1:
  64. return 'Failure'
  65. case 0:
  66. return 'Unpaid'
  67. case 1:
  68. return 'PaidConfirming'
  69. case 2:
  70. return 'Paid'
  71. default:
  72. break
  73. }
  74. }
  75. const mypaymentStatusMap = status => {
  76. switch (status) {
  77. case '05':
  78. return 'Refunded'
  79. case '04':
  80. return 'Refunding'
  81. case 'Hold':
  82. return 'Hold'
  83. case 'Expired':
  84. return 'Expired'
  85. case 'Failure':
  86. return 'Failure'
  87. case '01':
  88. return 'Unpaid'
  89. case '02':
  90. return 'PaidConfirming'
  91. case '03':
  92. return 'Paid'
  93. default:
  94. break
  95. }
  96. }
  97. const paymentMethodMap = status => {
  98. switch (status) {
  99. case '1':
  100. return '信用卡付款'
  101. case '2':
  102. return '銀行匯款'
  103. case '3':
  104. return '現場付款'
  105. default:
  106. break
  107. }
  108. }
  109. const paymentTermMap = status => {
  110. switch (status) {
  111. case '1':
  112. return '整筆付款'
  113. default:
  114. break
  115. }
  116. }
  117. const bookingColor = status => {
  118. if (/Unpaid/.test(status)) {
  119. return "tw-text-error-default";
  120. }
  121. if (/Failure/.test(status)) {
  122. return "tw-text-error-default";
  123. }
  124. if (/Confirming/.test(status)) {
  125. return "tw-text-secondary-default";
  126. }
  127. if (/Expired/.test(status)) {
  128. return "tw-text-neutrals-800";
  129. }
  130. if (/Refunded/.test(status)) {
  131. return "tw-text-success-default";
  132. }
  133. if (/Paid/.test(status)) {
  134. return "tw-text-success-default";
  135. }
  136. if (/Partial Payment/.test(status)) {
  137. return "tw-text-secondary-default";
  138. }
  139. if (/Considering/.test(status)) {
  140. return "tw-text-neutrals-800";
  141. }
  142. if (/Confirmed/.test(status)) {
  143. return "tw-text-secondary-default";
  144. }
  145. if (/Processing/.test(status)) {
  146. return "tw-text-secondary-default";
  147. }
  148. if (/Completed/.test(status)) {
  149. return "tw-text-success-default";
  150. }
  151. if (/Cancelled/.test(status)) {
  152. return "tw-text-neutrals-800";
  153. }
  154. if (/Awaiting Confirmation/.test(status)) {
  155. return "tw-text-secondary-default";
  156. }
  157. }
  158. export { bookingStatusMap, supplierStatusMap, paymentStatusMap, bookingColor, mybookingStatusMap, mypaymentStatusMap, paymentMethodMap, paymentTermMap }