shmily1213 1 месяц назад
Родитель
Сommit
b6088d83d1

+ 16 - 0
src/api/modules/pay.ts

@@ -0,0 +1,16 @@
+import type { ApiResponse, Pay } from "@/types";
+import flyio from "../flyio";
+// @ts-ignore
+import qs from 'qs';
+
+export function getEcardPrices(params: any) {
+  return flyio.get('/front/ecard/getEcardPrices', params) as Promise<ApiResponse<Pay.EcardPrice[]>>;
+}
+
+export function createOrder(params: any) {
+  return flyio.post('/front/ecard/createOrder?' + qs.stringify(params)) as Promise<ApiResponse<Pay.CreateOrderResult>>;
+}
+
+export function queryOrder(orderId: string) {
+  return flyio.get('/front/ecard/getOrderPayStatus', { orderId }) as Promise<ApiResponse<Pay.OrderPayStatus>>;
+}

+ 10 - 2
src/api/modules/user.ts

@@ -1,6 +1,6 @@
 import flyio from "../flyio";
-import { ApiCaptchaResponse, ApiResponse, DictItem, ConfigItem, ApiResponseList } from "@/types";
-import { ClassItem, ClassListQueryDTO, SchoolItem, SchoolListQueryDTO, SmsRequestDTO, CardInfo } from "@/types/user";
+import type { ApiCaptchaResponse, ApiResponse, DictItem, ConfigItem, ApiResponseList, User } from "@/types";
+import type { ClassItem, ClassListQueryDTO, SchoolItem, SchoolListQueryDTO, SmsRequestDTO, CardInfo } from "@/types/user";
 
 /**
  * 验证会员卡
@@ -32,4 +32,12 @@ export function getSchoolList(params: SchoolListQueryDTO) {
  */
 export function getClassList(params: ClassListQueryDTO) {
   return flyio.get('/front/user/getClassList', params) as Promise<ApiResponse<ClassItem[]>>;
+}
+
+/**
+ * 
+ * @returns 获取用户绑定的卡信息
+ */
+export function getUserBindCard() {
+  return flyio.get('/front/user/getUserBindCard', {}) as Promise<ApiResponse<User.CardInfo>>;
 }

+ 8 - 14
src/components/ie-button/ie-button.vue

@@ -1,7 +1,8 @@
 <template>
   <button class="ie-button"
-    :class="['ie-button', `ie-button-${type}`, `ie-button-${size}`, customClass, { 'is-disabled': disabled, 'has-shadow': hasShadow }]"
+    :class="['ie-button', `ie-button-${type}`, `ie-button-${size}`, customClass, { 'is-disabled': disabled || loading, 'has-shadow': hasShadow }]"
     :disabled="disabled" hover-class="button-hover" :style="getStyle" @click="handleClick">
+    <uv-loading-icon v-if="loading" color="#FFFFFF" size="16"></uv-loading-icon>
     <slot></slot>
   </button>
 </template>
@@ -14,6 +15,7 @@ type Props = {
   customClass: string;
   round: number;
   shadow: boolean;
+  loading?: boolean
 }
 const props = withDefaults(defineProps<Props>(), {
   disabled: false,
@@ -21,7 +23,8 @@ const props = withDefaults(defineProps<Props>(), {
   size: 'large',
   customClass: '',
   round: 999,
-  shadow: true
+  shadow: true,
+  loading: false
 });
 const hasShadow = computed(() => {
   return props.shadow && props.type === 'primary';
@@ -41,7 +44,7 @@ const handleClick = () => {
   height: fit-content !important;
   line-height: 1;
   font-weight: 800;
-  @apply relative text-center;
+  @apply relative text-center flex items-center justify-center gap-10;
 }
 
 .has-shadow {
@@ -86,19 +89,10 @@ const handleClick = () => {
 }
 
 .is-disabled {
-  background: #f7f7f7;
-  color: rgba(0, 0, 0, 0.3);
-  box-shadow: none;
+  opacity: 0.8;
 }
 
-.button-hover {
-  // background: linear-gradient(to right, #2a8dde, #007ae5);
+.button-hover:not(.is-disabled) {
   @apply opacity-80;
 }
-
-.is-disabled:hover {
-  background: #f7f7f7;
-  color: rgba(0, 0, 0, 0.3);
-  box-shadow: none;
-}
 </style>

+ 11 - 4
src/components/ie-page/components/vip-popup.vue

@@ -8,7 +8,7 @@
           <text>权限</text>
         </view>
         <view class="mt-10 text-32 text-fore-light">开通会员,立即畅享专属权益与服务</view>
-        <!-- <ie-button custom-class="mt-60" @click="handleBuy">升级VIP权限</ie-button> -->
+        <ie-button custom-class="mt-60" @click="handleBuy">升级VIP权限</ie-button>
         <ie-button type="info" custom-class="mt-40" @click="handleActivate">已线下购买,去激活</ie-button>
       </view>
       <ie-image :is-oss="true" src="/study-bg14.png" custom-class="absolute bottom-0 left-0 w-full h-full z-0"
@@ -29,12 +29,19 @@ const close = () => {
 }
 const handleBuy = () => {
   close();
+  setTimeout(() => {
+    transferTo('/pagesSystem/pages/pay/pay', {
+      data: {}
+    });
+  }, 0);
 }
 const handleActivate = () => {
   close();
-  transferTo('/pagesSystem/pages/card-verify/card-verify', {
-    data: {}
-  });
+  setTimeout(() => {
+    transferTo('/pagesSystem/pages/card-verify/card-verify', {
+      data: {}
+    });
+  }, 0);
 }
 defineExpose({
   open,

+ 0 - 1
src/components/ie-page/ie-page.vue

@@ -47,7 +47,6 @@ const vipPopupRef = ref<InstanceType<typeof VipPopup>>();
 
 // 添加安全检查
 const showVipPopup = () => {
-  console.log('showVipPopup called, vipPopupRef.value:', vipPopupRef.value);
   if (vipPopupRef.value) {
     vipPopupRef.value.open();
   } else {

+ 27 - 0
src/hooks/useEnv.ts

@@ -0,0 +1,27 @@
+import { useAppStore } from "@/store/appStore";
+
+export const useEnv = () => {
+  const { sysInfo } = useAppStore();
+  const { uniPlatform } = sysInfo;
+  const platform = computed(() => {
+    if (uniPlatform === 'mp-weixin') {
+      return 'mp';
+    } else if (uniPlatform === 'web') {
+      return window?.platform || 'h5';
+    }
+  });
+  const isH5 = computed(() => platform.value === "h5");
+  const isWap2App = computed(() => platform.value === "wap2app");
+  const isMP = computed(() => platform.value === "mp");
+  const isAndroid = computed(() => sysInfo.platform.toLowerCase() == 'android')
+  const isIOS = computed(() => sysInfo.platform.toLowerCase() == 'ios')
+
+  return {
+    platform,
+    isH5,
+    isWap2App,
+    isMP,
+    isAndroid,
+    isIOS
+  }
+}

+ 239 - 0
src/hooks/usePay.ts

@@ -0,0 +1,239 @@
+import { createOrder, getEcardPrices, queryOrder } from "@/api/modules/pay";
+import { useEnv } from "./useEnv";
+import { usePayStore } from "@/store/payStore";
+import config from "@/config";
+import type { Pay } from "@/types";
+
+export const usePay = () => {
+  const { isH5, isWap2App, isMP } = useEnv();
+  const payStore = usePayStore();
+  const { price } = storeToRefs(payStore);
+  const ready = ref(false);
+  const loading = ref(false);
+  const outTradeNo = ref('');
+  const h5url = ref('');
+  const queryTimes = ref(10);
+  const callback = ref<Pay.OrderPayCallback>({});
+  let webview: PlusWebviewWebviewObject | HTMLIFrameElement | undefined = undefined;
+
+  const payType = computed(() => {
+    if (isH5.value || isWap2App.value) {
+      return undefined;
+    } else if (isMP.value) {
+      return 'jsapi'; // ???
+    }
+  });
+
+  const formatPrice = computed(() => {
+    return price.value / 100;
+  });
+  const getPrice = async () => {
+    const res = await getEcardPrices({});
+    const card = res.data?.at(0);
+    if (card) {
+      payStore.setPrice(card.price)
+      ready.value = true;
+    }
+  }
+  const pay = async () => {
+    loading.value = true;
+    uni.$ie.showLoading('支付中...');
+    try {
+      const { data } = await createOrder({
+        totalFee: price.value,
+        type: payType.value
+      });
+      uni.$ie.hideLoading();
+      console.log(data, 666)
+      // outTradeNo.value = data.outTradeNo;
+      // const no = outTradeNo.value.split('_')[1];
+      // if (no) {
+      //   payStore.setOrderId(Number(no));
+      // }
+      // h5url.value = data.h5url;
+      // if (outTradeNo && h5url) {
+      //   clearResultFrame()
+      //   webview = await createResultFrame(h5url.value);
+      // } else {
+      //   throw new Error('支付地址缺失');
+      // }
+    } catch (error) {
+      loading.value = false;
+      uni.$ie.showToast('下单失败,请稍后再试');
+    }
+  }
+
+  const queryPayStatus = () => {
+    if (payStore.orderId) {
+      return queryOrderStatus(payStore.orderId + '')
+    }
+    return null;
+  }
+
+  const queryOrderStatus = async (orderId: string) => {
+    try {
+      const { data } = await queryOrder(orderId);
+      if (!data) {
+        return null;
+      }
+      return data;
+    } catch (error) {
+      return null;
+    }
+  }
+  const checkOrderStatus = async () => {
+    const no = payStore.orderId;
+    if (no == null) {
+      return;
+    }
+    let queryCount = 0; // 当前查询次数
+    const queryInterval = 3000; // 查询间隔(毫秒)
+    let timerId: ReturnType<typeof setTimeout> | null = null;
+
+    /**
+     * 停止查询
+     */
+    const stopQuery = () => {
+      if (timerId) {
+        clearTimeout(timerId);
+        timerId = null;
+        clearResultFrame();
+      }
+      loading.value = false;
+      uni.$ie.hideLoading();
+    };
+
+    /**
+     * 执行查询
+     */
+    const query = async () => {
+      try {
+        queryCount++;
+        const data = await queryOrderStatus(no + '');
+        console.log(`checkOrderStatus: 第 ${queryCount} 次查询订单状态`);
+        console.log(JSON.stringify(data))
+        if (!data) {
+          console.error('checkOrderStatus: 查询结果为空');
+          stopQuery();
+          callback.value.onFailed?.();
+          return;
+        }
+
+        // 支付成功
+        if (data.isPaySuccess) {
+          console.log('checkOrderStatus: 支付成功');
+          stopQuery();
+          callback.value.onSuccess?.();
+          return;
+        }
+
+        // 支付失败
+        if (data.isPayFailed) {
+          console.log('checkOrderStatus: 支付失败');
+          stopQuery();
+          callback.value.onFailed?.();
+          return;
+        }
+
+        // 未支付状态
+        if (data.isUnPaid) {
+          // 如果已达到最大查询次数,回调失败
+          if (queryCount >= queryTimes.value) {
+            console.log(`checkOrderStatus: 已查询 ${queryTimes.value} 次,仍未支付,回调失败`);
+            stopQuery();
+            callback.value.onFailed?.();
+            return;
+          }
+
+          // 继续查询
+          timerId = setTimeout(() => {
+            query();
+          }, queryInterval);
+        } else {
+          // 未知状态,回调失败
+          console.error('checkOrderStatus: 未知的支付状态', data);
+          stopQuery();
+          callback.value.onFailed?.();
+        }
+      } catch (error) {
+        // 查询过程中发生错误,回调失败
+        console.error('checkOrderStatus: 查询订单状态失败', error);
+        stopQuery();
+        callback.value.onFailed?.();
+      }
+    };
+
+    // 开始第一次查询
+    uni.$ie.showLoading('支付查询中...')
+    query();
+  }
+
+  const createResultFrame = async (url: string) => {
+    if (isH5.value) {
+      await sleep()
+      const iframe = document.createElement('iframe');
+      const style = `width:0px;height:0px;position: absolute;opacity: 0;z-index: -1;outline:none;border:none;`;
+      iframe.setAttribute('style', style);
+      iframe.setAttribute('sandbox', 'allow-scripts allow-top-navigation allow-same-origin');
+      iframe.style.position = 'absolute';
+      iframe.src = url;
+      iframe.onload = () => checkOrderStatus()
+      iframe.onerror = () => console.error('Payment: iframe加载失败')
+      document.body.appendChild(iframe);
+      return iframe
+    } else if (isWap2App.value) {
+      const style: PlusWebviewWebviewStyles = {
+        webviewBGTransparent: true,
+        opacity: 0,
+        render: 'always',
+        zindex: -1,
+        width: '1px',
+        height: '1px',
+        top: '0px',
+        left: '0px',
+        additionalHttpHeaders: {
+          Referer: config.paySiteUrl,
+        }
+      };
+      const wv = plus.webview.create(url, 'wechatPayWebview', style);
+      wv.addEventListener('loaded', (e) => {
+        checkOrderStatus();
+      }, false);
+      wv.show();
+      return wv;
+    }
+  }
+
+  const clearResultFrame = () => {
+    const { isH5, isWap2App } = useEnv();
+    if (webview) {
+      if (isH5.value) {
+        document.body.removeChild(webview as HTMLIFrameElement)
+      } else if (isWap2App.value) {
+        (webview as PlusWebviewWebviewObject).close();
+      }
+      webview = undefined;
+    }
+  }
+
+  const sleep = (time: number = 300) => {
+    return new Promise(resolve => {
+      setTimeout(resolve, time);
+    });
+  }
+
+  const setCallback = (cb: Pay.OrderPayCallback) => {
+    callback.value = cb;
+  }
+
+  return {
+    getPrice,
+    price,
+    formatPrice,
+    ready,
+    pay,
+    loading,
+    setCallback,
+    queryPayStatus
+  }
+}

+ 6 - 0
src/pages.json

@@ -248,6 +248,12 @@
           "style": {
             "navigationBarTitleText": ""
           }
+        },
+        {
+          "path": "pages/pay/pay",
+          "style": {
+            "navigationBarTitleText": ""
+          }
         }
       ]
     },

+ 1 - 1
src/pagesMain/pages/index/components/index-guide.vue

@@ -70,7 +70,7 @@ const loadData = () => {
     newsList.value = res.rows;
   });
 }
-onShow(() => {
+onLoad(() => {
   loadData();
 });
 </script>

+ 1 - 1
src/pagesMain/pages/index/components/index-news.vue

@@ -29,7 +29,7 @@ const loadData = async () => {
   newsList.value = rows;
 }
 
-onShow(() => {
+onLoad(() => {
   loadData();
 });
 </script>

+ 10 - 12
src/pagesMain/pages/index/index.vue

@@ -73,8 +73,9 @@ const checkProvinceInfo = () => {
     popupRef.value.open();
   }
 }
-const checkTeacherInfo = async () => {
-  await userStore.checkInfoComplete();
+const checkInfo = async () => {
+  await userStore.checkInfoTeacherComplete();
+  await userStore.checkInfoStudentComplete();
 }
 const reloadUserInfo = async () => {
   if (userStore.isLogin) {
@@ -95,6 +96,13 @@ onPageScroll((e) => {
     scrollTop.value = e.scrollTop;
   }
 });
+onLoad(() => {
+  checkProvinceInfo();
+  if (userStore.isLogin) {
+    checkInfo();
+    userStore.getDirectedSchoolList();
+  }
+});
 onShow(() => {
   setTimeout(() => {
     uni.pageScrollTo({
@@ -102,18 +110,8 @@ onShow(() => {
       duration: 0
     });
   }, 0);
-  setTimeout(() => {
-    checkProvinceInfo();
-    checkTeacherInfo();
-    reloadUserInfo();
-  }, 500);
   isHide.value = false;
 });
-onLoad(() => {
-  if (userStore.isLogin) {
-    userStore.getDirectedSchoolList();
-  }
-});
 </script>
 
 <style lang="scss" scoped></style>

+ 7 - 9
src/pagesMain/pages/me/components/me-info.vue

@@ -48,6 +48,7 @@
 <script lang="ts" setup>
 import { useUserStore } from '@/store/userStore';
 import { useTransferPage } from '@/hooks/useTransferPage';
+import { OPEN_VIP_POPUP } from '@/types/injectionSymbols';
 
 const userStore = useUserStore();
 const { transferTo, routes } = useTransferPage();
@@ -59,6 +60,8 @@ const isStudent = computed(() => userStore.isStudent);
 const isLogin = computed(() => userStore.isLogin);
 const isExperienceVip = computed(() => userStore.isExperienceVip);
 const vipInfo = computed(() => userStore.vipInfo);
+const openVipPopup = inject(OPEN_VIP_POPUP);
+
 const roleDesc = computed(() => {
   if (isLogin.value && !isVip && !userStore.isStudent) {
     return '普通会员';
@@ -78,17 +81,12 @@ const roleDesc = computed(() => {
   return '普通会员';
 });
 
-const handleHeaderClick = async () => {
-  // 不询问直接跳转登录
-  const isLogin = await userStore.checkLogin({ askToLogin: false });
-  if (isLogin) {
-    setTimeout(async () => {
-      await userStore.checkInfoComplete();
-    }, 500)
-  }
+const handleHeaderClick = () => {
+  userStore.checkLogin({ askToLogin: false });
 }
 const handleVip = () => {
-  transferTo('/pagesSystem/pages/card-verify/card-verify')
+  // transferTo('/pagesSystem/pages/card-verify/card-verify')
+  openVipPopup?.();
 }
 
 const handleSettingClick = async () => {

+ 126 - 0
src/pagesSystem/pages/pay/pay.vue

@@ -0,0 +1,126 @@
+<template>
+  <ie-page bg-color="#F6F8FA">
+    <ie-navbar title="收银台" />
+    <view>
+      <view class="content">
+        <view class="money-info flex flex-col items-center justify-center">
+          <view class="">
+            <text class="unit">¥</text>
+            <text class="money">{{ formatPrice }}</text>
+          </view>
+          <view class="tip">待支付金额</view>
+        </view>
+        <view class="goods-info">
+          <view class="goods-info-item flex items-center justify-between">
+            <text class="tip">商品名称</text>
+            <text>会员卡</text>
+          </view>
+          <view class="goods-info-item flex items-center justify-between">
+            <text class="tip">商品金额</text>
+            <text>¥{{ formatPrice }}</text>
+          </view>
+        </view>
+      </view>
+      <view class="tip mt-[30px] px-[20px]">选择支付方式</view>
+      <view v-if="!isIOS" class="channel-list">
+        <uv-radio-group v-model="payType" placement="column" iconPlacement="right" shape="square" size="24"
+          iconSize="18">
+          <uv-radio :name="payType">
+            <view class="flex items-center" slot="label">
+              <image class="channel-icon" mode="widthFix" src="@/static/image/wechat-pay.png" />
+              <text>微信支付</text>
+            </view>
+          </uv-radio>
+        </uv-radio-group>
+      </view>
+      <view class="btn-wrap">
+        <ie-button type="primary" :loading="loading" @click="handlePay">{{ `确认支付 ¥${formatPrice}` }}</ie-button>
+      </view>
+    </view>
+  </ie-page>
+</template>
+<script lang="ts" setup>
+import { usePay } from '@/hooks/usePay';
+import { useUserStore } from '@/store/userStore';
+
+const userStore = useUserStore();
+const { ready, formatPrice, pay, setCallback, loading } = usePay();
+const isIOS = ref(false);
+const payType = ref('wechat');
+
+const handlePay = () => {
+  loading.value = true
+  setCallback({
+    onSuccess: () => {
+      uni.$ie.showSuccess('支付成功');
+      setTimeout(async () => {
+        userStore.checkInfoStudentComplete();
+      }, 300);
+    },
+    onFailed: () => {
+      uni.$ie.showError('支付失败');
+    }
+  });
+  pay();
+}
+</script>
+<style lang="scss" scoped>
+.content {
+  padding: 0 20px;
+}
+
+.money-info {
+  padding: 30px 0;
+}
+
+.unit {
+  font-size: 20px;
+}
+
+.money {
+  font-size: 48px;
+  font-weight: bold;
+  letter-spacing: 2px;
+}
+
+.tip {
+  color: #7c7c7c;
+  font-size: 15px;
+}
+
+.goods-info {
+  margin-bottom: 26px;
+}
+
+.goods-info-item {
+  &+& {
+    margin-top: 10px;
+  }
+}
+
+.channel-list {
+  margin: 10px 10px 0 10px;
+  border-radius: 12px;
+  background-color: #ffffff;
+  padding: 12px;
+}
+
+.u-radio+.u-radio {
+  margin-top: 10px;
+}
+
+.u-radio:last-child {
+  border-bottom: none !important;
+}
+
+.channel-icon {
+  width: 40px;
+  height: 40px;
+  margin-right: 8px;
+}
+
+.btn-wrap {
+  margin-top: 50px;
+  padding: 0 20px;
+}
+</style>

BIN
src/static/image/wechat-pay.png


+ 1 - 2
src/store/appStore.ts

@@ -15,8 +15,7 @@ export const useAppStore = defineStore('ie-app', {
       activeTabbar: 0,
       statusBarHeight: 0,
       systemInfo: null as UniApp.GetSystemInfoResult | null,
-      appConfig: [] as ConfigItem[],
-      platform: 'web'
+      appConfig: [] as ConfigItem[]
     }
   },
   getters: {

+ 20 - 0
src/store/payStore.ts

@@ -0,0 +1,20 @@
+export const usePayStore = defineStore('ie-pay', {
+  state: () => ({
+    price: 468000,
+    orderId: null as number | null
+  }),
+  actions: {
+    setPrice(price: number) {
+      this.price = price;
+    },
+    setOrderId(id: number | null) {
+      this.orderId = id;
+    }
+  },
+  persist: {
+    storage: {
+      getItem: uni.getStorageSync,
+      setItem: uni.setStorageSync,
+    }
+  }
+});

+ 53 - 9
src/store/userStore.ts

@@ -3,11 +3,13 @@ import { useTransferPage } from '@/hooks/useTransferPage';
 import { getUserInfo, logoutPhysical } from '@/api/modules/login';
 import config from '@/config';
 import type { Study, UserStoreState } from '@/types';
-import { UserInfo, VipCardInfo } from '@/types/user';
+import type { UserInfo, VipCardInfo } from '@/types/user';
 import tools from '@/utils/uni-tool';
 import defaultAvatar from '@/static/personal/avatar_default.png'
-import { CardType, EnumExamType, EnumReviewMode, EnumUserType } from '@/common/enum';
+import { CardType, EnumBindScene, EnumExamType, EnumReviewMode, EnumUserType } from '@/common/enum';
 import { getDirectedSchool, saveDirectedSchool } from '@/api/modules/study';
+import { usePay } from '@/hooks/usePay';
+import { getUserBindCard } from '@/api/modules/user';
 
 const themeColor = '#31A0FC';
 type CheckLoginOptions = {
@@ -183,7 +185,12 @@ export const useUserStore = defineStore('ie-user', {
         resolve(true);
       });
     },
-    checkInfoComplete() {
+
+    /**
+     * 检查老师是否完善信息
+     * @returns 
+     */
+    checkInfoTeacherComplete() {
       return new Promise((resolve, reject) => {
         if (this.needCompleteInfo && (!this.userInfo.location || !this.userInfo.examType || !this.userInfo.endYear)) {
           const { transferTo } = useTransferPage();
@@ -197,6 +204,41 @@ export const useUserStore = defineStore('ie-user', {
         }
       });
     },
+    /**
+     * 检查学生是否需要完善信息
+     * @returns 
+     */
+    checkInfoStudentComplete(): Promise<boolean> {
+      const { queryPayStatus } = usePay();
+      return new Promise(async (resolve, reject) => {
+        const payResult = await queryPayStatus();
+        if (payResult && payResult.isPaySuccess) {
+          const { data } = await getUserBindCard();
+          if (data && data.cardNo && data.password) {
+            const submitInfo = {
+              token: this.accessToken,
+              scene: EnumBindScene.LOGIN_BIND,
+              userInfo: this.userInfo,
+              cardInfo: data,
+              registerInfo: {
+                username: data.cardNo,
+                password: data.password,
+              }
+            };
+            const { transferTo } = useTransferPage();
+            transferTo('/pagesSystem/pages/bind-profile/bind-profile', {
+              data: submitInfo
+            }).then(res => {
+              resolve(res as boolean);
+            }).catch(() => {
+              resolve(false);
+            });
+          }
+        } else {
+          resolve(false);
+        }
+      });
+    },
     async getUserInfo() {
       const res = await getUserInfo();
       const { data, isDefaultModifyPwd, isPasswordExpired, card, org } = res;
@@ -211,6 +253,8 @@ export const useUserStore = defineStore('ie-user', {
       if (org) {
         this.org = org;
       }
+      const { getPrice } = usePay();
+      getPrice();
       return data;
     },
     /**
@@ -265,12 +309,12 @@ export const useUserStore = defineStore('ie-user', {
       this.org = {
         ...config.defaultOrg,
       };
-      // const { transferTo } = useTransferPage();
-      // setTimeout(() => {
-      //   transferTo('/pagesMain/pages/index/index', {
-      //     type: 'reLaunch'
-      //   })
-      // }, 300);
+      const { transferTo, routes } = useTransferPage();
+      setTimeout(() => {
+        transferTo(routes.pageIndex, {
+          type: 'reLaunch'
+        });
+      }, 0);
     },
     deleteAccount() {
       uni.$ie.showLoading('注销中...');

+ 2 - 2
src/types/index.ts

@@ -10,10 +10,11 @@ import * as Voluntary from "./voluntary";
 import * as Dropdown from "./dropdown";
 import * as University from "./university";
 import * as TestCenter from "./test-center";
+import * as Pay from "./pay";
 import { VipCardInfo } from "./user";
 import { EnumExamMode, EnumExamType, EnumReviewMode } from "@/common/enum";
 
-export { Study, User, News, Transfer, System, Major, Career, Tree, Voluntary, Dropdown, University, TestCenter };
+export { Study, User, News, Transfer, System, Major, Career, Tree, Voluntary, Dropdown, University, TestCenter, Pay };
 
 /// 接口响应
 export interface ApiResponse<T> {
@@ -77,7 +78,6 @@ export interface AppStoreState {
   statusBarHeight: number;
   systemInfo: UniApp.GetSystemInfoResult | null;
   appConfig: ConfigItem[];
-  platform: string;
 }
 
 export interface DictStoreState {

+ 26 - 0
src/types/pay.ts

@@ -0,0 +1,26 @@
+export interface EcardPrice {
+  id: number;
+  price: number;
+  location: string;
+  outTime: string;
+  examType: string;
+  createdAt: string;
+  updatedAt: string;
+}
+
+export interface CreateOrderResult {
+  h5url: string;
+  outTradeNo: string;
+}
+
+export interface OrderPayStatus {
+  isUnPaid: boolean;
+  isPayFailed: boolean;
+  isPaySuccess: boolean;
+}
+
+export interface OrderPayCallback {
+  onSuccess?: () => void;
+  onFailed?: () => void;
+  onUnpaid?: () => void;
+}