juRenPack.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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. font-weight: 700;
  123. }
  124. .label-title {
  125. display: flex;
  126. flex-direction: row;
  127. padding: 0 45px;
  128. box-sizing: border-box;
  129. }
  130. .label-info-left {
  131. display: flex;
  132. // flex: 1;
  133. flex-direction: column;
  134. flex-wrap: wrap;
  135. margin: 54px 0 0 62px;
  136. div {
  137. height: 17px;
  138. }
  139. }
  140. .label-info-right {
  141. display: flex;
  142. // flex: 1;
  143. flex-direction: column;
  144. justify-content: center;
  145. margin: 37px 0 1px 30px;
  146. // .right-box {
  147. // // margin: 34px 0 1px 18px
  148. // }
  149. .right-div {
  150. // margin: 0 0 1px 18px;
  151. height: 17px;
  152. }
  153. }
  154. .row {
  155. display: flex;
  156. justify-content: space-between;
  157. margin-bottom: 4px;
  158. }
  159. .knife-table {
  160. border-collapse: collapse;
  161. width: 100%;
  162. margin: 8px 0;
  163. text-align: center;
  164. }
  165. .knife-table th,
  166. .knife-table td {
  167. border: 1px solid #000;
  168. padding: 4px;
  169. }
  170. .knife-table tbody {
  171. height: 30px;
  172. .knife-title {
  173. width: 60px;
  174. }
  175. }
  176. .knife-table img {
  177. height: 80px;
  178. }
  179. .info {
  180. display: flex;
  181. flex-direction: column;
  182. padding: 0 62px 0 45px;
  183. box-sizing: border-box;
  184. p {
  185. padding: 0;
  186. margin: 0;
  187. }
  188. }
  189. .phone-box {
  190. display: flex;
  191. flex-direction: row;
  192. padding: 0 62px 0 45px;
  193. align-items: center;
  194. justify-content: center;
  195. box-sizing: border-box;
  196. .phone-canvas-left-box {
  197. width: 220px;
  198. display: flex;
  199. flex-direction: column;
  200. align-items: center;
  201. canvas {
  202. width: 100px;
  203. height: 55px;
  204. }
  205. p {
  206. margin: 0;
  207. padding: 0;
  208. font-size: 9px;
  209. font-weight: normal;
  210. }
  211. }
  212. .phone-canvas-right-box {
  213. display: flex;
  214. width: 100%;
  215. justify-content: flex-end;
  216. flex-direction: column;
  217. align-items: center;
  218. canvas {
  219. width: 150px;
  220. height: 55px;
  221. }
  222. p {
  223. margin: 0;
  224. padding: 0;
  225. font-size: 10px;
  226. font-weight: normal;
  227. }
  228. }
  229. }
  230. .icons {
  231. display: flex;
  232. gap: 3px;
  233. padding: 0 62px 0 45px;
  234. margin-top: 10px;
  235. box-sizing: border-box;
  236. font-size: 8px;
  237. }
  238. .barcode {
  239. text-align: center;
  240. }
  241. .size {
  242. text-align: center;
  243. font-size: 8px;
  244. font-weight: normal;
  245. margin-top: 8px;
  246. }
  247. .expiry {
  248. display: flex;
  249. text-align: left;
  250. font-size: 14px;
  251. font-weight: normal;
  252. align-items: center;
  253. }
  254. </style>