From a8e3d1f875da1bdea27989edeaedb82b313df558 Mon Sep 17 00:00:00 2001 From: zhouyanli <593579392@qq.com> Date: Thu, 4 Jun 2026 17:42:29 +0800 Subject: [PATCH] =?UTF-8?q?=E9=93=B6=E8=81=94=E6=94=AF=E4=BB=98=E9=9B=86?= =?UTF-8?q?=E6=88=90=E5=92=8C=E8=B4=AD=E4=B9=B0=E6=8F=92=E4=BB=B6=EF=BC=9B?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A6=96=E9=A1=B5=E5=B0=8F=E5=8C=BA=E6=9B=B4?= =?UTF-8?q?=E6=94=B9=E5=90=8E=E8=8E=B7=E5=8F=96=E6=95=B0=E6=8D=AE=EF=BC=9B?= =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E6=88=91=E7=9A=84=E4=BF=A1=E6=81=AF=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- property-uniapp-project/manifest.json | 28 +- .../pageSubPack/api/apiSub.js | 22 +- .../pageSubPack/my/settingIndex.vue | 148 +++++++- .../pageSubPack/notice-list/oneClickOpen.vue | 14 +- .../payment-list/addHydropower.vue | 14 +- .../payment-list/arrearsPayment.vue | 342 +++++------------- .../pageSubPack/payment-list/paymentIndex.vue | 67 ++-- .../pageSubPack/visitor/visitor-add.vue | 8 +- property-uniapp-project/pages.json | 6 + property-uniapp-project/pages/index/index.vue | 47 ++- .../pages/myIndex/myIndex.vue | 37 +- 11 files changed, 409 insertions(+), 324 deletions(-) diff --git a/property-uniapp-project/manifest.json b/property-uniapp-project/manifest.json index 3ccf8e9..eb416c6 100644 --- a/property-uniapp-project/manifest.json +++ b/property-uniapp-project/manifest.json @@ -3,7 +3,7 @@ "appid" : "__UNI__29C3D60", "description" : "物业用户端app", "versionName" : "1.0.1", - "versionCode" : "103", + "versionCode" : 105, "transformPx" : false, /* 5+App特有相关 */ "app-plus" : { @@ -23,7 +23,9 @@ "Camera" : {}, "Contacts" : {}, "Gallery" : {}, - "Push" : {} + "Push" : {}, + "Barcode" : {}, + "Payment" : {} }, /* 应用发布信息 */ "distribute" : { @@ -48,7 +50,8 @@ "", "", "" - ] + ], + "schemes" : "" }, /* ios打包配置 */ "ios" : { @@ -56,7 +59,9 @@ "privacyDescription" : { "NSPhotoLibraryUsageDescription" : "需要访问您的相册,用于选择图片上传", "NSPhotoLibraryAddUsageDescription" : "保存二维码图片到相册" - } + }, + "urltypes" : "uppaylyhuts", + "urlschemewhitelist" : "uppaywallet,uppaysdk,uppayx1,uppayx2,uppayx3,paesuperbank,ccbmbsylunionpay,bocom,bankabc,cmbmobilebank,cmblife,com.icbc.iphoneclient,spdbbank,spdbcccUnionPay,citicbankpay,credit,uppayxingyecredit,uppayhuaxiacredit,uppaybeijingcredit,uppayzhonghangcredit,uppayguangdacredit,uppaygonghangcredit,uppayjianhangcredit,uppayjiaohangcredit,uppayguangfa,psbccashier,uppayyouchucredit,com.cebbank.ebank,BankOfShangHai,boscgdlf,citicbankdkkj,cmbc,cibmb,bocmbankpsn,bankofbjpay,uppaynonghangcredit,uppayhuaxia,zytuppay,LZYHSJYHAUTHSSOAPP,bnbpay,dlrcb,czbank,uppayCbhb" }, /* SDK配置 */ "sdkConfigs" : { @@ -89,7 +94,20 @@ "UniversalLinks" : "" } }, - "payment" : {} + "payment" : { + "appleiap" : {}, + "alipay" : { + "__platform__" : [ "ios", "android" ] + }, + "unionpay" : { + "__platform__" : [ "ios", "android" ] + }, + "weixin" : { + "__platform__" : [ "ios", "android" ], + "appid" : "", + "UniversalLinks" : "" + } + } } } }, diff --git a/property-uniapp-project/pageSubPack/api/apiSub.js b/property-uniapp-project/pageSubPack/api/apiSub.js index 382909a..c2ba05b 100644 --- a/property-uniapp-project/pageSubPack/api/apiSub.js +++ b/property-uniapp-project/pageSubPack/api/apiSub.js @@ -136,8 +136,7 @@ export const getTopUpSelectByResident = (data) => { } // 绑定设备 export const getTopUpBindDevice = (data) => { - return post(`/api/topUp/bindDevice/${data.deviceCode}/${data.residentUserId}/${data.openid}/${data.deviceType}`, - data) + return post(`/api/topUp/bindDevice/${data.deviceCode}/${data.residentUserId}/${data.deviceType}`, data) } // 充值调用 // /${data.rechargeAmount}/${data.type}/${data.deviceCode} @@ -148,9 +147,9 @@ export const getopenIdByCode = (data) => { return get(`/api/topUp/getOpenIdByCode?code=${data.code}`, data) } -// 微信支付调用 -export const getToWxPay = (data) => { - return post(`/api/topUp/wxPay/${data.orderId}/${data.openid}`, data) +// 银联支付下单 +export const getUnionPayTn = (data) => { + return post('/api/topUp/unionPay/getTn', data) } // 缴费记录查询 export const getTopupRecordWithStat = (data) => { @@ -223,3 +222,16 @@ export const getParkingDetail = (data) => { export const rebindCar = (data) => { return post(`/ResidentCarAreaManage/rebind`, data) } + +// 查询版本信息 +export const getAppVersion = (platform, channel) => { + return get(`/api/app/version/${platform}/${channel}`) +} +// 检查是否需要更新 +export const checkAppUpdate = (data) => { + return post(`/api/app/checkUpdate`, data) +} +// 记录更新日志 +export const postUpdateLog = (data) => { + return post(`/api/app/updateLog`, data) +} diff --git a/property-uniapp-project/pageSubPack/my/settingIndex.vue b/property-uniapp-project/pageSubPack/my/settingIndex.vue index 301b2aa..66428a5 100644 --- a/property-uniapp-project/pageSubPack/my/settingIndex.vue +++ b/property-uniapp-project/pageSubPack/my/settingIndex.vue @@ -39,12 +39,14 @@ onPullDownRefresh } from '@dcloudio/uni-app' import { - authLogout, getUserProfile, getUserNotify, changeUserNotify + authLogout, getUserProfile, getUserNotify, changeUserNotify, getAppVersion, checkAppUpdate, postUpdateLog } from '/pageSubPack/api/apiSub.js' // const statusBarHeight = ref(20) const cacheSize = ref(0) + const currentVersion = ref('1.0.0') + const currentVersionCode = ref(1) const settingList = ref([{ title: '更改手机号码', type: 'text', @@ -67,11 +69,142 @@ { title: '升级版本', type: 'text', - value: '当前版本 2.9.8', + value: '当前版本 1.0.0', valueClass: 'item-version' } ]) + // 格式化字节大小 + const formatSize = (bytes) => { + if (!bytes || bytes === 0) return '0B' + const k = 1024 + const sizes = ['B', 'KB', 'M', 'G'] + const i = Math.floor(Math.log(bytes) / Math.log(k)) + return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + sizes[i] + } + + // 获取真实缓存大小 + const getCacheSizeData = () => { + return new Promise((resolve) => { + // #ifdef APP-PLUS + // App 端获取完整缓存(含图片、文件等) + plus.cache.calculate((size) => { + resolve(formatSize(size)) + }) + // #endif + // #ifndef APP-PLUS + // 小程序/H5 端只能获取 storage 缓存 + const info = uni.getStorageInfoSync() + const size = (info.currentSize || 0) * 1024 // currentSize 单位 KB + resolve(formatSize(size)) + // #endif + }) + } + + // 获取当前运行版本号 + const initCurrentVersion = () => { + // #ifdef APP-PLUS + currentVersion.value = plus.runtime.version || '1.0.0' + currentVersionCode.value = plus.runtime.versionCode || 1 + // #endif + // #ifndef APP-PLUS + const manifest = uni.getAppAuthorizeSetting ? uni.getAppAuthorizeSetting() : null + if (manifest && manifest.version) { + currentVersion.value = manifest.version + } + // #endif + settingList.value[4].value = '当前版本 ' + currentVersion.value + } + + // 版本号比较:v1 > v2 返回 1,v1 = v2 返回 0,v1 < v2 返回 -1 + const compareVersion = (v1, v2) => { + const arr1 = v1.split('.').map(Number) + const arr2 = v2.split('.').map(Number) + const len = Math.max(arr1.length, arr2.length) + for (let i = 0; i < len; i++) { + const n1 = arr1[i] || 0 + const n2 = arr2[i] || 0 + if (n1 > n2) return 1 + if (n1 < n2) return -1 + } + return 0 + } + + // 检查版本更新 + const checkVersionUpdate = async () => { + uni.showLoading({ title: '检查中...', mask: true }) + try { + const systemInfo = uni.getSystemInfoSync() + const platform = systemInfo.platform === 'ios' ? 'ios' : 'android' + const channel = 'resident' + + // 1. 查询最新版本 + const versionRes = await getAppVersion(platform, channel) + if (versionRes.code === 200 && versionRes.data) { + const latestVersion = versionRes.data.versionName || '' + const latestVersionCode = versionRes.data.versionCode || 0 + + // 2. 调 checkAppUpdate 检查是否需要更新 + const checkRes = await checkAppUpdate({ + platform: platform, + channel: channel, + currentVersionCode: currentVersionCode.value + }) + uni.hideLoading() + + if (checkRes.code === 200 && checkRes.data) { + const needUpdate = checkRes.data.needUpdate !== false + if (needUpdate) { + const updateType = checkRes.data.updateType || versionRes.data.updateType || 'optional' + const isForce = updateType === 'force' + uni.showModal({ + title: isForce ? '强制更新' : '发现新版本', + content: `当前版本:${currentVersion.value}\n最新版本:${latestVersion}${versionRes.data.releaseNotes || versionRes.data.updateDesc ? '\n\n更新内容:' + (versionRes.data.releaseNotes || versionRes.data.updateDesc) : ''}`, + showCancel: !isForce, + confirmText: '立即更新', + cancelText: '稍后', + success: (modalRes) => { + if (modalRes.confirm && versionRes.data.downloadUrl) { + // 记录更新日志 + const userId = uni.getStorageSync('userId') + if (userId) { + postUpdateLog({ + userId: userId, + platform: platform, + fromVersion: currentVersionCode.value, + toVersion: latestVersionCode + }) + } + // #ifdef APP-PLUS + plus.runtime.openURL(versionRes.data.downloadUrl) + // #endif + // #ifndef APP-PLUS + uni.showToast({ title: '请在应用商店更新', icon: 'none' }) + // #endif + } else if (isForce && !modalRes.confirm) { + // 强制更新时用户点取消,退出应用 + // #ifdef APP-PLUS + plus.runtime.quit() + // #endif + } + } + }) + } else { + uni.showToast({ title: '已是最新版本', icon: 'success' }) + } + } else { + uni.showToast({ title: '检查失败', icon: 'none' }) + } + } else { + uni.hideLoading() + uni.showToast({ title: '检查失败', icon: 'none' }) + } + } catch (err) { + uni.hideLoading() + uni.showToast({ title: '检查失败', icon: 'none' }) + } + } + // const onItemClick = (item) => { if (item.title == '更改手机号码') { @@ -84,7 +217,10 @@ }); } else if (item.title == '清除缓存') { uni.clearStorageSync(); - settingList.value[3].value = '0M' + // #ifdef APP-PLUS + plus.cache.clear(() => {}) + // #endif + settingList.value[3].value = '0B' uni.showLoading({ title: '清除中...', mask: true @@ -98,6 +234,8 @@ setTimeout(() => { uni.hideLoading(); }, 2500); + } else if (item.title == '升级版本') { + checkVersionUpdate() } } @@ -166,7 +304,9 @@ }); } - onMounted(() => { + onMounted(async () => { + initCurrentVersion() + settingList.value[3].value = await getCacheSizeData() getUserProfile().then(res => { if (res.code === 200 && res.data) { const phone = res.data.phone || '' diff --git a/property-uniapp-project/pageSubPack/notice-list/oneClickOpen.vue b/property-uniapp-project/pageSubPack/notice-list/oneClickOpen.vue index 901000e..5823e5d 100644 --- a/property-uniapp-project/pageSubPack/notice-list/oneClickOpen.vue +++ b/property-uniapp-project/pageSubPack/notice-list/oneClickOpen.vue @@ -124,13 +124,22 @@ const openDoorClick = () => { // }) // return // } - getAccessOpenData() + uni.showToast({ + title: '正在对接硬件中...', + icon: 'none' + }) + // getAccessOpenData() } // 开门接口 const getAccessOpenData = async () =>{ + uni.showLoading({ + title: '开门中...', + mask: true + }) try{ let params = {deviceId:selectedDoor.value} const res = await getAccessOpen(params) + uni.hideLoading() if(res.code === 200){ uni.showToast({ title:'开门成功', @@ -141,8 +150,9 @@ const getAccessOpenData = async () =>{ title:'开门失败', icon:"error" }) - } + } }catch(err){ + uni.hideLoading() uni.showToast({ title: err.msg || '开门失败', icon:"none" diff --git a/property-uniapp-project/pageSubPack/payment-list/addHydropower.vue b/property-uniapp-project/pageSubPack/payment-list/addHydropower.vue index e5456ef..df21f75 100644 --- a/property-uniapp-project/pageSubPack/payment-list/addHydropower.vue +++ b/property-uniapp-project/pageSubPack/payment-list/addHydropower.vue @@ -10,7 +10,7 @@ + :src="paymentType=='水费'?'https://wuyeadmin.bugtc.com/images/propertyImgs/water.png':'https://wuyeadmin.bugtc.com/images/propertyImgs/electric.png'"> {{paymentType}} @@ -175,10 +175,18 @@ // return // } const openid = uni.getStorageSync('openid') + // if (!openid) { + // uni.hideLoading() + // uni.showToast({ + // title: '获取用户信息失败,请重新登录', + // icon: 'none' + // }) + // return + // } await getTopUpBindDevice({ - deviceType: paymentType.value=='物业费A'?'2':'1', + deviceType: paymentType.value=='水费'?'2':'1', deviceCode: deviceNo.value, - openid: openid, + // openid: openid, residentUserId: uni.getStorageSync('userId') }) uni.hideLoading() diff --git a/property-uniapp-project/pageSubPack/payment-list/arrearsPayment.vue b/property-uniapp-project/pageSubPack/payment-list/arrearsPayment.vue index 27c29a9..e2e1cf7 100644 --- a/property-uniapp-project/pageSubPack/payment-list/arrearsPayment.vue +++ b/property-uniapp-project/pageSubPack/payment-list/arrearsPayment.vue @@ -44,8 +44,13 @@ ¥ - - + @@ -57,7 +62,6 @@ - @@ -98,29 +102,18 @@