StockTable.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <table>
  3. <tbody>
  4. <tr class="title">
  5. <th rowspan="2">Model</th>
  6. <th rowspan="2">Available stock</th>
  7. <th colspan="2">Next shipment</th>
  8. </tr>
  9. <tr>
  10. <th>Date</th>
  11. <th>QTY</th>
  12. </tr>
  13. <template v-if="comData.length">
  14. <tr v-for="(items, key) in comData" :key="key">
  15. <!-- point是旧字段, 后续版本可以删掉. -->
  16. <td>{{ items.sku_model || items.point }}</td>
  17. <td>{{ items.available_stock }}</td>
  18. <td>{{ $utils.formatTime(items.next_times, 'DD-MM-YYYY',true) }}</td>
  19. <td>{{ items.arrival_stock }}</td>
  20. </tr>
  21. </template>
  22. <tr v-else>
  23. <td rowspan="3" colspan="4">No Data</td>
  24. </tr>
  25. </tbody>
  26. </table>
  27. </template>
  28. <script>
  29. export default {
  30. props: {
  31. data: [],
  32. },
  33. computed:{
  34. comData(){
  35. return this.data.filter(item => item.is_show)
  36. }
  37. }
  38. };
  39. </script>
  40. <style lang="scss" scoped>
  41. $deep-blue:#004A97;
  42. table {
  43. width: 100%;
  44. font-size: 16px;
  45. text-align: center;
  46. overflow: hidden;
  47. border-right: 1px solid #ddd;
  48. border-top: 1px solid #ddd;
  49. border-spacing: 0;
  50. table-layout: fixed;
  51. margin-bottom: 10px;
  52. tr {
  53. height: 32px;
  54. &:nth-child(1),&:nth-child(2) {
  55. background-color: $deep-blue;
  56. }
  57. th {
  58. border-left: 1px solid #ddd;
  59. border-bottom: 1px solid #ddd;
  60. vertical-align: middle;
  61. color: #fff;
  62. }
  63. td {
  64. border-left: 1px solid #ddd;
  65. border-bottom: 1px solid #ddd;
  66. vertical-align: middle;
  67. color: #4a596c;
  68. }
  69. }
  70. }
  71. </style>