Orders.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <script setup lang="ts">
  2. import { useMainStore } from "@/stores/main";
  3. import { reactive } from "vue";
  4. import { useI18n } from "vue-i18n";
  5. const { t } = useI18n();
  6. const mainStore = useMainStore();
  7. let orders: any[] = reactive([]);
  8. mainStore
  9. .getYTViewsList()
  10. .then((result) => {
  11. console.log(result);
  12. if (result) {
  13. orders.push(result);
  14. }
  15. })
  16. .catch((error) => {
  17. console.error(error);
  18. });
  19. console.log("orders", orders);
  20. const headers = [
  21. {
  22. title: "付款狀態",
  23. sortable: true,
  24. key: "payment_state",
  25. align: "left",
  26. },
  27. {
  28. title: "ID",
  29. sortable: true,
  30. key: "id",
  31. align: "left",
  32. },
  33. {
  34. title: "商品金額",
  35. sortable: true,
  36. key: "amount",
  37. align: "left",
  38. },
  39. {
  40. title: "姓名",
  41. sortable: true,
  42. key: "name",
  43. align: "left",
  44. },
  45. {
  46. title: "手機號碼",
  47. sortable: true,
  48. key: "phone",
  49. align: "left",
  50. },
  51. {
  52. title: "電子郵件",
  53. sortable: true,
  54. key: "email",
  55. align: "left",
  56. },
  57. {
  58. title: "公司 / 所屬產業",
  59. sortable: true,
  60. key: "company",
  61. align: "left",
  62. },
  63. {
  64. title: "YouTube 影片網址",
  65. sortable: true,
  66. key: "url",
  67. align: "left",
  68. },
  69. {
  70. title: "影片放送地區",
  71. sortable: true,
  72. key: "area",
  73. align: "left",
  74. },
  75. {
  76. title: "受眾語言",
  77. sortable: true,
  78. key: "language",
  79. align: "left",
  80. },
  81. {
  82. title: "客層",
  83. sortable: true,
  84. key: "ages",
  85. align: "left",
  86. },
  87. {
  88. title: "目標對象區隔",
  89. sortable: true,
  90. key: "target",
  91. align: "left",
  92. },
  93. {
  94. title: "影片主題",
  95. sortable: true,
  96. key: "theme",
  97. align: "left",
  98. },
  99. {
  100. title: "統編號碼",
  101. sortable: true,
  102. key: "taxID",
  103. align: "left",
  104. },
  105. ];
  106. </script>
  107. <template>
  108. <div>
  109. <v-toolbar light>
  110. <v-toolbar-title>
  111. <h3>訂單明細</h3>
  112. </v-toolbar-title>
  113. </v-toolbar>
  114. <v-data-table
  115. :headers="headers"
  116. :items="orders[0]"
  117. :sort-by="[{ key: 'id', order: 'desc' }]"
  118. >
  119. <template v-slot:item.payment_state="{ item }">
  120. <span v-if="item.raw.payment_state === 'succeeded'">
  121. <v-icon icon="check_circle" color="success" />
  122. 完成
  123. </span>
  124. <span v-else-if="item.raw.payment_state === 'waiting'">
  125. <v-icon icon="pending" color="warning" />
  126. 處理中
  127. </span>
  128. <span v-else>
  129. <v-icon icon="warning" color="error" />
  130. 失敗
  131. </span>
  132. </template>
  133. </v-data-table>
  134. </div>
  135. </template>
  136. <style lang="scss">
  137. .v-data-table-footer {
  138. margin-top: 10px;
  139. }
  140. .v-table {
  141. td,
  142. th {
  143. white-space: nowrap;
  144. }
  145. }
  146. </style>