samplePDF.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <template>
  2. <div>
  3. <div
  4. id="pdfDom"
  5. ref="pdfDom"
  6. style="padding: 30px 60px"
  7. v-loading="loading"
  8. >
  9. <table border="1" style="width: 100%" class="table">
  10. <tr>
  11. <td style="width: 120px">
  12. <img
  13. :src="pdfData.companyPic"
  14. alt=""
  15. fit="scale-down"
  16. style="height: 60px; width: 60px"
  17. />
  18. </td>
  19. <td style="padding: 10px">
  20. <div style="font-size: 18px" class="color-class">
  21. {{ pdfData.sellCorporationNameEn }}
  22. </div>
  23. <div style="font-size: 18px" class="color-class">
  24. {{ pdfData.sellCorporationName }}
  25. </div>
  26. <div style="font-size: 14px; color: #000">
  27. Address: {{ pdfData.sellDetailedAddressEn }}
  28. </div>
  29. <div style="font-size: 14px; color: #000; margin-top: 5px">
  30. {{ pdfData.sellCityNameEn }} , {{ pdfData.sellProvinceNameEn }} ,
  31. {{ pdfData.sellCountryNameEn }}
  32. </div>
  33. <div style="font-size: 14px; color: #000; margin-top: 10px">
  34. 地址: {{ pdfData.sellCountryName }} ,
  35. {{ pdfData.sellProvinceName }} , {{ pdfData.sellCityName }}
  36. </div>
  37. <div style="font-size: 14px; color: #000; margin-top: 5px">
  38. {{ pdfData.sellDetailedAddress }}
  39. </div>
  40. <div style="margin: 8px 0; color: black">
  41. Tel: <span>{{ pdfData.sellContactNumber }}</span>
  42. <!-- Fax:
  43. <span>{{ pdfData.fax }}</span>
  44. Website:
  45. <span>{{ pdfData.Website }}</span> -->
  46. </div>
  47. </td>
  48. </tr>
  49. <tr>
  50. <td colspan="2">
  51. <div
  52. class="color-class"
  53. style="text-align: center; font-size: 18px"
  54. >
  55. Sample Proforma Invoice
  56. </div>
  57. </td>
  58. </tr>
  59. </table>
  60. <div style="height: 15px; background: #7f197f"></div>
  61. <table border="1" style="width: 100%" class="table">
  62. <tr>
  63. <td style="width: 50%; text-align: left">
  64. Buyer: {{ pdfData.buyCorporationName }}
  65. </td>
  66. <td style="width: 50%; text-align: left">
  67. Seller: {{ pdfData.sellCorporationNameEn }}
  68. </td>
  69. </tr>
  70. </table>
  71. <table border="1" style="width: 100%; border-top: none" class="table">
  72. <tr>
  73. <td style="width: 15%">Sample PI No</td>
  74. <td style="width: 35%">{{ pdfData.contractCode }}</td>
  75. <td style="width: 15%">Date:</td>
  76. <td style="width: 35%">{{ pdfData.createTimeEn }}</td>
  77. </tr>
  78. <tr>
  79. <td style="width: 15%">Contact Person:</td>
  80. <td style="width: 35%">{{ pdfData.createUserNameEn }}</td>
  81. <td style="width: 15%">Email:</td>
  82. <td style="width: 35%">
  83. {{ pdfData.createUserEmail }}
  84. </td>
  85. </tr>
  86. <tr>
  87. <td style="width: 15%">Payment Teams:</td>
  88. <td style="width: 35%">{{ pdfData.remark }}</td>
  89. <td style="width: 15%">Lead Time:</td>
  90. <td style="width: 35%">{{ pdfData.deliveryTime }}</td>
  91. </tr>
  92. </table>
  93. <div style="height: 15px; background: #7f197f"></div>
  94. <table border="1" style="width: 100%" class="table">
  95. <tr>
  96. <td style="width: 15%">Image</td>
  97. <td style="width: 20%">Description</td>
  98. <td style="width: 15%">Size</td>
  99. <td style="width: 15%">Quantity</td>
  100. <td style="width: 17%">Sample <br />Fee</td>
  101. <td style="width: 18%">Total <br />Amount</td>
  102. </tr>
  103. <tr
  104. v-if="pdfData.productInfoList && pdfData.productInfoList.length > 0"
  105. v-for="(item, index) in pdfData.productInfoList"
  106. :key="item.productId"
  107. >
  108. <td style="width: 15%">
  109. <img
  110. :src="item.fileList[0].fileUrl"
  111. alt=""
  112. fit="scale-down"
  113. style="height: 60px; width: 60px"
  114. v-if="item.fileList && item.fileList.length > 0"
  115. />
  116. </td>
  117. <td style="width: 20%">{{ item.productName }}</td>
  118. <td style="width: 15%">
  119. <span v-if="item.productModel">{{ item.productModel }} cm</span>
  120. </td>
  121. <td style="width: 15%">
  122. {{ item.productQuantity }}
  123. </td>
  124. <td style="width: 17%">
  125. {{ pdfData.currency }} {{ moneyFormat(item.productPrice, 2) }}
  126. </td>
  127. <td style="width: 18%">
  128. {{ pdfData.currency }} {{ moneyFormat(item.amount, 2) }}
  129. </td>
  130. </tr>
  131. <template
  132. v-if="
  133. pdfData.sampleProjectList && pdfData.sampleProjectList.length > 0
  134. "
  135. >
  136. <tr>
  137. <td colspan="5" style="text-align: right">
  138. <div
  139. v-for="(item, index) in pdfData.sampleProjectList"
  140. :key="item.id"
  141. >
  142. {{ item.payName }}:
  143. </div>
  144. </td>
  145. <td class="center-class">
  146. <div
  147. v-for="(item, index) in pdfData.sampleProjectList"
  148. :key="item.id"
  149. >
  150. {{ pdfData.currency }}
  151. {{ moneyFormat(item.amount, 2) }}
  152. </div>
  153. </td>
  154. </tr>
  155. </template>
  156. <tr>
  157. <td colspan="5" style="text-align: right">Total Amount:</td>
  158. <td style="width: 10%">
  159. {{ pdfData.currency }}
  160. {{ moneyFormat(pdfData.totalAmount, 2) }}
  161. </td>
  162. </tr>
  163. </table>
  164. <div style="height: 15px; background: #7f197f"></div>
  165. <table border="1" style="width: 100%" class="table">
  166. <tr>
  167. <td class="width-one" style="text-align: left">5.Banking Info</td>
  168. <td style="text-align: left">
  169. <div>Beneficiary Name: {{ pdfData.beneficiaryName }}</div>
  170. <div>Beneficiary Bank: {{ pdfData.beneficiaryBank }}</div>
  171. <div>
  172. Beneficiary Bank Address:
  173. {{ pdfData.beneficiaryBankAddress }}
  174. </div>
  175. <div>
  176. Beneficiary Account Number:
  177. {{ pdfData.beneficiaryAccountNumber }}
  178. </div>
  179. <div>Swift Code: {{ pdfData.swiftCode }}</div>
  180. <div>Beneficiary Address: {{ pdfData.beneficiaryAddress }}</div>
  181. </td>
  182. </tr>
  183. </table>
  184. </div>
  185. </div>
  186. </template>
  187. <script setup>
  188. import { NumberToChinese } from "@/utils/util.js";
  189. import { watch } from "vue";
  190. const { proxy } = getCurrentInstance();
  191. const pdfData = ref({});
  192. const props = defineProps({
  193. rowData: Object,
  194. });
  195. const loading = ref(false);
  196. const getPdfData = (query) => {
  197. loading.value = true;
  198. proxy.post("/sample/getSamplePdfInfo", query).then((res) => {
  199. pdfData.value = res;
  200. if (pdfData.value.sellCorporationId) {
  201. proxy
  202. .post("/fileInfo/getList", {
  203. businessIdList: [pdfData.value.sellCorporationId],
  204. fileType: 1,
  205. })
  206. .then((fileObj) => {
  207. proxy
  208. .getImgBase64(fileObj[pdfData.value.sellCorporationId][0].fileUrl)
  209. .then((res) => {
  210. pdfData.value.companyPic = res;
  211. });
  212. });
  213. }
  214. loading.value = false;
  215. // 拿取产品图
  216. if (
  217. pdfData.value.productInfoList &&
  218. pdfData.value.productInfoList.length > 0
  219. ) {
  220. let arr = pdfData.value.productInfoList.map((x) => x.productId);
  221. proxy
  222. .post("/fileInfo/getList", {
  223. businessIdList: arr,
  224. })
  225. .then(async (fileObj) => {
  226. for (let i = 0; i < pdfData.value.productInfoList.length; i++) {
  227. const e = pdfData.value.productInfoList[i];
  228. for (const key in fileObj) {
  229. if (e.productId === key) {
  230. if (fileObj[key] && fileObj[key].length > 0) {
  231. const res = await proxy.getImgBase64(fileObj[key][0].fileUrl);
  232. fileObj[key][0].fileUrl = res;
  233. e.fileList = fileObj[key];
  234. }
  235. }
  236. }
  237. }
  238. });
  239. }
  240. });
  241. };
  242. watch(
  243. () => props.rowData,
  244. () => {
  245. if (props.rowData.id) {
  246. getPdfData({ id: props.rowData.id });
  247. }
  248. },
  249. {
  250. immediate: true,
  251. deep: true,
  252. }
  253. );
  254. </script>
  255. <style lang="scss" scoped>
  256. .color-class {
  257. color: #7f197f;
  258. }
  259. .bck {
  260. background: #7f197f;
  261. }
  262. .width-one {
  263. width: 140px;
  264. }
  265. .table {
  266. border-collapse: collapse;
  267. border-spacing: 0;
  268. td {
  269. text-align: center;
  270. padding: 2px 4px;
  271. // padding: 5px 10px;
  272. }
  273. }
  274. </style>