1
MrShi
2025-03-18 a836f03a5d1fbfa81e147d09ffdfa87ba3975c13
admin/src/views/operation/components/QRcode.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,126 @@
<template>
  <GlobalWindow title="查看图片" :visible.sync="visible" :confirm-working="isWorking" confirmText="打印二维码">
    <div class="box" id="print-content">
      <template v-for="(item, index) in list">
        <div class="box_item" v-if="item.imgurl" :key="index">
          <!--                <div class="box_item_title">微信</div>-->
          <div class="box_item_qr">
            <img :src="item.imgurl" />
            <!--                    <span>{{item.siteId}}/{{item.code}}</span>-->
          </div>
          <!--                <div class="box_item_footer">扫码取车</div>-->
        </div>
      </template>
    </div>
    <template v-slot:footer>
      <!--            <el-button type="primary" v-print="'#print-content'">打印</el-button>-->
      <el-button type="primary" :loading="isWorking.export" @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 { downloadImgs } from '@/api/business/bikes.js'
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.visible = true
    },
    close() {
      this.visible = false
    },
    exportImages() {
      downloadImgs(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>