submitted.vue 2.9 KB

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