index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <div id="home">
  3. <!--已入驻-->
  4. <go-examine v-if="isExaime" />
  5. <!-- 第一步 未入驻 -->
  6. <go-enter
  7. :current-step="currentStep"
  8. :store-application-status="storeApplicationStatus"
  9. @update:current-step="handleUpdateCurrentStep"
  10. />
  11. <!-- 第二步
  12. @update:get-user-info="getUserInfo"-->
  13. <go-flow
  14. :current-step="currentStep"
  15. @update:current-step="handleUpdateCurrentStep"
  16. :store-application-status="storeApplicationStatus"
  17. />
  18. </div>
  19. </template>
  20. <script setup lang="ts">
  21. import { onMounted, ref, watch } from "vue";
  22. import { localGet, localSet } from "@/utils/index";
  23. import goEnter from "../home/components/go-enter.vue";
  24. import goFlow from "./go-flow.vue";
  25. import goExamine from "../home/components/go-examine.vue";
  26. import { getMerchantByPhone, getDetail } from "@/api/modules/homeEntry";
  27. import { is } from "@/utils/is";
  28. import { useAuthStore } from "@/stores/modules/auth";
  29. const authStore = useAuthStore();
  30. const isEntry = ref<boolean>(false);
  31. const isExaime = ref<boolean>(false);
  32. onMounted(() => {
  33. // getUserInfo();
  34. });
  35. // 当前步骤:0-首页,1-第一步,2-第二步
  36. const currentStep = ref(0);
  37. const storeId = ref<Number | undefined>(undefined);
  38. // 处理更新currentStep事件
  39. const handleUpdateCurrentStep = (step: number) => {
  40. currentStep.value = step;
  41. };
  42. let storeApplicationStatus = ref<number | undefined>(undefined);
  43. // const getUserInfo = async () => {
  44. // try {
  45. // const geekerUser = localGet("geeker-user");
  46. // if (!geekerUser || !geekerUser.userInfo || !geekerUser.userInfo.phone) {
  47. // console.error("用户信息不存在");
  48. // return;
  49. // }
  50. // let param = {
  51. // phone: geekerUser.userInfo.phone
  52. // };
  53. // const res: any = await getMerchantByPhone(param);
  54. // storeId.value = res.data.storeId;
  55. // if (res && res.code == 200 && res.data) {
  56. // // 更新缓存中的 storeId
  57. // geekerUser.userInfo.storeId = res.data.storeId;
  58. // localSet("geeker-user", geekerUser);
  59. // // 同时更新 createdId 缓存
  60. // if (res.data.storeId) {
  61. // localSet("createdId", res.data.storeId);
  62. // }
  63. // if (res.data.storeId == null) {
  64. // isEntry.value = true;
  65. // }
  66. // if (res.data.storeId != null) {
  67. // let param1 = {
  68. // id: res.data.storeId
  69. // };
  70. // const resStore: any = await getDetail(param1);
  71. // if (resStore && resStore.code == 200 && resStore.data) {
  72. // // storeApplicationStatus.value = resStore.data.storeApplicationStatus;
  73. // // // 如果是等待审核(0)或审核拒绝(2),且当前步骤为0,显示 go-enter 组件
  74. // // // 如果用户已经主动跳转到其他步骤,则不重置步骤
  75. // // if ((storeApplicationStatus.value == 0 || storeApplicationStatus.value == 2) && currentStep.value === 0) {
  76. // // currentStep.value = 0;
  77. // // }
  78. // if (resStore.data.storeApplicationStatus !== 1 && res.data.storeId != null) {
  79. // //storeId && storeDetail.storeApplicationStatus === 1
  80. // isEntry.value = true;
  81. // } else {
  82. // isExaime.value = true;
  83. // }
  84. // }
  85. // }
  86. // }
  87. // } catch (error) {
  88. // console.error(error);
  89. // }
  90. // };
  91. </script>
  92. <style scoped lang="scss"></style>