<template>
  <view class="forward_content">
    <view class="forward_content_header">
      <view>
        <uni-icons type="auth-filled" size="80" color="#0082fa"></uni-icons>
      </view>
      <view class="label"> 请选择微信好友 </view>
    </view>
    <view class="footer">
      <view class="btn">
        <hs-button type="display" size="md" label="返回" @click="handleNavigateBack" />
      </view>
      <view class="btn">
        <hs-button type="primary" size="md" openType="share" label="请选择好友" />
      </view>
    </view>
  </view>
</template>

<script setup lang="ts">
import { onLoad, onShareAppMessage } from '@dcloudio/uni-app'
import { ref } from 'vue'
const loading = ref(false)
const formData = ref<any>({})

onLoad((e: any) => {
  console.log('forward', e)
  formData.value = e
})

// const handleSubmit = () => {
//   console.log('formData', formData.value)
//   uni.shareAppMessageToGroup({
//     title: '分享给您物业账单',
//     path: '//INDEX/bill/list/index',
//     imageUrl:
//       'https://pay-prod-1369486729.cos.ap-guangzhou.myqcloud.com/uploads/cs-test/01K5B5RY2TQQAJ1GT2RZSK426V.jpg'
//   })
// }

const handleNavigateBack = () => {
  uni.navigateBackMiniProgram({
    success(res) {
      // 返回成功
    }
  })
}

onShareAppMessage(() => {
  if (formData.value?.source === 'OutstandingFeeList') {
    //分享账单
    return {
      title: '分享给您物业账单',
      path: '/INDEX/bill/list/index',
      imageUrl:
        'https://pay-prod-1369486729.cos.ap-guangzhou.myqcloud.com/uploads/cs-test/01K5B5RY2TQQAJ1GT2RZSK426V.jpg'
    }
  }
  if (formData.value?.source === 'HouseholdRegistration') {
    //邀请入户登记
    return {
      title: '邀请您入户',
      path: '/INDEX/binding/index',
      imageUrl:
        'https://pay-prod-1369486729.cos.ap-guangzhou.myqcloud.com/uploads/cs-test/01K5B5RY2TQQAJ1GT2RZSK426V.jpg'
    }
  }
  return {}
})
</script>

<style lang="scss">
@import './style.scss';
</style>
