all.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <!-- @format -->
  2. <script lang="ts" setup>
  3. import { useData } from "./useData"
  4. const {
  5. tableData,
  6. total,
  7. getTableList,
  8. changePage,
  9. currentPage,
  10. page_size,
  11. cancelOrder,
  12. } = useData({ type: "" })
  13. function tableRowClassName({ rowIndex }: any) {
  14. if (rowIndex % 2 === 0) return "warning-row"
  15. return ""
  16. }
  17. getTableList()
  18. </script>
  19. <template>
  20. <div>
  21. <el-table
  22. :data="tableData"
  23. style="width: 100%"
  24. :row-class-name="tableRowClassName"
  25. >
  26. <el-table-column prop="billNo" label="Order No." width="180">
  27. <template #default="{ row }">
  28. <nuxt-link
  29. :to="`/orders/${row.id}`"
  30. class="hover:underline text-#0068FF"
  31. >
  32. {{ row.billNo }}
  33. </nuxt-link>
  34. </template>
  35. </el-table-column>
  36. <!-- <el-table-column prop="brandQuantity" label="Brand Qty." width="180" /> -->
  37. <el-table-column
  38. prop="merchandiseQuantity"
  39. label="Products"
  40. width="180"
  41. />
  42. <el-table-column prop="totalPrice" label="Order Total" width="180" />
  43. <el-table-column label="Status" width="180">
  44. <template #default="{ row }">
  45. <div :class="row.state === '1' && 'text-#0068FF'">
  46. {{ row.state === "1" ? "Submitted" : "Cancelled" }}
  47. </div>
  48. </template>
  49. </el-table-column>
  50. <el-table-column prop="createTime" label="Created Time" width="180" />
  51. <el-table-column fixed="right" label="Action" min-width="240">
  52. <template #default="{ row }">
  53. <el-button
  54. class="!text-#C58C64 !h-40px !b-unset !bg-transparent hover:!bg-transparent hover:!text-#C58C64 hover:!underline"
  55. >
  56. <nuxt-link :to="`/orders/${row.id}`"> View details </nuxt-link>
  57. </el-button>
  58. <el-popconfirm
  59. title="Are you sure to cancel?"
  60. @confirm="cancelOrder(row)"
  61. >
  62. <template #reference>
  63. <el-button
  64. v-if="row.state === '1'"
  65. class="!text-#C58C64 !h-40px !b-unset !bg-transparent hover:!bg-transparent hover:!text-#C58C64 hover:!underline"
  66. >
  67. Cancel
  68. </el-button>
  69. </template>
  70. </el-popconfirm>
  71. </template>
  72. </el-table-column>
  73. </el-table>
  74. <div v-if="tableData.length" class="mt-25px flex justify-end">
  75. <el-pagination
  76. v-model:current-page="currentPage"
  77. :page-size="page_size"
  78. :pager-count="10"
  79. class="custom-pagination"
  80. layout="prev, pager, next"
  81. :total="total"
  82. @change="changePage"
  83. />
  84. </div>
  85. </div>
  86. </template>
  87. <style lang="less" scoped>
  88. ::v-deep(.el-table) {
  89. color: #333;
  90. .el-table__header-wrapper {
  91. .el-table__header {
  92. height: 50px;
  93. .el-table__cell {
  94. color: #333;
  95. font-weight: 400 !important;
  96. background-color: #fff2e1;
  97. }
  98. }
  99. }
  100. .el-table__row {
  101. height: 68px;
  102. &.warning-row {
  103. --el-table-tr-bg-color: #f7f7f7;
  104. }
  105. }
  106. }
  107. </style>