index.vue 21 KB

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