zhengyiming
2025-03-27 55c03f35a31979aefd46aead13a145c9b293e6d8
packages/components/src/hooks/selectPayType.ts
@@ -9,14 +9,14 @@
import Taro from '@tarojs/taro';
type UseSelectPayTypeOptions = {
  openId?: MaybeRef<string>;
  isInWeChat?: MaybeRef<boolean>;
  isH5?: MaybeRef<boolean>;
  appId?: MaybeRef<string>;
  getOpenId?: MaybeRef<() => Promise<string>>;
};
export function useSelectPayType(options: UseSelectPayTypeOptions = {}) {
  const { openId, isInWeChat, isH5, appId } = options;
  const { isInWeChat, isH5, appId, getOpenId } = options;
  const { blLifeRecharge } = useLifeRechargeContext();
@@ -98,10 +98,12 @@
  async function getPayOrderForJsAPI(orderNo: string) {
    try {
      const _getOpenId = unref(getOpenId);
      const openId = await _getOpenId();
      let params: GetPayOrderForJsAPIInput = {
        orderNo: orderNo,
        lifePayType: blLifeRecharge.constants.LifePayTypeEnum.WxPay,
        openId: unref(openId),
        openId: openId,
        attach: Date.now().toString(),
        payAppId: unref(appId),
      };
@@ -117,9 +119,7 @@
      let res = await getPayOrderForJsAPI(orderNo);
      if (res) {
        //@ts-ignore
        if (WeixinJSBridge) {
          //@ts-ignore
          WeixinJSBridge.invoke(
            'getBrandWCPayRequest',
            {
@@ -169,7 +169,7 @@
  const { blLifeRecharge } = useLifeRechargeContext();
  useQuery({
    queryKey: ['platformServicePayServices/getPayStatusByOrderNo', orderNo],
    queryKey: ['blLifeRecharge/getPayStatusByOrderNo', orderNo],
    queryFn: async () => {
      return await blLifeRecharge.services.getPayStatusByOrderNo(
        {