index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  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. const { proxy } = getCurrentInstance();
  228. const accountList = ref([]);
  229. const corporationList = ref([]);
  230. const customerList = ref([]);
  231. const tradeMethods = ref([]);
  232. const accountCurrency = ref([]);
  233. const shippingMethod = ref([]);
  234. const status = ref([
  235. {
  236. label: "草稿",
  237. value: 0,
  238. },
  239. {
  240. label: "审批中",
  241. value: 10,
  242. },
  243. {
  244. label: "驳回",
  245. value: 20,
  246. },
  247. {
  248. label: "审批通过",
  249. value: 30,
  250. },
  251. {
  252. label: "终止",
  253. value: 99,
  254. },
  255. ]);
  256. const sourceList = ref({
  257. data: [],
  258. pagination: {
  259. total: 0,
  260. pageNum: 1,
  261. pageSize: 10,
  262. keyword: "",
  263. status: "",
  264. sellCorporationId: "",
  265. },
  266. });
  267. const loading = ref(false);
  268. const selectConfig = computed(() => {
  269. return [
  270. {
  271. label: "审批状态",
  272. prop: "status",
  273. data: status.value,
  274. },
  275. {
  276. label: "归属公司",
  277. prop: "sellCorporationId",
  278. data: corporationList.value,
  279. },
  280. ];
  281. });
  282. const config = computed(() => {
  283. return [
  284. {
  285. attrs: {
  286. label: "报价单号",
  287. prop: "code",
  288. width: 200,
  289. },
  290. },
  291. {
  292. attrs: {
  293. label: "归属公司",
  294. prop: "sellCorporationId",
  295. "min-width": 220,
  296. },
  297. render(type) {
  298. return proxy.dictValueLabel(type, corporationList.value);
  299. },
  300. },
  301. {
  302. attrs: {
  303. label: "报价人",
  304. prop: "userName",
  305. width: 160,
  306. },
  307. },
  308. {
  309. attrs: {
  310. label: "报价时间",
  311. prop: "createTime",
  312. width: 160,
  313. },
  314. },
  315. {
  316. attrs: {
  317. label: "客户名称",
  318. prop: "buyCorporationId",
  319. "min-width": 220,
  320. },
  321. render(type) {
  322. return proxy.dictValueLabel(type, customerList.value);
  323. },
  324. },
  325. {
  326. attrs: {
  327. label: "报价金额",
  328. slot: "amount",
  329. width: 140,
  330. },
  331. },
  332. {
  333. attrs: {
  334. label: "预付比例",
  335. slot: "advanceRatio",
  336. width: 120,
  337. },
  338. },
  339. {
  340. attrs: {
  341. label: "审批状态",
  342. prop: "status",
  343. width: 140,
  344. },
  345. render(type) {
  346. return proxy.dictValueLabel(type, status.value);
  347. },
  348. },
  349. {
  350. attrs: {
  351. label: "操作",
  352. width: 120,
  353. align: "center",
  354. fixed: "right",
  355. },
  356. renderHTML(row) {
  357. return [
  358. {
  359. attrs: {
  360. label: "复制",
  361. type: "primary",
  362. text: true,
  363. },
  364. el: "button",
  365. click() {
  366. clickCopy(row);
  367. },
  368. },
  369. {
  370. attrs: {
  371. label: "打印",
  372. type: "primary",
  373. text: true,
  374. },
  375. el: "button",
  376. click() {
  377. clickPrint(row);
  378. },
  379. },
  380. ];
  381. },
  382. },
  383. ];
  384. });
  385. const getDict = () => {
  386. proxy.post("/saleQuotation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  387. accountList.value = res.rows.map((item) => {
  388. return {
  389. label: item.alias,
  390. value: item.id,
  391. };
  392. });
  393. });
  394. proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  395. corporationList.value = res.rows.map((item) => {
  396. return {
  397. ...item,
  398. label: item.name,
  399. value: item.id,
  400. };
  401. });
  402. });
  403. proxy.post("/customer/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  404. customerList.value = res.rows.map((item) => {
  405. return {
  406. ...item,
  407. label: item.name,
  408. value: item.id,
  409. };
  410. });
  411. });
  412. proxy.getDictOne(["trade_mode", "account_currency", "shipping_method"]).then((res) => {
  413. tradeMethods.value = res["trade_mode"].map((x) => ({
  414. label: x.dictValue,
  415. value: x.dictKey,
  416. }));
  417. accountCurrency.value = res["account_currency"].map((x) => ({
  418. label: x.dictValue,
  419. value: x.dictKey,
  420. }));
  421. shippingMethod.value = res["shipping_method"].map((x) => ({
  422. label: x.dictValue,
  423. value: x.dictKey,
  424. }));
  425. });
  426. };
  427. const getList = async (req) => {
  428. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  429. loading.value = true;
  430. proxy.post("/saleQuotation/page", sourceList.value.pagination).then((res) => {
  431. sourceList.value.data = res.rows;
  432. sourceList.value.pagination.total = res.total;
  433. setTimeout(() => {
  434. loading.value = false;
  435. }, 200);
  436. });
  437. };
  438. getDict();
  439. getList();
  440. const newPriceSheet = () => {
  441. proxy.$router.replace({
  442. path: "/platform_manage/process/processApproval",
  443. query: {
  444. flowKey: "sale_quotation_flow",
  445. flowName: "报价审批流程",
  446. random: proxy.random(),
  447. tenantType: "EHSD",
  448. },
  449. });
  450. };
  451. const clickCopy = (item) => {
  452. proxy.$router.replace({
  453. path: "/platform_manage/process/processApproval",
  454. query: {
  455. flowKey: "sale_quotation_flow",
  456. flowName: "报价审批流程",
  457. priceSheetId: item.id,
  458. random: proxy.random(),
  459. tenantType: "EHSD",
  460. },
  461. });
  462. };
  463. const openPrint = ref(false);
  464. const printDetails = ref({});
  465. const clickPrint = (row) => {
  466. printDetails.value = {};
  467. openPrint.value = true;
  468. proxy.post("/saleQuotation/detail", { id: row.id }).then((res) => {
  469. printDetails.value = res;
  470. });
  471. };
  472. const clickDownload = () => {
  473. proxy.getPdf("报价单PDF文件");
  474. };
  475. const statistics = (label, index) => {
  476. let num = 0;
  477. if (printDetails.value.quotationProductList && printDetails.value.quotationProductList.length > 0) {
  478. printDetails.value.quotationProductList.map((item) => {
  479. if (item[label]) {
  480. num = parseFloat(Number(num) + Number(item[label])).toFixed(index);
  481. }
  482. });
  483. }
  484. return num;
  485. };
  486. const getLabel = (key, list, label) => {
  487. let text = "";
  488. if (list && list.length > 0) {
  489. let data = list.filter((item) => item.id === key);
  490. if (data && data.length > 0) {
  491. text = data[0][label];
  492. }
  493. }
  494. return text;
  495. };
  496. const getAllMoney = (num) => {
  497. let money = num;
  498. if (printDetails.value.quotationPayList && printDetails.value.quotationPayList.length > 0) {
  499. printDetails.value.quotationPayList.map((item) => {
  500. if (item.amount) {
  501. money = parseFloat(Number(money) + Number(item.amount)).toFixed(2);
  502. }
  503. });
  504. }
  505. return money;
  506. };
  507. </script>
  508. <style lang="scss" scoped>
  509. .tenant {
  510. padding: 20px;
  511. }
  512. ::v-deep(.el-input-number .el-input__inner) {
  513. text-align: left;
  514. }
  515. .baseRow {
  516. min-height: 24px;
  517. border-top: 1px solid black;
  518. border-left: 1px solid black;
  519. }
  520. .contentRow {
  521. border-right: 1px solid black;
  522. line-height: 24px;
  523. padding-left: 4px;
  524. }
  525. </style>