From 661aaa874a1c5becc985087e911485472acab5ac Mon Sep 17 00:00:00 2001 From: ch Date: Tue, 12 Jul 2022 11:37:54 +0800 Subject: [PATCH] =?UTF-8?q?jsapi=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.js | 15 +++------- src/pages/wapPay.vue | 67 +++++++++++++++++++++++++++++++++----------- 2 files changed, 55 insertions(+), 27 deletions(-) diff --git a/src/main.js b/src/main.js index 0fbc4b5..b12df68 100644 --- a/src/main.js +++ b/src/main.js @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-07-08 11:46:30 * @LastEditors: ch - * @LastEditTime: 2022-07-12 10:57:40 + * @LastEditTime: 2022-07-12 11:09:38 * @Description: file content */ @@ -20,7 +20,7 @@ if (ua.includes('micromessenger')) { const openId = localStorage.getItem('payOpenId'); if (!openId) { let query = FormatSearchJson(window.location.search); - + // 通过订单No获取APPID ApiGetOrderInfo({ payOrderNo: query.payOrderNo }).then(({ result }) => { const appid = result.prepayWxApp.prepayAppId; if (query.code) { @@ -29,25 +29,18 @@ if (ua.includes('micromessenger')) { appid }).then(({ error, result }) => { if (error) { - // uni.$u.toast(error.message); return false; } - localStorage.setItem('payOpenId', result.openId); + localStorage.setItem('payOpenId', result.openId); }) } else { - ApiGetAuthUrl({ appid, redirectUrl: window.location.href, scope: 'snsapi_base' }).then(({ result, error }) => { if (error) { - // uni.$u.toast(error.message); - uni.showToast({ - title: error.message, - icon: 'none', - duration: 2000 - }) + uni._$oast(error.message) return false; } window.location.replace(result); diff --git a/src/pages/wapPay.vue b/src/pages/wapPay.vue index 8c4bc85..8e81a35 100644 --- a/src/pages/wapPay.vue +++ b/src/pages/wapPay.vue @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-07-08 11:46:30 * @LastEditors: ch - * @LastEditTime: 2022-07-09 18:34:53 + * @LastEditTime: 2022-07-12 11:37:13 * @Description: file content -->