print-pop.vue 6.2 KB

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