加油站付款小程序,打印小票
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

141 lines
2.8 KiB

11 months ago
  1. <template>
  2. <uni-popup ref="privacyPopup" type="center" :is-mask-click="true">
  3. <view class="privacyPopup">
  4. <view class="title">
  5. <view class="title_circle"></view>
  6. <view>惠享服务圈</view>
  7. </view>
  8. <view class="content_pri">
  9. <text>在你使用惠享服务圈服务之前请仔细阅读</text>
  10. <text style="color: #1793ee;" @click="goToPrivacy">惠享服务圈小程序隐私保护指引</text>
  11. <text>如你同意惠享服务圈小程序隐私保护指引请点击同意开始使用惠享服务圈</text>
  12. </view>
  13. <view class="pri_btn">
  14. <button class="confuse_btn" @click="confusePrivacy">拒绝</button>
  15. <button class="confirm_btn" id="agree-btn" open-type="agreePrivacyAuthorization"
  16. @agreeprivacyauthorization="handleAgreePrivacyAuthorization">同意</button>
  17. </view>
  18. </view>
  19. </uni-popup>
  20. </template>
  21. <script setup>
  22. import {
  23. onShow
  24. } from "@dcloudio/uni-app"
  25. import {
  26. reactive,
  27. ref,
  28. defineExpose
  29. } from 'vue';
  30. const privacyPopup = ref()
  31. let resolvePrivacyAuthorization
  32. //初始化
  33. function init(resolve) {
  34. privacyPopup.value.open()
  35. resolvePrivacyAuthorization = resolve
  36. }
  37. // 打开隐私协议
  38. function goToPrivacy() {
  39. wx.openPrivacyContract({
  40. success: () => {
  41. console.log('打开成功');
  42. }, // 打开成功
  43. fail: () => {
  44. uni.showToast({
  45. title: '打开失败,稍后重试',
  46. icon: 'none'
  47. })
  48. } // 打开失败
  49. })
  50. }
  51. // 拒绝
  52. function confusePrivacy() {
  53. privacyPopup.value.close()
  54. resolvePrivacyAuthorization({
  55. event: 'disagree'
  56. })
  57. }
  58. // 同意
  59. function handleAgreePrivacyAuthorization() {
  60. // 告知平台用户已经同意,参数传同意按钮的id
  61. resolvePrivacyAuthorization({
  62. buttonId: 'agree-btn',
  63. event: 'agree'
  64. })
  65. privacyPopup.close()
  66. }
  67. defineExpose({
  68. init
  69. });
  70. </script>
  71. <style lang="scss" scoped>
  72. // *{
  73. // box-sizing: border-box;
  74. // }
  75. .privacyPopup {
  76. width: 520rpx;
  77. /* height: 500rpx; */
  78. background-color: #fff;
  79. border-radius: 50rpx;
  80. padding: 20rpx 40rpx;
  81. }
  82. .title {
  83. display: flex;
  84. align-items: center;
  85. justify-content: start;
  86. margin: 20rpx 0;
  87. font-size: 38rpx;
  88. font-weight: 600;
  89. }
  90. .title .title_circle {
  91. width: 60rpx;
  92. height: 60rpx;
  93. background-color: #efefef;
  94. border-radius: 50%;
  95. margin-right: 20rpx;
  96. }
  97. .content_pri {
  98. width: 480rpx;
  99. margin: 0 auto;
  100. font-size: 34rpx;
  101. line-height: 1.5;
  102. }
  103. .pri_btn {
  104. width: 100%;
  105. height: 158rpx;
  106. display: flex;
  107. align-items: center;
  108. justify-content: space-evenly;
  109. }
  110. .pri_btn .confuse_btn,
  111. .pri_btn .confirm_btn {
  112. width: 200rpx;
  113. height: 90rpx;
  114. border-radius: 20rpx;
  115. font-size: 34rpx;
  116. }
  117. .pri_btn .confuse_btn {
  118. background-color: #eee;
  119. color: #52bf6b;
  120. }
  121. .pri_btn .confirm_btn {
  122. background-color: #52bf6b;
  123. color: #fff;
  124. }
  125. </style>