print-template-ht-1.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <ele-modal
  3. title="出库单"
  4. :visible.sync="QRvisible"
  5. v-if="QRvisible"
  6. width="80%"
  7. >
  8. <div
  9. id="printSection"
  10. style="
  11. display: flex;
  12. align-items: center;
  13. justify-content: center;
  14. flex-direction: column;
  15. "
  16. >
  17. <div>
  18. <div
  19. style="
  20. font-size: 20px;
  21. font-weight: 800;
  22. padding-right: 20px;
  23. width: 400px;
  24. margin: 0 auto;
  25. "
  26. >{{ groupName }}出库单</div
  27. >
  28. </div>
  29. <div
  30. style="
  31. width: 100%;
  32. font-size: 12px;
  33. display: flex;
  34. justify-content: space-between;
  35. margin-bottom: 10px;
  36. margin-top: 10px;
  37. "
  38. >
  39. <span style="width: 30%">客户:{{ formData.contactName }}</span>
  40. <span style="width: 30%">单据编码:{{ formData.docNo }}</span>
  41. <span style="width: 30%">单据日期:{{ formData.createTime }}</span>
  42. </div>
  43. <div
  44. style="
  45. width: 100%;
  46. font-size: 12px;
  47. display: flex;
  48. justify-content: space-between;
  49. margin-bottom: 10px;
  50. "
  51. >
  52. <span style="width: 80%">送货地址:{{ formData.receiveAddress }}</span>
  53. </div>
  54. <table
  55. cellspacing="0"
  56. border
  57. style="
  58. width: 100%;
  59. table-layout: fixed;
  60. word-break: break-all;
  61. word-wrap: break-word;
  62. font-size: 12px;
  63. "
  64. >
  65. <tbody>
  66. <tr align="center">
  67. <td style="padding: 5px"> 序号 </td>
  68. <td style="padding: 5px"> 名称 </td>
  69. <td style="padding: 5px"> 规格型号 </td>
  70. <td style="padding: 5px; width: 60px"> 单位 </td>
  71. <td style="padding: 5px; width: 110px"> 数量 </td>
  72. <td style="padding: 5px"> 颜色 </td>
  73. <td style="padding: 5px"> 生产批号 </td>
  74. <td style="padding: 5px"> 裁线米段 </td>
  75. <td style="padding: 5px"> 仓库 </td>
  76. </tr>
  77. <tr align="center" v-for="(item, index) in formData.productList">
  78. <td style="padding: 5px"> {{ index + 1 }} </td>
  79. <td style="padding: 5px"> {{ item.productName }} </td>
  80. <td style="padding: 5px">
  81. {{ item.specification }}/{{ item.modelType }}
  82. </td>
  83. <td style="padding: 5px"> {{ item.measuringUnit }}</td>
  84. <td style="padding: 5px"> {{ item.totalCount }}</td>
  85. <td style="padding: 5px"> {{ item.colorKey }}</td>
  86. <td style="padding: 5px"> {{ item.batchNo }}</td>
  87. <td style="padding: 5px"> {{ item.remark }}</td>
  88. <td style="padding: 5px"> {{ item.warehouseName }}</td>
  89. </tr>
  90. <tr align="center">
  91. <td style="padding: 5px"> </td>
  92. <td style="padding: 5px"> 合计 </td>
  93. <td style="padding: 5px" colspan="2"> </td>
  94. <td style="padding: 5px">{{ getTotalValue('totalCount', 2) }} </td>
  95. <td style="padding: 5px"> </td>
  96. <td style="padding: 5px"> </td>
  97. <td style="padding: 5px"> </td>
  98. <td style="padding: 5px"> </td>
  99. </tr>
  100. </tbody>
  101. </table>
  102. <div
  103. style="
  104. width: 100%;
  105. font-size: 12px;
  106. display: flex;
  107. justify-content: space-between;
  108. margin-top: 10px;
  109. "
  110. >
  111. <div style="flex: 1">
  112. <div>制单人:{{ formData.makerName }}</div>
  113. </div>
  114. <div style="flex: 1"> 核对人: </div>
  115. <div style="flex: 1">
  116. <div>仓库:</div>
  117. </div>
  118. <div style="flex: 1"> 审核: {{ formData.reviewerName || '' }}</div>
  119. </div>
  120. <div
  121. style="
  122. width: 100%;
  123. font-size: 12px;
  124. display: flex;
  125. justify-content: space-between;
  126. margin-top: 10px;
  127. "
  128. >
  129. <div style="flex: 1">
  130. <div>司机:</div>
  131. </div>
  132. <div style="flex: 1"> 是否回单: {{ receiptRequirementTypeOption.find(item => item.value === formData.receiptRequirementTypeId)?.label || '' }}</div>
  133. <div style="flex: 1">
  134. <div>运费:{{ formData.deliveryTypeName || '' }}</div>
  135. </div>
  136. <div style="flex: 1"> </div>
  137. </div>
  138. <div
  139. style="
  140. width: 100%;
  141. font-size: 12px;
  142. display: flex;
  143. justify-content: space-between;
  144. margin-top: 10px;
  145. "
  146. >
  147. <div style="flex: 1">
  148. <div>备注:</div>
  149. </div>
  150. </div>
  151. </div>
  152. <div slot="footer">
  153. <el-button @click="print">打印预览</el-button>
  154. <el-button @click="close">关闭</el-button>
  155. </div>
  156. </ele-modal>
  157. </template>
  158. <script>
  159. import { getSendSaleOrderrecordDetailSplit } from '@/api/saleManage/saleordersendrecord';
  160. import { mapGetters } from 'vuex';
  161. import dictMixins from '@/mixins/dictMixins';
  162. export default {
  163. mixins: [dictMixins],
  164. name: 'print',
  165. computed: {
  166. ...mapGetters(['user'])
  167. },
  168. props: {
  169. groupName: ''
  170. },
  171. data() {
  172. return {
  173. checked: '',
  174. QRvisible: false,
  175. isPrintPrice: false,
  176. formData: {},
  177. receiptRequirementTypeOption: [
  178. {
  179. label: '签回单',
  180. value: 1
  181. },
  182. {
  183. label: '不签回单',
  184. value: 2
  185. },
  186. {
  187. label: '带签收单',
  188. value: 3
  189. }
  190. ]
  191. };
  192. },
  193. created() {
  194. this.requestDict('送货方式');
  195. },
  196. methods: {
  197. async open(id, isPrintPrice) {
  198. this.formData = await getSendSaleOrderrecordDetailSplit(id);
  199. this.formData.deliveryTypeName = this.getDictValue(
  200. '送货方式',
  201. this.formData.deliveryTypeId
  202. );
  203. this.QRvisible = true;
  204. this.isPrintPrice = isPrintPrice;
  205. //包装维度
  206. },
  207. close() {
  208. this.QRvisible = false;
  209. },
  210. getTotalValue(key, num) {
  211. let val = this.formData?.productList?.reduce((total, item) => {
  212. return (total += Number(item[key]));
  213. }, 0);
  214. return (
  215. (val &&
  216. parseFloat(val)
  217. .toFixed(num)
  218. .replace(/\.?0+$/, '')) ||
  219. 0
  220. );
  221. },
  222. print() {
  223. const printSection = document.getElementById('printSection');
  224. // 创建打印任务
  225. const printWindow = window.open('', '_blank');
  226. printWindow.document.open();
  227. printWindow.document.write('<html><head><title>打印预览</title>');
  228. printWindow.document.write(
  229. '<link rel="stylesheet" href="your-stylesheet-url.css" type="text/css" />'
  230. );
  231. printWindow.document.write('</head><body>');
  232. printWindow.document.write(printSection.innerHTML);
  233. printWindow.document.write('</body></html>');
  234. printWindow.document.close();
  235. printWindow.onload = function () {
  236. printWindow.print();
  237. };
  238. }
  239. }
  240. };
  241. </script>
  242. <style lang="scss"></style>