delivery-record.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <div class="fn-sm p-x-md">
  3. <table class="w-max">
  4. <thead>
  5. <tr class="fn-10">
  6. <th class="fn-left p-l-md p-y-xs">{{$t('option.a0')}}</th>
  7. <th class="fn-left">{{$t('option.d0')}}</th>
  8. <th class="fn-right p-r-md">{{$t('option.d2')}}</th>
  9. </tr>
  10. </thead>
  11. <tbody class="color-light trade-list">
  12. <tr v-for="item in list" :key="item.order_no">
  13. <td class="fn-left p-l-md p-y-xs rounded-bl-xs rounded-tl-xs">
  14. <div>{{item.pair_time_name}}</div>
  15. <div class="fn-sm color-default">{{$date(item.created_at)}}</div>
  16. </td>
  17. <td class="fn-left" :class="getColor(item.delivery_up_down)">
  18. {{item.delivery_range}}% ({{getStatusText(item.delivery_up_down)}})
  19. </td>
  20. <td class="fn-right p-r-md rounded-br-xs rounded-tr-xs">
  21. {{$date(item.end_time_text)}}
  22. </td>
  23. </tr>
  24. <tr>
  25. <td
  26. class="fn-center color-default bg-panel-2 p-y-md link-active"
  27. @click="more"
  28. colspan="3"
  29. v-if="loadMore"
  30. >{{$t('option.d3')}}</td>
  31. </tr>
  32. </tbody>
  33. </table>
  34. </div>
  35. </template>
  36. <script>
  37. import Option from "@/api/option";
  38. export default {
  39. props: ["query"],
  40. data() {
  41. return {
  42. list: [],
  43. page: 1,
  44. loadMore: true,
  45. };
  46. },
  47. watch:{
  48. query(){
  49. this.reset()
  50. }
  51. },
  52. methods: {
  53. getColor(status) {
  54. if (status == 1) return "color-buy";
  55. if (status == 2) return "color-sell";
  56. if (status == 3) return "";
  57. },
  58. getStatusText(status) {
  59. if (status == 1) return this.$t('option.b8');
  60. if (status == 2) return this.$t('option.c0');
  61. if (status == 3) return this.$t('option.b9');
  62. },
  63. reset() {
  64. this.page = 1;
  65. this.loadMore = true;
  66. this.getSceneResultList();
  67. },
  68. more() {
  69. this.page++;
  70. this.getSceneResultList();
  71. },
  72. getSceneResultList() {
  73. let data = {
  74. status: 2,
  75. page: this.page,
  76. pair_id: this.query.pair_id,
  77. time_id: this.query.time_id,
  78. };
  79. Option.getSceneResultList(data).then((res) => {
  80. if (res.data.current_page == 1) this.list = [];
  81. this.list = [...this.list, ...res.data.data];
  82. if (res.data.data.length < res.data.per_page) {
  83. this.loadMore = false;
  84. }
  85. });
  86. },
  87. },
  88. created() {
  89. this.getSceneResultList();
  90. },
  91. };
  92. </script>
  93. <style lang="scss" scoped>
  94. .trade-list{
  95. tr:nth-of-type(2n-1){
  96. td{
  97. background: $panel-3;
  98. }
  99. }
  100. }
  101. </style>