print-template-jsyp.vue 8.7 KB

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