contractPDF.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <template>
  2. <div>
  3. <div id="printMe">
  4. <div id="pdfDom" style="width: 800px; padding: 16px; font-size: 12px !important">
  5. <div style="font-size: 18px; text-align: center">
  6. {{ printDetails.sellCorporationNameEn }}
  7. </div>
  8. <div style="text-align: center">
  9. {{ printDetails.sellDetailedAddress }},{{ printDetails.sellCityName }},{{ printDetails.sellProvinceName }},{{ printDetails.sellCountryName }}
  10. </div>
  11. <div style="font-size: 14px; color: #409eff; text-align: center; padding-top: 16px">PROFORMA INVOICE</div>
  12. <div style="padding-top: 8px">
  13. <div>PI NO. : {{ printDetails.contractCode }}</div>
  14. <div>PI DATE: {{ printDetails.createTimeEn }}</div>
  15. </div>
  16. <div style="border: 1px solid black; display: flex">
  17. <div style="width: 50%; border-right: 1px solid black">
  18. <div style="color: #409eff">VENDOR:</div>
  19. <div>{{ printDetails.sellCorporationNameEn }}</div>
  20. <div style="padding: 16px 0">
  21. {{ printDetails.sellDetailedAddress }},{{ printDetails.sellCityName }},{{ printDetails.sellProvinceName }},{{ printDetails.sellCountryName }}
  22. </div>
  23. <div>CONTACT: {{ printDetails.sellContactName }}</div>
  24. <div>TEL.: {{ printDetails.sellContactNumber }}</div>
  25. </div>
  26. <div style="width: 50%">
  27. <div style="color: #409eff">BUYER:</div>
  28. <div>{{ printDetails.buyCorporationName }}</div>
  29. <div style="padding: 16px 0">
  30. {{ printDetails.buyDetailedAddress }},{{ printDetails.buyCityName }},{{ printDetails.buyProvinceName }},{{ printDetails.buyCountryName }}
  31. </div>
  32. <div>CONTACT: {{ printDetails.buyContactName }}</div>
  33. <div>TEL.: {{ printDetails.buyContactNumber }}</div>
  34. </div>
  35. </div>
  36. <div style="height: 16px"></div>
  37. <div style="border: 1px solid black">
  38. <div style="display: flex; width: 100%">
  39. <div style="width: 33%; border-bottom: 1px solid black; border-right: 1px solid black">
  40. <div style="color: #409eff">COUNTRY OF ORIGIN:</div>
  41. <div>{{ printDetails.sellCountryName }}</div>
  42. </div>
  43. <div style="width: 34%; border-bottom: 1px solid black; border-right: 1px solid black">
  44. <div style="color: #409eff">COUNTRY OF DESTINATION:</div>
  45. <div>{{ printDetails.buyCountryName }}</div>
  46. </div>
  47. <div style="width: 33%; border-bottom: 1px solid black">
  48. <div style="color: #409eff">PLACE OF DISCHARGE:</div>
  49. <div>{{ printDetails.transportRemark }}</div>
  50. </div>
  51. </div>
  52. <div style="display: flex; width: 100%">
  53. <div style="width: 33%; border-bottom: 1px solid black; border-right: 1px solid black">
  54. <div style="color: #409eff">TERMS OF DELIVERY:</div>
  55. <div>
  56. {{ dictValueLabel(printDetails.tradeMethods, tradeMethods) }}
  57. </div>
  58. </div>
  59. <div style="width: 34%; border-bottom: 1px solid black; border-right: 1px solid black">
  60. <div style="color: #409eff">CURRENCY:</div>
  61. <div>
  62. {{ printDetails.currency }}
  63. </div>
  64. </div>
  65. <div style="width: 33%; border-bottom: 1px solid black">
  66. <div style="color: #409eff">EXPORT BY/VIA:</div>
  67. <div>
  68. {{ dictValueLabel(printDetails.transportMethod, shippingMethod) }}
  69. </div>
  70. </div>
  71. </div>
  72. <div style="display: flex; width: 100%">
  73. <div style="width: 33%; border-right: 1px solid black">
  74. <div style="color: #409eff">DELIVERY TIME:</div>
  75. <div>{{ printDetails.deliveryTime }}</div>
  76. </div>
  77. <div style="width: 67%">
  78. <div style="color: #409eff">TERMS OF PAYMENT:</div>
  79. <div>{{ printDetails.remark }}</div>
  80. </div>
  81. </div>
  82. </div>
  83. <div style="height: 16px"></div>
  84. <div class="baseRow" style="display: flex; color: #409eff">
  85. <div class="contentRow" style="width: 50px; text-align: center">NO.</div>
  86. <div class="contentRow" style="width: calc(100% - 450px); text-align: center">COMMODITY, SPECIFICATION</div>
  87. <div class="contentRow" style="width: 100px; text-align: center">UNIT</div>
  88. <div class="contentRow" style="width: 100px; text-align: center">QUANTITY</div>
  89. <div class="contentRow" style="width: 100px; text-align: center">UNIT PRICE</div>
  90. <div class="contentRow" style="width: 100px; text-align: center">TOTAL PRICE</div>
  91. </div>
  92. <div v-if="printDetails.productInfoList && printDetails.productInfoList.length > 0">
  93. <div class="baseRow" style="display: flex" v-for="(item, index) in printDetails.productInfoList" :key="item.productId">
  94. <div class="contentRow" style="width: 50px; text-align: center">
  95. {{ index + 1 }}
  96. </div>
  97. <div class="contentRow" style="width: calc(100% - 450px); text-align: center">
  98. {{ item.productName }}
  99. </div>
  100. <div class="contentRow" style="width: 100px; text-align: center">
  101. {{ dictValueLabel(item.productUnit, productUnit) }}
  102. </div>
  103. <div class="contentRow" style="width: 100px; text-align: center">
  104. {{ item.productQuantity }}
  105. </div>
  106. <div class="contentRow" style="width: 100px; text-align: center">
  107. {{ item.productPrice }}
  108. </div>
  109. <div class="contentRow" style="width: 100px; text-align: center">
  110. {{ item.amount }}
  111. </div>
  112. </div>
  113. </div>
  114. <div class="baseRow" style="display: flex; color: #409eff">
  115. <div class="contentRow" style="width: calc(100% - 400px); text-align: center">SUBTOTAL:</div>
  116. <div class="contentRow" style="width: 100px; text-align: center"></div>
  117. <div class="contentRow" style="width: 100px; text-align: center">
  118. {{ statistics("productQuantity", 0) }}
  119. </div>
  120. <div class="contentRow" style="width: 100px; text-align: center"></div>
  121. <div class="contentRow" style="width: 100px; text-align: center">
  122. {{ statistics("amount", 2) }}
  123. </div>
  124. </div>
  125. <!-- <div v-if="printDetails.quotationPayList && printDetails.quotationPayList.length > 0">
  126. <div class="baseRow" style="display: flex" v-for="(item, index) in printDetails.quotationPayList" :key="index">
  127. <div class="contentRow" style="width: calc(100% - 100px); text-align: right; color: #409eff">{{ item.payName }}:</div>
  128. <div class="contentRow" style="width: 100px; text-align: center">{{ item.amount }}</div>
  129. </div>
  130. </div> -->
  131. <div class="baseRow" style="display: flex">
  132. <div class="contentRow" style="width: calc(100% - 100px); text-align: right; color: #409eff">FREIGHT COST:</div>
  133. <div class="contentRow" style="width: 100px; text-align: center">
  134. {{ statisticsTwo("amount", 2) }}
  135. </div>
  136. </div>
  137. <div class="baseRow" style="display: flex">
  138. <div class="contentRow" style="width: calc(100% - 100px); text-align: right; color: #409eff">TOTAL PRICE:</div>
  139. <div class="contentRow" style="width: 100px; text-align: center">
  140. {{ printDetails.totalAmount }}
  141. </div>
  142. </div>
  143. <div class="baseRow" style="display: flex; border-bottom: 1px solid black">
  144. <div class="contentRow" style="width: 100%">
  145. {{ translateIntoEnglish(printDetails.totalAmount, printDetails.currency) }}
  146. </div>
  147. </div>
  148. <div style="height: 16px"></div>
  149. <div class="baseRow" style="color: #409eff">
  150. <div class="contentRow" style="width: 100%">ACCOUNT INFORMATION:</div>
  151. </div>
  152. <div class="baseRow" style="border-bottom: 1px solid black">
  153. <div class="contentRow" style="width: 100%">
  154. <div style="line-height: 24px; padding-left: 4px; word-break: break-all; word-wrap: break-word">
  155. Beneficiary Name: {{ printDetails.beneficiaryName }}
  156. </div>
  157. <div style="line-height: 24px; padding-left: 4px; word-break: break-all; word-wrap: break-word">
  158. Beneficiary Bank: {{ printDetails.beneficiaryBank }}
  159. </div>
  160. <div style="line-height: 24px; padding-left: 4px; word-break: break-all; word-wrap: break-word">
  161. Beneficiary Bank Address:
  162. {{ printDetails.beneficiaryBankAddress }}
  163. </div>
  164. <div style="line-height: 24px; padding-left: 4px; word-break: break-all; word-wrap: break-word">
  165. Beneficiary Account Number:
  166. {{ printDetails.beneficiaryAccountNumber }}
  167. </div>
  168. <div style="line-height: 24px; padding-left: 4px; word-break: break-all; word-wrap: break-word">Swift Code: {{ printDetails.swiftCode }}</div>
  169. <div style="line-height: 24px; padding-left: 4px; word-break: break-all; word-wrap: break-word">
  170. Beneficiary Address: {{ printDetails.beneficiaryAddress }}
  171. </div>
  172. </div>
  173. </div>
  174. <div style="height: 32px"></div>
  175. <div style="display: flex">
  176. <div style="width: 50%">
  177. <div style="color: #409eff">CONFIRMED BY VENDOR:</div>
  178. <div>{{ printDetails.sellCorporationNameEn }}</div>
  179. </div>
  180. <div style="width: 50%">
  181. <div style="color: #409eff">CONFIRMED BY BUYER:</div>
  182. <div>{{ printDetails.buyCorporationName }}</div>
  183. </div>
  184. </div>
  185. </div>
  186. </div>
  187. </div>
  188. </template>
  189. <script setup>
  190. import { NumberToChinese } from "@/utils/util.js";
  191. import { watch } from "vue";
  192. const { proxy } = getCurrentInstance();
  193. const printDetails = ref({});
  194. const props = defineProps({
  195. rowData: Object,
  196. });
  197. const getPdfData = (query) => {
  198. proxy.post("/contract/getContractPdfInfo", query).then((res) => {
  199. printDetails.value = res;
  200. });
  201. };
  202. const statistics = (label, index) => {
  203. let num = 0;
  204. if (printDetails.value.productInfoList && printDetails.value.productInfoList.length > 0) {
  205. printDetails.value.productInfoList.map((item) => {
  206. if (item[label]) {
  207. num = parseFloat(Number(num) + Number(item[label])).toFixed(index);
  208. }
  209. });
  210. }
  211. return num;
  212. };
  213. const statisticsTwo = (label, index) => {
  214. let num = 0;
  215. if (printDetails.value.contractProjectList && printDetails.value.contractProjectList.length > 0) {
  216. printDetails.value.contractProjectList.map((item) => {
  217. if (item[label]) {
  218. num = parseFloat(Number(num) + Number(item[label])).toFixed(index);
  219. }
  220. });
  221. }
  222. return num;
  223. };
  224. const productUnit = ref([]);
  225. const tradeMethods = ref([]);
  226. const shippingMethod = ref([]);
  227. const getDict = () => {
  228. proxy.getDictOne(["trade_mode", "shipping_method", "unit"]).then((res) => {
  229. tradeMethods.value = res["trade_mode"].map((x) => ({
  230. label: x.dictValue,
  231. value: x.dictKey,
  232. }));
  233. shippingMethod.value = res["shipping_method"].map((x) => ({
  234. label: x.dictValue,
  235. value: x.dictKey,
  236. }));
  237. productUnit.value = res["unit"].map((x) => ({
  238. label: x.dictValue,
  239. value: x.dictKey,
  240. }));
  241. });
  242. };
  243. getDict();
  244. watch(
  245. props,
  246. () => {
  247. if (props.rowData) {
  248. if (props.rowData.id) {
  249. getPdfData({ id: props.rowData.id });
  250. } else if (props.rowData.code) {
  251. getPdfData({ code: props.rowData.code });
  252. }
  253. }
  254. },
  255. {
  256. immediate: true,
  257. deep: true,
  258. }
  259. );
  260. </script>
  261. <style lang="scss" scoped>
  262. .baseRow {
  263. min-height: 24px;
  264. border-top: 1px solid black;
  265. border-left: 1px solid black;
  266. }
  267. .contentRow {
  268. border-right: 1px solid black;
  269. line-height: 24px;
  270. padding-left: 4px;
  271. }
  272. </style>