index.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <!-- 现货合同详情-->
  3. <a-modal class="add-custom custom-detail" title="现货合同详情" v-model:visible="visible" centered :maskClosable="false"
  4. @cancel="cancel" width="890px">
  5. <template #footer>
  6. <a-button key="submit" type="primary" :loading="loading" @click="cancel">关闭</a-button>
  7. </template>
  8. <a-tabs v-model:activeKey="activeKey" @change="tabClick">
  9. <a-tab-pane v-for="item in tabList" :key="item.key" :tab="item.name"></a-tab-pane>
  10. </a-tabs>
  11. <InfoDetail :selectedRow="selectedRow" v-if="activeKey == 1" />
  12. <div class="tableDatas" v-else>
  13. <a-table class="dialogTable" :columns="columns" :data-source="tableList" :pagination="false">
  14. <template #status="{ text }">
  15. <span class="yellow">{{ text }}</span>
  16. <!-- 审核通过'green' 审核拒绝 'orange' 待审核'yellow' -->
  17. </template>
  18. <!-- 审核状态 -->
  19. <template #applystatus="{ text }">
  20. <a>{{ getApplyStatusName(text) }}</a>
  21. </template>
  22. <!-- 发票金额-->
  23. <template #invoicetype="{ text }">
  24. <a>{{ invoiceStatusName(text) }}</a>
  25. </template>
  26. <!-- 发票类型-->
  27. <template #contracttype="{ text }">
  28. <a>{{ getReceiptName(text) }}</a>
  29. </template>
  30. <!-- 出入库类型 -->
  31. <template #inouttype="{ text }">
  32. <a>{{ InOutTypeName(text) }}</a>
  33. </template>
  34. <!-- 款项类型 -->
  35. <template #kxtype="{ record }">
  36. <a>{{ stateName(record.deductamount, record.contracttype) }}</a>
  37. </template>
  38. <!-- 金额-->
  39. <template #payamount="{ text, record }">
  40. <span>{{ formatValue(record.kxtype === 2 ? record.deductamount : text) }}</span>
  41. </template>
  42. <!-- 调整付保证金-->
  43. <template #addmargin="{ record }">
  44. <span>{{ formatValue(record.addmargin === undefined || '' ? record.decmargin : record.addmargin) }}</span>
  45. </template>
  46. <!-- 交收量 -->
  47. <template #reckonrealqty="{ record }">
  48. <span>{{ formatValue(record.reckonrealqty) }}</span>
  49. </template>
  50. <!-- 其他费用 -->
  51. <template #reckonotheramount="{ record }">
  52. <span>{{ formatValue(record.reckonotheramount) }}</span>
  53. </template>
  54. <!-- 调整金额 -->
  55. <template #reckonadjustamount="{ record }">
  56. <span>{{ formatValue(record.reckonadjustamount) }}</span>
  57. </template>
  58. <!-- 申请人 -->
  59. <template #applyname="{ record }">
  60. <span>{{ formatValue(record.applyname) }}</span>
  61. </template>
  62. <template #warehousename="{ record }">
  63. {{ record.warehousecode }}
  64. </template>
  65. <!-- 款项记录 款项类型为退款 则金额使用deductamount-->
  66. </a-table>
  67. </div>
  68. </a-modal>
  69. </template>
  70. <script lang="ts">
  71. import { defineComponent, PropType, ref } from 'vue';
  72. import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
  73. import { queryResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
  74. import { QueryBusinessFp, QueryBusinessKx } from '@/services/go/ermcp/finance-review';
  75. import { QueryBusinessDj, QueryBusinessJs } from '@/services/go/ermcp/business-review';
  76. import { QueryAreaStockApply } from '@/services/go/ermcp/inventory-review';
  77. import { QueryChangeLog } from '@/services/go/ermcp/spot-contract';
  78. import { QueryPaTradeLinkDetail } from '@/services/go/ermcp/patrade-link';
  79. import InfoDetail from '../infoDetail/index.vue';
  80. import { getApplyStatusName, getReceiptName } from '@/common/constants/enumsName';
  81. import { getTableColumns } from '@/common/setup/table';
  82. import { invoiceStatusName, stateName } from '@/views/manage/finance-review/setup';
  83. import { getPlanContractType } from '@/views/business/plan/setup';
  84. import { InOutTypeName } from '@/views/manage/inventory-review/setup';
  85. import { kxtypeName } from '@/views/manage/finance-review/setup';
  86. import { _closeModal } from '@/common/setup/modal/modal';
  87. import { formatValue } from '@/common/methods';
  88. import { columnsPaTradeLink } from './setup';
  89. import moment from 'moment';
  90. export default defineComponent({
  91. name: 'spot-contract-detail',
  92. components: { InfoDetail },
  93. emits: ['cancel', 'update'],
  94. props: {
  95. selectedRow: {
  96. type: Object as PropType<Ermcp3ContractRsp>,
  97. default: {},
  98. },
  99. },
  100. setup(props, context) {
  101. const { visible, cancel } = _closeModal(context);
  102. const tabList = ref<{ key: number; name: string }[]>([]);
  103. const activeKey = ref<number>(1);
  104. const loading = ref<boolean>(false);
  105. const tableList = ref<any[]>([]);
  106. // 表头数据
  107. const { columns, registerColumn } = getTableColumns();
  108. // 审核拒绝和未提交不显示后面的选项
  109. tabList.value = [0, 4, 6].includes(props.selectedRow.contracctstatus)
  110. ? [{ key: 1, name: '合同详情' }]
  111. : [
  112. { key: 1, name: '合同详情' },
  113. { key: 2, name: '点价记录' },
  114. { key: 3, name: '交收记录' },
  115. { key: 4, name: '款项记录' },
  116. { key: 5, name: '发票记录' },
  117. { key: 6, name: props.selectedRow.contracttype === 1 ? '入库记录' : '出库记录' },
  118. { key: 7, name: '变更记录' },
  119. //{ key: 8, name: '关联记录' },
  120. ];
  121. activeKey.value = 1;
  122. function tabClick() {
  123. const { spotcontractid, contracttype, contractno } = props.selectedRow;
  124. switch (activeKey.value) {
  125. case 2: // 点价记录
  126. registerColumn('table_pcweb_someprice_detail_dj');
  127. queryResultLoadingAndInfo(QueryBusinessDj, loading, { relatedid: spotcontractid }).then((res) => {
  128. tableList.value = res;
  129. });
  130. break;
  131. case 3: // 交收记录
  132. registerColumn('table_pcweb_someprice_detail_js');
  133. queryResultLoadingAndInfo(QueryBusinessJs, loading, { relatedid: spotcontractid }).then((res) => {
  134. tableList.value = res;
  135. });
  136. break;
  137. case 4: //款项记录
  138. registerColumn('table_pcweb_someprice_detail_kx');
  139. queryResultLoadingAndInfo(QueryBusinessKx, loading, { relatedid: spotcontractid }).then((res) => {
  140. tableList.value = res;
  141. });
  142. break;
  143. case 5: // 发票记录
  144. registerColumn('table_pcweb_someprice_detail_fp');
  145. queryResultLoadingAndInfo(QueryBusinessFp, loading, { relatedid: spotcontractid }).then((res) => {
  146. tableList.value = res;
  147. });
  148. break;
  149. case 6: // 出入库记录
  150. const inouttype = contracttype === 1 ? '5' : '6';
  151. if (contracttype === 1) {
  152. registerColumn('table_pcweb_someprice_detail_stock');
  153. } else {
  154. registerColumn('table_pcweb_someprice_detail_stock_out');
  155. }
  156. queryResultLoadingAndInfo(QueryAreaStockApply, loading, {
  157. spotcontractid,
  158. inouttype,
  159. }).then((res) => {
  160. tableList.value = res;
  161. });
  162. break;
  163. case 7: // 变更记录
  164. registerColumn('table_pcweb_someprice_detail_change');
  165. queryResultLoadingAndInfo(QueryChangeLog, loading, { RelatedId: spotcontractid }).then((res) => {
  166. tableList.value = res;
  167. });
  168. break;
  169. case 8: // 关联记录
  170. columns.value.length = 0;
  171. columns.value.push(...columnsPaTradeLink);
  172. queryResultLoadingAndInfo(QueryPaTradeLinkDetail, loading, { contractno }).then((res) => {
  173. // 关联日期降序
  174. tableList.value = res.sort((a, b) => moment(b.tradetime).valueOf() - moment(a.tradetime).valueOf());
  175. });
  176. break;
  177. }
  178. }
  179. return {
  180. visible,
  181. cancel,
  182. loading,
  183. maskClosableFlag: false,
  184. activeKey,
  185. columns,
  186. tableList,
  187. tabList,
  188. tabClick,
  189. getApplyStatusName,
  190. invoiceStatusName,
  191. getPlanContractType,
  192. InOutTypeName,
  193. kxtypeName,
  194. formatValue,
  195. getReceiptName,
  196. stateName,
  197. };
  198. },
  199. });
  200. </script>
  201. <style lang="less">
  202. .custom-detail {
  203. .ant-modal-content {
  204. .ant-modal-body {
  205. padding-top: 0;
  206. padding-left: 0;
  207. padding-right: 0;
  208. .ant-tabs {
  209. background: @m-black11;
  210. width: 100%;
  211. padding: 0 24px;
  212. .ant-tabs-bar {
  213. margin-bottom: 0;
  214. border-bottom: 0;
  215. }
  216. .anticon {
  217. color: @m-grey2;
  218. }
  219. .ant-tabs-nav-container {
  220. .ant-tabs-nav-wrap {
  221. .ant-tabs-nav {
  222. .ant-tabs-tab {
  223. width: 70px;
  224. margin-right: 43px;
  225. text-align: center;
  226. font-size: 16px;
  227. color: @m-grey2;
  228. padding: 0;
  229. line-height: 45px;
  230. }
  231. .ant-tabs-tab-active.ant-tabs-tab {
  232. color: @m-blue0;
  233. }
  234. .ant-tabs-ink-bar {
  235. width: 70px !important;
  236. background: @m-blue0;
  237. .rounded-corners(1px);
  238. }
  239. }
  240. }
  241. }
  242. }
  243. }
  244. }
  245. .tableDatas {
  246. margin-top: 26px;
  247. padding: 0 24px;
  248. overflow: hidden;
  249. .dialogTable {
  250. width: 100%;
  251. overflow: overlay;
  252. }
  253. }
  254. .ant-form.inlineForm {
  255. margin-top: 20px;
  256. padding: 0 24px;
  257. }
  258. }
  259. </style>