123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <template>
- <a-modal
- centered
- class="replenishmentManagement-printSticker-modal"
- :footer="null"
- :maskClosable="false"
- title="打印预览"
- v-model="isShow"
- @cancel="isShow = false"
- :width="400">
- <!-- 列表 -->
- <div id="print">
- <div
- v-for="(item,index) in list"
- :key="index"
- class="print-pages"
- style="font-size: 12px;padding:10pt 15pt;width:300px;margin:0 auto;">
- <div class="storeName" style="text-align: center;margin: 5pt 0 0;">
- {{ nowData.dealerName }}
- </div>
- <div class="storeName" style="text-align: center;margin: 0pt 0 10pt;">
- {{ nowData.shelfInfo?nowData.shelfInfo.shelfName: nowData.shelfName }}
- </div>
- <div style="overflow: hidden;">
- <div style="float: left;">
- <div class="qrcode" ref="qrCodeUrl" style="text-align: center;">
- <vue-qr :text="`${item.shelfSn}&${item.productCode}&${item.productSn}&${item.shelfPlaceSn}`" :margin="0" :size="70"></vue-qr>
- </div>
- </div>
- <div style="float: left;padding-left:10pt;width: 60%;">
- <div class="productSno" style="font-size: 30pt;height:30pt;line-height:30pt;">{{ item.shelfPlaceCode }}</div>
- <div class="productCode" style="margin-top: 2pt;font-size:12pt;">{{ item.productCode }}</div>
- <div style="margin: 2pt 0;">{{ moment().format('YYYY-MM-DD HH:mm') }}</div>
- </div>
- </div>
- <div style="margin-top:10px;" v-if="!(nowData&&nowData.shelfInfo)">
- <span style="margin-left:16px;">打印数量:</span>
- <a-input-number
- size="small"
- id="replenishmentManagement-printNum"
- v-model="printQtyNum"
- :min="1"
- :max="999999"
- :precision="0"
- style="width:63%;"/>
- </div>
- </div>
- </div>
- <div class="btn-cont">
- <a-button type="primary" id="replenishmentManagement-printSticker-modal-save" @click="handleSave">确定打印</a-button>
- <a-button id="replenishmentManagement-printSticker-modal-back" @click="isShow = false" style="margin-left: 15px;">取消</a-button>
- </div>
- </a-modal>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import moment from 'moment'
- import vueQr from 'vue-qr'
- import { JGPrintTag } from '@/libs/JGPrint'
- import { STable, VSelect } from '@/components'
- export default {
- name: 'PrintStickerModal',
- components: { STable, VSelect, vueQr },
- mixins: [commonMixin],
- props: {
- openModal: { // 弹框显示状态
- type: Boolean,
- default: false
- }
- },
- data () {
- return {
- isShow: false,
- nowData: null, // 当前数据
- list: [], // 打印明细列表
- printQtyNum: 1// 默认打印数量
- }
- },
- methods: {
- moment: moment,
- // 开始打印
- handleSave () {
- for (let i = 0; i < this.list.length; i++) {
- const item = this.list[i]
- item.dealerName = this.nowData.dealerName
- item.qrCodeContent = `${item.shelfSn}&${item.productCode}&${item.productSn}&${item.shelfPlaceSn}`
- item.shelfName = this.nowData.shelfInfo ? this.nowData.shelfInfo.shelfName : this.nowData.shelfName
- item.printTime = moment().format('YYYY-MM-DD HH:mm')
- if (!(this.nowData && this.nowData.shelfInfo)) {
- item.printQty = this.printQtyNum
- }
- JGPrintTag('60mm', '40mm', item)
- }
- },
- // 设置值
- setData (nowData, list) {
- const dearInfo = this.$store.state.user.info
- this.nowData = nowData
- this.list = list
- this.nowData.dealerName = dearInfo.orgName
- this.nowData.dealerSn = dearInfo.orgSn
- this.nowData.parintUser = dearInfo.userNameCN
- }
- },
- watch: {
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.nowData = null
- this.list = []
- this.$emit('close')
- }
- }
- }
- }
- </script>
- <style lang="less">
- .replenishmentManagement-printSticker-modal {
- .btn-cont {
- text-align: center;
- margin: 35px 0 10px;
- }
- .print-pages{
- border-bottom: 1px solid #eee;
- }
- }
- </style>
|