From 2c528b797353b165e39d5d68bfdb7b023372bfc1 Mon Sep 17 00:00:00 2001 From: wangyuxin <2695255229ww> Date: Thu, 30 Apr 2026 08:24:22 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=88=91=E7=9A=84=E6=88=BF=E5=B1=8B?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E5=AF=B9=E6=8E=A5=E6=8E=A5=E5=8F=A3=EF=BC=8C?= =?UTF-8?q?=E7=BC=B4=E8=B4=B9=E9=A1=B5=E9=9D=A2=E5=8A=9F=E8=83=BD=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=80=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- property-uniapp-project/manifest.json | 5 + .../pageSubPack/api/apiSub.js | 90 ++ .../pageSubPack/api/request.js | 63 +- .../pageSubPack/api/useImageUpload.js | 173 +++ .../pageSubPack/my/addHouse.vue | 1032 +++++++++++------ .../pageSubPack/my/houseDetail.vue | 289 ++--- .../pageSubPack/my/myHouseIndex.vue | 293 ++--- .../pageSubPack/my/selectBuilding.vue | 524 ++++----- .../my/selectResidentialCommunity.vue | 235 ++-- .../pageSubPack/my/settingIndex.vue | 279 ++--- .../payment-list/addHydropower.vue | 227 ++-- .../pageSubPack/payment-list/addPayment.vue | 211 ++-- .../payment-list/addPaymentSuccess.vue | 94 +- .../payment-list/arrearsPayment.vue | 350 +++--- .../payment-list/noArrearsPayment.vue | 210 +--- .../pageSubPack/payment-list/paymentIndex.vue | 303 ++--- .../payment-list/paymentRecord.vue | 398 +++---- .../payment-list/selectPaymentEntity.vue | 451 +++---- property-uniapp-project/pages.json | 1 - 19 files changed, 2675 insertions(+), 2553 deletions(-) create mode 100644 property-uniapp-project/pageSubPack/api/apiSub.js create mode 100644 property-uniapp-project/pageSubPack/api/useImageUpload.js diff --git a/property-uniapp-project/manifest.json b/property-uniapp-project/manifest.json index 6659695..1efa631 100644 --- a/property-uniapp-project/manifest.json +++ b/property-uniapp-project/manifest.json @@ -54,6 +54,11 @@ "setting" : { "urlCheck" : false }, + "permission": { + "scope.camera": { + "desc": "用于扫码" + } + }, "usingComponents" : true }, "mp-alipay" : { diff --git a/property-uniapp-project/pageSubPack/api/apiSub.js b/property-uniapp-project/pageSubPack/api/apiSub.js new file mode 100644 index 0000000..7cf240c --- /dev/null +++ b/property-uniapp-project/pageSubPack/api/apiSub.js @@ -0,0 +1,90 @@ +import request, { + get, + post, + deleteMethod, + putMethod +} from "./request.js" + + +// =======公告列表======== +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 uploadFileUploadImage = (data) => { + return post(`/api/resident/file/uploadImage`, data) +} \ No newline at end of file diff --git a/property-uniapp-project/pageSubPack/api/request.js b/property-uniapp-project/pageSubPack/api/request.js index 37d6624..aa0e9ab 100644 --- a/property-uniapp-project/pageSubPack/api/request.js +++ b/property-uniapp-project/pageSubPack/api/request.js @@ -1,25 +1,29 @@ - -let baseUrl = ''; +let baseUrl = ''; if (process.env.NODE_ENV === 'development') { + // http://192.168.1.215 + // http://192.168.0.224 baseUrl = 'http://192.168.0.224:8080'; // 开发环境 } else { - baseUrl = 'http://192.168.1.224:8080'; // 生产环境 + baseUrl = 'http://192.168.0.224:8080'; // 生产环境 } export default function request(url, data = {}, method = "GET") { return new Promise((resolve, reject) => { // 加载中提示(提升用户体验) - uni.showLoading({ title: '请求中...', mask: true }); + uni.showLoading({ + title: '请求中...', + mask: true + }); uni.request({ url: baseUrl + url, data: data, method: method, header: { - "Authorization": "Bearer " + (uni.getStorageSync("token") || ''), - "clientid": "resident", - 'content-type': 'application/json' - }, + "Authorization": "Bearer " + (uni.getStorageSync("token") || ''), + "clientid": "resident", + 'content-type': 'application/json' + }, // header: { // "token": uni.getStorageSync("token") || '', // 'content-type': 'application/json' @@ -30,9 +34,13 @@ export default function request(url, data = {}, method = "GET") { // 处理HTTP状态码(网络层面) if (res.statusCode !== 200) { const errMsg = `请求失败(${res.statusCode})`; - uni.showToast({ title: errMsg, icon: "none", duration: 2000 }); + uni.showToast({ + title: errMsg, + icon: "none", + duration: 2000 + }); reject(errMsg); - return; + return; } // 处理业务状态码(后端返回的data里) @@ -40,10 +48,16 @@ export default function request(url, data = {}, method = "GET") { // 优先处理token过期(401) if (resData.code === 401) { - uni.showToast({ title: '登录过期,请重新登录', icon: 'none', duration: 2000 }); + uni.showToast({ + title: '登录过期,请重新登录', + icon: 'none', + duration: 2000 + }); uni.clearStorageSync('token'); setTimeout(() => { - uni.reLaunch({ url: '/pageSubPack/loginSub/pwd-login' }); + uni.reLaunch({ + url: '/pageSubPack/loginSub/pwd-login' + }); }, 1500); reject('token 过期'); return; @@ -56,20 +70,31 @@ export default function request(url, data = {}, method = "GET") { // 业务失败(code=500) else if (resData.code === 500) { const errMsg = resData.msg || '请求失败'; - uni.showToast({ title: errMsg, icon: "none", duration: 2000 }); + uni.showToast({ + title: errMsg, + icon: "none", + duration: 2000 + }); // resolve(null) reject(errMsg); - } - else { + } else { const errMsg = resData.msg || '业务异常'; - uni.showToast({ title: errMsg, icon: "none", duration: 2000 }); + uni.showToast({ + title: errMsg, + icon: "none", + duration: 2000 + }); reject(errMsg); } }, fail: (err) => { uni.hideLoading(); // 关闭加载提示 const errMsg = err.msg || '网络请求失败'; - uni.showToast({ title: errMsg, icon: "none", duration: 2000 }); + uni.showToast({ + title: errMsg, + icon: "none", + duration: 2000 + }); reject(err); } }); @@ -77,5 +102,5 @@ 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'); \ No newline at end of file diff --git a/property-uniapp-project/pageSubPack/api/useImageUpload.js b/property-uniapp-project/pageSubPack/api/useImageUpload.js new file mode 100644 index 0000000..0e73d64 --- /dev/null +++ b/property-uniapp-project/pageSubPack/api/useImageUpload.js @@ -0,0 +1,173 @@ +// 服务器地址(与 request.js 保持一致) +const baseUrl = 'http://192.168.0.224:8080'; + +/** + * 图片上传 Hook + * 支持 uniapp 和微信小程序 + * 解决编辑回显后重新上传的问题 + */ + +import { ref } 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 + + // 当前显示的图片(前端展示用,支持 base64/blob URL/网络URL) + const previewUrl = ref('') + // 服务器返回的 URL(提交时使用) + const serverUrl = ref('') + // 临时的文件路径(重新上传时用) + const tempFilePath = ref(null) + // 上传状态 + const uploading = ref(false) + + /** + * 设置回显图片(编辑时从后端获取) + * @param {string} url - 后端返回的图片URL + */ + const setPreviewUrl = (url) => { + if (url) { + previewUrl.value = url + serverUrl.value = url + tempFilePath.value = 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] + // 设置预览 + previewUrl.value = path + // 记录临时文件路径 + tempFilePath.value = path + // 置空服务器URL,等实际上传后再获取 + serverUrl.value = '' + resolve(path) + }, + fail: (err) => { + reject(err) + } + }) + }) + } + + /** + * 上传图片到服务器 + * @returns {Promise} 返回服务器上的URL + */ + const uploadImage = () => { + // 如果没有新选择临时文件,直接返回已有的服务器URL + if (!tempFilePath.value) { + return Promise.resolve(serverUrl.value) + } + + // 如果已经有服务器URL且没有重新选择,也直接返回 + if (serverUrl.value && !tempFilePath.value) { + return Promise.resolve(serverUrl.value) + } + + uploading.value = true + + return new Promise((resolve, reject) => { + uni.uploadFile({ + url: baseUrl + uploadUrl, + filePath: tempFilePath.value, + name: fileKey, + header: { + 'Authorization': 'Bearer ' + (uni.getStorageSync('token') || ''), + 'clientid': 'resident' + }, + success: (res) => { + try { + const data = JSON.parse(res.data) + if (data.code === 200 && data.data) { + // 更新服务器URL(确保存的是字符串) + const url = typeof data.data === 'string' ? data.data : (data.data?.url || '') + serverUrl.value = url + // 清空临时文件 + tempFilePath.value = null + resolve(url) + } else { + uni.showToast({ + title: data.msg || '上传失败', + icon: 'none' + }) + reject(new Error(data.msg || '上传失败')) + } + } catch (e) { + uni.showToast({ + title: '上传失败', + icon: 'none' + }) + reject(e) + } + }, + fail: (err) => { + uni.showToast({ + title: err.message || '上传失败', + icon: 'none' + }) + reject(err) + }, + complete: () => { + uploading.value = false + } + }) + }) + } + + /** + * 获取最终可提交的URL + * 如果有新上传的图片,先上传再返回URL + * 如果没有新上传,直接返回已有的服务器URL + * @returns {Promise} + */ + const getSubmitUrl = async () => { + // 如果重新选择了新图片,先上传 + if (tempFilePath.value) { + return await uploadImage() + } + // 否则返回已有的服务器URL + return serverUrl.value + } + + /** + * 重置状态 + */ + const reset = () => { + previewUrl.value = '' + serverUrl.value = '' + tempFilePath.value = null + uploading.value = false + } + + return { + previewUrl, // 前端展示用 + serverUrl, // 提交时使用的URL + tempFilePath, // 临时文件路径 + uploading, // 上传中状态 + setPreviewUrl, // 设置回显图片(编辑时用) + chooseImage, // 选择图片(预览用,不上传) + uploadImage, // 上传到服务器 + getSubmitUrl, // 获取最终可提交的URL(自动处理上传) + reset // 重置 + } +} \ No newline at end of file diff --git a/property-uniapp-project/pageSubPack/my/addHouse.vue b/property-uniapp-project/pageSubPack/my/addHouse.vue index 8810bf4..9630357 100644 --- a/property-uniapp-project/pageSubPack/my/addHouse.vue +++ b/property-uniapp-project/pageSubPack/my/addHouse.vue @@ -73,7 +73,8 @@ 房屋状态 - {{ formData.status || '请选择' }} + {{ formData.status.name || '请选择' }} @@ -86,9 +87,9 @@ - - {{ item }} + + {{ item.name }} @@ -127,7 +128,8 @@ 证件类型 - {{ form.cardType || '请选择' }} + {{ form.cardType.name || '请选择' }} @@ -137,7 +139,8 @@ 与业主关系 - {{ form.relation || '请选择' }} + {{ form.relation.name || '请选择' }} @@ -164,15 +167,15 @@ - + - @@ -196,14 +199,13 @@ - - {{item}} + + {{item.name}} - @@ -211,9 +213,9 @@ - - {{item}} + + {{item.name}} @@ -231,383 +233,653 @@ - \ No newline at end of file diff --git a/property-uniapp-project/pageSubPack/my/houseDetail.vue b/property-uniapp-project/pageSubPack/my/houseDetail.vue index b03a924..a996255 100644 --- a/property-uniapp-project/pageSubPack/my/houseDetail.vue +++ b/property-uniapp-project/pageSubPack/my/houseDetail.vue @@ -32,21 +32,23 @@ 小区 - {{form.community}}} + {{form.villageName}} 房间号 - {{form.houseNumber}} + {{form.houseNo}} 业主 - {{form.owner}} + {{form.ownerName}} 房间状态 - {{form.status}} + {{ + form.status === '0' ? '自住' : form.status === '1' ? + '闲置' : form.status === '2' ? '租赁' : form.status === '3' ? '其他' : '' + }} @@ -59,35 +61,42 @@ 住户 - {{form.resident}} + {{form.name}} 房间号 - {{form.gender}} + {{form.houseNo}} 证件类型 - {{form.documentType}} + {{form.idCardType=='0'?'居民身份证':form.idCardType=='1'?'护照':form.idCardType=='2'?'其他':''}} 证件号码 - {{form.documentNumber}} + {{form.idCard}} 与业主关系 - {{form.relationship}} + {{form.ownerRelationship=='0'?'本人':form.ownerRelationship=='1'?'配偶':form.ownerRelationship=='2'?'父母':form.ownerRelationship=='3'?'子女':form.ownerRelationship=='4'?'亲属':form.ownerRelationship=='5'?'租户':form.ownerRelationship=='6'?'其他':''}} 手机号码 - {{form.phoneNum}} + {{form.phone}} 本人身份证照片 - - + + + + + @@ -103,143 +112,149 @@ - - - - + + + + + + + + \ No newline at end of file diff --git a/property-uniapp-project/pageSubPack/payment-list/paymentIndex.vue b/property-uniapp-project/pageSubPack/payment-list/paymentIndex.vue new file mode 100644 index 0000000..0cceb90 --- /dev/null +++ b/property-uniapp-project/pageSubPack/payment-list/paymentIndex.vue @@ -0,0 +1,519 @@ + + + + + + + \ No newline at end of file From ccacc323e6b81ad370bc843fa2e60e28051274e4 Mon Sep 17 00:00:00 2001 From: wangyuxin <2695255229ww> Date: Thu, 30 Apr 2026 09:15:14 +0800 Subject: [PATCH 4/4] 1 --- .../pageSubPack/payment-list/paymentIndex.vue | 157 +----------------- 1 file changed, 9 insertions(+), 148 deletions(-) diff --git a/property-uniapp-project/pageSubPack/payment-list/paymentIndex.vue b/property-uniapp-project/pageSubPack/payment-list/paymentIndex.vue index 0cceb90..2fd58bc 100644 --- a/property-uniapp-project/pageSubPack/payment-list/paymentIndex.vue +++ b/property-uniapp-project/pageSubPack/payment-list/paymentIndex.vue @@ -39,16 +39,14 @@ -<<<<<<< HEAD -======= - ->>>>>>> de6e6ebfc1fe0b87a29728bd9d5d2cddae9f726f - - - + + + + + + {{ item.name +'费'}} - {{ item.name +'费'}} - @@ -62,7 +60,7 @@ ref, onMounted, computed - + } from 'vue' import { onShow, @@ -122,94 +120,7 @@ icon: "http://47.104.199.163:9090/images/propertyImgs/electric.png", iconClass: "electric" }, -<<<<<<< HEAD - { - name: "暖气", - type: "heating", - icon: "http://47.104.199.163:9090/images/propertyImgs/heating.png", - iconClass: "heating" -======= - mounted() {}, - data() { - return { - /* 设定状态栏默认高度 */ - statusBarHeight: 20, - paymentList: [{ - id: 1, - name: '物业费', - status: '已欠费', - address: '桂花园(别墅)2号楼2层', - icon: "http://47.104.199.163:9090/images/propertyImgs/property.png", - }, - { - id: 2, - // name: '暖气费', - name: '物业费', - - status: '', - address: '山东省日照市东港区桂花园(别墅)2号楼2层', - icon: "http://47.104.199.163:9090/images/propertyImgs/heating.png", - - }, - { - id: 3, - // name: '电费', - name: '物业费', - status: '已欠费', - address: '山东省日照市东港区桂花园(别墅)2号楼2层', - icon: "http://47.104.199.163:9090/images/propertyImgs/electric.png", - - } - ], - // 新增缴费列表数据 - addList: [{ - // name: "燃气", - name: '物业', - type: "gas", - icon: "http://47.104.199.163:9090/images/propertyImgs/gas.png", - iconClass: "gas" - }, - { - // name: "水", - name: '物业', - type: "water", - icon: "http://47.104.199.163:9090/images/propertyImgs/water.png", - iconClass: "water" - }, - { - // name: "物业", - name: '物业', - type: "property", - icon: "http://47.104.199.163:9090/images/propertyImgs/property.png", - iconClass: "property" - }, - { - // name: "电", - name: '物业', - type: "electric", - icon: "http://47.104.199.163:9090/images/propertyImgs/electric.png", - iconClass: "electric" - }, - { - // name: "暖气", - name: '物业', - type: "heating", - icon: "http://47.104.199.163:9090/images/propertyImgs/heating.png", - iconClass: "heating" - }, - { - // name: "车位", - name: '物业', - type: "parking", - icon: "http://47.104.199.163:9090/images/propertyImgs/parkingIcon.png", - iconClass: "parking" - } - ] - - } ->>>>>>> de6e6ebfc1fe0b87a29728bd9d5d2cddae9f726f - }, { name: "车位", type: "parking", @@ -223,7 +134,6 @@ onShow(() => {}) onLoad(() => {}) -<<<<<<< HEAD // 方法 const goToBill = (item) => { uni.setStorageSync('arrearsPayment', item.name) @@ -237,56 +147,7 @@ }) } } -======= - methods: { - // 跳转到缴费 - goToBill(item) { - uni.setStorageSync('arrearsPayment', item.name) - if (item.status == '已欠费') { - uni.redirectTo({ - url: '/pageSubPack/payment-list/arrearsPayment', - success: res => {}, - fail: () => {}, - complete: () => {} - }); - } else { - uni.redirectTo({ - url: '/pageSubPack/payment-list/noArrearsPayment', - success: res => {}, - fail: () => {}, - complete: () => {} - }); - } - }, - // 跳转到缴费记录 - goToRecord() { - uni.redirectTo({ - url: '/pageSubPack/payment-list/paymentRecord', - success: res => {}, - fail: () => {}, - complete: () => {} - }); - }, - // 跳转到新增缴费 - goToAdd(type) { - // else if (type.name == '水' || type.name == '电') - if (type.name == '燃气' || type.name == '暖气') { - uni.redirectTo({ - url: '/pageSubPack/payment-list/selectPaymentEntity', - success: res => {}, - fail: () => {}, - complete: () => {} - }); - } else if (type.name == '物业' || type.name == '物业') { - uni.redirectTo({ - url: '/pageSubPack/payment-list/addHydropower', - success: res => {}, - fail: () => {}, - complete: () => {} - }); - } - uni.setStorageSync('addPaymentType', type.name) ->>>>>>> de6e6ebfc1fe0b87a29728bd9d5d2cddae9f726f + const goToRecord = () => { uni.redirectTo({