diff --git a/huakai-app/App.vue b/huakai-app/App.vue
index 13d0db7..87de236 100644
--- a/huakai-app/App.vue
+++ b/huakai-app/App.vue
@@ -1,73 +1,50 @@
diff --git a/huakai-app/pageSubPack/api/api.js b/huakai-app/pageSubPack/api/api.js
index 9a9f54f..5edfddd 100644
--- a/huakai-app/pageSubPack/api/api.js
+++ b/huakai-app/pageSubPack/api/api.js
@@ -1,141 +1,22 @@
-import request,{get,post,upload} from "./request.js"
-
+import request, { get, post } from "./request.js"
// =======账号密码登录========
-export const getLoginPassword = (data) =>{
- return post('/api/resident/auth/loginByPassword',data)
+export const getLoginPassword = (data) => {
+ return post('/api/resident/auth/loginByPassword', data)
}
-// 注册新用户获取验证码
-export const getSendCode = (data) =>{
- return post('/api/resident/auth/sendSmsCode',data)
+// 获取验证码
+export const getSendCode = (data) => {
+ return post('/api/resident/auth/sendSmsCode', data)
}
// 注册新用户
-export const getRegisterUser = (data) =>{
- return post('/api/resident/auth/register',data)
+export const getRegisterUser = (data) => {
+ return post('/api/resident/auth/register', data)
}
// 短信验证码登录
-export const getLoginBySms = (data) =>{
- return post('/api/resident/auth/loginBySms',data)
+export const getLoginBySms = (data) => {
+ return post('/api/resident/auth/loginBySms', data)
}
// 忘记密码接口
-export const getResetPassword = (data) =>{
- return post('/api/resident/auth/resetPassword',data)
+export const getResetPassword = (data) => {
+ return post('/api/resident/auth/resetPassword', data)
}
-// =========首页=======
-// 获取bannar图
-export const getBannarList = (data) =>{
- return get('/resident/banner',data)
-}
-// 首页最新公告
-export const getNoticeLatest = () =>{
- return get('/api/resident/notice/latest')
-}
-
-// 查询已认证的小区
-export const getVillageList = (data) =>{
- return get('/api/resident/village/myList', data)
-}
-// 获取当前小区
-export const getCurrentVillage = () =>{
- return get('/api/resident/village/current')
-}
-// 切换小区
-export const getVillageSwitch = (data)=>{
- return post('/api/resident/village/switch',data)
-}
-// 首页最新活动列表
-export const getActivitylatest = () =>{
- return get('/api/resident/activity/latest')
-}
-
-// ========公告列表======
-// 获取公告列表
-export const getNoticeList = (data) =>{
- return get('/api/resident/notice/list',data)
-}
-// 获取公告详情
-export const getNoticeDetails = (noticeId) =>{
- return get(`/api/resident/notice/${noticeId}`)
-}
-// =========键开门===============
-// 查询门禁列表
-export const getAccessDevices = (data) =>{
- return get("/api/resident/access/devices",data)
-}
-// 确认开门
-export const getAccessOpen = (data) =>{
- return post("/api/resident/access/open",data)
-}
-// ==========活动列表===========
-// 获取活动列表
-export const getActivityList = (data) =>{
- return get("/api/resident/activity/list",data)
-}
-// 获取活动列表详情
-export const getActivityDetails = (id) =>{
- return get(`/api/resident/activity/${id}`)
-}
-// 确认报名
-export const confirmResident = (id) =>{
- return post(`/api/resident/activity/${id}/apply`)
-}
-// 取消报名
-export const cancelActivity = (id) =>{
- return post(`/api/resident/activity/${id}/cancel`)
-}
-// =========我的活动========
-export const getMyActivityList = (data) =>{
- return get("/api/resident/activity/my",data)
-}
-// ===========活动实况============
-// 活动实况列表
-export const getActivityLive = (id) =>{
- return get(`/api/resident/activity/${id}/live`)
-}
-// 添加实况
-export const addActivityLive = (id, data) =>{
- return post(`/api/resident/activity/${id}/live`, data)
-}
-// 签到
-export const signinActivityLive = (id, data) =>{
- return post(`/api/resident/activity/${id}/signin`, data)
-}
-// ==============在线报修========
-// 添加报修工单
-export const addQueryRepair = (data) =>{
- return post("/repairOrder/addRepair",data)
-}
-// 获取公共维修项目列表
-export const getRepairProjectList = (data) =>{
- return get("/repairOrder/list",data)
-}
-// 获取报修列表
-export const getQueryRepair = (data) =>{
- return get("/repairOrder/queryRepair",data)
-}
-// 获取房屋列表
-export const getHouseList = (data) =>{
- return get('/api/resident/my/house/list',data)
-}
-// 报修详情
-export const getRepairDetail = (data) =>{
- return get('/repairOrder/queryRepairDetail',data)
-}
-// =========访客邀请===========
-// 获取访客列表
-export const getVisitorList = (data) =>{
- return get('/api/visitor/list',data)
-}
-// 获取详情信息
-export const getVisitorDetail = (id) =>{
- return get(`/api/visitor/${id}`)
-}
-// 新增访客
-export const addVisitorData = (data) =>{
- return post("/api/visitor", data)
-}
-
-// 上传单张图片
-export const uploadFile = (filePath) => {
- return upload(filePath,'/api/resident/file/uploadImage');
-}
\ No newline at end of file
diff --git a/huakai-app/pageSubPack/api/apiSub.js b/huakai-app/pageSubPack/api/apiSub.js
index 382909a..11bcc80 100644
--- a/huakai-app/pageSubPack/api/apiSub.js
+++ b/huakai-app/pageSubPack/api/apiSub.js
@@ -1,135 +1,16 @@
import request, {
get,
- post,
- deleteMethod,
- putMethod
+ post
} from "./request.js"
+// ======= 缴费相关 API =======
+
// 字典
export const getSystemDictData = (data) => {
return get('/system/dict/data/list', data)
}
-// =======公告列表========
-export const getResidentNoticeList = (data) => {
- return get('/api/resident/notice/list', data)
-}
-// 我的房屋列表
-export const getMyHouseList = (data) => {
- return get('/api/resident/my/house/list', data)
-}
-// 提交房屋注册认证申请
-export const myHouseApply = (data) => {
- return post('/api/resident/my/house/apply', data)
-}
-// 查询小区列表
-export const getVillageList = (data) => {
- return get('/api/resident/village/list', data)
-} // 查询楼栋列表
-export const getHouseBuildings = (data) => {
- return get('/api/resident/house/buildings', data)
-}
-// 查询单元列表
-export const getHouseUnits = (data) => {
- return get('/api/resident/house/units', data)
-}
-// 查询楼层列表
-export const getHouseFloors = (data) => {
- return get('/api/resident/house/floors', data)
-}
-// 查询户号列表
-export const getHouseHouses = (data) => {
- return get('/api/resident/house/houses', data)
-}
-// 房屋绑定手机获取验证码
-export const getHouseAuthSendSmsCode = (data) => {
- return post('/api/resident/auth/sendSmsCode', data)
-}
-// 房屋详情
-export const getMyHouseDetail = (data) => {
- return get(`/api/resident/my/house/${data.id}`, data)
-}
-// 删除房屋
-export const deleteMyHouse = (data) => {
- return deleteMethod(`/api/resident/my/house/${data.id}`, data)
-}
-// 设置默认房屋
-export const setMyHouseDefault = (data) => {
- return post(`/api/resident/my/house/default`, data)
-}
-// 获取当前用户登录信息
-export const getUserProfile = (data) => {
- return get(`/api/resident/user/profile`, data)
-}
-// 发送新手机号验证码
-export const getAuthSendSmsCode = (data) => {
- return post(`/api/resident/auth/sendSmsCode`, data)
-}
-// 更改手机号
-export const getUserChangePhone = (data) => {
- return post(`/api/resident/user/changePhone`, data)
-}
-// 获取消息通知开关
-export const getUserNotify = (data) => {
- return get(`/api/resident/user/notify`, data)
-}
-// 更新消息通知开关
-export const changeUserNotify = (data) => {
- return post(`/api/resident/user/notify`, data)
-} // 修改密码(需登录)
-export const authChangePassword = (data) => {
- return post(`/api/resident/auth/changePassword`, data)
-} // 退出登录
-export const authLogout = (data) => {
- return post(`/api/resident/auth/logout`, data)
-}
-// 编辑房屋
-export const upDateMyHouse = (data) => {
- return putMethod(`/api/resident/my/house/${data.id}`, data)
-
-}
-
-// =========问卷调查=========
-// 问卷列表
-export const getQuestionnaireList = (data) => {
- return get('/api/resident/questionnaire/list',data)
-}
-// 问卷详情
-export const getQuestionnaireDetail = (data) => {
- return get('/api/resident/questionnaire/myAnswers',data)
-}
-// 提交问卷
-export const submitQuestionnair = (id,data) => {
- return post(`/api/resident/questionnaire/${id}/submit`, data)
-}
-// =====投诉意见=======
-// 获取投诉类型
-export const getComplainType = () => {
- return get('/complain/getComplainType')
-}
-// 获取投诉列表
-export const getComplainList = (data) => {
- return get('/complain/getComplainList',data)
-}
-// 提交投诉建议
-export const addComplain = (data) => {
- return post('/complain/add',data)
-}
-// 投诉详情
-export const getComplainDetail = (data) => {
- return get('/complain/detail',data)
-}
-// 联系物业
-export const getManagePhoneData = (data) => {
- return get('/api/manage/banner/getManagePhone',data)
-}
-
-// 修改身份证照片
-export const uploadFileUploadImage = (data) => {
- return post(`/api/resident/file/uploadImage`, data)
-}
-
-// 水电表
+// 查询水电表列表
export const getTopUpSelectByResident = (data) => {
console.log(data);
return get(`/api/topUp/selectByResident/${data.residentUserId}`, data)
@@ -139,18 +20,21 @@ export const getTopUpBindDevice = (data) => {
return post(`/api/topUp/bindDevice/${data.deviceCode}/${data.residentUserId}/${data.openid}/${data.deviceType}`,
data)
}
-// 充值调用
-// /${data.rechargeAmount}/${data.type}/${data.deviceCode}
+// 充值下单
export const getTopUp = (data) => {
return post(`/api/topUp`, data)
}
+// 获取 openid
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)
+// 保存 openid
+export const postInsertOpenId = (data) => {
+ return post(`/api/resident/auth/insertOpenId`, data)
+}
+// 日照银行支付参数获取
+export const getToRizhaoPay = (data) => {
+ return post(`/api/topUp/rizhaoPay/${data.orderId}/${data.openid}`, data)
}
// 缴费记录查询
export const getTopupRecordWithStat = (data) => {
@@ -158,68 +42,7 @@ export const getTopupRecordWithStat = (data) => {
`/api/topUp/topupRecordWithStat?residentUserId=${data.residentUserId}&pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
data)
}
-export const postInsertOpenId = (data) => {
- return post(`/api/resident/auth/insertOpenId`, data)
-}
+// 微信订阅消息授权保存
export const postSubscribeAuth = (data) => {
return post(`/api/wx/subscribeAuth/auth`, data)
}
-
-// 添加车辆
-export const postCar = (data) => {
- return post(`/api/resident/car`, data)
-}
-// 修改车辆
-export const putCar = (data) => {
- return putMethod(`/api/resident/car`, data)
-}
-
-// 获取车辆列表
-export const getMyCarList = (data) => {
- return get(`/api/resident/car/myList`, data)
-}
-// 获取车位列表
-export const getCarList = (data) => {
- return get(`/api/resident/car/list`, data)
-}
-// 获取车辆详细信息
-export const getCarDetail = (data) => {
- return get(`/api/resident/car/${data.id}`, data)
-}
-// 删除车辆信息
-export const deleteCar = (data) => {
- return deleteMethod(`/api/resident/car/${data.carId}`, data)
-}
-// 获取用户车位绑定列表
-export const getUserParkingSpaceList = (data) => {
- return get(`/api/resident/car/parking/list`, data)
-}
-
-// 获取区域列表
-export const getResidentCarAreaManageAreaListByVillageId = (data) => {
- return get(`/ResidentCarAreaManage/areaListByVillageId`, data)
-}
-// 根据区域id获得车位列表
-export const getResidentCarAreaManageParkingListByAreaId = (data) => {
- return get(`/ResidentCarAreaManage/parkingListByAreaId`, data)
-}
-// 绑定车位
-export const postCarBind = (data) => {
- return post(`/api/resident/car/bind`, data)
-}
-// 获取用户下车位绑定信息
-// export const getCarList = (data) => {
-// return get(`/api/resident/car/list`, data)
-// }
-// 删除车位
-export const deleteParking = (data) => {
- return deleteMethod(`/ResidentCarAreaManage/parking/${data.parkingId}`, data)
-}
-// 车位详情
-export const getParkingDetail = (data) => {
- return get(`/api/resident/car/parking/detail/${data.id}`, data)
-}
-// 解绑车辆
-export const rebindCar = (data) => {
- return post(`/ResidentCarAreaManage/rebind`, data)
-}
diff --git a/huakai-app/pageSubPack/api/appLaunch.js b/huakai-app/pageSubPack/api/appLaunch.js
new file mode 100644
index 0000000..4c68bc9
--- /dev/null
+++ b/huakai-app/pageSubPack/api/appLaunch.js
@@ -0,0 +1,78 @@
+/**
+ * App 跳转参数处理
+ * 花开物业 App 通过 path query string 将 token、支付参数传入本中间小程序。
+ *
+ * App 传入示例:
+ * pageSubPack/payment-list/arrearsPayment?token=xxx&userId=xxx&payAmount=10&acct=xxx&custId=xxx&sign=xxx&...
+ */
+
+const STORAGE_KEY = 'app_launch_payment_data'
+
+/**
+ * 从启动参数中获取 App 传入的全部数据(支付参数 + token + userId)
+ */
+export function captureAppLaunchData(onShowOptions) {
+ let data = null
+
+ const tryGetData = (options, label) => {
+ if (!options) return null
+ console.log(label, JSON.stringify(options))
+ if (options.query && Object.keys(options.query).length > 0) {
+ return options.query
+ }
+ if (options?.referrerInfo?.extraData) {
+ return options.referrerInfo.extraData
+ }
+ return null
+ }
+
+ // 冷启动
+ try {
+ data = tryGetData(wx.getLaunchOptionsSync?.() || {}, '冷启动')
+ } catch (e) { console.error('getLaunchOptionsSync 失败:', e) }
+
+ // 热启动
+ if (!data) {
+ data = tryGetData(onShowOptions, '热启动')
+ }
+
+ if (data && (data.payAmount || data.acct || data.custId)) {
+ // 恢复登录态
+ if (data.token) {
+ uni.setStorageSync('token', data.token)
+ console.log('已恢复 token')
+ }
+ if (data.userId) {
+ uni.setStorageSync('userId', data.userId)
+ console.log('已恢复 userId')
+ }
+
+ uni.setStorageSync(STORAGE_KEY, data)
+ console.log('已存储 App 支付数据:', JSON.stringify(data))
+ return data
+ }
+
+ return null
+}
+
+/** 检查是否已登录(token 存在) */
+export function isLoggedIn() {
+ return !!uni.getStorageSync('token')
+}
+
+/** 获取 App 传入的支付数据 */
+export function getAppPaymentData() {
+ try { return uni.getStorageSync(STORAGE_KEY) || null } catch (e) { return null }
+}
+
+/** 清除 */
+export function clearAppPaymentData() {
+ uni.removeStorageSync(STORAGE_KEY)
+}
+
+/** 组装 paymentItem */
+export function buildPaymentItemFromApp(appData) {
+ if (!appData) return null
+ const amount = Number(appData.payAmount || 0).toFixed(2)
+ return { ...appData, type: '缴费', rechargeAmount: amount }
+}
diff --git a/huakai-app/pageSubPack/api/request.js b/huakai-app/pageSubPack/api/request.js
index 0d29659..4f26c03 100644
--- a/huakai-app/pageSubPack/api/request.js
+++ b/huakai-app/pageSubPack/api/request.js
@@ -83,31 +83,3 @@ export default function request(url, data = {}, method = "GET") {
export const get = (url, data = {}) => request(url, data, 'GET');
export const post = (url, data) => request(url, data, 'POST');
-export const deleteMethod = (url, data) => request(url, data, 'DELETE');
-export const putMethod = (url, data) => request(url, data, 'PUT');
-
-// 上传
-export const upload = (filePath, url) => {
- return new Promise((resolve, reject) => {
- uni.uploadFile({
- url: baseUrl + url,
- filePath: filePath,
- name: 'file',
- header: {
- "Authorization": "Bearer " + (uni.getStorageSync("token") || ''),
- "clientid": "resident"
- },
- success: (res) => {
- try {
- const data = JSON.parse(res.data);
- resolve(data.data || ''); // 直接返回图片地址
- } catch (e) {
- resolve('');
- }
- },
- fail: (err) => {
- reject(err);
- }
- });
- });
-};
diff --git a/huakai-app/pageSubPack/api/useImageUpload.js b/huakai-app/pageSubPack/api/useImageUpload.js
deleted file mode 100644
index 497d1ff..0000000
--- a/huakai-app/pageSubPack/api/useImageUpload.js
+++ /dev/null
@@ -1,190 +0,0 @@
-// 服务器地址(与 request.js 保持一致)
-const baseUrl = 'http://192.168.0.239:8080';
-
-/**
- * 图片上传 Hook
- * 支持 uniapp 和微信小程序
- * 解决编辑回显后重新上传的问题
- */
-
-import { reactive } from 'vue'
-
-/**
- * @param {Object} options 配置
- * @param {string} options.uploadUrl - 上传接口地址
- * @param {string} options.fileKey - 上传文件的字段名,默认 'file'
- * @returns {Object}
- */
-export function useImageUpload(options = {}) {
- const {
- uploadUrl = '/api/resident/file/uploadImage',
- fileKey = 'file'
- } = options
-
- // 使用 reactive 对象存储所有状态
- const state = reactive({
- // 当前显示的图片(前端展示用,支持 base64/blob URL/网络URL)
- previewUrl: '',
- // 服务器返回的 URL(提交时使用)
- serverUrl: '',
- // 临时的文件路径(重新上传时用)
- tempFilePath: null,
- // 上传状态
- uploading: false
- })
-
- /**
- * 设置回显图片(编辑时从后端获取)
- * @param {string} url - 后端返回的图片URL
- */
- const setPreviewUrl = (url) => {
- if (url) {
- // 确保 url 是字符串
- const urlStr = typeof url === 'string' ? url : (url?.url || String(url))
- state.previewUrl = urlStr
- state.serverUrl = urlStr
- state.tempFilePath = null // 重置临时文件,表示没有重新上传
- }
- }
-
- /**
- * 选择图片并预览(不上传)
- * @returns {Promise} 返回临时文件路径
- */
- const chooseImage = () => {
- return new Promise((resolve, reject) => {
- uni.chooseImage({
- count: 1,
- sizeType: ['compressed'],
- sourceType: ['camera', 'album'],
- success: (res) => {
- const path = res.tempFilePaths?.[0]
- if (!path) {
- reject(new Error('选择图片失败'))
- return
- }
- // 确保 path 是字符串
- const pathStr = typeof path === 'string' ? path : String(path)
- // 设置预览
- state.previewUrl = pathStr
- // 记录临时文件路径
- state.tempFilePath = pathStr
- // 置空服务器URL,等实际上传后再获取
- state.serverUrl = ''
- resolve(pathStr)
- },
- fail: (err) => {
- reject(err)
- }
- })
- })
- }
-
- /**
- * 上传图片到服务器
- * @returns {Promise