print-pop.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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. <view class="pop-main">
  13. <view class="flex_box flex-row-center pd-30">
  14. <view class="qr-code">
  15. <uqrcode
  16. ref="uqrcode"
  17. canvas-id="qrcode"
  18. value="https://uqrcode.cn/doc"
  19. sizeUnit="rpx"
  20. :size="200"
  21. ></uqrcode>
  22. </view>
  23. <view class="flex-box flex-column flex-justify-sa info-box">
  24. <view class="item-value">快马便利</view>
  25. <view class="item-value">阳光店</view>
  26. <view class="item-value">DD2500426-188</view>
  27. </view>
  28. </view>
  29. <tki-barcode
  30. ref="barcode"
  31. :show="showBarCode"
  32. :val="barcodeVal"
  33. :opations="{
  34. width: 1,
  35. height: 100,
  36. displayValue: true,
  37. margin: 10,
  38. }"
  39. @result="getBarCodeImg"
  40. />
  41. <view class="tips-value">请确认打印条码数量</view>
  42. <view class="num-box">
  43. <u-number-box
  44. v-model="printNum"
  45. :inputWidth="56"
  46. :min="0"
  47. ></u-number-box>
  48. </view>
  49. </view>
  50. <!-- 操作按钮 -->
  51. <view class="btn-footer">
  52. <u-button
  53. text="取消"
  54. type="primary"
  55. :plain="true"
  56. @click="handleClose"
  57. :customStyle="{
  58. marginRight: '16rpx',
  59. border: '1px solid #bfc8db',
  60. color: '#86909c',
  61. }"
  62. class="footer-btn no-btn"
  63. ></u-button>
  64. <u-button
  65. text="确定"
  66. type="primary"
  67. @click="handleConfirm"
  68. class="footer-btn yes-btn"
  69. ></u-button>
  70. </view>
  71. </view>
  72. </u-popup>
  73. </view>
  74. </template>
  75. <script>
  76. import tkiBarcode from "@/components/tki-barcode/tki-barcode.vue";
  77. export default {
  78. components: { tkiBarcode },
  79. props: {
  80. show: {
  81. type: Boolean,
  82. default: false,
  83. },
  84. info: {
  85. type: Object,
  86. default: () => ({}),
  87. },
  88. },
  89. computed: {
  90. barcodeVal() {
  91. return this.info.barCode || "";
  92. },
  93. },
  94. data() {
  95. return {
  96. showBarCode: false,
  97. printNum: 1,
  98. };
  99. },
  100. methods: {
  101. // 关闭弹窗
  102. handleClose() {
  103. this.showBarCode = false;
  104. this.$emit("update:show", false);
  105. this.$emit("close");
  106. },
  107. handleOpen() {
  108. this.printNum = 1;
  109. this.showBarCode = true;
  110. },
  111. handleConfirm() {
  112. const params = {
  113. num: this.printNum,
  114. // data: this.info,
  115. data: {
  116. qrCode: "12892u483482731", // 二维码
  117. barCode: "189387467634928", // 商品条码
  118. customerName: "快马便利(阳光店)", //客户名
  119. number: "DD2500426-188", // 单据编号
  120. batchNumber: "12892847378728467", // 批次条码
  121. },
  122. };
  123. this.$emit("confirm", params);
  124. this.handleClose();
  125. },
  126. getBarCodeImg(res) {
  127. console.log("条形码图片", res);
  128. this.$emit("barCodeImg", res);
  129. },
  130. },
  131. };
  132. </script>
  133. <style lang="scss" scoped>
  134. .pop-content {
  135. width: 590rpx;
  136. padding: 60rpx 20rpx 48rpx;
  137. background: #fff;
  138. border-radius: 10rpx;
  139. .pop-main {
  140. display: flex;
  141. flex-direction: column;
  142. align-items: center;
  143. }
  144. .flex_box {
  145. display: flex;
  146. }
  147. .pd-30 {
  148. padding: 30rpx;
  149. }
  150. .mt-30 {
  151. margin-top: 30rpx;
  152. }
  153. .flex-column {
  154. flex-direction: column;
  155. }
  156. .flex-align-center {
  157. align-items: center;
  158. }
  159. .flex-row-center {
  160. flex-direction: row;
  161. justify-content: center;
  162. }
  163. .info-box {
  164. flex: 1;
  165. }
  166. .item-value {
  167. font-size: 32rpx;
  168. margin-bottom: 10rpx;
  169. }
  170. .qr-code {
  171. width: 200rpx;
  172. height: 200rpx;
  173. background-color: #bfc8db;
  174. margin-right: 20rpx;
  175. }
  176. .bar-code {
  177. width: 400rpx;
  178. margin-bottom: 10rpx;
  179. }
  180. .tips-value {
  181. color: #1d212a;
  182. font-family: "PingFang SC";
  183. font-size: 32rpx;
  184. font-style: normal;
  185. font-weight: bold;
  186. margin-top: 30rpx;
  187. text-align: center;
  188. }
  189. .num-box {
  190. display: flex;
  191. align-items: center;
  192. justify-content: center;
  193. margin-top: 30rpx;
  194. }
  195. .btn-footer {
  196. display: flex;
  197. padding: 30rpx;
  198. .no-btn {
  199. border: 1px solid #bfc8db;
  200. color: #86909c;
  201. }
  202. .yes-btn {
  203. background: #0256ff;
  204. }
  205. .footer-btn {
  206. flex: 1;
  207. margin: 0 16rpx;
  208. width: 244rpx;
  209. border-radius: 16rpx;
  210. font-size: 32rpx;
  211. }
  212. }
  213. }
  214. </style>