history.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <div class="p-repair">
  3. <h3 class="ptc-title">Confirm appointment</h3>
  4. <div v-if="!list.length" class="ptc-empty">
  5. <i class="ptc-empty-img"></i>
  6. <p class="ptc-empty-txt">No appointment yet</p>
  7. </div>
  8. <div v-for="item of list" :key="item.id" class="ptc-block wrapper">
  9. <div class="inner">
  10. <div class="block-title">
  11. <span class="text">{{ item.pickup_time }} {{ item.shop_name }}</span>
  12. <span class="ptc-tag" :class="`s${item.audit_status}`">{{
  13. item.audit_status == 0
  14. ? 'Under review'
  15. : item.audit_status == 1
  16. ? 'Approved'
  17. : 'Canceled'
  18. }}</span>
  19. </div>
  20. <div class="cell-group mt48">
  21. <div class="cell">
  22. <span class="cell-label">Phone Brand:</span>
  23. <span class="cell-value">{{ item.phone_brand }}</span>
  24. </div>
  25. <div class="cell">
  26. <span class="cell-label">Phone Model:</span>
  27. <span class="cell-value">{{ item.phone_model }}</span>
  28. </div>
  29. <div class="cell">
  30. <span class="cell-label">Phone Number:</span>
  31. <span class="cell-value">{{ item.phone_number }}</span>
  32. </div>
  33. <div class="cell">
  34. <span class="cell-label">IMEI:</span>
  35. <span class="cell-value">{{ item.phone_imei }}</span>
  36. </div>
  37. <div class="cell">
  38. <span class="cell-label">Service:</span>
  39. <span class="cell-value">{{ item.fix_name }}</span>
  40. </div>
  41. <div class="cell">
  42. <span class="cell-label">Member Price:</span>
  43. <span class="cell-value">${{ item.price }}</span>
  44. </div>
  45. <div class="cell mt48">
  46. <span class="cell-label">Postscript:</span>
  47. <span class="cell-value">{{ item.remark }}</span>
  48. </div>
  49. </div>
  50. </div>
  51. <div class="button-group">
  52. <button
  53. v-if="
  54. item.audit_status == 2 ||
  55. (item.audit_status == 1 && item.expired == 1)
  56. "
  57. class="ptc-button ptc-button--stroke"
  58. @click="deleteRepair(item)"
  59. >
  60. Delete
  61. </button>
  62. <template v-else>
  63. <button
  64. class="ptc-button"
  65. @click="$router.push('/repair/appointment?id=' + item.id)"
  66. >
  67. Reschedule
  68. </button>
  69. <button
  70. class="ptc-button ptc-button--stroke"
  71. @click="cancelRepair(item)"
  72. >
  73. Cancel
  74. </button>
  75. </template>
  76. </div>
  77. </div>
  78. </div>
  79. </template>
  80. <script>
  81. import { defineComponent } from 'vue'
  82. import * as api from '@/service/repair'
  83. export default defineComponent({
  84. async beforeRouteEnter(to, from, next) {
  85. const { results } = await api.getRepairList()
  86. next(vm => (vm.list = results))
  87. },
  88. data() {
  89. return {
  90. /** @type {any[]} */
  91. list: [],
  92. }
  93. },
  94. methods: {
  95. async cancelRepair(item) {
  96. await api.cancelRepair(item.id)
  97. item.audit_status = 2
  98. },
  99. async deleteRepair(item) {
  100. await api.deleteRepair(item.id)
  101. this.list.splice(this.list.indexOf(item), 1)
  102. },
  103. },
  104. })
  105. </script>
  106. <style lang="scss" src="./index.scss"></style>