jiangping
2023-12-29 f9691d544e62d6c04dbfe45d05a6c7bc5e004291
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<template>
    <GlobalWindow
        :title="title"
        :visible.sync="visible"
        :confirm-working="isWorking"
        confirmText="打印二维码"
        width="700px"
    >
        <div class="box" id="print-content">
            <div class="box_item" v-for="(item, index) in list" :key="index">
<!--                <div class="box_item_title">微信</div>-->
                <div class="box_item_qr">
                    <img :src="item.imgfullurl" />
<!--                    <span>{{item.siteId}}/{{item.code}}</span>-->
                </div>
<!--                <div class="box_item_footer">扫码取车</div>-->
            </div>
        </div>
        <template v-slot:footer>
<!--            <el-button type="primary" v-print="'#print-content'">打印</el-button>-->
            <el-button type="primary" :loading="isWorking.export" v-if="isLoading==false" @click="exportImages">打包下载</el-button>
            <el-button @click="close">返回</el-button>
        </template>
    </GlobalWindow>
</template>
 
<script>
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
import { qrcodeList,exportImages } from '@/api/business/sites'
export default {
  name: 'QRcode',
  extends: BaseOpera,
  components: { GlobalWindow },
  data () {
    return {
      siteId:'',
      isLoading : true,
      list: []
    }
  },
  created () {
    this.config({
      api: '/business/sites',
      'field.id': 'id'
    })
  },
  methods: {
    open (title, id) {
      this.list = []
      this.title = title
      this.visible = true
      this.siteId = id
      var that = this
      qrcodeList(id)
        .then(res => {
          that.isLoading = false
          this.list = res
        })
    },
    close () {
      this.visible = false
    },
    exportImages () {
      exportImages( this.siteId)
          .then(response => {
            this.download(response)
          })
          .catch(e => {
            this.$tip.apiFailed(e)
          })
          .finally(() => {
            this.isWorking.export = false
          })
    }
  }
}
</script>
 
<style lang="scss" scoped>
    .box {
        width: 100%;
        display: flex;
        align-items: center;
        /*justify-content: space-between;*/
        flex-wrap: wrap;
        .box_item {
            width: 152px;
            height: auto;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            align-items: center;
            background: #FFFFFF;
            border: 1px solid #BBBBBB;
            padding: 3px 0 4px 0;
            box-sizing: border-box;
            margin-top: 50px;
            margin-left: 35px;
            .box_item_title {
                font-size: 21px;
                font-weight: 400;
                color: #222222;
            }
            .box_item_qr {
                width: 139px;
                height: 154px;
                padding: 6px 7px;
                box-sizing: border-box;
                background: #282828;
                display: flex;
                flex-direction: column;
                align-items: center;
                justify-content: space-between;
                img {
                    width: 126px;
                    height: 146px;
                }
                span {
                    font-size: 13px;
                    font-weight: 400;
                    color: #FFFFFF;
                }
            }
            .box_item_footer {
                font-size: 23px;
                font-weight: bold;
                color: #222222;
            }
        }
    }
</style>