index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. <template>
  2. <!-- 现货合同审核-->
  3. <a-modal class="add-custom custom-detail"
  4. title="现货合同审核"
  5. v-model:visible="visible"
  6. centered
  7. :maskClosable="maskClosableFlag"
  8. @cancel="cancel"
  9. width="890px">
  10. <template #footer>
  11. <a-button key="submit"
  12. class="cancelBtn"
  13. @click="refuse">审核拒绝</a-button>
  14. <a-button key="submit"
  15. type="primary"
  16. :loading="loading"
  17. @click="submit">审核通过</a-button>
  18. </template>
  19. <a-form class="inlineForm"
  20. ref="formRef"
  21. :model="formState"
  22. :rules="rules">
  23. <fieldset class="formFieldSet">
  24. <legend>基本信息</legend>
  25. <a-row :gutter="24">
  26. <a-col :span="12">
  27. <a-form-item label="合同编号">
  28. <span class="white">{{ formatValue(selectedRow.contractno) }}</span>
  29. </a-form-item>
  30. </a-col>
  31. <a-col :span="12">
  32. <a-form-item label="合同类型">
  33. <span class="white">{{ getContractTypeName(selectedRow.contracttype) }}</span>
  34. </a-form-item>
  35. </a-col>
  36. </a-row>
  37. <a-row :gutter="24">
  38. <a-col :span="12">
  39. <a-form-item label="业务类型">
  40. <span class="white">{{ getBizTypeName(selectedRow.biztype) }}</span>
  41. </a-form-item>
  42. </a-col>
  43. <a-col :span="12">
  44. <a-form-item label="采购方">
  45. <span class="white">{{ formatValue(selectedRow.buyusername) }}</span>
  46. </a-form-item>
  47. </a-col>
  48. </a-row>
  49. <a-row :gutter="24">
  50. <a-col :span="12">
  51. <a-form-item label="销售方">
  52. <span class="white">{{ formatValue(selectedRow.sellusername) }}</span>
  53. </a-form-item>
  54. </a-col>
  55. <a-col :span="12">
  56. <a-form-item label="合同附件">
  57. <span class="white"
  58. @click="previewImg(selectedRow.attachment)">{{ formatValue(getImgName(selectedRow.attachment)) }}</span>
  59. </a-form-item>
  60. </a-col>
  61. </a-row>
  62. <a-row :gutter="24">
  63. <a-col :span="24">
  64. <a-form-item label="状态">
  65. <span class="green">{{ formatValue(getContractStatusName(selectedRow.contracctstatus)) }}</span>
  66. </a-form-item>
  67. </a-col>
  68. </a-row>
  69. </fieldset>
  70. <fieldset class="formFieldSet">
  71. <legend>现货信息</legend>
  72. <a-row :gutter="24">
  73. <a-col :span="12">
  74. <a-form-item label="现货品种">
  75. <span class="white">{{ formatValue(selectedRow.deliverygoodsname) }}</span>
  76. </a-form-item>
  77. </a-col>
  78. <a-col :span="12">
  79. <a-form-item label="品类">
  80. <span class="white">{{ formatValue(selectedRow.wrstandardname) }}</span>
  81. </a-form-item>
  82. </a-col>
  83. </a-row>
  84. <a-row :gutter="24">
  85. <a-col :span="12">
  86. <a-form-item label="品牌">
  87. <span class="white">{{ formatValue(selectedRow.brandname) }}</span>
  88. </a-form-item>
  89. </a-col>
  90. <a-col :span="12">
  91. <a-form-item label="标仓系数">
  92. <span class="white">{{ formatValue(selectedRow.convertfactor) }}</span>
  93. </a-form-item>
  94. </a-col>
  95. </a-row>
  96. <a-row :gutter="24">
  97. <a-col :span="24">
  98. <a-form-item label="商品规格">
  99. <span class="white">{{ formatValue(selectedRow.spotgoodsdesc) }}</span>
  100. </a-form-item>
  101. </a-col>
  102. </a-row>
  103. </fieldset>
  104. <fieldset class="formFieldSet">
  105. <legend>价格信息</legend>
  106. <a-row :gutter="24">
  107. <a-col :span="12">
  108. <a-form-item label="定价类型">
  109. <span class="white">{{ getPriceTypeName(formatValue(selectedRow.pricetype)) }}</span>
  110. </a-form-item>
  111. </a-col>
  112. <a-col :span="12">
  113. <a-form-item label="数量">
  114. <span class="white">{{ formatValue(selectedRow.qty) }}</span>
  115. </a-form-item>
  116. </a-col>
  117. </a-row>
  118. <a-row :gutter="24">
  119. <a-col :span="12">
  120. <a-form-item label="点价合约">
  121. <span class="white">{{ formatValue(selectedRow.goodscode) }}</span>
  122. </a-form-item>
  123. </a-col>
  124. <a-col :span="12">
  125. <a-form-item label="升贴水">
  126. <span class="white">{{ formatValue(selectedRow.pricemove) }}</span>
  127. </a-form-item>
  128. </a-col>
  129. </a-row>
  130. <a-row :gutter="24">
  131. <a-col :span="12">
  132. <a-form-item label="点价期">
  133. <span class="white">{{ formatValue(formatTime(selectedRow.startdate, "d") + '--' + formatTime(selectedRow.enddate, "d")) }}</span>
  134. </a-form-item>
  135. </a-col>
  136. <a-col :span="12">
  137. <a-form-item label="交收期">
  138. <span class="white">{{ formatValue(formatTime(selectedRow.deliverystartdate, "d") + '--' + formatTime(selectedRow.deliveryenddate, "d"))}}</span>
  139. </a-form-item>
  140. </a-col>
  141. </a-row>
  142. </fieldset>
  143. <fieldset class="formFieldSet">
  144. <legend>其他信息</legend>
  145. <a-row :gutter="24">
  146. <a-col :span="12">
  147. <a-form-item label="保证金">
  148. <span class="white">{{ formatValue(selectedRow.contractmargin) }}</span>
  149. </a-form-item>
  150. </a-col>
  151. <a-col :span="12">
  152. <a-form-item label="业务员"
  153. name="SaleUserID">
  154. <a-select class="inlineFormSelect"
  155. v-model:value="formState.SaleUserID"
  156. style="width: 200px"
  157. placeholder="请选择业务员">
  158. <a-select-option v-for="item in businesserList"
  159. :key="item.loginid"
  160. :value="item.loginid">
  161. {{item.accountname}}-{{item.logincode}}
  162. </a-select-option>
  163. </a-select>
  164. </a-form-item>
  165. </a-col>
  166. </a-row>
  167. <a-row :gutter="24">
  168. <a-col :span="12">
  169. <a-form-item label="跟单员"
  170. name="MerUserID">
  171. <a-select class="inlineFormSelect"
  172. v-model:value="formState.MerUserID"
  173. style="width: 200px"
  174. placeholder="请选择跟单员">
  175. <a-select-option v-for="item in merchandiserList"
  176. :key="item.loginid"
  177. :value="item.loginid">
  178. {{item.accountname}}-{{item.logincode}}
  179. </a-select-option>
  180. </a-select>
  181. </a-form-item>
  182. </a-col>
  183. <a-col :span="12">
  184. <a-form-item label="交易用户"
  185. name="TradeUserID">
  186. <a-select class="inlineFormSelect"
  187. style="width: 200px"
  188. v-model:value="formState.TradeUserID"
  189. placeholder="请选择期货账户">
  190. <a-select-option v-for="item in traderList"
  191. :key="item.roleid"
  192. :value="item.roleid">
  193. {{item.rolename}}
  194. </a-select-option>
  195. </a-select>
  196. </a-form-item>
  197. </a-col>
  198. </a-row>
  199. <a-row :gutter="24">
  200. <a-col :span="24">
  201. <a-form-item label="备注">
  202. <span class="white">{{ formatValue(selectedRow.remark) }}</span>
  203. </a-form-item>
  204. </a-col>
  205. </a-row>
  206. </fieldset>
  207. <fieldset class="formFieldSet">
  208. <legend>审核信息</legend>
  209. <a-row :gutter="24">
  210. <a-col :span="24">
  211. <a-form-item label="审核意见"
  212. name="Remark">
  213. <a-input class="dialogInput"
  214. v-model:value="formState.Remark"
  215. style="width: 620px"
  216. placeholder="请输入审核意见" />
  217. </a-form-item>
  218. </a-col>
  219. </a-row>
  220. </fieldset>
  221. </a-form>
  222. <a-modal :visible="previewVisible"
  223. :footer="null"
  224. @cancel="cancelImg">
  225. <img alt="预览附件"
  226. style="width: 100%"
  227. :src="previewImage" />
  228. </a-modal>
  229. </a-modal>
  230. </template>
  231. <script lang="ts">
  232. import { defineComponent, PropType, ref, toRaw, watchEffect } from 'vue';
  233. import { closeModal } from '@/common/setup/modal/index';
  234. import { getBizTypeName, getContractStatusName, getContractTypeName, getPriceTypeName } from '@/common/constants/enumsName';
  235. import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
  236. import { formatTime, formatValue } from '@/common/methods';
  237. import { orderContractControl, orderContractOperateControl } from '@/views/information/spot-contract/components/setup';
  238. import { Modal } from 'ant-design-vue';
  239. import { handleForm } from './setup';
  240. import { GldErmcpSpotContractOperateReq, SpotContractOperateReq } from '@/services/proto/spotcontract/interface';
  241. import { validateAction } from '@/common/setup/form';
  242. import { FormState } from './interface';
  243. import { ErmcpLoginUser } from '@/services/go/ermcp/account/interface';
  244. import { handlerManagerList } from '@/common/setup/user';
  245. import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
  246. import { hedgePlanReq } from '@/services/proto/hedgeplan';
  247. import { orderContract, spotContractStatus } from '@/services/proto/spotcontract';
  248. import { getUserId } from '@/services/bus/account';
  249. import { handlePreviewImg } from '@/common/setup/upload';
  250. export default defineComponent({
  251. name: 'spot-contract-detail',
  252. components: {},
  253. props: {
  254. selectedRow: {
  255. type: Object as PropType<Ermcp3ContractRsp>,
  256. default: {},
  257. },
  258. },
  259. setup(props, context) {
  260. const loading = ref<boolean>(false);
  261. const { visible, cancel } = closeModal('spot_contract_btn_check');
  262. // 获取 业务账户
  263. const { queryTable: queryBusinessManager, getBusinesserOrMerchandiser } = handlerManagerList(loading, 1);
  264. const { tableList: traderList, queryTable: queryTradeManager } = handlerManagerList(loading, 2, true);
  265. // 业务员
  266. const businesserList = ref<ErmcpLoginUser[]>([]);
  267. // 跟单员
  268. const merchandiserList = ref<ErmcpLoginUser[]>([]);
  269. // 表单
  270. const { rules, formState, formRef } = handleForm();
  271. // 预览附件
  272. const { previewVisible, previewImage, cancelImg, previewImg, getImgName } = handlePreviewImg();
  273. function submit() {
  274. validateAction<FormState>(formRef, formState).then((param) => {
  275. Modal.confirm({
  276. title: '是否确认审核通过',
  277. okText: '审核通过',
  278. cancelText: '取消',
  279. onOk() {
  280. // 为什么不删 因为以后可能又改回来
  281. // const reqParam: SpotContractOperateReq = {
  282. // SpotContractID: props.selectedRow.spotcontractid,
  283. // OperateType: 3,
  284. // Remark: param.Remark,
  285. // Info: {
  286. // BizType: props.selectedRow.biztype,
  287. // MerUserID: param.MerUserID as number, // 跟单员ID
  288. // SaleUserID: param.SaleUserID as number, // 业务员ID
  289. // TradeUserID: param.TradeUserID as number, // 交易员ID
  290. // Remark: param.Remark,
  291. // UserID: getUserId(),
  292. // },
  293. // };
  294. const reqParam: GldErmcpSpotContractOperateReq = {
  295. SpotContractID: props.selectedRow.spotcontractid,
  296. OperateType: 4,
  297. Remark: param.Remark,
  298. Info: {
  299. BizType: props.selectedRow.biztype,
  300. MerUserID: param.MerUserID as number, // 跟单员ID
  301. SaleUserID: param.SaleUserID as number, // 业务员ID
  302. TradeUserID: param.TradeUserID as number, // 交易员ID
  303. Remark: param.Remark,
  304. UserID: getUserId(),
  305. CurrencyID: props.selectedRow.currencyid, // 币种id
  306. },
  307. };
  308. // Fixme 6/4 代码修改
  309. // 审核通过 SpotContractOperateReq operateType 操作类型-1:保存草稿(作废)2:提交申请(作废)3:审核通过4:审核拒绝(作废)5:撤回(作废)6:正常完结7:异常终止
  310. // Fixme 6/9 代码修改
  311. // 审核通过 GldErmcpSpotContractOperateReq 操作类型-1:保存草稿2:提交申请3:审核通过4:审核拒绝5:撤回6:正常完结7:异常终止
  312. requestResultLoadingAndInfo(orderContract, reqParam, loading, ['审核通过成功', '审核失败:']).then(() => {
  313. context.emit('refresh');
  314. cancel();
  315. });
  316. },
  317. onCancel() {},
  318. });
  319. });
  320. }
  321. function refuse() {
  322. Modal.confirm({
  323. title: '是否确认审核拒绝',
  324. okText: '审核拒绝',
  325. cancelText: '取消',
  326. onOk() {
  327. const param = toRaw(formState);
  328. const reqParam: GldErmcpSpotContractOperateReq = {
  329. SpotContractID: props.selectedRow.spotcontractid,
  330. OperateType: 5,
  331. Remark: param.Remark,
  332. };
  333. // Fixme 6/4 代码修改
  334. // 审核拒绝 操作类型-1:保存草稿2:提交申请3:删除4:审核通过5:审核拒绝6:撤销
  335. requestResultLoadingAndInfo(orderContract, reqParam, loading, ['审核拒绝成功', '审核失败:']).then(() => {
  336. context.emit('refresh');
  337. cancel();
  338. });
  339. },
  340. onCancel() {},
  341. });
  342. }
  343. watchEffect(() => {
  344. if (visible.value) {
  345. queryBusinessManager().then(() => {
  346. businesserList.value = getBusinesserOrMerchandiser('22');
  347. merchandiserList.value = getBusinesserOrMerchandiser('23');
  348. });
  349. queryTradeManager();
  350. const { saleuserid, tradeuserid, meruserid, remark } = props.selectedRow;
  351. saleuserid && (formState.SaleUserID = saleuserid);
  352. tradeuserid && (formState.TradeUserID = tradeuserid);
  353. meruserid && (formState.MerUserID = meruserid);
  354. formState.Remark = remark;
  355. }
  356. });
  357. return {
  358. visible,
  359. cancel,
  360. submit,
  361. maskClosableFlag: false,
  362. getContractTypeName,
  363. getBizTypeName,
  364. formatValue,
  365. getContractStatusName,
  366. formatTime,
  367. getPriceTypeName,
  368. refuse,
  369. traderList,
  370. merchandiserList,
  371. businesserList,
  372. loading,
  373. formState,
  374. rules,
  375. formRef,
  376. previewVisible,
  377. previewImage,
  378. cancelImg,
  379. previewImg,
  380. getImgName,
  381. };
  382. },
  383. });
  384. </script>
  385. <style lang="less">
  386. .add-custom custom-detail {
  387. .upload {
  388. .look {
  389. margin-left: 0;
  390. }
  391. }
  392. }
  393. </style>;