setup.ts 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. import { WrOrderDetail } from "@/services/go/wrtrade/interface";
  2. export const useOrderWarrant = (hasWR: 0 | 1) => {
  3. const tableColumns = [
  4. {
  5. key: '0th',
  6. dataIndex: 'wrtradeorderid',
  7. title: '挂牌单号',
  8. align: 'center',
  9. slots: {
  10. customRender: 'wrtradeorderid',
  11. },
  12. width: 180,
  13. },
  14. {
  15. key: '6th',
  16. dataIndex: 'wrtradetype',
  17. title: '挂牌类型',
  18. align: 'center',
  19. slots: {
  20. customRender: 'wrtradetype',
  21. },
  22. width: 120,
  23. },
  24. {
  25. key: '7th',
  26. dataIndex: 'deliverygoodsname',
  27. title: '品种',
  28. align: 'center',
  29. slots: {
  30. customRender: 'deliverygoodsname',
  31. },
  32. width: 120,
  33. },
  34. {
  35. key: '8th',
  36. dataIndex: 'wrtypename',
  37. title: '商品',
  38. align: 'center',
  39. slots: {
  40. customRender: 'wrtypename',
  41. },
  42. width: 250,
  43. },
  44. {
  45. key: '9th',
  46. dataIndex: 'warehousename',
  47. title: '仓库',
  48. align: 'center',
  49. slots: {
  50. customRender: 'warehousename',
  51. },
  52. width: 120,
  53. },
  54. {
  55. key: '5th',
  56. dataIndex: 'wrpricetype',
  57. title: '挂牌方式',
  58. align: 'center',
  59. slots: {
  60. customRender: 'wrpricetype',
  61. },
  62. width: 250,
  63. },
  64. {
  65. key: '101th',
  66. dataIndex: 'goodscode',
  67. title: '期货合约',
  68. align: 'center',
  69. slots: {
  70. customRender: 'goodscode',
  71. },
  72. width: 200,
  73. },
  74. {
  75. key: '10th',
  76. dataIndex: 'futushow',
  77. title: '价格/基差',
  78. align: 'center',
  79. slots: {
  80. customRender: 'futushow',
  81. },
  82. width: 200,
  83. },
  84. {
  85. key: '1th',
  86. dataIndex: 'orderqty',
  87. title: '挂牌数量',
  88. align: 'center',
  89. slots: {
  90. customRender: 'orderqty',
  91. },
  92. width: 120,
  93. },
  94. {
  95. key: '2th',
  96. dataIndex: 'tradeqty',
  97. title: '成交数量',
  98. align: 'center',
  99. slots: {
  100. customRender: 'tradeqty',
  101. },
  102. width: 120,
  103. },
  104. {
  105. key: '3th',
  106. dataIndex: 'ordertime',
  107. title: '挂牌时间',
  108. align: 'center',
  109. slots: {
  110. customRender: 'ordertime',
  111. },
  112. width: 250,
  113. },
  114. {
  115. key: '4th',
  116. dataIndex: 'wrtradeorderstatus',
  117. title: '状态',
  118. align: 'center',
  119. slots: {
  120. customRender: 'wrtradeorderstatus',
  121. },
  122. width: 120,
  123. },
  124. ];
  125. if (!hasWR) { // 无仓单 需要交收月
  126. const obj = {
  127. key: '42th',
  128. dataIndex: 'deliverymonth',
  129. title: '交收月',
  130. align: 'center',
  131. slots: {
  132. customRender: 'deliverymonth',
  133. },
  134. width: 120,
  135. }
  136. tableColumns.splice(6, 0, obj)
  137. }
  138. // 挂牌方式
  139. function getWrPriceType({ wrpricetype, isspecified, canbargain }: WrOrderDetail) {
  140. let result = '--'
  141. if (isspecified) {
  142. if (canbargain) {
  143. result = '贸易圈-可议价'
  144. } else {
  145. result = '贸易圈'
  146. }
  147. } else {
  148. if (wrpricetype === 1) {
  149. result = '一口价'
  150. } else {
  151. result = '浮动价'
  152. }
  153. }
  154. return result
  155. }
  156. // 是否显示 议价单 按钮
  157. function isShowBarginBtn({ isspecified, canbargain }: WrOrderDetail) {
  158. return isspecified && canbargain
  159. }
  160. // 显示价格 或者基差
  161. function showPriceOrMove({ wrpricetype, fixedprice, pricemove }: WrOrderDetail) {
  162. const result = wrpricetype === 1 ? fixedprice : pricemove
  163. return result ? result : '--'
  164. }
  165. return { tableColumns, getWrPriceType, isShowBarginBtn, showPriceOrMove }
  166. }