print-pop.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <view>
  3. <u-popup
  4. :show="show"
  5. mode="center"
  6. @close="handleClose"
  7. @open="handleOpen"
  8. :round="10"
  9. :closeOnClickOverlay="false"
  10. >
  11. <view class="pop-content">
  12. <!-- 出库 -->
  13. <view class="pop-main" v-if="info.type == 2">
  14. <view class="flex_box flex-row-center pd-30">
  15. <view class="qr-code">
  16. <uqrcode
  17. ref="uqrcode"
  18. canvas-id="qrcode"
  19. :value="info.number"
  20. sizeUnit="rpx"
  21. :size="200"
  22. ></uqrcode>
  23. </view>
  24. <view class="flex-box flex-column flex-justify-sa info-box">
  25. <view class="item-value">{{ info.customerName }}</view>
  26. <view class="item-value">{{ info.number }}</view>
  27. </view>
  28. </view>
  29. <tki-barcode
  30. ref="skubarCode"
  31. :show="showBarCode"
  32. :val="barcodeVal"
  33. cid="sku-barcode1"
  34. :opations="{
  35. width: 1,
  36. height: 100,
  37. displayValue: true,
  38. margin: 10,
  39. }"
  40. :loadMake="false"
  41. />
  42. <view class="tips-value">请确认打印条码数量</view>
  43. <view class="num-box">
  44. <u-number-box
  45. v-model="printNum"
  46. :inputWidth="56"
  47. :min="0"
  48. ></u-number-box>
  49. </view>
  50. </view>
  51. <!-- 入库 -->
  52. <view class="pop-main" v-if="info.type == 1">
  53. <!-- sku -->
  54. <tki-barcode
  55. ref="skubarCode1"
  56. :show="showBarCode"
  57. :val="barcodeVal"
  58. cid="sku-barcode"
  59. :opations="{
  60. width: 1,
  61. height: 100,
  62. displayValue: true,
  63. margin: 10,
  64. }"
  65. :loadMake="false"
  66. />
  67. <!-- 批次号(入库已完成) -->
  68. <tki-barcode
  69. ref="batchNumber"
  70. :show="showBarCode && info.status == 2"
  71. :val="batchNumberVal"
  72. cid="batch-barcode"
  73. :opations="{
  74. width: 1,
  75. height: 100,
  76. displayValue: true,
  77. margin: 10,
  78. }"
  79. :loadMake="false"
  80. />
  81. <view class="tips-value">请确认打印条码数量</view>
  82. <view class="num-box">
  83. <u-number-box
  84. v-model="printNum"
  85. :inputWidth="56"
  86. :min="0"
  87. ></u-number-box>
  88. </view>
  89. </view>
  90. <!-- 操作按钮 -->
  91. <view class="btn-footer">
  92. <u-button
  93. text="取消"
  94. type="primary"
  95. :plain="true"
  96. @click="handleClose"
  97. :customStyle="{
  98. marginRight: '16rpx',
  99. border: '1px solid #bfc8db',
  100. color: '#86909c',
  101. }"
  102. class="footer-btn no-btn"
  103. ></u-button>
  104. <u-button
  105. text="确定"
  106. type="primary"
  107. @click="handleConfirm"
  108. class="footer-btn yes-btn"
  109. ></u-button>
  110. </view>
  111. </view>
  112. </u-popup>
  113. </view>
  114. </template>
  115. <script>
  116. import tkiBarcode from "@/components/tki-barcode/tki-barcode.vue";
  117. export default {
  118. components: { tkiBarcode },
  119. props: {
  120. show: {
  121. type: Boolean,
  122. default: false,
  123. },
  124. /**
  125. * 入库显示条码号、批次号(显示:订单状态且为已入库)
  126. * 出库显示二维码(订单编号)、发货客户名称、发货商品sku
  127. */
  128. info: {
  129. type: Object,
  130. default: () => ({
  131. customerName: "", // 客户名称
  132. number: "", // 订单编号
  133. barCode: "", // 商品条码
  134. batchNumber: "", // 批次号
  135. type: null, // 入库:1 出库;2
  136. status: "", // 订单状态 入库状态为2才有批次号,出库不显示批次号
  137. }),
  138. },
  139. },
  140. computed: {
  141. barcodeVal() {
  142. return this.info.barCode ? `SKU-${this.info.barCode}` : "";
  143. },
  144. batchNumberVal() {
  145. return this.info.batchNumber ? `PC${this.info.batchNumber}` : "";
  146. },
  147. },
  148. data() {
  149. return {
  150. showBarCode: false,
  151. printNum: 1,
  152. };
  153. },
  154. methods: {
  155. // 关闭弹窗
  156. handleClose() {
  157. this.showBarCode = false;
  158. this.$emit("update:show", false);
  159. this.$emit("close");
  160. },
  161. handleOpen() {
  162. this.printNum = 1;
  163. this.showBarCode = true;
  164. this.$nextTick(() => {
  165. if (this.info.type == 1) {
  166. this.$refs.skubarCode1._makeCode();
  167. this.$refs.batchNumber._makeCode();
  168. } else {
  169. this.$refs.skubarCode._makeCode();
  170. }
  171. });
  172. },
  173. handleConfirm() {
  174. const params = {
  175. num: this.printNum,
  176. data: {
  177. barCode: this.info.barCode, // 商品条码
  178. customerName: this.info.customerName, //客户名
  179. number: this.info.number, // 单据编号
  180. batchNumber: this.info.batchNumber, // 批次号
  181. type: this.info.type, // 入库:1 出库;2
  182. status: this.info.status, // 订单状态 入库状态为2才有批次号,出库不显示批次号
  183. },
  184. };
  185. this.$emit("confirm", params);
  186. this.handleClose();
  187. },
  188. },
  189. };
  190. </script>
  191. <style lang="scss" scoped>
  192. .pop-content {
  193. width: 590rpx;
  194. padding: 60rpx 20rpx 48rpx;
  195. background: #fff;
  196. border-radius: 10rpx;
  197. .pop-main {
  198. display: flex;
  199. flex-direction: column;
  200. align-items: center;
  201. }
  202. .flex_box {
  203. display: flex;
  204. }
  205. .pd-30 {
  206. padding: 30rpx;
  207. }
  208. .mt-30 {
  209. margin-top: 30rpx;
  210. }
  211. .flex-column {
  212. flex-direction: column;
  213. }
  214. .flex-align-center {
  215. align-items: center;
  216. }
  217. .flex-row-center {
  218. flex-direction: row;
  219. justify-content: center;
  220. }
  221. .info-box {
  222. flex: 1;
  223. }
  224. .item-value {
  225. font-size: 32rpx;
  226. margin-bottom: 10rpx;
  227. }
  228. .qr-code {
  229. width: 200rpx;
  230. height: 200rpx;
  231. background-color: #bfc8db;
  232. margin-right: 20rpx;
  233. }
  234. .bar-code {
  235. width: 400rpx;
  236. margin-bottom: 10rpx;
  237. }
  238. .tips-value {
  239. color: #1d212a;
  240. font-family: "PingFang SC";
  241. font-size: 32rpx;
  242. font-style: normal;
  243. font-weight: bold;
  244. margin-top: 30rpx;
  245. text-align: center;
  246. }
  247. .num-box {
  248. display: flex;
  249. align-items: center;
  250. justify-content: center;
  251. margin-top: 30rpx;
  252. }
  253. .btn-footer {
  254. display: flex;
  255. padding: 30rpx;
  256. .no-btn {
  257. border: 1px solid #bfc8db;
  258. color: #86909c;
  259. }
  260. .yes-btn {
  261. background: #0256ff;
  262. }
  263. .footer-btn {
  264. flex: 1;
  265. margin: 0 16rpx;
  266. width: 244rpx;
  267. border-radius: 16rpx;
  268. font-size: 32rpx;
  269. }
  270. }
  271. }
  272. </style>