From 4b5d26e0f1bd3195078081c1dfe891c8fa3760ab Mon Sep 17 00:00:00 2001 From: zhx Date: Wed, 24 Jun 2026 16:31:13 +0800 Subject: [PATCH] =?UTF-8?q?yumi=20=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/api.js | 5 +++++ recharge/index.html | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/common/api.js b/common/api.js index 09b0270..b76f483 100644 --- a/common/api.js +++ b/common/api.js @@ -882,6 +882,11 @@ var default_api = 'https://api.global-interaction.com/'; if (isYumiWebPay()) { return mapYumiOptions( Object.assign({}, options, { + pay_country_id: + query.payCountryId || + options.pay_country_id || + options.payCountryId || + '', country_code: query.countryCode || options.country_code, }) diff --git a/recharge/index.html b/recharge/index.html index 0f2a7e5..4182429 100644 --- a/recharge/index.html +++ b/recharge/index.html @@ -2266,19 +2266,32 @@ function selectPayCountryFromConfig(context) { var configured = selectedConfiguredPayCountry(context); if (configured) { + var resolved = payCountryFromContext( + context, + configured.country_code || configured.countryCode + ); + // app JSON 只控制国家和支付方式是否展示;后台 payCountryId 必须从账号 context 的国家映射里取, + // 否则 Yumi 这类旧下单接口会在商品已展示后因为 payCountryId 为空被参数校验拦截。 state.selectedPayCountryID = configured.pay_country_id || configured.payCountryId || configured.id || + resolved.pay_country_id || + resolved.payCountryId || + resolved.id || ''; state.selectedCountryCode = String( configured.country_code || configured.countryCode || + resolved.country_code || + resolved.countryCode || '' ).toUpperCase(); state.selectedCurrencyCode = configured.currency_code || configured.currencyCode || + resolved.currency_code || + resolved.currencyCode || state.selectedCurrencyCode || ''; return configured; @@ -2351,6 +2364,36 @@ : []; } + function payCountryFromContext(context, countryCode) { + var countries = + (context && + (context.country_list || context.countryList)) || + []; + var normalizedCountryCode = String(countryCode || '') + .trim() + .toUpperCase(); + if (!normalizedCountryCode || !countries.length) { + return {}; + } + return ( + countries.find(function (item) { + return ( + String( + item.country_code || + item.countryCode || + firstValue(item.country || {}, [ + 'alphaTwo', + 'alpha_two', + 'countryCode', + 'country_code', + ]) || + '' + ).toUpperCase() === normalizedCountryCode + ); + }) || {} + ); + } + function userCountryCodeFromContext(context) { context = context || {}; var account = (context && context.account) || {};