print-template-jsyp.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <ele-modal
  3. title="出库单"
  4. :visible.sync="QRvisible"
  5. v-if="QRvisible"
  6. width="90%"
  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. >{{ this.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: 39%">制单日期:{{ formData.createTime }}</span>
  40. <span style="width: 39%">发货日期:{{ outBound.createTime }}</span>
  41. <span style="width: 22%"
  42. >出库单号:{{ formData.printNo || outBound.bizNo }}</span
  43. >
  44. </div>
  45. <div
  46. style="
  47. width: 100%;
  48. font-size: 12px;
  49. display: flex;
  50. justify-content: space-between;
  51. margin-bottom: 10px;
  52. "
  53. >
  54. <span style="width: 39%"
  55. >上市许可持有人:{{
  56. this.groupName || '嘉实(湖南)医院科技有限公司'
  57. }}</span
  58. >
  59. <span style="width: 39%"
  60. >地址:长沙高新开发区汇智中路179号金导园C区8栋</span
  61. >
  62. <span style="width: 22%">电话:0731-84221288</span>
  63. </div>
  64. <div
  65. style="
  66. width: 100%;
  67. font-size: 12px;
  68. display: flex;
  69. justify-content: space-between;
  70. margin-bottom: 10px;
  71. "
  72. >
  73. <span style="width: 39%">受托生产企业:</span>
  74. <span style="width: 39%">地址:</span>
  75. <span style="width: 22%"></span>
  76. </div>
  77. <div
  78. style="
  79. width: 100%;
  80. font-size: 12px;
  81. display: flex;
  82. justify-content: space-between;
  83. margin-bottom: 10px;
  84. "
  85. >
  86. <span style="width: 39%">购货单位:{{ formData.contactName }}</span>
  87. <span style="width: 39%">收货地址:{{ formData.receiveAddress }}</span>
  88. <span style="width: 22%"></span>
  89. </div>
  90. <table
  91. cellspacing="0"
  92. border
  93. style="
  94. width: 100%;
  95. table-layout: fixed;
  96. word-break: break-all;
  97. word-wrap: break-word;
  98. font-size: 12px;
  99. "
  100. >
  101. <tbody>
  102. <tr align="center">
  103. <td style="padding: 5px"> 产品名称 </td>
  104. <td style="padding: 5px"> 规格 </td>
  105. <td style="padding: 5px"> 包装规格 </td>
  106. <td style="padding: 5px"> 剂型</td>
  107. <td style="padding: 5px"> 批准文号</td>
  108. <td style="padding: 5px"> 批号</td>
  109. <td style="padding: 5px"> 单位</td>
  110. <td style="padding: 5px"> 数量</td>
  111. <td style="padding: 5px"> 单价(元)</td>
  112. <td style="padding: 5px"> 金额(元)</td>
  113. <td style="padding: 5px"> 有效期</td>
  114. <td style="padding: 5px"> 备注</td>
  115. </tr>
  116. <tr
  117. align="center"
  118. v-for="(item, index) in outBound.outInDetailRecordRequestList"
  119. >
  120. <td style="padding: 5px"> {{ item.categoryName }} </td>
  121. <td style="padding: 5px">
  122. {{ item.specification }}
  123. </td>
  124. <td style="padding: 5px"> {{ item.packingSpecification }}</td>
  125. <td style="padding: 5px"> {{ item.categoryModel }}</td>
  126. <td style="padding: 5px"> {{ item.approvalNumber }}</td>
  127. <td style="padding: 5px"> {{ item.batchNo }}</td>
  128. <td style="padding: 5px"> {{ item.measureUnit }}</td>
  129. <td style="padding: 5px"> {{ item.measureQuantity }}</td>
  130. <td style="padding: 5px"> {{ item.singlePrice }}</td>
  131. <td style="padding: 5px">{{ item.totalPrice }} </td>
  132. <td style="padding: 5px"> {{ item.guaranteePeriodText }}</td>
  133. <td style="padding: 5px">{{ item.remark }} </td>
  134. </tr>
  135. <tr align="center">
  136. <td style="padding: 5px" colspan="7"> 合计 </td>
  137. <td style="padding: 5px"> {{ getTotal('measureQuantity') }}</td>
  138. <td style="padding: 5px"> {{ getTotal('singlePrice') }}</td>
  139. <td style="padding: 5px"> {{ getTotal('totalPrice') }} </td>
  140. <td style="padding: 5px"></td>
  141. <td style="padding: 5px"> </td>
  142. </tr>
  143. </tbody>
  144. </table>
  145. <div
  146. style="
  147. width: 100%;
  148. font-size: 12px;
  149. display: flex;
  150. justify-content: space-between;
  151. margin-top: 10px;
  152. "
  153. >
  154. <div style="flex: 1"> 开票员: </div>
  155. <div style="flex: 1"> 保管员: </div>
  156. <div style="flex: 1"> 复核: </div>
  157. <div style="flex: 1"> 发货员: </div>
  158. </div>
  159. <div
  160. style="
  161. width: 100%;
  162. font-size: 12px;
  163. display: flex;
  164. justify-content: space-between;
  165. margin-top: 10px;
  166. "
  167. >
  168. <div style="flex: 1"> </div>
  169. <div style="flex: 1"> 白联:开票留存 </div>
  170. <div style="flex: 1"> 红联:仓库留存 </div>
  171. <div style="flex: 1"> 蓝联:财务留存 </div>
  172. <div style="flex: 1"> 绿联/黄联:随货同行 </div>
  173. </div>
  174. </div>
  175. <div slot="footer">
  176. <el-button @click="print">打印预览</el-button>
  177. <el-button @click="close">关闭</el-button>
  178. </div>
  179. </ele-modal>
  180. </template>
  181. <script>
  182. import { getSendSaleOrderrecordDetailSplit } from '@/api/saleManage/saleordersendrecord';
  183. import { getInfoBySourceBizNoAll } from '@/api/wms';
  184. import { mapGetters } from 'vuex';
  185. export default {
  186. name: 'print',
  187. computed: {
  188. ...mapGetters(['user'])
  189. },
  190. props: {
  191. groupName: ''
  192. },
  193. data() {
  194. return {
  195. checked: '',
  196. QRvisible: false,
  197. isPrintPrice: false,
  198. formData: {},
  199. outBound: {}
  200. };
  201. },
  202. methods: {
  203. async open(id) {
  204. this.formData = await getSendSaleOrderrecordDetailSplit(id);
  205. this.QRvisible = true;
  206. let dataArray = await getInfoBySourceBizNoAll(this.formData.docNo);
  207. this.outBound = JSON.parse(JSON.stringify(dataArray[0]));
  208. this.outBound['outInDetailRecordRequestList'] = [];
  209. dataArray.forEach((item) => {
  210. item.outInDetailList.forEach((val) => {
  211. if (val.outInDetailRecordRequestList.length) {
  212. val.outInDetailRecordRequestList.forEach((j) => {
  213. let data = this.formData.productList.find(
  214. (product) => product.productCode == val.categoryCode
  215. );
  216. j['categoryName'] = val.categoryName;
  217. j['categoryModel'] = val.categoryModel;
  218. j['specification'] = val.specification;
  219. j['categoryCode'] = val.categoryCode;
  220. j['packingSpecification'] = val.extField?.packingSpecification;
  221. j['approvalNumber'] = val.extField?.approvalNumber;
  222. if (data) {
  223. j['singlePrice'] = data.singlePrice;
  224. j['totalPrice'] = j.measureQuantity * data.singlePrice;
  225. j['remark'] = data.remark;
  226. j['guaranteePeriodText'] = data.guaranteePeriod
  227. ? data.guaranteePeriod +
  228. (data.guaranteePeriodUnitName || '')
  229. : '';
  230. }
  231. });
  232. this.outBound['outInDetailRecordRequestList'].push(
  233. ...val.outInDetailRecordRequestList
  234. );
  235. } else {
  236. this.outBound['outInDetailRecordRequestList'].push(val);
  237. }
  238. });
  239. });
  240. },
  241. getTotal(key) {
  242. let val = 0;
  243. this.outBound?.outInDetailRecordRequestList?.forEach((item) => {
  244. if (Number(item[key])) {
  245. val += Number(item[key]);
  246. }
  247. });
  248. return val;
  249. },
  250. close() {
  251. this.QRvisible = false;
  252. },
  253. print() {
  254. const printSection = document.getElementById('printSection');
  255. // 创建打印任务
  256. const printWindow = window.open('', '_blank');
  257. printWindow.document.open();
  258. printWindow.document.write('<html><head><title>打印预览</title>');
  259. printWindow.document.write(
  260. '<link rel="stylesheet" href="your-stylesheet-url.css" type="text/css" />'
  261. );
  262. printWindow.document.write('</head><body>');
  263. printWindow.document.write(printSection.innerHTML);
  264. printWindow.document.write('</body></html>');
  265. printWindow.document.close();
  266. printWindow.onload = function () {
  267. printWindow.print();
  268. };
  269. }
  270. }
  271. };
  272. </script>
  273. <style lang="scss"></style>