diff --git a/src/utils/datas.ts b/src/utils/datas.ts index 5a40054..3d79f6a 100644 --- a/src/utils/datas.ts +++ b/src/utils/datas.ts @@ -46,9 +46,10 @@ export const { accountTypeMap } = { /** * 支付宝/微信 授权地址/环境判断 */ -export const { isWx, wxAuthUrl, zfbAuthUrl, zfbAuthMiniUrl } = { +export const { isWx, wxAuthUrlHB, wxAuthUrlLJJ, zfbAuthUrl, zfbAuthMiniUrl } = { isWx: navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1, - wxAuthUrl: 'https://utils.85938.cn/utils/v1/wechat/oauth/bale', + wxAuthUrlHB: 'https://openapi.1688sup.com/wechat/oauth?payment_subject=bale', // 红包 + wxAuthUrlLJJ: 'https://openapi.1688sup.com/wechat/oauth', // 立减金 zfbAuthUrl: 'https://openapi.1688sup.com/alipay/oauth', zfbAuthMiniUrl: 'alipays://platformapi/startapp?appId=2021004100663111', }; diff --git a/src/utils/empower.ts b/src/utils/empower.ts index d0aab27..95dd703 100644 --- a/src/utils/empower.ts +++ b/src/utils/empower.ts @@ -1,5 +1,5 @@ import { copyFn } from "@/utils/methods"; -import { isWx, wxAuthUrl, zfbAuthUrl, zfbAuthMiniUrl } from "@/utils/datas"; +import { isWx, wxAuthUrlHB, wxAuthUrlLJJ, zfbAuthUrl, zfbAuthMiniUrl } from "@/utils/datas"; import { GET_WXSCHEMA } from "@/router/api"; /** @@ -15,17 +15,24 @@ export async function channelJudge (channel: number, mode: number, judgeData?: a if (id) { // 单品 url = url + `&id=${id}`; } + if (group_id) { // 组合商品 - url = url + `&group_id=${group_id}&ids=${JSON.stringify(ids)}`; + url = url + `&group_id=${group_id}&ids=${JSON.stringify(ids)}&goodType=${type}`; } - const openid = localStorage.getItem('openid'); - if (openid) { - url = url + `&openid=${openid}`; + // 组合商品 存在 红包/立减金 支付宝/微信 切换兑换(复制链接)的情况 + const openidHB = localStorage.getItem('openidHB'); + const openidLJJ = localStorage.getItem('openidLJJ'); + if (openidHB) { + url = url + `&openidHB=${openidHB}`; + } + if (openidLJJ) { + url = url + `&openidLJJ=${openidLJJ}`; } const alipayuserid = localStorage.getItem('alipayuserid'); if (alipayuserid) { url = url + `&alipayuserid=${alipayuserid}`; } + const backLink = encodeURIComponent(url); if (channel === 1 && mode === 1) { // 支付宝-官方领取 区分商品类型:1 红包 支付宝小程序;3 立减金 支付宝授权 const ua = navigator.userAgent.toLowerCase(); @@ -80,9 +87,11 @@ export async function channelJudge (channel: number, mode: number, judgeData?: a showToast(res?.message || '请求失败') } } else { - if (!localStorage.getItem('openid')) { - // 微信进入未获取到 openid - location.replace(`${wxAuthUrl}?jump=${backLink}`); + if (!localStorage.getItem('openidHB') && [1].includes(type)) { // 红包 + location.replace(`${wxAuthUrlHB}&jump=${backLink}`); + } + if (!localStorage.getItem('openidLJJ') && [3].includes(type)) { // 立减金 + location.replace(`${wxAuthUrlLJJ}?jump=${backLink}`); } } } else { diff --git a/src/views/home.vue b/src/views/home.vue index 84e72db..3f5a9d4 100644 --- a/src/views/home.vue +++ b/src/views/home.vue @@ -6,7 +6,7 @@