content-popup.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <script setup>
  2. import { computed } from 'vue'
  3. import AnimatedOverlay from '../../components/dialog/AnimatedOverlay.vue'
  4. import PopupLayout from './components/PopupLayout.vue'
  5. import CenterLayout from './components/CenterLayout.vue'
  6. import MobileContentCard from './components/content-card.vue'
  7. import MobileCenterCard from './components/center-card.vue'
  8. import phoneConfirmDialog from './components/confirm-dialog.vue'
  9. import ChangePhoneDialog from './components/change-phone-dialog.vue'
  10. import {
  11. useContactMeLogic,
  12. usePhoneCheck,
  13. usePreLeaveInfo
  14. } from '@/utils/hooks'
  15. const props = defineProps({
  16. source: {
  17. type: String,
  18. default: '',
  19. required: true,
  20. },
  21. sourceDesc: {
  22. type: String,
  23. default: '',
  24. },
  25. popupTitle: {
  26. type: String,
  27. default: '联系专属客服,申请免费体验'
  28. },
  29. // 是否静态客服信息(非线索客服信息)
  30. staticInfo: {
  31. type: Boolean,
  32. default: false,
  33. },
  34. useCustomer3: {
  35. type: Boolean,
  36. default: false,
  37. },
  38. platform: {
  39. type: String,
  40. default: '',
  41. },
  42. })
  43. const center = computed(() => {
  44. return props.staticInfo
  45. })
  46. const contentTransitionName = computed(() => {
  47. return center.value ? 'fade' : 'slide-up'
  48. })
  49. const {
  50. updateVisible,
  51. close,
  52. visible,
  53. configInfo,
  54. } = usePreLeaveInfo({
  55. props
  56. })
  57. console.log(configInfo)
  58. const {
  59. contactMe,
  60. changePhoneDialog,
  61. successCheckDialog,
  62. confirmPhoneDialog,
  63. dialogEvents,
  64. } = usePhoneCheck({
  65. configInfo,
  66. props,
  67. popupVisible: visible,
  68. })
  69. defineExpose({
  70. updateVisible
  71. })
  72. </script>
  73. <script>
  74. export default {
  75. name: 'MobileContentPopover',
  76. }
  77. </script>
  78. <template>
  79. <AnimatedOverlay
  80. class="mobile-leave-dialog"
  81. :visible="visible"
  82. :content-transition-name="contentTransitionName"
  83. @update:visible="updateVisible"
  84. @close="close"
  85. >
  86. <div class="mobile-leave-dialog-content" :class="{ 'dialog-content-center': center, 'dialog-content-bottom': !center }">
  87. <CenterLayout v-if="center" @closeIconClick="close">
  88. <MobileCenterCard
  89. :qr="configInfo.wxer"
  90. :phone="configInfo.phone"
  91. :platform="platform"
  92. />
  93. </CenterLayout>
  94. <PopupLayout v-else :title="popupTitle" @closeIconClick="close">
  95. <MobileContentCard
  96. :qr="configInfo.wxer"
  97. :phone="configInfo.phone"
  98. :platform="platform"
  99. :use-customer3="useCustomer3"
  100. :is-current-phone="configInfo.isCurrentPhone"
  101. @contact="contactMe"
  102. />
  103. </PopupLayout>
  104. </div>
  105. <!-- 确认联系电话弹窗 -->
  106. <phoneConfirmDialog
  107. :visible.sync="confirmPhoneDialog.show"
  108. :title="successCheckDialog.title"
  109. :confirm-button-text="confirmPhoneDialog.confirmButtonText"
  110. :cancel-button-text="confirmPhoneDialog.cancelButtonText"
  111. :content-text="confirmPhoneDialog.contentText"
  112. @confirm="dialogEvents.confirmPhoneConfirm"
  113. @cancel="dialogEvents.confirmPhoneCancel"
  114. />
  115. <!-- 成功弹窗 -->
  116. <phoneConfirmDialog
  117. :visible.sync="successCheckDialog.show"
  118. :title="successCheckDialog.title"
  119. :confirm-button-text="successCheckDialog.confirmButtonText"
  120. :cancel-button-text="successCheckDialog.cancelButtonText"
  121. :content-text="successCheckDialog.contentText"
  122. @confirm="dialogEvents.successConfirm"
  123. />
  124. <!-- 修改手机号弹窗 -->
  125. <ChangePhoneDialog
  126. :visible.sync="changePhoneDialog.show"
  127. :phone.sync="changePhoneDialog.phoneNumber"
  128. @confirm="dialogEvents.phoneChangeConfirm"
  129. @cancel="dialogEvents.phoneChangeCancel"
  130. />
  131. </AnimatedOverlay>
  132. </template>
  133. <style scoped lang="scss">
  134. @import './style/dialog-layout.scss';
  135. $main: #2cb7ca;
  136. ::v-deep {
  137. ::-webkit-scrollbar {
  138. /*滚动条整体样式*/
  139. width: 2px;
  140. }
  141. .highlight-text {
  142. color: $main;
  143. }
  144. .overlay-content {
  145. width: 100%;
  146. }
  147. .app-bottom-button {
  148. color: #fff;
  149. background-color: $main;
  150. padding: 4px 8px;
  151. border: none;
  152. font-size: 16px;
  153. border-radius: 4px;
  154. }
  155. }
  156. .mobile-leave-dialog {
  157. display: flex;
  158. align-items: flex-end; /* 内容置底 */
  159. }
  160. </style>