print-pop.vue 4.6 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="info.number"
  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">{{ info.customerName }}</view>
  25. <view class="item-value">{{ info.number }}</view>
  26. </view>
  27. </view>
  28. <tki-barcode
  29. ref="barcode"
  30. :show="showBarCode"
  31. :val="barcodeVal"
  32. :opations="{
  33. width: 1,
  34. height: 100,
  35. displayValue: true,
  36. margin: 10,
  37. }"
  38. @result="getBarCodeImg"
  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="btn-footer">
  51. <u-button
  52. text="取消"
  53. type="primary"
  54. :plain="true"
  55. @click="handleClose"
  56. :customStyle="{
  57. marginRight: '16rpx',
  58. border: '1px solid #bfc8db',
  59. color: '#86909c',
  60. }"
  61. class="footer-btn no-btn"
  62. ></u-button>
  63. <u-button
  64. text="确定"
  65. type="primary"
  66. @click="handleConfirm"
  67. class="footer-btn yes-btn"
  68. ></u-button>
  69. </view>
  70. </view>
  71. </u-popup>
  72. </view>
  73. </template>
  74. <script>
  75. import tkiBarcode from "@/components/tki-barcode/tki-barcode.vue";
  76. export default {
  77. components: { tkiBarcode },
  78. props: {
  79. show: {
  80. type: Boolean,
  81. default: false,
  82. },
  83. info: {
  84. type: Object,
  85. default: () => ({
  86. customerName: "",
  87. number: "",
  88. barCode: "",
  89. }),
  90. },
  91. },
  92. computed: {
  93. barcodeVal() {
  94. return this.info.barCode || "";
  95. },
  96. },
  97. data() {
  98. return {
  99. showBarCode: false,
  100. printNum: 1,
  101. };
  102. },
  103. methods: {
  104. // 关闭弹窗
  105. handleClose() {
  106. this.showBarCode = false;
  107. this.$emit("update:show", false);
  108. this.$emit("close");
  109. },
  110. handleOpen() {
  111. this.printNum = 1;
  112. this.showBarCode = true;
  113. },
  114. handleConfirm() {
  115. const params = {
  116. num: this.printNum,
  117. data: {
  118. barCode: this.info.barCode, // 商品条码
  119. customerName: this.info.customerName, //客户名
  120. number: this.info.number, // 单据编号
  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>