bind-card.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <mx-submit-layout :button-text="buttonText" :bar-options="barOptions" :loading="loading" @submit="handleSubmit">
  3. <template #prepend>
  4. <activate-steps/>
  5. </template>
  6. <activate-steps-form ref="form"/>
  7. <template v-if="step==0" #suffix>
  8. <view class="border-0 !border-b border-solid border-primary">
  9. <uv-text type="primary" suffix-icon="shopping-cart" align="center"
  10. icon-style="font-size: 20px; color:var(--primary-color);"
  11. text="还没有卡?去购卡" @click="showBuyPopup"/>
  12. </view>
  13. </template>
  14. </mx-submit-layout>
  15. </template>
  16. <script setup>
  17. import {ref} from 'vue'
  18. import {useTransfer} from "@/hooks/useTransfer";
  19. import {useProvideActivateSteps} from "@/pages/login/components/hooks/useActivateStepsInjection";
  20. import {fnPlaceholder} from "@/utils/uni-helper";
  21. import ActivateSteps from "@/pages/login/components/activate-steps.vue";
  22. import ActivateStepsForm from "@/pages/login/components/activate-steps-form.vue";
  23. import {useSingletonBuyVip} from "@/hooks/useSingletonComponent";
  24. const {relaunch} = useTransfer()
  25. const form = ref(null)
  26. const {loading, buttonText, step, completed} = useProvideActivateSteps()
  27. const barOptions = {
  28. title: '绑定会员卡',
  29. leftClickBlock: async () => {
  30. // 因为用户进入这个绑卡页是有预期的,
  31. // 所以这里的逻辑与bind-profile页面是不一样的
  32. if (completed.value) {
  33. relaunch()
  34. return new Promise(fnPlaceholder)
  35. }
  36. }
  37. }
  38. // methods
  39. const handleSubmit = () => {
  40. form.value.next()
  41. }
  42. const showBuyPopup = () => {
  43. const popup = useSingletonBuyVip()
  44. popup.open()
  45. }
  46. </script>
  47. <style lang="scss">
  48. </style>