contract-entrustment.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <v-paging :ajax="getCurrentEntrust" class="h-max" ref="vPag">
  3. <template #box="list">
  4. <van-empty v-if="!Object.values(list).length" description="" />
  5. <div
  6. class="item bg-panel-4 m-md rounded-sm box-shadow"
  7. v-for="item in $list(list)"
  8. :key="item.id"
  9. >
  10. <div
  11. class="head d-flex align-center border-b p-x-md p-y-xs justify-between"
  12. >
  13. <div class="d-flex">
  14. <div>
  15. <div class="color-light fn-20">{{ item.symbol }}/USDT</div>
  16. <div class="fn-10">{{ item.created_at }}</div>
  17. </div>
  18. </div>
  19. <div class="d-flex">
  20. <span>{{ item.lever_rate }}X</span>
  21. </div>
  22. </div>
  23. <div class="p-x-md p-y-xs">
  24. <div class="row d-flex m-y-xs justify-between">
  25. <div class="label fn-sm">{{$t('contract.a6')}}</div>
  26. <div class="color-light">{{cals(item.side,item.order_type)}}</div>
  27. </div>
  28. <div class="row d-flex m-y-xs justify-between">
  29. <div class="label fn-sm">{{$t('contract.a7')}}/{{$t('contract.a8')}}</div>
  30. <div class="color-light">{{item.traded_amount}}/{{item.amount}}</div>
  31. </div>
  32. <div class="row d-flex m-y-xs justify-between">
  33. <div class="label fn-sm">{{$t('contract.a9')}}/{{$t('contract.b0')}}</div>
  34. <div class="color-light">{{item.entrust_price||'--'}}/--</div>
  35. </div>
  36. <div class="row d-flex m-y-xs justify-between">
  37. <div class="label fn-sm">{{$t('contract.b1')}}</div>
  38. <div class="color-light">{{item.margin*1}}</div>
  39. </div>
  40. <div class="row d-flex m-y-xs justify-between">
  41. <div class="label fn-sm">{{$t('contract.b2')}}</div>
  42. <div class="color-light">{{item.fee*1}}</div>
  43. </div>
  44. <div class="row d-flex m-y-xs justify-between">
  45. <div class="label fn-sm">{{$t('contract.b3')}}</div>
  46. <div class="color-light">{{ status(item.status) }}</div>
  47. </div>
  48. <div class="row d-flex m-y-xs justify-between">
  49. <div class="label fn-sm">{{$t('contract.b4')}}</div>
  50. <div class="color-light">
  51. <v-button type="green-plain" class="rounded-xs" size="mini" @click="ifCancelEntrust(item)">{{$t('contract.b5')}}</v-button>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </template>
  57. </v-paging>
  58. </template>
  59. <script>
  60. import Contract from "@/api/contract";
  61. export default {
  62. name: "contract-entrustment",
  63. data() {
  64. return {};
  65. },
  66. methods: {
  67. getCurrentEntrust: Contract.getCurrentEntrust,
  68. status(status) {
  69. switch (status) {
  70. case 0:
  71. return this.$t('contract.b6');
  72. case 1:
  73. return this.$t('contract.b7');
  74. case 2:
  75. return this.$t('contract.b8');
  76. case 3:
  77. return this.$t('contract.b9');
  78. }
  79. },
  80. cals(side, order_type) {
  81. // order_type - side
  82. let map = {
  83. "1-1": this.$t('contract.c0'),
  84. "1-2": this.$t('contract.c1'),
  85. "2-1": this.$t('contract.c2'),
  86. "2-2": this.$t('contract.c3'),
  87. };
  88. return map[`${side}-${order_type}`];
  89. },
  90. // 撤单
  91. ifCancelEntrust(item){
  92. this.$dialog.confirm({
  93. title:this.$t('contract.c4'),
  94. message:this.$t('contract.c5')+'?',
  95. cancelButtonText: this.$t('common.cancelButtonText'),
  96. confirmButtonText:this.$t('common.confirmButtonText')
  97. }).then(()=>{
  98. this.cancelEntrust(item)
  99. })
  100. },
  101. cancelEntrust(item){
  102. console.log('执行撤单')
  103. let data = {
  104. symbol:item.symbol,
  105. entrust_id:item.id,
  106. }
  107. Contract.cancelEntrust(data).then(()=>{
  108. this.$refs.vPag.ref()
  109. this.$toast(this.$t('contract.c6'))
  110. })
  111. }
  112. },
  113. };
  114. </script>