Pārlūkot izejas kodu

fix: 修正 openBusinessView businessType 为 wxpayScoreUse

官方文档规定 businessType 必须为 'wxpayScoreUse',
extraData 仅需 package 参数,无需 mch_id。
之前写成了 'payscore',微信无法识别,导致静默失败。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
skyline 2 nedēļas atpakaļ
vecāks
revīzija
ed3055f8a1
1 mainītis faili ar 4 papildinājumiem un 9 dzēšanām
  1. 4 9
      haha-mp/src/pages/index/index.vue

+ 4 - 9
haha-mp/src/pages/index/index.vue

@@ -87,7 +87,6 @@ const authReady = ref(false)
 const authBusy = ref(false)
 const authDeviceId = ref('')
 const authPackage = ref('')
-const authMchId = ref('')
 
 onShow(() => {
   const token = getToken()
@@ -161,7 +160,6 @@ const prepareAuth = async (deviceId: string) => {
 
     authDeviceId.value = deviceId;
     authPackage.value = result.package;
-    authMchId.value = result.mchId || '';
     authReady.value = true;
   } catch (error: any) {
     uni.hideLoading();
@@ -181,26 +179,23 @@ const invokePayScore = () => {
   if (authBusy.value) return;
   authBusy.value = true;
 
-  const mchId = authMchId.value;
   const pkg = authPackage.value;
 
-  logger.log('[支付分] invokePayScore - mchId:', mchId, 'package 长度:', pkg?.length);
+  logger.log('[支付分] invokePayScore, package 长度:', pkg?.length);
 
-  // 确保所有参数有效
-  if (!pkg || !mchId) {
+  if (!pkg) {
     authBusy.value = false;
     uni.showModal({
       title: '参数异常',
-      content: 'package 或 mchId 为空,请重新扫码',
+      content: 'package 为空,请重新扫码',
       showCancel: false,
     });
     return;
   }
 
   wx.openBusinessView({
-    businessType: 'payscore',
+    businessType: 'wxpayScoreUse',
     extraData: {
-      mch_id: mchId,
       package: pkg,
     },
     success: () => {