juRenPack.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <div class="label-container">
  3. <!-- 第一行信息 -->
  4. <div class="label-title">
  5. <div class="label-info-left">
  6. <div>{{ productName ? productName : ' ' }}</div>
  7. <div>{{ purchaseOrigins ? purchaseOrigins : ' ' }}</div>
  8. <div>{{ batchNo ? batchNo : ' ' }}</div>
  9. <div>{{ specification ? specification : ' ' }}</div>
  10. <div>{{ createDate ? createDate : ' ' }}</div>
  11. <div>{{ layBy ? layBy : ' ' }}</div>
  12. <div>{{ notice ? notice : ' ' }}</div>
  13. <div>{{ enforceStandards ? enforceStandards : ' ' }}</div>
  14. </div>
  15. <div class="label-info-right">
  16. <div class="right-div">{{ level ? level : ' ' }}</div>
  17. <div class="right-div"
  18. >{{ netWeight ? netWeight : ' '
  19. }}{{ weightUnit ? weightUnit : ' ' }}</div
  20. >
  21. <div class="right-div"
  22. >{{ warrantyPeriod ? warrantyPeriod : ' '
  23. }}{{ warrantyPeriodUnit ? warrantyPeriodUnit : ' ' }}</div
  24. >
  25. </div>
  26. </div>
  27. </div>
  28. </template>
  29. <script>
  30. // import JsBarcode from 'jsbarcode';
  31. export default {
  32. data() {
  33. return {
  34. batchNo: '',
  35. createDate: '',
  36. enforceStandards: '',
  37. layBy: '',
  38. level: '',
  39. netWeight: '',
  40. notice: '',
  41. productName: '',
  42. purchaseOrigins: '',
  43. specification: '',
  44. warrantyPeriod: '',
  45. warrantyPeriodUnit: '',
  46. weightUnit: ''
  47. };
  48. },
  49. mounted() {
  50. const {
  51. batchNo,
  52. createDate,
  53. enforceStandards,
  54. layBy,
  55. level,
  56. netWeight,
  57. notice,
  58. productName,
  59. purchaseOrigins,
  60. specification,
  61. warrantyPeriod,
  62. warrantyPeriodUnit,
  63. weightUnit
  64. } = this.$route.query;
  65. this.productName = productName ? productName : '';
  66. this.batchNo = batchNo ? batchNo : '';
  67. this.createDate = createDate ? createDate : '';
  68. this.enforceStandards = enforceStandards ? enforceStandards : '';
  69. this.layBy = layBy ? layBy : '';
  70. this.level = level ? level : '';
  71. this.netWeight = netWeight ? netWeight : '';
  72. this.notice = notice ? notice : '';
  73. this.purchaseOrigins = purchaseOrigins ? purchaseOrigins : '';
  74. this.specification = specification ? specification : '';
  75. this.warrantyPeriod =
  76. warrantyPeriod && !warrantyPeriod ? warrantyPeriod : '';
  77. this.warrantyPeriodUnit = warrantyPeriodUnit ? warrantyPeriodUnit : '';
  78. this.weightUnit = weightUnit ? weightUnit : '';
  79. if (this.warrantyPeriodUnit === '1') {
  80. this.warrantyPeriodUnit = '分钟';
  81. } else if (this.warrantyPeriodUnit === '2') {
  82. this.warrantyPeriodUnit = '小时';
  83. } else if (this.warrantyPeriodUnit === '3') {
  84. this.warrantyPeriodUnit = '日';
  85. } else if (this.warrantyPeriodUnit === '4') {
  86. this.warrantyPeriodUnit = '月';
  87. } else if (this.warrantyPeriodUnit === '5') {
  88. this.warrantyPeriodUnit = '年';
  89. } else {
  90. this.warrantyPeriodUnit = '';
  91. }
  92. this.$nextTick(() => {
  93. window.print();
  94. });
  95. // const { id, name, price } = this.$route.query;
  96. // this.order = { id, name, price };
  97. // console.log('打印参数', this.$route.query);
  98. // console.log('打印参数', this.$route.query);
  99. // this.orderId = this.$route.query.orderId;
  100. // this.type = this.$route.query.type;
  101. // window.addEventListener('message', (event) => {
  102. // console.log('接收到的参数', event.data);
  103. // });
  104. // JsBarcode('#barCode', '123456789012', {
  105. // format: 'CODE128',
  106. // width: 4,
  107. // height: 40,
  108. // displayValue: true
  109. // });
  110. }
  111. };
  112. </script>
  113. <style scoped lang="scss">
  114. .label-container {
  115. // font-family: "Arial", "Helvetica", sans-serif;
  116. width: 90mm;
  117. height: 60mm;
  118. box-sizing: border-box;
  119. font-size: 10px;
  120. color: green;
  121. margin: 0 auto;
  122. }
  123. .label-title {
  124. display: flex;
  125. flex-direction: row;
  126. padding: 0 45px;
  127. box-sizing: border-box;
  128. }
  129. .label-info-left {
  130. display: flex;
  131. // flex: 1;
  132. flex-direction: column;
  133. flex-wrap: wrap;
  134. margin: 54px 0 0 62px;
  135. div {
  136. height: 17px;
  137. }
  138. }
  139. .label-info-right {
  140. display: flex;
  141. // flex: 1;
  142. flex-direction: column;
  143. justify-content: center;
  144. margin: 37px 0 1px 30px;
  145. // .right-box {
  146. // // margin: 34px 0 1px 18px
  147. // }
  148. .right-div {
  149. // margin: 0 0 1px 18px;
  150. height: 17px;
  151. }
  152. }
  153. .row {
  154. display: flex;
  155. justify-content: space-between;
  156. margin-bottom: 4px;
  157. }
  158. .knife-table {
  159. border-collapse: collapse;
  160. width: 100%;
  161. margin: 8px 0;
  162. text-align: center;
  163. }
  164. .knife-table th,
  165. .knife-table td {
  166. border: 1px solid #000;
  167. padding: 4px;
  168. }
  169. .knife-table tbody {
  170. height: 30px;
  171. .knife-title {
  172. width: 60px;
  173. }
  174. }
  175. .knife-table img {
  176. height: 80px;
  177. }
  178. .info {
  179. display: flex;
  180. flex-direction: column;
  181. padding: 0 62px 0 45px;
  182. box-sizing: border-box;
  183. p {
  184. padding: 0;
  185. margin: 0;
  186. }
  187. }
  188. .phone-box {
  189. display: flex;
  190. flex-direction: row;
  191. padding: 0 62px 0 45px;
  192. align-items: center;
  193. justify-content: center;
  194. box-sizing: border-box;
  195. .phone-canvas-left-box {
  196. width: 220px;
  197. display: flex;
  198. flex-direction: column;
  199. align-items: center;
  200. canvas {
  201. width: 100px;
  202. height: 55px;
  203. }
  204. p {
  205. margin: 0;
  206. padding: 0;
  207. font-size: 9px;
  208. font-weight: normal;
  209. }
  210. }
  211. .phone-canvas-right-box {
  212. display: flex;
  213. width: 100%;
  214. justify-content: flex-end;
  215. flex-direction: column;
  216. align-items: center;
  217. canvas {
  218. width: 150px;
  219. height: 55px;
  220. }
  221. p {
  222. margin: 0;
  223. padding: 0;
  224. font-size: 10px;
  225. font-weight: normal;
  226. }
  227. }
  228. }
  229. .icons {
  230. display: flex;
  231. gap: 3px;
  232. padding: 0 62px 0 45px;
  233. margin-top: 10px;
  234. box-sizing: border-box;
  235. font-size: 8px;
  236. }
  237. .barcode {
  238. text-align: center;
  239. }
  240. .size {
  241. text-align: center;
  242. font-size: 8px;
  243. font-weight: normal;
  244. margin-top: 8px;
  245. }
  246. .expiry {
  247. display: flex;
  248. text-align: left;
  249. font-size: 14px;
  250. font-weight: normal;
  251. align-items: center;
  252. }
  253. </style>