samplePDF.vue 7.5 KB

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