index.vue 20 KB

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