<script setup>
  import { onLoad } from '@dcloudio/uni-app'
  import { ref } from 'vue'
  import { useUI } from '../../utils/use-ui'

  const { showToast } = useUI()

  const groupId = ref('')
  const productId = ref('')
  const qrcodeRef = ref(null)


  onLoad(e => {
    groupId.value = e.id
    productId.value = e.productId
    // /pages/mall/detail
  })

</script>

<template>
  <view class="share-box">
    <nav-bar title="拼单" targetColor="transparent"></nav-bar>
    <view class="code-box">
      <view class="code-content">
        <view class="code">
          <l-qrcode
            ref="qrcodeRef"
            :value="`/pages/mall/detail?productId=${productId}&groupId=${groupId}`"
            size="160"
          />
        </view>
        <!-- <view class="btn-box">
          <text>分享二维码</text>
          <text @click="onCode">保存到本地</text>
        </view> -->
      </view>
    </view>
  </view>
</template>

<style lang="scss" scoped>
  .share-box {
    height: 100vh;
    width: 100vw;
    // 导入背景图
    background: url('/static/images/discover/share-bg.png');
    background-size: 100%;
    background-position: center;
    background-repeat: no-repeat;

    .code-box {
      padding-top: 24vh;
      display: flex;
      justify-content: center;

      .code-content {
        width: 560rpx;
        height: 618rpx;
        background: linear-gradient(0deg, #00d993 0%, #00d9c5 100%);
        border-radius: 32rpx;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        .code {
          display: flex;
          justify-content: center;
          align-items: center;
          width: 332rpx;
          height: 332rpx;
        }
        .btn-box {
          margin-top: 60rpx;
          width: 332rpx;
          display: flex;
          justify-content: center;
          font-weight: bold;
          font-size: 28rpx;
          color: #ffffff;
        }
      }
    }
  }
</style>
