index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619
  1. <template>
  2. <div class="tenant">
  3. <div class="content">
  4. <byTable
  5. :source="sourceList.data"
  6. :pagination="sourceList.pagination"
  7. :config="config"
  8. :loading="loading"
  9. :selectConfig="selectConfig"
  10. highlight-current-row
  11. :action-list="[
  12. {
  13. text: '创建合同',
  14. action: () => newContract(),
  15. },
  16. ]"
  17. @get-list="getList">
  18. <template #amount="{ item }">
  19. <div>
  20. <span style="padding-right: 4px">{{ item.currency }}</span>
  21. <span>{{ moneyFormat(item.amount, 2) }}</span>
  22. </div>
  23. </template>
  24. <template #refundMoney="{ item }">
  25. <div>
  26. <span style="padding-right: 4px">{{ item.currency }}</span>
  27. <span>{{ moneyFormat(item.refundMoney, 2) }}</span>
  28. </div>
  29. </template>
  30. <template #advanceRatio="{ item }">
  31. <div>
  32. <span>{{ item.advanceRatio }}%</span>
  33. </div>
  34. </template>
  35. </byTable>
  36. </div>
  37. <el-dialog title="打印" v-if="openPrint" v-model="openPrint" width="860">
  38. <div id="pdfDom" style="width: 800px; padding: 16px; font-size: 12px !important">
  39. <div style="font-size: 18px; text-align: center">
  40. {{ printDetails.sellCorporationNameEn }}
  41. </div>
  42. <div style="text-align: center">
  43. {{ printDetails.sellCountryName }},{{ printDetails.sellProvinceName }},{{ printDetails.sellCityName }},{{ printDetails.sellDetailedAddress }}
  44. </div>
  45. <div style="font-size: 14px; color: #409eff; text-align: center; padding-top: 16px">PROFORMA INVOICE</div>
  46. <div style="padding-top: 8px">
  47. <div>PI NO. : {{ printDetails.contractCode }}</div>
  48. <div>PI DATE: {{ printDetails.createTimeEn }}</div>
  49. </div>
  50. <div style="border: 1px solid black; display: flex">
  51. <div style="width: 50%; border-right: 1px solid black">
  52. <div style="color: #409eff">VENDOR:</div>
  53. <div>{{ printDetails.sellCorporationNameEn }}</div>
  54. <div style="padding: 16px 0">
  55. {{ printDetails.sellCountryName }},{{ printDetails.sellProvinceName }},{{ printDetails.sellCityName }},{{ printDetails.sellDetailedAddress }}
  56. </div>
  57. <div>{{ printDetails.sellContactName }},{{ printDetails.sellContactNumber }}</div>
  58. </div>
  59. <div style="width: 50%">
  60. <div style="color: #409eff">BUYER:</div>
  61. <div>{{ printDetails.buyCorporationName }}</div>
  62. <div style="padding: 16px 0">
  63. {{ printDetails.buyCountryName }},{{ printDetails.buyProvinceName }},{{ printDetails.buyCityName }},{{ printDetails.buyDetailedAddress }}
  64. </div>
  65. <div>{{ printDetails.buyContactName }},{{ printDetails.buyContactNumber }}</div>
  66. </div>
  67. </div>
  68. <div style="height: 16px"></div>
  69. <div style="border: 1px solid black">
  70. <div style="display: flex; width: 100%">
  71. <div style="width: 33%; border-bottom: 1px solid black; border-right: 1px solid black">
  72. <div style="color: #409eff">COUNTRY OF ORIGIN:</div>
  73. <div>{{ printDetails.sellCountryName }}</div>
  74. </div>
  75. <div style="width: 34%; border-bottom: 1px solid black; border-right: 1px solid black">
  76. <div style="color: #409eff">COUNTRY OF DESTINATION:</div>
  77. <div>{{ printDetails.buyCountryName }}</div>
  78. </div>
  79. <div style="width: 33%; border-bottom: 1px solid black">
  80. <div style="color: #409eff">PLACE OF DISCHARGE:</div>
  81. <div>{{ printDetails.transportRemark }}</div>
  82. </div>
  83. </div>
  84. <div style="display: flex; width: 100%">
  85. <div style="width: 33%; border-bottom: 1px solid black; border-right: 1px solid black">
  86. <div style="color: #409eff">TERMS OF DELIVERY:</div>
  87. <div>
  88. {{ dictValueLabel(printDetails.tradeMethods, tradeMethods) }}
  89. </div>
  90. </div>
  91. <div style="width: 34%; border-bottom: 1px solid black; border-right: 1px solid black">
  92. <div style="color: #409eff">CURRENCY:</div>
  93. <div>
  94. {{ dictValueLabel(printDetails.currency, accountCurrency) }}
  95. </div>
  96. </div>
  97. <div style="width: 33%; border-bottom: 1px solid black">
  98. <div style="color: #409eff">EXPORT BY/VIA:</div>
  99. <div>
  100. {{ dictValueLabel(printDetails.transportMethod, shippingMethod) }}
  101. </div>
  102. </div>
  103. </div>
  104. <div style="display: flex; width: 100%">
  105. <div style="width: 33%; border-right: 1px solid black">
  106. <div style="color: #409eff">DELIVERY TIME:</div>
  107. <div>{{ printDetails.deliveryTime }}</div>
  108. </div>
  109. <div style="width: 67%">
  110. <div style="color: #409eff">TERMS OF PAYMENT:</div>
  111. <div>{{ printDetails.remark }}</div>
  112. </div>
  113. </div>
  114. </div>
  115. <div style="height: 16px"></div>
  116. <div class="baseRow" style="display: flex; color: #409eff">
  117. <div class="contentRow" style="width: 50px; text-align: center">NO.</div>
  118. <div class="contentRow" style="width: calc(100% - 450px); text-align: center">COMMODITY, SPECIFICATION</div>
  119. <div class="contentRow" style="width: 100px; text-align: center">UNIT</div>
  120. <div class="contentRow" style="width: 100px; text-align: center">QUANTITY</div>
  121. <div class="contentRow" style="width: 100px; text-align: center">UNIT PRICE</div>
  122. <div class="contentRow" style="width: 100px; text-align: center">TOTAL PRICE</div>
  123. </div>
  124. <div v-if="printDetails.productInfoList && printDetails.productInfoList.length > 0">
  125. <div class="baseRow" style="display: flex" v-for="(item, index) in printDetails.productInfoList" :key="item.productId">
  126. <div class="contentRow" style="width: 50px; text-align: center">
  127. {{ index + 1 }}
  128. </div>
  129. <div class="contentRow" style="width: calc(100% - 450px); text-align: center">
  130. {{ item.productName }}
  131. </div>
  132. <div class="contentRow" style="width: 100px; text-align: center">
  133. {{ item.productUnit }}
  134. </div>
  135. <div class="contentRow" style="width: 100px; text-align: center">
  136. {{ item.productQuantity }}
  137. </div>
  138. <div class="contentRow" style="width: 100px; text-align: center">
  139. {{ item.productPrice }}
  140. </div>
  141. <div class="contentRow" style="width: 100px; text-align: center">
  142. {{ item.amount }}
  143. </div>
  144. </div>
  145. </div>
  146. <div class="baseRow" style="display: flex; color: #409eff">
  147. <div class="contentRow" style="width: calc(100% - 400px); text-align: center">SUBTOTAL:</div>
  148. <div class="contentRow" style="width: 100px; text-align: center"></div>
  149. <div class="contentRow" style="width: 100px; text-align: center">
  150. {{ statistics("productQuantity", 0) }}
  151. </div>
  152. <div class="contentRow" style="width: 100px; text-align: center"></div>
  153. <div class="contentRow" style="width: 100px; text-align: center">
  154. {{ statistics("amount", 2) }}
  155. </div>
  156. </div>
  157. <!-- <div v-if="printDetails.quotationPayList && printDetails.quotationPayList.length > 0">
  158. <div class="baseRow" style="display: flex" v-for="(item, index) in printDetails.quotationPayList" :key="index">
  159. <div class="contentRow" style="width: calc(100% - 100px); text-align: right; color: #409eff">{{ item.payName }}:</div>
  160. <div class="contentRow" style="width: 100px; text-align: center">{{ item.amount }}</div>
  161. </div>
  162. </div> -->
  163. <div class="baseRow" style="display: flex">
  164. <div class="contentRow" style="width: calc(100% - 100px); text-align: right; color: #409eff">TOTAL PRICE:</div>
  165. <div class="contentRow" style="width: 100px; text-align: center">
  166. {{ statistics("amount", 2) }}
  167. </div>
  168. </div>
  169. <div class="baseRow" style="display: flex; border-bottom: 1px solid black">
  170. <div class="contentRow" style="width: 100%">
  171. {{ translateIntoEnglish(printDetails.totalAmount, printDetails.currency) }}
  172. </div>
  173. </div>
  174. <div style="height: 16px"></div>
  175. <div class="baseRow" style="color: #409eff">
  176. <div class="contentRow" style="width: 100%">ACCOUNT INFORMATION:</div>
  177. </div>
  178. <div class="baseRow" style="border-bottom: 1px solid black">
  179. <div class="contentRow" style="width: 100%">
  180. <div style="line-height: 24px; padding-left: 4px; word-break: break-all; word-wrap: break-word">
  181. Beneficiary Name: {{ printDetails.beneficiaryName }}
  182. </div>
  183. <div style="line-height: 24px; padding-left: 4px; word-break: break-all; word-wrap: break-word">
  184. Beneficiary Bank: {{ printDetails.beneficiaryBank }}
  185. </div>
  186. <div style="line-height: 24px; padding-left: 4px; word-break: break-all; word-wrap: break-word">
  187. Beneficiary Bank Address: {{ printDetails.beneficiaryBankAddress }}
  188. </div>
  189. <div style="line-height: 24px; padding-left: 4px; word-break: break-all; word-wrap: break-word">
  190. Beneficiary Account Number: {{ printDetails.beneficiaryAccountNumber }}
  191. </div>
  192. <div style="line-height: 24px; padding-left: 4px; word-break: break-all; word-wrap: break-word">Swift Code: {{ printDetails.swiftCode }}</div>
  193. <div style="line-height: 24px; padding-left: 4px; word-break: break-all; word-wrap: break-word">
  194. Beneficiary Address: {{ printDetails.beneficiaryAddress }}
  195. </div>
  196. </div>
  197. </div>
  198. <div style="height: 32px"></div>
  199. <div style="display: flex">
  200. <div style="width: 50%">
  201. <div style="color: #409eff">CONFIRMED BY VENDOR:</div>
  202. <div>{{ printDetails.sellCorporationNameEn }}</div>
  203. </div>
  204. <div style="width: 50%">
  205. <div style="color: #409eff">CONFIRMED BY BUYER:</div>
  206. <div>{{ printDetails.buyCorporationName }}</div>
  207. </div>
  208. </div>
  209. </div>
  210. <template #footer>
  211. <el-button @click="openPrint = false" size="large">取消</el-button>
  212. <el-button type="primary" @click="clickDownload()" size="large">下载PDF</el-button>
  213. </template>
  214. </el-dialog>
  215. </div>
  216. </template>
  217. <script setup>
  218. import { computed, ref } from "vue";
  219. import byTable from "@/components/byTable/index";
  220. import useUserStore from "@/store/modules/user";
  221. import { ElMessage, ElMessageBox } from "element-plus";
  222. const { proxy } = getCurrentInstance();
  223. const contractType = ref([]);
  224. const accountCurrency = ref([]);
  225. const tradeMethods = ref([]);
  226. const corporationList = ref([]);
  227. const customerList = ref([]);
  228. const shippingMethod = ref([]);
  229. const status = ref([
  230. {
  231. label: "草稿",
  232. value: 0,
  233. },
  234. {
  235. label: "审批中",
  236. value: 10,
  237. },
  238. {
  239. label: "驳回",
  240. value: 20,
  241. },
  242. {
  243. label: "审批通过",
  244. value: 30,
  245. },
  246. {
  247. label: "终止",
  248. value: 99,
  249. },
  250. ]);
  251. const refundStatus = ref([
  252. {
  253. label: "未到款",
  254. value: 0,
  255. },
  256. {
  257. label: "部分到款",
  258. value: 10,
  259. },
  260. {
  261. label: "已到款",
  262. value: 20,
  263. },
  264. ]);
  265. const sourceList = ref({
  266. data: [],
  267. pagination: {
  268. total: 0,
  269. pageNum: 1,
  270. pageSize: 10,
  271. keyword: "",
  272. status: "",
  273. sellCorporationId: "",
  274. },
  275. });
  276. const loading = ref(false);
  277. const selectConfig = computed(() => {
  278. return [
  279. {
  280. label: "审批状态",
  281. prop: "status",
  282. data: status.value,
  283. },
  284. {
  285. label: "到款状态",
  286. prop: "refundStatus",
  287. data: refundStatus.value,
  288. },
  289. // {
  290. // label: "归属公司",
  291. // prop: "sellCorporationId",
  292. // data: corporationList.value,
  293. // },
  294. ];
  295. });
  296. const config = computed(() => {
  297. return [
  298. {
  299. attrs: {
  300. label: "归属公司",
  301. prop: "sellCorporationId",
  302. "min-width": 220,
  303. },
  304. render(type) {
  305. let text = "";
  306. if (corporationList.value && corporationList.value.length > 0) {
  307. let data = corporationList.value.filter((item) => item.value == type);
  308. if (data && data.length > 0) {
  309. text = data[0].label;
  310. }
  311. }
  312. return text;
  313. },
  314. },
  315. {
  316. attrs: {
  317. label: "合同类型",
  318. prop: "contractType",
  319. width: 120,
  320. },
  321. render(type) {
  322. let text = "";
  323. if (contractType.value && contractType.value.length > 0) {
  324. let data = contractType.value.filter((item) => item.value == type);
  325. if (data && data.length > 0) {
  326. text = data[0].label;
  327. }
  328. }
  329. return text;
  330. },
  331. },
  332. {
  333. attrs: {
  334. label: "合同编码",
  335. prop: "code",
  336. width: 180,
  337. },
  338. },
  339. {
  340. attrs: {
  341. label: "客户",
  342. prop: "buyCorporationId",
  343. "min-width": 220,
  344. },
  345. render(type) {
  346. let text = "";
  347. if (customerList.value && customerList.value.length > 0) {
  348. let data = customerList.value.filter((item) => item.value == type);
  349. if (data && data.length > 0) {
  350. text = data[0].label;
  351. }
  352. }
  353. return text;
  354. },
  355. },
  356. {
  357. attrs: {
  358. label: "版本号",
  359. prop: "version",
  360. width: 120,
  361. },
  362. },
  363. {
  364. attrs: {
  365. label: "合同金额",
  366. slot: "amount",
  367. width: 140,
  368. },
  369. },
  370. {
  371. attrs: {
  372. label: "已到账金额",
  373. slot: "refundMoney",
  374. width: 140,
  375. },
  376. },
  377. {
  378. attrs: {
  379. label: "业务员",
  380. prop: "userName",
  381. width: 140,
  382. },
  383. },
  384. {
  385. attrs: {
  386. label: "创建时间",
  387. prop: "createTime",
  388. width: 160,
  389. },
  390. },
  391. {
  392. attrs: {
  393. label: "审批状态",
  394. prop: "status",
  395. width: 140,
  396. },
  397. render(type) {
  398. let text = "";
  399. if (status.value && status.value.length > 0) {
  400. let data = status.value.filter((item) => item.value == type);
  401. if (data && data.length > 0) {
  402. text = data[0].label;
  403. }
  404. }
  405. return text;
  406. },
  407. },
  408. {
  409. attrs: {
  410. label: "操作",
  411. width: "120",
  412. align: "center",
  413. fixed: "right",
  414. },
  415. renderHTML(row) {
  416. return [
  417. {
  418. attrs: {
  419. label: "打印",
  420. type: "primary",
  421. text: true,
  422. },
  423. el: "button",
  424. click() {
  425. clickPrint(row);
  426. },
  427. },
  428. {
  429. attrs: {
  430. label: "作废",
  431. type: "primary",
  432. text: true,
  433. },
  434. el: "button",
  435. click() {
  436. ElMessageBox.confirm("此操作将永久删除该数据, 是否继续?", "提示", {
  437. confirmButtonText: "确定",
  438. cancelButtonText: "取消",
  439. type: "warning",
  440. }).then(() => {
  441. proxy
  442. .post("/contract/edit", {
  443. id: row.id,
  444. status: 88,
  445. })
  446. .then(() => {
  447. ElMessage({
  448. message: "作废成功",
  449. type: "success",
  450. });
  451. getList();
  452. });
  453. });
  454. },
  455. },
  456. ];
  457. },
  458. },
  459. ];
  460. });
  461. const getDict = () => {
  462. proxy
  463. .post("/dictTenantData/page", {
  464. pageNum: 1,
  465. pageSize: 999,
  466. dictCode: "contract_type",
  467. tenantId: useUserStore().user.tenantId,
  468. })
  469. .then((res) => {
  470. if (res.rows && res.rows.length > 0) {
  471. contractType.value = res.rows.map((item) => {
  472. return {
  473. label: item.dictValue,
  474. value: item.dictKey,
  475. };
  476. });
  477. }
  478. });
  479. proxy
  480. .post("/dictTenantData/page", {
  481. pageNum: 1,
  482. pageSize: 999,
  483. dictCode: "account_currency",
  484. tenantId: useUserStore().user.tenantId,
  485. })
  486. .then((res) => {
  487. if (res.rows && res.rows.length > 0) {
  488. accountCurrency.value = res.rows.map((item) => {
  489. return {
  490. label: item.dictValue,
  491. value: item.dictKey,
  492. };
  493. });
  494. }
  495. });
  496. proxy
  497. .post("/dictTenantData/page", {
  498. pageNum: 1,
  499. pageSize: 999,
  500. dictCode: "trade_methods",
  501. tenantId: useUserStore().user.tenantId,
  502. })
  503. .then((res) => {
  504. if (res.rows && res.rows.length > 0) {
  505. tradeMethods.value = res.rows.map((item) => {
  506. return {
  507. label: item.dictValue,
  508. value: item.dictKey,
  509. };
  510. });
  511. }
  512. });
  513. proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  514. corporationList.value = res.rows.map((item) => {
  515. return {
  516. ...item,
  517. label: item.name,
  518. value: item.id,
  519. };
  520. });
  521. });
  522. proxy.post("/customer/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  523. customerList.value = res.rows.map((item) => {
  524. return {
  525. ...item,
  526. label: item.name,
  527. value: item.id,
  528. };
  529. });
  530. });
  531. proxy
  532. .post("/dictTenantData/page", {
  533. pageNum: 1,
  534. pageSize: 999,
  535. dictCode: "shipping_method",
  536. tenantId: useUserStore().user.tenantId,
  537. })
  538. .then((res) => {
  539. if (res.rows && res.rows.length > 0) {
  540. shippingMethod.value = res.rows.map((item) => {
  541. return {
  542. label: item.dictValue,
  543. value: item.dictKey,
  544. };
  545. });
  546. }
  547. });
  548. };
  549. const getList = async (req) => {
  550. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  551. loading.value = true;
  552. proxy.post("/contract/page", sourceList.value.pagination).then((res) => {
  553. sourceList.value.data = res.rows;
  554. sourceList.value.pagination.total = res.total;
  555. setTimeout(() => {
  556. loading.value = false;
  557. }, 200);
  558. });
  559. };
  560. getDict();
  561. getList();
  562. const newContract = () => {
  563. proxy.$router.replace({
  564. path: "/platform_manage/process/processApproval",
  565. query: {
  566. flowKey: "contract_flow",
  567. flowName: "销售合同审批流程",
  568. random: proxy.random(),
  569. tenantType: "EHSD",
  570. },
  571. });
  572. };
  573. const openPrint = ref(false);
  574. const printDetails = ref({});
  575. const clickPrint = (row) => {
  576. printDetails.value = {};
  577. openPrint.value = true;
  578. proxy.post("/contract/getContractPdfInfo", { id: row.id }).then((res) => {
  579. printDetails.value = res;
  580. });
  581. };
  582. const clickDownload = () => {
  583. proxy.getPdf("外销合同PDF文件");
  584. };
  585. const statistics = (label, index) => {
  586. let num = 0;
  587. if (printDetails.value.productInfoList && printDetails.value.productInfoList.length > 0) {
  588. printDetails.value.productInfoList.map((item) => {
  589. if (item[label]) {
  590. num = parseFloat(Number(num) + Number(item[label])).toFixed(index);
  591. }
  592. });
  593. }
  594. return num;
  595. };
  596. </script>
  597. <style lang="scss" scoped>
  598. .tenant {
  599. padding: 20px;
  600. }
  601. ::v-deep(.el-input-number .el-input__inner) {
  602. text-align: left;
  603. }
  604. .baseRow {
  605. min-height: 24px;
  606. border-top: 1px solid black;
  607. border-left: 1px solid black;
  608. }
  609. .contentRow {
  610. border-right: 1px solid black;
  611. line-height: 24px;
  612. padding-left: 4px;
  613. }
  614. </style>