From ebc8cfa3cb74b6a8a88d0979816dd8e364f4d940 Mon Sep 17 00:00:00 2001 From: zhouyanli <593579392@qq.com> Date: Sat, 25 Jul 2026 16:30:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=94=AF=E4=BB=98=E9=A1=B5?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- property-uniapp-project/manifest.json | 4 +- .../pageSubPack/api/request.js | 2 +- .../payment-list/arrearsPayment.vue | 53 +++++------ .../payment-list/propertyFeePayment.vue | 90 ++++++++++--------- 4 files changed, 74 insertions(+), 75 deletions(-) diff --git a/property-uniapp-project/manifest.json b/property-uniapp-project/manifest.json index 7c4eb7a..a8cac23 100644 --- a/property-uniapp-project/manifest.json +++ b/property-uniapp-project/manifest.json @@ -2,8 +2,8 @@ "name" : "花开物业", "appid" : "__UNI__29C3D60", "description" : "智慧社区居民端面向小区业主使用,支持注册、验证码、账号密码多种登录方式,提供密码找回功能,账号使用安全便捷。支持多小区切换,首页设有轮播 banner、社区公告,集成远程开门、生活缴费、在线报修、访客邀请、社区活动常用服务。全服务板块统一涵盖门禁开门、线上缴费、报修申报、访客预约、投诉反馈、问卷调研、活动报名、社区公示、一键联系物业功能。个人中心可管理房屋、住户、车位、车辆信息,支持更换手机号、修改密码、消息通知设置、版本更新及账号退出,一站式满足业主居家生活、社区服务、房产车辆管理需求,实现社区生活数字化、便捷化。", - "versionName" : "1.0.1", - "versionCode" : 114, + "versionName" : "1.0.2", + "versionCode" : 115, "transformPx" : false, "uniCloud" : { "provider" : "aliyun", diff --git a/property-uniapp-project/pageSubPack/api/request.js b/property-uniapp-project/pageSubPack/api/request.js index 641207a..397effd 100644 --- a/property-uniapp-project/pageSubPack/api/request.js +++ b/property-uniapp-project/pageSubPack/api/request.js @@ -1,6 +1,6 @@ let baseUrl = ''; if (process.env.NODE_ENV === 'development') { - baseUrl = 'http://192.168.1.6:8080'; // 开发环境 + baseUrl = 'http://192.168.1.222:8085'; // 开发环境 // baseUrl = 'http://wuyeapi.ckdzkj.com'; } else { baseUrl = 'https://wuyeapi.ckdzkj.com'; // 生产环境 diff --git a/property-uniapp-project/pageSubPack/payment-list/arrearsPayment.vue b/property-uniapp-project/pageSubPack/payment-list/arrearsPayment.vue index 8c37964..79ed863 100644 --- a/property-uniapp-project/pageSubPack/payment-list/arrearsPayment.vue +++ b/property-uniapp-project/pageSubPack/payment-list/arrearsPayment.vue @@ -191,14 +191,15 @@ const res = await getBankMiniProgramParams({ acct: uni.getStorageSync('userId'), - orderType: '20', + orderType: '10', orderAmount: String(Math.round(Number(amount) * 100)), // orderAmount: String(Math.round(Number(arrearsAmount.value) * 100)), deviceCode: paymentItem.deviceCode || '', deviceType: mappedDeviceType, billId: paymentItem.billId || '', residentUserId: uni.getStorageSync('userId'), - goodName: paymentItem.name || '' + goodName: paymentItem.name || switchStatus(paymentItem.type) || '', + remark:'服务费' }) uni.hideLoading() @@ -220,20 +221,13 @@ return } - // 解析 extraData(后端返回可能是字符串或对象) - /* let extraDataObj = extraData - if (typeof extraData === 'string') { - try { - extraDataObj = JSON.parse(extraData) - } catch (e) { - console.error('extraData JSON解析失败,使用空对象', e) - extraDataObj = {} - } - } - if (!extraDataObj || typeof extraDataObj !== 'object') { - extraDataObj = {} - } - console.log('解析-----extraDataObj', extraDataObj) */ + // 把支付金额和token拼接到 extraData 查询字符串中传入中间小程序,实现免登录 + const token = uni.getStorageSync('token') || '' + const payAmountStr = String(payAmount.value) + const orderAmountStr = String(Math.round(Number(amount) * 100)) + const custId = uni.getStorageSync('custId') || '' + const extraDataWithAmount = extraData + '&payAmount=' + encodeURIComponent(payAmountStr) + '&orderAmount=' + encodeURIComponent(orderAmountStr) + '&token=' + encodeURIComponent(token) + '&custId=' + encodeURIComponent(custId) + console.log('传入中间小程序的extraData:', extraDataWithAmount) // #ifdef APP-PLUS // 原生App:通过微信SDK拉起小程序 plus.share.getServices((services) => { @@ -247,25 +241,24 @@ return } - + weixin.launchMiniProgram({ - id: 'gh_4ba5e4fdaa83', - // appId:'00004951', - type: 1, // 0=正式版 1=测试版 2=预览版 - path: path, - // extMsg: JSON.stringify({ extraData: extraData }) - extraData: extraData + id: 'gh_a765aef0172c', + // appId: 'wx40625124315d2de1', + type:1, // 0 正式版 / 1测试版 / 2预览版 + path: 'pageSubPack/payment-list/arrearsPayment', + extraData: extraDataWithAmount, }, (res) => { console.log('ress-------------',res) - if (res.retCode === 'SUCCESS') { - console.log('成功拉起日照银行小程序(App)', res.retCode) - } else { - console.log('拉起日照银行小程序返回失败(App======)', res.retMsg) - } + // if (res.retCode === 'SUCCESS') { + // console.log('成功拉起日照银行小程序(App)', res.retCode) + // } else { + // console.log('拉起日照银行小程序返回失败(App======)', res.retMsg) + // } - console.log('回调---日照银行小程序回调结果(App)', JSON.stringify(res)) + console.log('回调---回调结果(App)', JSON.stringify(res)) }, (err) => { - console.error('拉起日照银行小程序失败(App)', JSON.stringify(err)) + console.error('err---拉起失败(App)', JSON.stringify(err)) uni.showToast({ title: '拉起支付小程序失败', icon: 'none' }) }) }) diff --git a/property-uniapp-project/pageSubPack/payment-list/propertyFeePayment.vue b/property-uniapp-project/pageSubPack/payment-list/propertyFeePayment.vue index 2ab3b48..3b25d95 100644 --- a/property-uniapp-project/pageSubPack/payment-list/propertyFeePayment.vue +++ b/property-uniapp-project/pageSubPack/payment-list/propertyFeePayment.vue @@ -114,7 +114,6 @@ if (options && options.referrerInfo && options.referrerInfo.extraData) { const extraData = options.referrerInfo.extraData if (extraData.retCode === 'SUCCESS') { - currentStep.value = 2 sendPaySuccessPush() uni.redirectTo({ url: '/pageSubPack/payment-list/addPaymentSuccess?type=pay' @@ -154,23 +153,25 @@ // 立即缴费 — 通过微信拉起日照银行小程序进行支付 const handlePay = async () => { + const amount = arrearsAmount.value try { uni.showLoading({ title: '加载中...' }) // 设备类型映射:物业费→3,车位费→4,垃圾处理费→5 const deviceTypeMap = { '物业费': '3', '车位费': '4', '垃圾处理费': '5' } - const mappedDeviceType = deviceTypeMap[switchStatus(paymentItem.type)] || '' + const mappedDeviceType = deviceTypeMap[switchStatus(paymentItem.type)] || paymentItem.deviceType || '' const res = await getBankMiniProgramParams({ acct: uni.getStorageSync('userId'), - orderType: '20', - orderAmount: String(Math.round(Number(payAmount.value) * 100)), + orderType: '10', + orderAmount: String(Math.round(Number(amount) * 100)), deviceCode: paymentItem.deviceCode || '', deviceType: mappedDeviceType, billId: paymentItem.billId || '', residentUserId: uni.getStorageSync('userId'), - goodName: paymentItem.name || '' + goodName: paymentItem.name || switchStatus(paymentItem.type) || '', + remark:'服务费' }) uni.hideLoading() @@ -180,7 +181,6 @@ return } console.log('resres返回数据', res) - console.log('resres', res.data) const { appId, path, extraData } = res.data console.log('navigateToMiniProgram参数:', { appId, path, extraData }) @@ -192,20 +192,16 @@ return } - // 解析 extraData(后端返回可能是字符串或对象) - let extraDataObj = extraData - if (typeof extraData === 'string') { - try { - extraDataObj = JSON.parse(extraData) - } catch (e) { - console.error('extraData JSON解析失败,使用空对象', e) - extraDataObj = {} - } - } - if (!extraDataObj || typeof extraDataObj !== 'object') { - extraDataObj = {} - } - + // 把 extraData 对象和支付金额、token拼成查询字符串传入中间小程序,实现免登录 + const token = uni.getStorageSync('token') || '' + const payAmountStr = String(payAmount.value) + const orderAmountStr = String(Math.round(Number(amount) * 100)) + // extraData 是对象,先转为 query string 再拼接额外参数 + const extraDataStr = typeof extraData === 'object' && extraData !== null + ? Object.keys(extraData).map(k => encodeURIComponent(k) + '=' + encodeURIComponent(extraData[k])).join('&') + : (extraData || '') + const extraDataWithAmount = extraDataStr + '&payAmount=' + encodeURIComponent(payAmountStr) + '&orderAmount=' + encodeURIComponent(orderAmountStr) + '&token=' + encodeURIComponent(token) + console.log('传入中间小程序的extraData:', extraDataWithAmount) // #ifdef APP-PLUS // 原生App:通过微信SDK拉起小程序 plus.share.getServices((services) => { @@ -218,13 +214,23 @@ uni.showToast({ title: '当前微信版本太低,不支持拉起小程序', icon: 'none' }) return } + + weixin.launchMiniProgram({ - id: appId, - type: 0, // 0=正式版 1=测试版 2=预览版 - path: path || '', - extraData: extraDataObj - }, () => { - console.log('成功拉起日照银行小程序(App)') + id: 'gh_a765aef0172c', + // appId: 'wx40625124315d2de1', + type:1, // 0 正式版 / 1测试版 / 2预览版 + path: 'pageSubPack/payment-list/arrearsPayment', + extraData: extraData, + }, (res) => { + console.log('ress-------------',res) + // if (res.retCode === 'SUCCESS') { + // console.log('成功拉起日照银行小程序(App)', res.retCode) + // } else { + // console.log('拉起日照银行小程序返回失败(App======)', res.retMsg) + // } + + console.log('回调---日照银行小程序回调结果(App)', JSON.stringify(res)) }, (err) => { console.error('拉起日照银行小程序失败(App)', JSON.stringify(err)) uni.showToast({ title: '拉起支付小程序失败', icon: 'none' }) @@ -232,22 +238,22 @@ }) // #endif - // #ifdef MP-WEIXIN - // 微信小程序:直接navigateToMiniProgram - uni.navigateToMiniProgram({ - appId: appId, - path: path || '', - extraData: extraDataObj, - envVersion: 'develop', - success: () => { - console.log('成功拉起日照银行小程序(微信)') - }, - fail: (err) => { - console.error('拉起日照银行小程序失败(微信)', JSON.stringify(err)) - uni.showToast({ title: err.errMsg || err.msg || '拉起支付小程序失败', icon: 'none' }) - } - }) - // #endif + // // #ifdef MP-WEIXIN + // // 微信小程序:直接navigateToMiniProgram + // uni.navigateToMiniProgram({ + // appId: appId, + // path: path || '', + // extraData: extraData, + // envVersion: 'develop', + // success: () => { + // console.log('成功拉起日照银行小程序(微信)') + // }, + // fail: (err) => { + // console.error('拉起日照银行小程序失败(微信)', JSON.stringify(err)) + // uni.showToast({ title: err.errMsg || err.msg || '拉起支付小程序失败', icon: 'none' }) + // } + // }) + // // #endif } catch (err) { uni.hideLoading() console.error('获取支付参数异常', err)