QrBox.vue 2.62 KB
<template>
  <uni-popup
    ref="qr"
    type="center"
    :is-mask-click="false"
    animation
    class="qrPopup"
  >
    <view class="box">
      <view
        class="icon-close-box flex"
        @click="close"
      >
        <uni-icons
          class="icon-close"
          type="closeempty"
          :size="16"
          color="#1A1A1A"
        ></uni-icons>
      </view>
      <view class="content flex">
        <view class="title flex">
          <view class="sprite-icon icon-scan"></view>
          请让客户扫码领取
        </view>
        <template v-if="received">
          <view class="received flex">
            <view class="sprite-icon icon-qr-success"></view>
            <view class="received-title">客户领券成功</view>
            <view class="received-text">车主已领取该礼券,请前往客户邀约列表查看</view>
          </view>
        </template>
        <template v-else>
          <view class="qr-box">
            <image :src="url" />
          </view>
        </template>
      </view>
    </view>
  </uni-popup>
</template>

<script type='text/ecmascript-6'>
export default {
  name: 'QRBox',
  props: {
    url: {
      type: String,
      default: '',
    },
    received: Boolean
  },
  data () {
    return {
    }
  },
  mounted () {
  },
  methods: {
    open () {
      this.$refs.qr.open();
    },
    close () {
      this.$refs.qr.close();
      this.$emit('close')
    },
  }
}
</script>

<style scoped lang='scss'>
.qrPopup {
  z-index: 99 !important;
}
.box {
  width: 1040rpx;
  height: 800rpx;
  background: #ffffff;
  border-radius: 48rpx;
  position: relative;
  .icon-close-box {
    position: absolute;
    padding: 48rpx;
    top: 0;
    right: 0;
  }
  .content {
    flex-direction: column;

    .title {
      padding: 80rpx 0 48rpx;
      font-weight: 500;
      font-size: 32rpx;
      color: #333333;
      .sprite-icon{
        margin-right: 12rpx;
      }
    }
    .qr-box {
      width: 560rpx;
      height: 560rpx;
      background: #ffffff;
      box-shadow: 0 0 24rpx 0 #0000001a;
      border-radius: 32rpx;
      padding: 40rpx;
      box-sizing: border-box;
      image {
        width: 100%;
        height: 100%;
        vertical-align: top;
      }
    }
    .received {
      width: 560rpx;
      height: 560rpx;
      background: #f9f9f9;
      border-radius: 32rpx;
      flex-direction: column;
      justify-content: center;
      &-title {
        font-weight: 500;
        font-size: 28rpx;
        color: #333333;
        margin: 16rpx 0 48rpx;
      }
      &-text {
        font-size: 28rpx;
        color: #666666;
        margin: 0 56rpx;
      }
    }
  }
}
</style>