10/14
This commit is contained in:
@@ -1,25 +1,33 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { onLaunch } from '@dcloudio/uni-app'
|
import { onLaunch, onShow } from '@dcloudio/uni-app';
|
||||||
|
import { captureAppLaunchData, capturePaymentResult } from '/pageSubPack/api/apiSub.js';
|
||||||
// 应用启动时执行
|
// 应用启动时执行
|
||||||
onLaunch(() => {
|
onLaunch(() => {
|
||||||
console.log('App 启动')
|
console.log('App 启动');
|
||||||
|
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
// 只有 App 平台才获取 CID
|
// 只有 App 平台才获取 CID
|
||||||
getPushCID()
|
getPushCID();
|
||||||
// #endif
|
// #endif
|
||||||
})
|
});
|
||||||
|
|
||||||
|
onShow((options) => {
|
||||||
|
console.log('App onShow, options:', JSON.stringify(options));
|
||||||
|
// 捕获 App 跳转传入的支付参数(热启动 — options 携带新的 referrerInfo)
|
||||||
|
// captureAppLaunchData(options);
|
||||||
|
// 捕获日照银行支付小程序返回的支付结果(navigateBackMiniProgram 的 extraData)
|
||||||
|
capturePaymentResult(options);
|
||||||
|
});
|
||||||
|
|
||||||
// 获取 uniPush 2.0 CID
|
// 获取 uniPush 2.0 CID
|
||||||
function getPushCID() {
|
function getPushCID() {
|
||||||
uni.getPushClientId({
|
uni.getPushClientId({
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log('推送初始化成功')
|
console.log('推送初始化成功');
|
||||||
console.log('CID =', res.cid)
|
console.log('CID =', res.cid);
|
||||||
|
|
||||||
// 存起来备用
|
// 存起来备用
|
||||||
uni.setStorageSync('push_cid', res.cid)
|
uni.setStorageSync('push_cid', res.cid);
|
||||||
|
|
||||||
// 弹出CID给你看
|
// 弹出CID给你看
|
||||||
// uni.showModal({
|
// uni.showModal({
|
||||||
@@ -28,9 +36,9 @@
|
|||||||
// })
|
// })
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
console.error('获取推送 CID 失败', err)
|
console.error('获取推送 CID 失败', err);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
// export default {
|
// export default {
|
||||||
// on
|
// on
|
||||||
@@ -41,12 +49,11 @@
|
|||||||
// console.log('App Hide')
|
// console.log('App Hide')
|
||||||
// },
|
// },
|
||||||
|
|
||||||
|
|
||||||
// }
|
// }
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@import "@/uni_modules/uview-plus/index.scss";
|
@import '@/uni_modules/uview-plus/index.scss';
|
||||||
/*每个页面公共css */
|
/*每个页面公共css */
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,7 @@
|
|||||||
"quickapp": {},
|
"quickapp": {},
|
||||||
/* 小程序特有相关 */
|
/* 小程序特有相关 */
|
||||||
"mp-weixin": {
|
"mp-weixin": {
|
||||||
"appid" : "wx40625124315d2de1",
|
"appid": "wxa6184796ceba80ca",
|
||||||
"setting": {
|
"setting": {
|
||||||
"urlCheck": false
|
"urlCheck": false
|
||||||
},
|
},
|
||||||
@@ -104,9 +104,6 @@
|
|||||||
"permission": {
|
"permission": {
|
||||||
"scope.camera": {
|
"scope.camera": {
|
||||||
"desc": "用于扫码"
|
"desc": "用于扫码"
|
||||||
},
|
|
||||||
"scope.userLocation" : {
|
|
||||||
"desc" : "你的位置信息将用于定位选择"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"usingComponents": true
|
"usingComponents": true
|
||||||
|
|||||||
2
huakai-app/package-lock.json
generated
2
huakai-app/package-lock.json
generated
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "property-uniapp-project",
|
"name": "huakai-app",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
|
|||||||
@@ -223,3 +223,187 @@ export const getParkingDetail = (data) => {
|
|||||||
export const rebindCar = (data) => {
|
export const rebindCar = (data) => {
|
||||||
return post(`/ResidentCarAreaManage/rebind`, data)
|
return post(`/ResidentCarAreaManage/rebind`, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// RZbank
|
||||||
|
/**
|
||||||
|
* 归一化 billId/billIds:单个 id 用 billId,多个用 billIds,统一转为 billIds 数组
|
||||||
|
*/
|
||||||
|
function normalizeBillParams(obj) {
|
||||||
|
if (!obj) return
|
||||||
|
// 先解码再拆分为数组
|
||||||
|
if (typeof obj.billIds === 'string') {
|
||||||
|
const decoded = decodeURIComponent(obj.billIds)
|
||||||
|
obj.billIds = decoded.includes(',') ?
|
||||||
|
decoded.split(',').map(v => v.trim()).filter(Boolean) : [decoded]
|
||||||
|
}
|
||||||
|
// billId 存在且 billIds 不存在时,包装为数组
|
||||||
|
if (obj.billId && !obj.billIds) {
|
||||||
|
const decoded = decodeURIComponent(
|
||||||
|
typeof obj.billId === 'string' ? obj.billId : String(obj.billId)
|
||||||
|
)
|
||||||
|
obj.billIds = decoded.includes(',') ?
|
||||||
|
decoded.split(',').map(v => v.trim()).filter(Boolean) : [decoded]
|
||||||
|
delete obj.billId
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 从启动参数中获取 App 传入的全部数据(支付参数 + token + userId)
|
||||||
|
*/
|
||||||
|
export function captureAppLaunchData(onShowOptions) {
|
||||||
|
let data = null
|
||||||
|
let queryData = null
|
||||||
|
|
||||||
|
const tryGetData = (options, label) => {
|
||||||
|
if (!options) return null
|
||||||
|
console.log(label, JSON.stringify(options))
|
||||||
|
|
||||||
|
// 保存 path query 参数(供接口调用)
|
||||||
|
if (options.query && Object.keys(options.query).length > 0) {
|
||||||
|
queryData = options.query
|
||||||
|
console.log(label + ' path query 参数:', JSON.stringify(queryData))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 优先从 query 获取
|
||||||
|
if (options.query && Object.keys(options.query).length > 0) {
|
||||||
|
return options.query
|
||||||
|
}
|
||||||
|
|
||||||
|
// referrerInfo.extraData:可能是对象也可能是查询字符串
|
||||||
|
const extraData = options?.referrerInfo?.extraData
|
||||||
|
if (extraData) {
|
||||||
|
if (typeof extraData === 'string') {
|
||||||
|
console.log(label + ' extraData 是查询字符串,解析中...')
|
||||||
|
return parseQueryString(extraData)
|
||||||
|
}
|
||||||
|
return 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 || data.billId || data.billIds)) {
|
||||||
|
// 归一化 billId/billIds:单个 id 用 billId,多个用 billIds,统一转为 billIds 数组
|
||||||
|
normalizeBillParams(data)
|
||||||
|
|
||||||
|
// 恢复登录态
|
||||||
|
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))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 归一化 queryData 中的 billId/billIds
|
||||||
|
normalizeBillParams(queryData)
|
||||||
|
|
||||||
|
// 单独保存参数供接口使用(优先 queryData,fallback 到 data,即 extraData 来源)
|
||||||
|
const queryParams = queryData || data
|
||||||
|
if (queryParams) {
|
||||||
|
uni.setStorageSync(APP_QUERY_KEY, queryParams)
|
||||||
|
console.log('已存储 App 接口参数:', JSON.stringify(queryParams))
|
||||||
|
}
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取日照银行小程序拉起参数
|
||||||
|
export const getBankMiniProgramParams = (data) => {
|
||||||
|
return post('/api/pay/yidang/create', data)
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 支付返回结果
|
||||||
|
* 日照银行支付小程序完成支付后,通过 navigateBackMiniProgram 携带 extraData 返回,
|
||||||
|
* 本小程序在 App.onShow 中通过 referrerInfo.extraData 接收(场景值 1038)。
|
||||||
|
* 这里只负责捕获/读取/清除原始返回数据,成功/失败判定见 resolvePaymentResult。
|
||||||
|
*/
|
||||||
|
const PAYMENT_RESULT_KEY = 'payment_return_result'
|
||||||
|
/**
|
||||||
|
* 捕获支付返回结果(在 App.onShow 中调用)
|
||||||
|
* 注意:App 冷/热启动进入时 extraData 是支付参数(payAmount/billIds 等),
|
||||||
|
* 并非支付返回,需跳过,避免覆盖真实结果。
|
||||||
|
*/
|
||||||
|
export function capturePaymentResult(onShowOptions) {
|
||||||
|
console.log(onShowOptions)
|
||||||
|
if (!onShowOptions) return
|
||||||
|
const extraData = onShowOptions?.referrerInfo?.extraData
|
||||||
|
if (!extraData) return
|
||||||
|
|
||||||
|
// 含支付参数字段说明是 App 跳转进入(冷/热启动),不是支付返回,跳过
|
||||||
|
if (typeof extraData === 'object' && (extraData.payAmount || extraData.billId || extraData.billIds || extraData
|
||||||
|
.acct || extraData.custId)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let parsed = extraData
|
||||||
|
if (typeof extraData === 'string') {
|
||||||
|
try {
|
||||||
|
parsed = JSON.parse(extraData)
|
||||||
|
} catch (e) {
|
||||||
|
parsed = parseQueryString(extraData)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log('捕获到支付返回结果:', JSON.stringify(parsed))
|
||||||
|
uni.setStorageSync(PAYMENT_RESULT_KEY, parsed)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 读取支付返回结果(读取后建议调用 clearPaymentReturnResult 清除) */
|
||||||
|
export function getPaymentReturnResult() {
|
||||||
|
try {
|
||||||
|
return uni.getStorageSync(PAYMENT_RESULT_KEY) || null
|
||||||
|
} catch (e) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 清除支付返回结果 */
|
||||||
|
export function clearPaymentReturnResult() {
|
||||||
|
uni.removeStorageSync(PAYMENT_RESULT_KEY)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 失败/成功信号值(大小写不敏感),字段名与取值以日照银行实际返回为准,如不一致只需调整下方映射
|
||||||
|
const FAIL_SIGNALS = ['fail', 'failed', 'cancel', 'cancelled', 'error', 'closed', 'notpay', 'payerror', '2', 'false',
|
||||||
|
'no', '01'
|
||||||
|
]
|
||||||
|
const SUCCESS_SIGNALS = ['success', 'ok', 'paid', 'finish', 'finished', '1', '0000', '0', '200', 'true', 'yes', '00']
|
||||||
|
const RESULT_FIELDS = ['payResult', 'result', 'status', 'payStatus', 'tradeState', 'returnCode', 'code', 'errCode',
|
||||||
|
'orderState'
|
||||||
|
]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判定日照银行返回的支付结果:'success' | 'fail' | null(无法判定)
|
||||||
|
*/
|
||||||
|
export function resolvePaymentResult(data) {
|
||||||
|
console.log("日照银行返回数据:", data)
|
||||||
|
if (!data || typeof data !== 'object') return null
|
||||||
|
// 布尔字段优先
|
||||||
|
if (typeof data.success === 'boolean') return data.success ? 'success' : 'fail'
|
||||||
|
if (typeof data.isSuccess === 'boolean') return data.isSuccess ? 'success' : 'fail'
|
||||||
|
for (const key of RESULT_FIELDS) {
|
||||||
|
const v = data[key]
|
||||||
|
if (v === undefined || v === null || v === '') continue
|
||||||
|
const s = String(v).trim().toLowerCase()
|
||||||
|
if (FAIL_SIGNALS.includes(s)) return 'fail'
|
||||||
|
if (SUCCESS_SIGNALS.includes(s)) return 'success'
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
42
huakai-app/pageSubPack/api/date.js
Normal file
42
huakai-app/pageSubPack/api/date.js
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/**
|
||||||
|
* 日期格式化
|
||||||
|
* @param {Date|number|string} time 时间戳/日期字符串/Date对象
|
||||||
|
* @param {string} fmt 格式 'yyyy-MM-dd HH:mm:ss'
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
export function formatDate(time, fmt = 'yyyy-MM-dd HH:mm:ss') {
|
||||||
|
if (!time) return ''
|
||||||
|
let date
|
||||||
|
if (typeof time === 'number') {
|
||||||
|
// 小程序时间戳注意:毫秒直接用,秒要*1000
|
||||||
|
date = new Date(time.toString().length === 10 ? time * 1000 : time)
|
||||||
|
} else {
|
||||||
|
date = new Date(time)
|
||||||
|
}
|
||||||
|
// 兼容ios:2025-08-01 → 2025/08/01
|
||||||
|
if (isNaN(date.getTime())) {
|
||||||
|
date = new Date(String(time).replace(/-/g, '/'))
|
||||||
|
}
|
||||||
|
if (isNaN(date.getTime())) return ''
|
||||||
|
|
||||||
|
const o = {
|
||||||
|
'M+': date.getMonth() + 1, // 月
|
||||||
|
'd+': date.getDate(), // 日
|
||||||
|
'H+': date.getHours(), // 24小时制
|
||||||
|
'h+': date.getHours() % 12, //12小时
|
||||||
|
'm+': date.getMinutes(), // 分
|
||||||
|
's+': date.getSeconds(), // 秒
|
||||||
|
'q+': Math.floor((date.getMonth() + 3) / 3), //季度
|
||||||
|
'S': date.getMilliseconds() //毫秒
|
||||||
|
}
|
||||||
|
if (/(y+)/.test(fmt)) {
|
||||||
|
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
|
||||||
|
}
|
||||||
|
for (const k in o) {
|
||||||
|
if (new RegExp(`(${k})`).test(fmt)) {
|
||||||
|
const str = o[k] + ''
|
||||||
|
fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? str : str.padStart(2, '0'))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fmt
|
||||||
|
}
|
||||||
@@ -1,18 +1,34 @@
|
|||||||
let baseUrl = '';
|
let baseUrl = '';
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
// baseUrl = 'https://wuyeapi.ckdzkj.com'; // 开发环境
|
baseUrl = 'https://wuyeapi.ckdzkj.com'; // 开发环境
|
||||||
baseUrl = "https://wuyeapi.bugtc.com"
|
// baseUrl = "http://192.168.0.222:8080"
|
||||||
|
// baseUrl = 'https://wuyeapi.ckdzkj.com';
|
||||||
|
// baseUrl = "https://apitest.ckdzkj.com"
|
||||||
|
// baseUrl = "https://wuyeapi.bugtc.com"
|
||||||
|
// baseUrl = 'https://during-immovable-eats.ngrok-free.dev';
|
||||||
} else {
|
} else {
|
||||||
baseUrl = 'https://wuyeapi.bugtc.com'; // 生产环境
|
baseUrl = 'https://wuyeapi.ckdzkj.com';
|
||||||
|
// baseUrl = 'https://apitest.ckdzkj.com';
|
||||||
|
// baseUrl = 'https://during-immovable-eats.ngrok-free.dev';
|
||||||
}
|
}
|
||||||
|
// 图片基础地址
|
||||||
|
// const imgBaseUrl = 'https://wuyeadmin.bugtc.com'
|
||||||
|
const imgBaseUrl = 'https://wuye.ckdzkj.com'
|
||||||
|
export {
|
||||||
|
baseUrl,
|
||||||
|
imgBaseUrl
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* 显示接口错误提示(自动处理长消息截断问题)
|
* 显示接口错误提示(自动处理长消息截断问题)
|
||||||
* @param {string|Object} msg - 错误消息或含 msg 字段的错误对象
|
* @param {string|Object} msg - 错误消息或含 msg 字段的错误对象
|
||||||
*/
|
*/
|
||||||
export function showApiError(msg) {
|
export function showApiError(msg) {
|
||||||
const message = typeof msg === 'string' ? msg : (msg.msg || msg.message || '请求失败');
|
const message = typeof msg === 'string' ? msg : (msg.msg || msg.message || '请求失败');
|
||||||
uni.showToast({ title: message || '请求失败', icon: 'error', duration: 2000 });
|
uni.showToast({
|
||||||
|
title: message || '请求失败',
|
||||||
|
icon: 'error',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function request(url, data = {}, method = "GET") {
|
export default function request(url, data = {}, method = "GET") {
|
||||||
@@ -36,7 +52,10 @@ export default function request(url, data = {}, method = "GET") {
|
|||||||
|
|
||||||
// HTTP 失败
|
// HTTP 失败
|
||||||
if (res.statusCode !== 200) {
|
if (res.statusCode !== 200) {
|
||||||
reject({ msg: `请求异常 ${res.statusCode}`, code: res.statusCode });
|
reject({
|
||||||
|
msg: `请求异常 ${res.statusCode}`,
|
||||||
|
code: res.statusCode
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,7 +63,11 @@ export default function request(url, data = {}, method = "GET") {
|
|||||||
|
|
||||||
// token 过期 — 清除登录态,提示用户,但不强制跳转(用户可继续浏览非敏感页面)
|
// token 过期 — 清除登录态,提示用户,但不强制跳转(用户可继续浏览非敏感页面)
|
||||||
if (resData.code === 401) {
|
if (resData.code === 401) {
|
||||||
uni.showToast({ title: '登录已过期,请重新登录', icon: 'none', duration: 2000 });
|
uni.showToast({
|
||||||
|
title: '登录已过期,请重新登录',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
uni.removeStorageSync('token');
|
uni.removeStorageSync('token');
|
||||||
uni.removeStorageSync('userId');
|
uni.removeStorageSync('userId');
|
||||||
// 使用 navigateTo 而非 reLaunch,用户可通过返回按钮退出登录页
|
// 使用 navigateTo 而非 reLaunch,用户可通过返回按钮退出登录页
|
||||||
@@ -53,11 +76,16 @@ export default function request(url, data = {}, method = "GET") {
|
|||||||
url: '/pageSubPack/loginSub/pwd-login',
|
url: '/pageSubPack/loginSub/pwd-login',
|
||||||
fail: () => {
|
fail: () => {
|
||||||
// 如果 navigateTo 失败(如页面栈满),则用 reLaunch
|
// 如果 navigateTo 失败(如页面栈满),则用 reLaunch
|
||||||
uni.reLaunch({ url: '/pageSubPack/loginSub/pwd-login' });
|
uni.reLaunch({
|
||||||
|
url: '/pageSubPack/loginSub/pwd-login'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, 1500);
|
}, 1500);
|
||||||
reject({ msg: '登录过期', code: 401 });
|
reject({
|
||||||
|
msg: '登录过期',
|
||||||
|
code: 401
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,14 +96,26 @@ export default function request(url, data = {}, method = "GET") {
|
|||||||
// 业务失败(code === 500 统一 showToast 展示完整 msg)
|
// 业务失败(code === 500 统一 showToast 展示完整 msg)
|
||||||
else {
|
else {
|
||||||
if (resData.code === 500 && resData.msg) {
|
if (resData.code === 500 && resData.msg) {
|
||||||
uni.showToast({ title: resData.msg, icon: 'error', duration: 2500 });
|
uni.showToast({
|
||||||
|
title: resData.msg,
|
||||||
|
icon: 'error',
|
||||||
|
duration: 2500
|
||||||
|
});
|
||||||
}
|
}
|
||||||
reject({ msg: resData.msg || '请求失败', code: resData.code, data: resData });
|
reject({
|
||||||
|
msg: resData.msg || '请求失败',
|
||||||
|
code: resData.code,
|
||||||
|
data: resData
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
reject({ msg: '网络异常', code: -1, raw: err });
|
reject({
|
||||||
|
msg: '网络异常',
|
||||||
|
code: -1,
|
||||||
|
raw: err
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
// 服务器地址(与 request.js 保持一致)
|
// 服务器地址(与 request.js 保持一致)
|
||||||
const baseUrl = 'http://192.168.0.239:8080';
|
// const baseUrl = 'http://192.168.0.239:8080';
|
||||||
|
// const baseUrl = 'http://192.168.1.222:8080';
|
||||||
|
import {
|
||||||
|
baseUrl
|
||||||
|
} from './request.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 图片上传 Hook
|
* 图片上传 Hook
|
||||||
@@ -7,7 +11,9 @@ const baseUrl = 'http://192.168.0.239:8080';
|
|||||||
* 解决编辑回显后重新上传的问题
|
* 解决编辑回显后重新上传的问题
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { reactive } from 'vue'
|
import {
|
||||||
|
reactive
|
||||||
|
} from 'vue'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} options 配置
|
* @param {Object} options 配置
|
||||||
@@ -87,12 +93,16 @@ export function useImageUpload(options = {}) {
|
|||||||
const uploadImage = () => {
|
const uploadImage = () => {
|
||||||
// 如果没有新选择临时文件,直接返回已有的服务器URL
|
// 如果没有新选择临时文件,直接返回已有的服务器URL
|
||||||
if (!state.tempFilePath) {
|
if (!state.tempFilePath) {
|
||||||
return Promise.resolve({ url: state.serverUrl })
|
return Promise.resolve({
|
||||||
|
url: state.serverUrl
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果已经有服务器URL且没有重新选择,也直接返回
|
// 如果已经有服务器URL且没有重新选择,也直接返回
|
||||||
if (state.serverUrl && !state.tempFilePath) {
|
if (state.serverUrl && !state.tempFilePath) {
|
||||||
return Promise.resolve({ url: state.serverUrl })
|
return Promise.resolve({
|
||||||
|
url: state.serverUrl
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
state.uploading = true
|
state.uploading = true
|
||||||
@@ -118,11 +128,14 @@ export function useImageUpload(options = {}) {
|
|||||||
const data = JSON.parse(res.data)
|
const data = JSON.parse(res.data)
|
||||||
if (data.code === 200 && data.data) {
|
if (data.code === 200 && data.data) {
|
||||||
// 更新服务器URL(确保存的是字符串)
|
// 更新服务器URL(确保存的是字符串)
|
||||||
const url = typeof data.data === 'string' ? data.data : (data.data?.url || '')
|
const url = typeof data.data === 'string' ? data.data : (data.data
|
||||||
|
?.url || '')
|
||||||
state.serverUrl = url
|
state.serverUrl = url
|
||||||
// 清空临时文件
|
// 清空临时文件
|
||||||
state.tempFilePath = null
|
state.tempFilePath = null
|
||||||
resolve({ url })
|
resolve({
|
||||||
|
url
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: data.msg || '上传失败',
|
title: data.msg || '上传失败',
|
||||||
@@ -164,7 +177,9 @@ export function useImageUpload(options = {}) {
|
|||||||
return await uploadImage()
|
return await uploadImage()
|
||||||
}
|
}
|
||||||
// 否则返回已有的服务器URL
|
// 否则返回已有的服务器URL
|
||||||
return { url: state.serverUrl }
|
return {
|
||||||
|
url: state.serverUrl
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,52 +8,55 @@
|
|||||||
<!-- 手机号输入框 -->
|
<!-- 手机号输入框 -->
|
||||||
<view class="input-item">
|
<view class="input-item">
|
||||||
<view class="input-icon">
|
<view class="input-icon">
|
||||||
<image src="http://47.104.199.163:9090/images/login/phone.png" mode="" style="height: 100%;width: 100%;"></image>
|
<image :src="`${imgBaseUrl}/images/login/phone.png`" mode="" style="height: 100%; width: 100%"></image>
|
||||||
</view>
|
</view>
|
||||||
<uni-easyinput class="input-content" type="number" v-model="phoneNumber" trim="all"
|
<uni-easyinput
|
||||||
placeholder="请输入手机号" :inputBorder="false" maxlength="11" :placeholderStyle="placeholderStyle">
|
class="input-content"
|
||||||
</uni-easyinput>
|
type="number"
|
||||||
|
v-model="phoneNumber"
|
||||||
|
trim="all"
|
||||||
|
placeholder="请输入手机号"
|
||||||
|
:inputBorder="false"
|
||||||
|
maxlength="11"
|
||||||
|
:placeholderStyle="placeholderStyle"
|
||||||
|
></uni-easyinput>
|
||||||
</view>
|
</view>
|
||||||
<!-- 验证码输入 + 获取验证码按钮 -->
|
<!-- 验证码输入 + 获取验证码按钮 -->
|
||||||
<view class="input-item verify-item">
|
<view class="input-item verify-item">
|
||||||
<view class="input-icon">
|
<view class="input-icon">
|
||||||
<image src="http://47.104.199.163:9090/images/login/code.png" mode="" style="height: 100%;width: 100%;"></image>
|
<image :src="`${imgBaseUrl}/images/login/code.png`" mode="" style="height: 100%; width: 100%"></image>
|
||||||
<!-- <uni-icons type="locked" size="24" color="#999"></uni-icons> -->
|
<!-- <uni-icons type="locked" size="24" color="#999"></uni-icons> -->
|
||||||
</view>
|
</view>
|
||||||
<uni-easyinput class="input-content verify-input" type="number" v-model="verifyCode" trim="all"
|
<uni-easyinput
|
||||||
placeholder="请输入验证码" :inputBorder="false" maxlength="6" :placeholderStyle="placeholderStyle">
|
class="input-content verify-input"
|
||||||
</uni-easyinput>
|
type="number"
|
||||||
<button
|
v-model="verifyCode"
|
||||||
class="get-verify-btn"
|
trim="all"
|
||||||
:disabled="!canGetVerify || countDown > 0"
|
placeholder="请输入验证码"
|
||||||
@click="getVerifyCode"
|
:inputBorder="false"
|
||||||
>
|
maxlength="6"
|
||||||
|
:placeholderStyle="placeholderStyle"
|
||||||
|
></uni-easyinput>
|
||||||
|
<button class="get-verify-btn" :disabled="!canGetVerify || countDown > 0" @click="getVerifyCode">
|
||||||
{{ countDown > 0 ? `${countDown}s后重新获取` : '获取验证码' }}
|
{{ countDown > 0 ? `${countDown}s后重新获取` : '获取验证码' }}
|
||||||
</button>
|
</button>
|
||||||
</view>
|
</view>
|
||||||
<!-- 下一步 -->
|
<!-- 下一步 -->
|
||||||
<button
|
<button class="forget-btn" :disabled="!canRegister" @click="handleNext">下一步</button>
|
||||||
class="forget-btn"
|
|
||||||
:disabled="!canRegister"
|
|
||||||
@click="handleNext"
|
|
||||||
>
|
|
||||||
下一步
|
|
||||||
</button>
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onUnmounted } from 'vue';
|
import { ref, computed, onUnmounted } from 'vue';
|
||||||
import {getSendCode} from '../api/api.js'
|
import { getSendCode } from '../api/api.js';
|
||||||
import { showApiError } from '../api/request.js'
|
import { showApiError, imgBaseUrl } from '../api/request.js';
|
||||||
|
|
||||||
// ====响应式数据======
|
// ====响应式数据======
|
||||||
const phoneNumber = ref('')
|
const phoneNumber = ref('');
|
||||||
const verifyCode = ref('')
|
const verifyCode = ref('');
|
||||||
|
|
||||||
const countDown = ref(0)
|
const countDown = ref(0);
|
||||||
let timer = null;
|
let timer = null;
|
||||||
const placeholderStyle = ref('font-size:24rpx')
|
const placeholderStyle = ref('font-size:24rpx');
|
||||||
|
|
||||||
// ========== 计算属性 ==========
|
// ========== 计算属性 ==========
|
||||||
// 是否可获取验证码(手机号格式正确)
|
// 是否可获取验证码(手机号格式正确)
|
||||||
@@ -68,8 +71,9 @@ const getVerifyCode = () => {
|
|||||||
let params = {
|
let params = {
|
||||||
phone: phoneNumber.value,
|
phone: phoneNumber.value,
|
||||||
scene: 'reset'
|
scene: 'reset'
|
||||||
}
|
};
|
||||||
getSendCode(params).then(res =>{
|
getSendCode(params)
|
||||||
|
.then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '验证码已发送',
|
title: '验证码已发送',
|
||||||
@@ -91,19 +95,17 @@ const getVerifyCode = () => {
|
|||||||
// icon: 'error'
|
// icon: 'error'
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
}).catch(err =>{
|
|
||||||
showApiError(err)
|
|
||||||
})
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
showApiError(err);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
// 是否下一步
|
// 是否下一步
|
||||||
const canRegister = computed(() => {
|
const canRegister = computed(() => {
|
||||||
const phoneReg = /^1[3-9]\d{9}$/; // 手机号11位
|
const phoneReg = /^1[3-9]\d{9}$/; // 手机号11位
|
||||||
const verifyReg = /^\d{6}$/; // 验证码6位
|
const verifyReg = /^\d{6}$/; // 验证码6位
|
||||||
|
|
||||||
return phoneReg.test(phoneNumber.value)
|
return phoneReg.test(phoneNumber.value) && verifyReg.test(verifyCode.value);
|
||||||
&& verifyReg.test(verifyCode.value)
|
|
||||||
});
|
});
|
||||||
// 下一步
|
// 下一步
|
||||||
const handleNext = () => {
|
const handleNext = () => {
|
||||||
@@ -114,23 +116,22 @@ const handleNext = () =>{
|
|||||||
});
|
});
|
||||||
if (!canRegister.value) {
|
if (!canRegister.value) {
|
||||||
uni.showToast({ title: '请输入', icon: 'error' });
|
uni.showToast({ title: '请输入', icon: 'error' });
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pageSubPack/loginSub/change-pwd'
|
url: '/pageSubPack/loginSub/change-pwd'
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
// 返回上一页
|
// 返回上一页
|
||||||
const goBack = () => {
|
const goBack = () => {
|
||||||
uni.navigateBack();
|
uni.navigateBack();
|
||||||
};
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.forget-page {
|
.forget-page {
|
||||||
padding: 20rpx 40rpx 40rpx;
|
padding: 20rpx 40rpx 40rpx;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background: repeating-linear-gradient(180deg, #E2F0FF, #F6FAFF );
|
background: repeating-linear-gradient(180deg, #e2f0ff, #f6faff);
|
||||||
}
|
}
|
||||||
.status_bar {
|
.status_bar {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -248,6 +249,4 @@ const goBack = () => {
|
|||||||
.forget-btn:after {
|
.forget-btn:after {
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -15,26 +15,34 @@
|
|||||||
<view class="input-item">
|
<view class="input-item">
|
||||||
<view class="input-icon">
|
<view class="input-icon">
|
||||||
<!-- <uni-icons type="phone" size="24" color="#999"></uni-icons> -->
|
<!-- <uni-icons type="phone" size="24" color="#999"></uni-icons> -->
|
||||||
<image src="https://wuyeadmin.bugtc.com/images/login/phone.png" mode="" style="height: 100%;width: 100%;"></image>
|
<image :src="`${imgBaseUrl}/images/login/phone.png`" mode="" style="height: 100%; width: 100%"></image>
|
||||||
</view>
|
</view>
|
||||||
<uni-easyinput class="input-content" type="number" v-model="phoneNumber"
|
<uni-easyinput
|
||||||
placeholder="请输入手机号" :inputBorder="false" maxlength="11" :placeholderStyle="placeholderStyle">
|
class="input-content"
|
||||||
</uni-easyinput>
|
type="number"
|
||||||
|
v-model="phoneNumber"
|
||||||
|
placeholder="请输入手机号"
|
||||||
|
:inputBorder="false"
|
||||||
|
maxlength="11"
|
||||||
|
:placeholderStyle="placeholderStyle"
|
||||||
|
></uni-easyinput>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 验证码输入框 + 获取验证码按钮 -->
|
<!-- 验证码输入框 + 获取验证码按钮 -->
|
||||||
<view class="input-item verify-item">
|
<view class="input-item verify-item">
|
||||||
<view class="input-icon">
|
<view class="input-icon">
|
||||||
<image src="https://wuyeadmin.bugtc.com/images/login/code.png" mode="" style="height: 100%;width: 100%;"></image>
|
<image :src="`${imgBaseUrl}/images/login/code.png`" mode="" style="height: 100%; width: 100%"></image>
|
||||||
</view>
|
</view>
|
||||||
<uni-easyinput class="input-content verify-input" type="number" v-model="verifyCode"
|
<uni-easyinput
|
||||||
placeholder="请输入验证码" :inputBorder="false" maxlength="6" :placeholderStyle="placeholderStyle">
|
class="input-content verify-input"
|
||||||
</uni-easyinput>
|
type="number"
|
||||||
<button
|
v-model="verifyCode"
|
||||||
class="get-verify-btn"
|
placeholder="请输入验证码"
|
||||||
:disabled="!canGetVerify || countDown > 0"
|
:inputBorder="false"
|
||||||
@click="getVerifyCode"
|
maxlength="6"
|
||||||
>
|
:placeholderStyle="placeholderStyle"
|
||||||
|
></uni-easyinput>
|
||||||
|
<button class="get-verify-btn" :disabled="!canGetVerify || countDown > 0" @click="getVerifyCode">
|
||||||
{{ countDown > 0 ? `${countDown}s后重新获取` : '获取验证码' }}
|
{{ countDown > 0 ? `${countDown}s后重新获取` : '获取验证码' }}
|
||||||
</button>
|
</button>
|
||||||
</view>
|
</view>
|
||||||
@@ -42,29 +50,17 @@
|
|||||||
<!-- 协议勾选 -->
|
<!-- 协议勾选 -->
|
||||||
<view class="agreement-item">
|
<view class="agreement-item">
|
||||||
<view @click="toggleAgreement">
|
<view @click="toggleAgreement">
|
||||||
<uni-icons
|
<uni-icons type="checkbox-filled" size="24" color="#007aff" v-if="agreeAgreement"></uni-icons>
|
||||||
type="checkbox-filled"
|
<uni-icons type="checkbox" size="24" color="#999" v-else></uni-icons>
|
||||||
size="24"
|
|
||||||
color="#007aff"
|
|
||||||
v-if="agreeAgreement"
|
|
||||||
></uni-icons>
|
|
||||||
<uni-icons
|
|
||||||
type="checkbox"
|
|
||||||
size="24"
|
|
||||||
color="#999"
|
|
||||||
v-else
|
|
||||||
></uni-icons>
|
|
||||||
</view>
|
</view>
|
||||||
<text class="agreement-text" @click.stop="goToPrivacy">我已阅读并同意<text class="agreePrivacy" @click.stop="goToPrivacy">《用户隐私政策》</text></text>
|
<text class="agreement-text" @click.stop="goToPrivacy">
|
||||||
|
我已阅读并同意
|
||||||
|
<text class="agreePrivacy" @click.stop="goToPrivacy">《用户隐私政策》</text>
|
||||||
|
</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 登录按钮 -->
|
<!-- 登录按钮 -->
|
||||||
<button
|
<button class="login-btn" @click="handleLogin">登录</button>
|
||||||
class="login-btn"
|
|
||||||
@click="handleLogin"
|
|
||||||
>
|
|
||||||
登录
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<!-- 底部链接 -->
|
<!-- 底部链接 -->
|
||||||
<view class="bottom-link">
|
<view class="bottom-link">
|
||||||
@@ -76,16 +72,16 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onUnmounted } from 'vue';
|
import { ref, computed, onUnmounted } from 'vue';
|
||||||
import {getLoginBySms,getSendCode} from '../api/api.js'
|
import { getLoginBySms, getSendCode } from '../api/api.js';
|
||||||
import { showApiError } from '../api/request.js'
|
import { showApiError, imgBaseUrl } from '../api/request.js';
|
||||||
import { saveLoginData } from '../api/auth.js'
|
import { saveLoginData } from '../api/auth.js';
|
||||||
|
|
||||||
// ========== 响应式数据 ==========
|
// ========== 响应式数据 ==========
|
||||||
// 手机号
|
// 手机号
|
||||||
const phoneNumber = ref('');
|
const phoneNumber = ref('');
|
||||||
// 验证码
|
// 验证码
|
||||||
const verifyCode = ref('');
|
const verifyCode = ref('');
|
||||||
const placeholderStyle = ref('font-size:24rpx')
|
const placeholderStyle = ref('font-size:24rpx');
|
||||||
// 是否同意协议
|
// 是否同意协议
|
||||||
const agreeAgreement = ref(false); // 默认不勾选
|
const agreeAgreement = ref(false); // 默认不勾选
|
||||||
// 倒计时(秒)
|
// 倒计时(秒)
|
||||||
@@ -131,9 +127,9 @@ const toggleAgreement = () => {
|
|||||||
// 跳转隐私协议
|
// 跳转隐私协议
|
||||||
const goToPrivacy = () => {
|
const goToPrivacy = () => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:'/pageSubPack/loginSub/privacy',
|
url: '/pageSubPack/loginSub/privacy'
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
// 获取验证码
|
// 获取验证码
|
||||||
const getVerifyCode = () => {
|
const getVerifyCode = () => {
|
||||||
@@ -141,9 +137,10 @@ const getVerifyCode = () => {
|
|||||||
let params = {
|
let params = {
|
||||||
phone: phoneNumber.value,
|
phone: phoneNumber.value,
|
||||||
scene: 'login'
|
scene: 'login'
|
||||||
}
|
};
|
||||||
uni.showLoading({ title: '发送中...', mask: true });
|
uni.showLoading({ title: '发送中...', mask: true });
|
||||||
getSendCode(params).then(res =>{
|
getSendCode(params)
|
||||||
|
.then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -160,10 +157,10 @@ const getVerifyCode = () => {
|
|||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
|
||||||
showApiError(err)
|
|
||||||
})
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
showApiError(err);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 登录处理
|
// 登录处理
|
||||||
@@ -192,9 +189,10 @@ const handleLogin = () => {
|
|||||||
let params = {
|
let params = {
|
||||||
phone: phoneNumber.value,
|
phone: phoneNumber.value,
|
||||||
smsCode: verifyCode.value,
|
smsCode: verifyCode.value,
|
||||||
scene:'login',
|
scene: 'login'
|
||||||
}
|
};
|
||||||
getLoginBySms(params).then(res =>{
|
getLoginBySms(params)
|
||||||
|
.then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
saveLoginData(res.data);
|
saveLoginData(res.data);
|
||||||
@@ -207,15 +205,15 @@ const handleLogin = () => {
|
|||||||
uni.switchTab({ url: '/pages/paymentIndex/paymentIndex' });
|
uni.switchTab({ url: '/pages/paymentIndex/paymentIndex' });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},1500)
|
}, 1500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}).catch(err => {
|
|
||||||
showApiError(err)
|
|
||||||
})
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
showApiError(err);
|
||||||
|
});
|
||||||
|
|
||||||
uni.hideLoading()
|
uni.hideLoading();
|
||||||
};
|
};
|
||||||
|
|
||||||
// ========== 生命周期 ==========
|
// ========== 生命周期 ==========
|
||||||
@@ -233,7 +231,7 @@ onUnmounted(() => {
|
|||||||
padding: 80rpx 40rpx 40rpx;
|
padding: 80rpx 40rpx 40rpx;
|
||||||
/* background-color: #f8f9fa; */
|
/* background-color: #f8f9fa; */
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background: repeating-linear-gradient(to bottom, #E2F0FF, #F6FAFF );
|
background: repeating-linear-gradient(to bottom, #e2f0ff, #f6faff);
|
||||||
}
|
}
|
||||||
.status_bar {
|
.status_bar {
|
||||||
height: var(--status-bar-height, 88rpx);
|
height: var(--status-bar-height, 88rpx);
|
||||||
@@ -363,7 +361,7 @@ onUnmounted(() => {
|
|||||||
margin-left: 10rpx;
|
margin-left: 10rpx;
|
||||||
}
|
}
|
||||||
.agreePrivacy {
|
.agreePrivacy {
|
||||||
color: #2F77FD;
|
color: #2f77fd;
|
||||||
}
|
}
|
||||||
/* 登录按钮 */
|
/* 登录按钮 */
|
||||||
.login-btn {
|
.login-btn {
|
||||||
|
|||||||
@@ -15,44 +15,44 @@
|
|||||||
<view class="input-item">
|
<view class="input-item">
|
||||||
<view class="input-icon">
|
<view class="input-icon">
|
||||||
<!-- <uni-icons type="phone" size="24" color="#999"></uni-icons> -->
|
<!-- <uni-icons type="phone" size="24" color="#999"></uni-icons> -->
|
||||||
<image src="https://wuyeadmin.bugtc.com/images/login/phone.png" mode="" style="height: 100%;width: 100%;"></image>
|
<image :src="`${imgBaseUrl}/images/login/phone.png`" mode="" style="height: 100%; width: 100%"></image>
|
||||||
</view>
|
</view>
|
||||||
<uni-easyinput class="input-content" type="text" v-model="phoneNumber"
|
<uni-easyinput
|
||||||
placeholder="请输入帐号" :inputBorder="false" :placeholderStyle="placeholderStyle">
|
class="input-content"
|
||||||
</uni-easyinput>
|
type="text"
|
||||||
|
v-model="phoneNumber"
|
||||||
|
placeholder="请输入帐号"
|
||||||
|
:inputBorder="false"
|
||||||
|
:placeholderStyle="placeholderStyle"
|
||||||
|
></uni-easyinput>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 密码输入框 -->
|
<!-- 密码输入框 -->
|
||||||
<view class="input-item">
|
<view class="input-item">
|
||||||
<view class="input-icon">
|
<view class="input-icon">
|
||||||
<!-- <uni-icons type="locked" size="24" color="#999"></uni-icons> -->
|
<!-- <uni-icons type="locked" size="24" color="#999"></uni-icons> -->
|
||||||
<image src="https://wuyeadmin.bugtc.com/images/login/password.png" mode="" style="height: 100%;width: 100%;"></image>
|
<image :src="`${imgBaseUrl}/images/login/password.png`" mode="" style="height: 100%; width: 100%"></image>
|
||||||
</view>
|
</view>
|
||||||
<uni-easyinput class="input-content" type="password" v-model="password"
|
<uni-easyinput
|
||||||
placeholder="请输入密码" :inputBorder="false" :placeholderStyle="placeholderStyle">
|
class="input-content"
|
||||||
</uni-easyinput>
|
type="password"
|
||||||
|
v-model="password"
|
||||||
|
placeholder="请输入密码"
|
||||||
|
:inputBorder="false"
|
||||||
|
:placeholderStyle="placeholderStyle"
|
||||||
|
></uni-easyinput>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 协议勾选 + 忘记密码 -->
|
<!-- 协议勾选 + 忘记密码 -->
|
||||||
<view class="agreement-wrap">
|
<view class="agreement-wrap">
|
||||||
<view class="agreement-item">
|
<view class="agreement-item">
|
||||||
<view @click="toggleAgreement">
|
<view @click="toggleAgreement">
|
||||||
<uni-icons
|
<uni-icons type="checkbox-filled" size="24" color="#007aff" v-if="agreeAgreement"></uni-icons>
|
||||||
type="checkbox-filled"
|
<uni-icons type="checkbox" size="24" color="#999" v-else></uni-icons>
|
||||||
size="24"
|
|
||||||
color="#007aff"
|
|
||||||
v-if="agreeAgreement"
|
|
||||||
></uni-icons>
|
|
||||||
<uni-icons
|
|
||||||
type="checkbox"
|
|
||||||
size="24"
|
|
||||||
color="#999"
|
|
||||||
v-else
|
|
||||||
></uni-icons>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<text class="agreement-text" @click.stop="goToPrivacy">我已阅读并同意
|
<text class="agreement-text" @click.stop="goToPrivacy">
|
||||||
|
我已阅读并同意
|
||||||
<text class="agreePrivacy" @click.stop="goToPrivacy">《用户隐私政策》</text>
|
<text class="agreePrivacy" @click.stop="goToPrivacy">《用户隐私政策》</text>
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -60,12 +60,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 登录按钮 -->
|
<!-- 登录按钮 -->
|
||||||
<button
|
<button class="login-btn" @click="handleLogin">登录</button>
|
||||||
class="login-btn"
|
|
||||||
@click="handleLogin"
|
|
||||||
>
|
|
||||||
登录
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<!-- 底部链接 -->
|
<!-- 底部链接 -->
|
||||||
<view class="bottom-link">
|
<view class="bottom-link">
|
||||||
@@ -77,17 +72,16 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import {onLoad} from "@dcloudio/uni-app"
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
import {getLoginPassword} from '../api/api.js'
|
import { getLoginPassword } from '../api/api.js';
|
||||||
import { showApiError } from '../api/request.js'
|
import { showApiError, imgBaseUrl } from '../api/request.js';
|
||||||
import { saveLoginData } from '../api/auth.js'
|
import { saveLoginData } from '../api/auth.js';
|
||||||
|
|
||||||
// 响应式数据
|
// 响应式数据
|
||||||
const phoneNumber = ref('');
|
const phoneNumber = ref('');
|
||||||
const password = ref('');
|
const password = ref('');
|
||||||
const agreeAgreement = ref(false); // 默认勾选
|
const agreeAgreement = ref(false); // 默认勾选
|
||||||
const placeholderStyle = ref('font-size:24rpx')
|
const placeholderStyle = ref('font-size:24rpx');
|
||||||
|
|
||||||
|
|
||||||
// 计算属性:是否可登录(帐号+密码+协议都满足)
|
// 计算属性:是否可登录(帐号+密码+协议都满足)
|
||||||
const canLogin = computed(() => {
|
const canLogin = computed(() => {
|
||||||
@@ -104,9 +98,9 @@ const toggleAgreement = () => {
|
|||||||
// 跳转隐私协议
|
// 跳转隐私协议
|
||||||
const goToPrivacy = () => {
|
const goToPrivacy = () => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:'/pageSubPack/loginSub/privacy',
|
url: '/pageSubPack/loginSub/privacy'
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
// 检查表单
|
// 检查表单
|
||||||
const checkForm = () => {};
|
const checkForm = () => {};
|
||||||
@@ -121,13 +115,10 @@ const handleCancel = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onLoad(() => {});
|
||||||
onLoad(() =>{
|
|
||||||
});
|
|
||||||
|
|
||||||
// 登录逻辑
|
// 登录逻辑
|
||||||
const handleLogin = () => {
|
const handleLogin = () => {
|
||||||
|
|
||||||
if (!phoneNumber.value) {
|
if (!phoneNumber.value) {
|
||||||
uni.showToast({ title: '请输入账号', icon: 'none' });
|
uni.showToast({ title: '请输入账号', icon: 'none' });
|
||||||
return;
|
return;
|
||||||
@@ -156,8 +147,9 @@ const handleLogin = () => {
|
|||||||
let params = {
|
let params = {
|
||||||
username: phoneNumber.value,
|
username: phoneNumber.value,
|
||||||
password: password.value
|
password: password.value
|
||||||
}
|
};
|
||||||
getLoginPassword(params).then(res =>{
|
getLoginPassword(params)
|
||||||
|
.then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
saveLoginData(res.data);
|
saveLoginData(res.data);
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
@@ -169,14 +161,13 @@ const handleLogin = () => {
|
|||||||
uni.switchTab({ url: '/pages/paymentIndex/paymentIndex' });
|
uni.switchTab({ url: '/pages/paymentIndex/paymentIndex' });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},1000)
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
}).catch(err => {
|
|
||||||
// console.log(err)
|
|
||||||
showApiError(err)
|
|
||||||
})
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
// console.log(err)
|
||||||
|
showApiError(err);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -185,7 +176,7 @@ const handleLogin = () => {
|
|||||||
padding: 80rpx 40rpx 40rpx;
|
padding: 80rpx 40rpx 40rpx;
|
||||||
/* background-color: #f8f9fa; */
|
/* background-color: #f8f9fa; */
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background: repeating-linear-gradient(180deg, #E2F0FF, #F6FAFF );
|
background: repeating-linear-gradient(180deg, #e2f0ff, #f6faff);
|
||||||
}
|
}
|
||||||
.status_bar {
|
.status_bar {
|
||||||
height: var(--status-bar-height, 88rpx);
|
height: var(--status-bar-height, 88rpx);
|
||||||
@@ -276,7 +267,7 @@ const handleLogin = () => {
|
|||||||
margin-left: 10rpx;
|
margin-left: 10rpx;
|
||||||
}
|
}
|
||||||
.agreePrivacy {
|
.agreePrivacy {
|
||||||
color: #2F77FD;
|
color: #2f77fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
.forget-pwd {
|
.forget-pwd {
|
||||||
@@ -299,7 +290,6 @@ const handleLogin = () => {
|
|||||||
.login-btn:disabled {
|
.login-btn:disabled {
|
||||||
background-color: #99c8ff;
|
background-color: #99c8ff;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
|
||||||
}
|
}
|
||||||
/* 禁用按钮边框 */
|
/* 禁用按钮边框 */
|
||||||
button:after {
|
button:after {
|
||||||
|
|||||||
@@ -13,24 +13,34 @@
|
|||||||
<!-- 手机号输入框 -->
|
<!-- 手机号输入框 -->
|
||||||
<view class="input-item">
|
<view class="input-item">
|
||||||
<view class="input-icon">
|
<view class="input-icon">
|
||||||
<image src="https://wuyeadmin.bugtc.com/images/login/phone.png" mode=""
|
<image :src="`${imgBaseUrl}/images/login/phone.png`" mode="" style="height: 100%; width: 100%"></image>
|
||||||
style="height: 100%;width: 100%;"></image>
|
|
||||||
</view>
|
</view>
|
||||||
<uni-easyinput class="input-content" type="number" v-model="phoneNumber" placeholder="请输入手机号"
|
<uni-easyinput
|
||||||
:inputBorder="false" maxlength="11" :placeholderStyle="placeholderStyle">
|
class="input-content"
|
||||||
</uni-easyinput>
|
type="number"
|
||||||
|
v-model="phoneNumber"
|
||||||
|
placeholder="请输入手机号"
|
||||||
|
:inputBorder="false"
|
||||||
|
maxlength="11"
|
||||||
|
:placeholderStyle="placeholderStyle"
|
||||||
|
></uni-easyinput>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 验证码输入 + 获取验证码按钮 -->
|
<!-- 验证码输入 + 获取验证码按钮 -->
|
||||||
<view class="input-item verify-item">
|
<view class="input-item verify-item">
|
||||||
<view class="input-icon">
|
<view class="input-icon">
|
||||||
<image src="https://wuyeadmin.bugtc.com/images/login/code.png" mode="" style="height: 100%;width: 100%;">
|
<image :src="`${imgBaseUrl}/images/login/code.png`" mode="" style="height: 100%; width: 100%"></image>
|
||||||
</image>
|
|
||||||
<!-- <uni-icons type="locked" size="24" color="#999"></uni-icons> -->
|
<!-- <uni-icons type="locked" size="24" color="#999"></uni-icons> -->
|
||||||
</view>
|
</view>
|
||||||
<uni-easyinput class="input-content verify-input" type="number" v-model="verifyCode" placeholder="请输入验证码"
|
<uni-easyinput
|
||||||
:inputBorder="false" maxlength="6" :placeholderStyle="placeholderStyle">
|
class="input-content verify-input"
|
||||||
</uni-easyinput>
|
type="number"
|
||||||
|
v-model="verifyCode"
|
||||||
|
placeholder="请输入验证码"
|
||||||
|
:inputBorder="false"
|
||||||
|
maxlength="6"
|
||||||
|
:placeholderStyle="placeholderStyle"
|
||||||
|
></uni-easyinput>
|
||||||
|
|
||||||
<button class="get-verify-btn" :disabled="!canGetVerify || countDown > 0" @click="getVerifyCode">
|
<button class="get-verify-btn" :disabled="!canGetVerify || countDown > 0" @click="getVerifyCode">
|
||||||
{{ countDown > 0 ? `${countDown}s后重新获取` : '获取验证码' }}
|
{{ countDown > 0 ? `${countDown}s后重新获取` : '获取验证码' }}
|
||||||
@@ -40,27 +50,26 @@
|
|||||||
<!-- 账号输入框 -->
|
<!-- 账号输入框 -->
|
||||||
<view class="input-item">
|
<view class="input-item">
|
||||||
<view class="input-icon">
|
<view class="input-icon">
|
||||||
<image src="https://wuyeadmin.bugtc.com/images/login/account.png" mode=""
|
<image :src="`${imgBaseUrl}/images/login/account.png`" mode="" style="height: 100%; width: 100%"></image>
|
||||||
style="height: 100%;width: 100%;"></image>
|
|
||||||
<!-- <uni-icons type="person" size="24" color="#999"></uni-icons> -->
|
<!-- <uni-icons type="person" size="24" color="#999"></uni-icons> -->
|
||||||
</view>
|
</view>
|
||||||
<uni-easyinput class="input-content" type="text" v-model="account" placeholder="请输入账号" :inputBorder="false"
|
<uni-easyinput class="input-content" type="text" v-model="account" placeholder="请输入账号" :inputBorder="false" :placeholderStyle="placeholderStyle"></uni-easyinput>
|
||||||
:placeholderStyle="placeholderStyle">
|
|
||||||
</uni-easyinput>
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 密码输入框 -->
|
<!-- 密码输入框 -->
|
||||||
<view class="input-item">
|
<view class="input-item">
|
||||||
<view class="input-icon">
|
<view class="input-icon">
|
||||||
<image src="https://wuyeadmin.bugtc.com/images/login/password.png" mode=""
|
<image :src="`${imgBaseUrl}/images/login/password.png`" mode="" style="height: 100%; width: 100%"></image>
|
||||||
style="height: 100%;width: 100%;"></image>
|
|
||||||
<!-- <uni-icons type="locked" size="24" color="#999"></uni-icons> -->
|
<!-- <uni-icons type="locked" size="24" color="#999"></uni-icons> -->
|
||||||
</view>
|
</view>
|
||||||
<uni-easyinput class="input-content" type="password" v-model="password" placeholder="请输入密码"
|
<uni-easyinput
|
||||||
:inputBorder="false" :placeholderStyle="placeholderStyle">
|
class="input-content"
|
||||||
</uni-easyinput>
|
type="password"
|
||||||
|
v-model="password"
|
||||||
|
placeholder="请输入密码"
|
||||||
|
:inputBorder="false"
|
||||||
|
:placeholderStyle="placeholderStyle"
|
||||||
|
></uni-easyinput>
|
||||||
</view>
|
</view>
|
||||||
<!-- 协议勾选 -->
|
<!-- 协议勾选 -->
|
||||||
<view class="agreement-item">
|
<view class="agreement-item">
|
||||||
@@ -68,15 +77,14 @@
|
|||||||
<uni-icons type="checkbox-filled" size="24" color="#007aff" v-if="agreeAgreement"></uni-icons>
|
<uni-icons type="checkbox-filled" size="24" color="#007aff" v-if="agreeAgreement"></uni-icons>
|
||||||
<uni-icons type="checkbox" size="24" color="#999" v-else></uni-icons>
|
<uni-icons type="checkbox" size="24" color="#999" v-else></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
<text class="agreement-text" @click.stop="goToPrivacy">我已阅读并同意<text
|
<text class="agreement-text" @click.stop="goToPrivacy">
|
||||||
class="agreePrivacy">《用户隐私政策》</text></text>
|
我已阅读并同意
|
||||||
|
<text class="agreePrivacy">《用户隐私政策》</text>
|
||||||
|
</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<!-- 立即注册按钮 -->
|
<!-- 立即注册按钮 -->
|
||||||
<button class="register-btn" @click="handleRegister">
|
<button class="register-btn" @click="handleRegister">立即注册</button>
|
||||||
立即注册
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<!-- 跳转登录链接 -->
|
<!-- 跳转登录链接 -->
|
||||||
<view class="login-link">
|
<view class="login-link">
|
||||||
@@ -86,24 +94,17 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import { ref, computed, onUnmounted } from 'vue';
|
||||||
ref,
|
import { getRegisterUser, getSendCode } from '../api/api.js';
|
||||||
computed,
|
|
||||||
onUnmounted
|
|
||||||
} from 'vue';
|
|
||||||
import {
|
|
||||||
getRegisterUser,
|
|
||||||
getSendCode
|
|
||||||
} from '../api/api.js'
|
|
||||||
|
|
||||||
// ========== 响应式数据 ==========
|
// ========== 响应式数据 ==========
|
||||||
// 表单数据
|
// 表单数据
|
||||||
import { showApiError } from '../api/request.js'
|
import { showApiError, imgBaseUrl } from '../api/request.js';
|
||||||
const phoneNumber = ref('');
|
const phoneNumber = ref('');
|
||||||
const verifyCode = ref('');
|
const verifyCode = ref('');
|
||||||
const account = ref('');
|
const account = ref('');
|
||||||
const password = ref('');
|
const password = ref('');
|
||||||
const placeholderStyle = ref('font-size:24rpx')
|
const placeholderStyle = ref('font-size:24rpx');
|
||||||
// 协议勾选
|
// 协议勾选
|
||||||
const agreeAgreement = ref(false);
|
const agreeAgreement = ref(false);
|
||||||
// 验证码倒计时
|
// 验证码倒计时
|
||||||
@@ -124,11 +125,7 @@ import { showApiError } from '../api/request.js'
|
|||||||
const accountReg = /^.{4,20}$/; // 账号4-20位
|
const accountReg = /^.{4,20}$/; // 账号4-20位
|
||||||
const pwdReg = /^.{6,16}$/; // 密码6-16位
|
const pwdReg = /^.{6,16}$/; // 密码6-16位
|
||||||
|
|
||||||
return phoneReg.test(phoneNumber.value) &&
|
return phoneReg.test(phoneNumber.value) && verifyReg.test(verifyCode.value) && accountReg.test(account.value) && pwdReg.test(password.value) && agreeAgreement.value;
|
||||||
verifyReg.test(verifyCode.value) &&
|
|
||||||
accountReg.test(account.value) &&
|
|
||||||
pwdReg.test(password.value) &&
|
|
||||||
agreeAgreement.value;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// ========== 方法 ==========
|
// ========== 方法 ==========
|
||||||
@@ -144,21 +141,21 @@ import { showApiError } from '../api/request.js'
|
|||||||
// 跳转隐私协议
|
// 跳转隐私协议
|
||||||
const goToPrivacy = () => {
|
const goToPrivacy = () => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pageSubPack/loginSub/privacy',
|
url: '/pageSubPack/loginSub/privacy'
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
// 检查表单状态(实时更新按钮状态)
|
// 检查表单状态(实时更新按钮状态)
|
||||||
const checkForm = () => {};
|
const checkForm = () => {};
|
||||||
|
|
||||||
|
|
||||||
// 获取验证码
|
// 获取验证码
|
||||||
const getVerifyCode = () => {
|
const getVerifyCode = () => {
|
||||||
if (!canGetVerify.value) return;
|
if (!canGetVerify.value) return;
|
||||||
let params = {
|
let params = {
|
||||||
phone: phoneNumber.value,
|
phone: phoneNumber.value,
|
||||||
scene: 'register'
|
scene: 'register'
|
||||||
}
|
};
|
||||||
getSendCode(params).then(res => {
|
getSendCode(params)
|
||||||
|
.then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '验证码已发送',
|
title: '验证码已发送',
|
||||||
@@ -180,11 +177,10 @@ import { showApiError } from '../api/request.js'
|
|||||||
// icon: 'error'
|
// icon: 'error'
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
|
||||||
showApiError(err)
|
|
||||||
})
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
showApiError(err);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 处理注册逻辑
|
// 处理注册逻辑
|
||||||
@@ -238,8 +234,9 @@ import { showApiError } from '../api/request.js'
|
|||||||
smsCode: verifyCode.value,
|
smsCode: verifyCode.value,
|
||||||
username: account.value,
|
username: account.value,
|
||||||
password: password.value
|
password: password.value
|
||||||
}
|
};
|
||||||
getRegisterUser(params).then(res => {
|
getRegisterUser(params)
|
||||||
|
.then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -258,9 +255,10 @@ import { showApiError } from '../api/request.js'
|
|||||||
// icon: 'error'
|
// icon: 'error'
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
}).catch((err) => {
|
|
||||||
showApiError(err)
|
|
||||||
})
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
showApiError(err);
|
||||||
|
});
|
||||||
// 注册成功后跳转到登录页
|
// 注册成功后跳转到登录页
|
||||||
// uni.redirectTo({
|
// uni.redirectTo({
|
||||||
// url: '/pages/login/pwd-login'
|
// url: '/pages/login/pwd-login'
|
||||||
@@ -286,7 +284,7 @@ import { showApiError } from '../api/request.js'
|
|||||||
padding: 20rpx 40rpx 40rpx;
|
padding: 20rpx 40rpx 40rpx;
|
||||||
/* background-color: #f8f9fa; */
|
/* background-color: #f8f9fa; */
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background: repeating-linear-gradient(180deg, #E2F0FF, #F6FAFF);
|
background: repeating-linear-gradient(180deg, #e2f0ff, #f6faff);
|
||||||
}
|
}
|
||||||
|
|
||||||
.status_bar {
|
.status_bar {
|
||||||
@@ -413,7 +411,7 @@ import { showApiError } from '../api/request.js'
|
|||||||
}
|
}
|
||||||
|
|
||||||
.agreePrivacy {
|
.agreePrivacy {
|
||||||
color: #2F77FD;
|
color: #2f77fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 立即注册按钮 */
|
/* 立即注册按钮 */
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="contentStyle" style="">
|
<view class="contentStyle" style="">
|
||||||
<view class="status-bar"></view>
|
<view class="status-bar"></view>
|
||||||
<uni-nav-bar :title="'新增'+paymentType+'缴费'" left-icon="left" @clickLeft="goBack" backgroundColor="transparent"
|
<uni-nav-bar :title="'新增' + paymentType + '缴费'" left-icon="left" @clickLeft="goBack" backgroundColor="transparent" :border="false"></uni-nav-bar>
|
||||||
:border="false">
|
|
||||||
</uni-nav-bar>
|
|
||||||
<!-- 表单区域 -->
|
<!-- 表单区域 -->
|
||||||
<scroll-view class="page" scroll-y="true">
|
<scroll-view class="page" scroll-y="true">
|
||||||
<view class="card-box">
|
<view class="card-box">
|
||||||
<!-- 头部水表标题+水滴图标 -->
|
<!-- 头部水表标题+水滴图标 -->
|
||||||
<view class="card-header">
|
<view class="card-header">
|
||||||
<image class="iconStyle"
|
<image
|
||||||
:src="paymentType=='水表'?'https://wuyeadmin.bugtc.com/images/propertyImgs/water.png':'https://wuyeadmin.bugtc.com/images/propertyImgs/electric.png'">
|
class="iconStyle"
|
||||||
</image>
|
:src="paymentType == '水表' ? `${imgBaseUrl}/images/propertyImgs/water.png` : `${imgBaseUrl}/images/propertyImgs/electric.png`"
|
||||||
|
></image>
|
||||||
<text class="card-title">{{ paymentType }}</text>
|
<text class="card-title">{{ paymentType }}</text>
|
||||||
</view>
|
</view>
|
||||||
<!-- 分割线 -->
|
<!-- 分割线 -->
|
||||||
@@ -27,12 +26,9 @@
|
|||||||
<view class="input-label">缴费设备号</view>
|
<view class="input-label">缴费设备号</view>
|
||||||
<view class="input-wrap">
|
<view class="input-wrap">
|
||||||
<!-- 输入框 -->
|
<!-- 输入框 -->
|
||||||
<input class="input" placeholder="请输入设备号" placeholder-class="input-placeholder"
|
<input class="input" placeholder="请输入设备号" placeholder-class="input-placeholder" v-model="deviceNo" />
|
||||||
v-model="deviceNo" />
|
|
||||||
<!-- 右边扫码图标 text标签直接用 双端不乱码 -->
|
<!-- 右边扫码图标 text标签直接用 双端不乱码 -->
|
||||||
<image class="scanTheCodeIconStyle"
|
<image class="scanTheCodeIconStyle" :src="`${imgBaseUrl}/images/propertyImgs/scanTheCodeIcon.png`" @click="scanCode"></image>
|
||||||
src="https://wuyeadmin.bugtc.com/images/propertyImgs/scanTheCodeIcon.png" @click="scanCode">
|
|
||||||
</image>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -40,7 +36,6 @@
|
|||||||
<view class="line"></view>
|
<view class="line"></view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<!-- 底部协议和提交按钮 -->
|
<!-- 底部协议和提交按钮 -->
|
||||||
<view class="bottom-area">
|
<view class="bottom-area">
|
||||||
<!-- <view class="agreement">
|
<!-- <view class="agreement">
|
||||||
@@ -51,56 +46,25 @@
|
|||||||
<text class="agreement-link" @click="handleProtocol">《协议链接》</text>
|
<text class="agreement-link" @click="handleProtocol">《协议链接》</text>
|
||||||
</view> -->
|
</view> -->
|
||||||
|
|
||||||
|
<button class="submit-btn" @click="goPay">提交</button>
|
||||||
<button class="submit-btn" @click="goPay">
|
|
||||||
提交
|
|
||||||
</button>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import { ref, onMounted, computed } from 'vue';
|
||||||
ref,
|
import { onShow, onReady, onReachBottom, onLoad, onUnload, onPullDownRefresh } from '@dcloudio/uni-app';
|
||||||
onMounted,
|
|
||||||
computed
|
|
||||||
|
|
||||||
} from 'vue'
|
import { getTopUpBindDevice, getopenIdByCode } from '/pageSubPack/api/apiSub.js';
|
||||||
import {
|
import { showApiError, baseUrl, imgBaseUrl } from '/pageSubPack/api/request.js';
|
||||||
onShow,
|
|
||||||
onReady,
|
|
||||||
onReachBottom,
|
|
||||||
onLoad,
|
|
||||||
onUnload,
|
|
||||||
onPullDownRefresh
|
|
||||||
} from '@dcloudio/uni-app'
|
|
||||||
|
|
||||||
import {
|
|
||||||
getTopUpBindDevice,
|
|
||||||
getopenIdByCode
|
|
||||||
} from '/pageSubPack/api/apiSub.js'
|
|
||||||
import { showApiError } from '/pageSubPack/api/request.js'
|
|
||||||
|
|
||||||
// 响应式数据
|
// 响应式数据
|
||||||
const paymentType = ref(uni.getStorageSync('addPaymentType'))
|
const paymentType = ref(uni.getStorageSync('addPaymentType'));
|
||||||
const deviceNo = ref('')
|
const deviceNo = ref('');
|
||||||
const isAgree = ref(false)
|
const isAgree = ref(false);
|
||||||
// 生命周期
|
// 生命周期
|
||||||
onMounted(() => {})
|
onMounted(() => {});
|
||||||
|
|
||||||
// 扫码
|
// 扫码
|
||||||
const scanCode = async () => {
|
const scanCode = async () => {
|
||||||
@@ -108,29 +72,29 @@ import { showApiError } from '/pageSubPack/api/request.js'
|
|||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '扫码中...',
|
title: '扫码中...',
|
||||||
mask: true
|
mask: true
|
||||||
})
|
});
|
||||||
|
|
||||||
const res = await uni.scanCode({
|
const res = await uni.scanCode({
|
||||||
onlyFromCamera: false,
|
onlyFromCamera: false,
|
||||||
scanType: ['qrCode', 'barCode']
|
scanType: ['qrCode', 'barCode']
|
||||||
})
|
});
|
||||||
|
|
||||||
// 扫码成功,赋值
|
// 扫码成功,赋值
|
||||||
deviceNo.value = res.result
|
deviceNo.value = res.result;
|
||||||
uni.hideLoading()
|
uni.hideLoading();
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '扫码成功',
|
title: '扫码成功',
|
||||||
icon: 'success'
|
icon: 'success'
|
||||||
})
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
uni.hideLoading()
|
uni.hideLoading();
|
||||||
console.log('扫码失败', err)
|
console.log('扫码失败', err);
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '扫码取消/失败',
|
title: '扫码取消/失败',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 提交缴费
|
// 提交缴费
|
||||||
const goPay = async () => {
|
const goPay = async () => {
|
||||||
@@ -138,8 +102,8 @@ import { showApiError } from '/pageSubPack/api/request.js'
|
|||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '请输入设备号',
|
title: '请输入设备号',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
});
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
@@ -150,7 +114,7 @@ import { showApiError } from '/pageSubPack/api/request.js'
|
|||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '提交中...',
|
title: '提交中...',
|
||||||
mask: true
|
mask: true
|
||||||
})
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// // 获取 openid
|
// // 获取 openid
|
||||||
@@ -175,46 +139,44 @@ import { showApiError } from '/pageSubPack/api/request.js'
|
|||||||
// })
|
// })
|
||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
const openid = uni.getStorageSync('openid')
|
const openid = uni.getStorageSync('openid');
|
||||||
await getTopUpBindDevice({
|
await getTopUpBindDevice({
|
||||||
deviceType: paymentType.value == '水表' ? '2' : '1',
|
deviceType: paymentType.value == '水表' ? '2' : '1',
|
||||||
deviceCode: deviceNo.value,
|
deviceCode: deviceNo.value,
|
||||||
openid: openid,
|
openid: openid,
|
||||||
residentUserId: uni.getStorageSync('userId')
|
residentUserId: uni.getStorageSync('userId')
|
||||||
})
|
});
|
||||||
uni.hideLoading()
|
uni.hideLoading();
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '提交成功',
|
title: '提交成功',
|
||||||
icon: 'success'
|
icon: 'success'
|
||||||
})
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
goNext()
|
goNext();
|
||||||
}, 1500)
|
}, 1500);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
uni.hideLoading()
|
uni.hideLoading();
|
||||||
showApiError(err)
|
showApiError(err);
|
||||||
console.error('绑定设备失败:', err)
|
console.error('绑定设备失败:', err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 跳转成功页
|
// 跳转成功页
|
||||||
const goNext = () => {
|
const goNext = () => {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: '/pageSubPack/payment-list/addPaymentSuccess'
|
url: '/pageSubPack/payment-list/addPaymentSuccess'
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
// 返回
|
// 返回
|
||||||
const goBack = () => {
|
const goBack = () => {
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: '/pages/paymentIndex/paymentIndex'
|
url: '/pages/paymentIndex/paymentIndex'
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
page {
|
page {
|
||||||
@@ -238,7 +200,6 @@ import { showApiError } from '/pageSubPack/api/request.js'
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* 白色卡片容器 */
|
/* 白色卡片容器 */
|
||||||
.card-box {
|
.card-box {
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
@@ -311,8 +272,6 @@ import { showApiError } from '/pageSubPack/api/request.js'
|
|||||||
color: #cccccc;
|
color: #cccccc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* 底部协议+按钮区域 */
|
/* 底部协议+按钮区域 */
|
||||||
.bottom-area {
|
.bottom-area {
|
||||||
margin-top: 60rpx;
|
margin-top: 60rpx;
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="contentStyle" style="">
|
<view class="contentStyle" style="">
|
||||||
<view class="status-bar"></view>
|
<view class="status-bar"></view>
|
||||||
<uni-nav-bar :title="'新增'+paymentType+'缴费'" left-icon="left" @clickLeft="goBack" backgroundColor="transparent"
|
<uni-nav-bar :title="'新增' + paymentType + '缴费'" left-icon="left" @clickLeft="goBack" backgroundColor="transparent" :border="false"></uni-nav-bar>
|
||||||
:border="false">
|
|
||||||
</uni-nav-bar>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 表单区域 -->
|
<!-- 表单区域 -->
|
||||||
<scroll-view class="page" scroll-y="true">
|
<scroll-view class="page" scroll-y="true">
|
||||||
@@ -12,9 +9,9 @@
|
|||||||
<!-- 顶部蓝色标题栏 -->
|
<!-- 顶部蓝色标题栏 -->
|
||||||
<view class="header-card">
|
<view class="header-card">
|
||||||
<view class="header-icon">
|
<view class="header-icon">
|
||||||
<image class="iconStyle"
|
<image class="iconStyle" :src="paymentType == '燃气' ? `${imgBaseUrl}/images/propertyImgs/gas.png` : `${imgBaseUrl}/images/propertyImgs/heating.png`">
|
||||||
:src="paymentType=='燃气'?'https://wuyeadmin.bugtc.com/images/propertyImgs/gas.png':'https://wuyeadmin.bugtc.com/images/propertyImgs/heating.png'">
|
>
|
||||||
></image>
|
</image>
|
||||||
</view>
|
</view>
|
||||||
<text class="header-title">{{ paymentType + '费' }}</text>
|
<text class="header-title">{{ paymentType + '费' }}</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -34,12 +31,8 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 快速获取户号 底部弹窗 -->
|
<!-- 快速获取户号 底部弹窗 -->
|
||||||
<view v-if="showPopup" class="popup-mask" @click="showPopup = false">
|
<view v-if="showPopup" class="popup-mask" @click="showPopup = false">
|
||||||
<view class="popup-content" @click.stop>
|
<view class="popup-content" @click.stop>
|
||||||
@@ -65,8 +58,6 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
<!-- 底部协议和立即缴费按钮 -->
|
<!-- 底部协议和立即缴费按钮 -->
|
||||||
<view class="bottom-area">
|
<view class="bottom-area">
|
||||||
@@ -77,55 +68,39 @@
|
|||||||
<text class="agreement-text">我已阅并同意</text>
|
<text class="agreement-text">我已阅并同意</text>
|
||||||
<text class="agreement-link" @click="handleProtocol">《协议链接》</text>
|
<text class="agreement-link" @click="handleProtocol">《协议链接》</text>
|
||||||
</view>
|
</view>
|
||||||
<button class="submit-btn" @click="handleSubmit">
|
<button class="submit-btn" @click="handleSubmit">立即缴费</button>
|
||||||
立即缴费
|
|
||||||
</button>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import { ref, onMounted, computed } from 'vue';
|
||||||
ref,
|
import { onShow, onReady, onReachBottom, onLoad, onUnload, onPullDownRefresh } from '@dcloudio/uni-app';
|
||||||
onMounted,
|
import { baseUrl, imgBaseUrl } from '/pageSubPack/api/request.js';
|
||||||
computed
|
|
||||||
|
|
||||||
} from 'vue'
|
|
||||||
import {
|
|
||||||
onShow,
|
|
||||||
onReady,
|
|
||||||
onReachBottom,
|
|
||||||
onLoad,
|
|
||||||
onUnload,
|
|
||||||
onPullDownRefresh
|
|
||||||
} from '@dcloudio/uni-app'
|
|
||||||
// 响应式数据
|
// 响应式数据
|
||||||
const statusBarHeight = ref(20)
|
const statusBarHeight = ref(20);
|
||||||
const paymentType = ref(uni.getStorageSync('addPaymentType'))
|
const paymentType = ref(uni.getStorageSync('addPaymentType'));
|
||||||
const userNo = ref('')
|
const userNo = ref('');
|
||||||
const isAgree = ref(false)
|
const isAgree = ref(false);
|
||||||
const showPopup = ref(false)
|
const showPopup = ref(false);
|
||||||
|
|
||||||
// 生命周期
|
// 生命周期
|
||||||
onShow(() => {})
|
onShow(() => {});
|
||||||
onMounted(() => {})
|
onMounted(() => {});
|
||||||
onReady(() => {
|
onReady(() => {
|
||||||
// nextTick 用法
|
// nextTick 用法
|
||||||
// nextTick(() => {})
|
// nextTick(() => {})
|
||||||
})
|
});
|
||||||
|
|
||||||
// 勾选协议
|
// 勾选协议
|
||||||
const handleAgreeChange = (e) => {
|
const handleAgreeChange = (e) => {
|
||||||
isAgree.value = e.detail.value.length > 0
|
isAgree.value = e.detail.value.length > 0;
|
||||||
}
|
};
|
||||||
|
|
||||||
// 协议链接点击
|
// 协议链接点击
|
||||||
const handleProtocol = () => {
|
const handleProtocol = () => {
|
||||||
uni.navigateTo({})
|
uni.navigateTo({});
|
||||||
}
|
};
|
||||||
|
|
||||||
// 提交
|
// 提交
|
||||||
const handleSubmit = () => {
|
const handleSubmit = () => {
|
||||||
@@ -133,16 +108,16 @@
|
|||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '请输入户号',
|
title: '请输入户号',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
});
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isAgree.value) {
|
if (!isAgree.value) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '请先同意协议',
|
title: '请先同意协议',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
});
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
@@ -153,42 +128,42 @@
|
|||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '提交中...',
|
title: '提交中...',
|
||||||
mask: true
|
mask: true
|
||||||
})
|
});
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '提交成功',
|
title: '提交成功',
|
||||||
icon: 'success'
|
icon: 'success'
|
||||||
})
|
});
|
||||||
}, 1000)
|
}, 1000);
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.hideLoading()
|
uni.hideLoading();
|
||||||
goNext()
|
goNext();
|
||||||
}, 2500)
|
}, 2500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
// 跳转成功页
|
// 跳转成功页
|
||||||
const goNext = () => {
|
const goNext = () => {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: '/pageSubPack/payment-list/addPaymentSuccess'
|
url: '/pageSubPack/payment-list/addPaymentSuccess'
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
// 切换(注释保留)
|
// 切换(注释保留)
|
||||||
const goToChange = () => {
|
const goToChange = () => {
|
||||||
// uni.redirectTo({
|
// uni.redirectTo({
|
||||||
// url: '/pageSubPack/payment-list/selectPaymentEntity'
|
// url: '/pageSubPack/payment-list/selectPaymentEntity'
|
||||||
// })
|
// })
|
||||||
}
|
};
|
||||||
|
|
||||||
// 返回
|
// 返回
|
||||||
const goBack = () => {
|
const goBack = () => {
|
||||||
uni.switchTab({ url: '/pages/paymentIndex/paymentIndex' });
|
uni.switchTab({ url: '/pages/paymentIndex/paymentIndex' });
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
page {
|
page {
|
||||||
@@ -223,7 +198,6 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border-bottom: 2rpx solid #ededed;
|
border-bottom: 2rpx solid #ededed;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-icon {
|
.header-icon {
|
||||||
@@ -235,7 +209,6 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
margin-right: 20rpx;
|
margin-right: 20rpx;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.iconStyle {
|
.iconStyle {
|
||||||
@@ -414,7 +387,6 @@
|
|||||||
/* 弹窗列表 */
|
/* 弹窗列表 */
|
||||||
.popup-list {
|
.popup-list {
|
||||||
padding: 0 10rpx;
|
padding: 0 10rpx;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.popup-item {
|
.popup-item {
|
||||||
|
|||||||
@@ -1,32 +1,25 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="contentStyle" style="">
|
<view class="contentStyle" style="">
|
||||||
<view class="status-bar"></view>
|
<view class="status-bar"></view>
|
||||||
<uni-nav-bar :title="paymentItem.type || '缴费'" left-icon="left" @clickLeft="goBack"
|
<uni-nav-bar :title="paymentItem.type || '缴费'" left-icon="left" @clickLeft="goBack" backgroundColor="transparent" :border="false"></uni-nav-bar>
|
||||||
backgroundColor="transparent" :border="false">
|
|
||||||
</uni-nav-bar>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 表单区域 -->
|
<!-- 表单区域 -->
|
||||||
<scroll-view class="page" scroll-y="true">
|
<scroll-view class="page" scroll-y="true">
|
||||||
|
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<!-- 1. 缴费详情 -->
|
<!-- 1. 缴费详情 -->
|
||||||
<view v-if="currentStep === 1" class="pay-page">
|
<view v-if="currentStep === 1" class="pay-page">
|
||||||
<!-- 物业费缴费 -->
|
<!-- 物业费缴费 -->
|
||||||
<!-- 金额展示 -->
|
<!-- 金额展示 -->
|
||||||
<view class="amount-section" v-if="outstandingPayment">
|
<view class="amount-section" v-if="outstandingPayment">
|
||||||
<text class="amount-text"
|
<text class="amount-text" :class="{ outstandingPaymentClass: outstandingPayment }">{{ outstandingPayment ? '-¥' + payAmount : '¥' + payAmount }}</text>
|
||||||
:class="{ 'outstandingPaymentClass':outstandingPayment }">{{outstandingPayment?'-¥'+payAmount:'¥'+payAmount}}</text>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="amount-section" v-else>
|
<view class="amount-section" v-else>
|
||||||
<text class="amount-text paymentClass">{{ '¥' + payAmount }}</text>
|
<text class="amount-text paymentClass">{{ '¥' + payAmount }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view style="border-bottom: 2rpx solid #ededed;margin:10rpx 0rpx;"></view>
|
<view style="border-bottom: 2rpx solid #ededed; margin: 10rpx 0rpx"></view>
|
||||||
<!-- 缴费信息 -->
|
<!-- 缴费信息 -->
|
||||||
<view class="info-section" style="">
|
<view class="info-section" style="">
|
||||||
|
|
||||||
<view>
|
<view>
|
||||||
|
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<text class="info-label">户号</text>
|
<text class="info-label">户号</text>
|
||||||
<text class="info-value">{{ paymentItem.deviceCode || '-' }}</text>
|
<text class="info-value">{{ paymentItem.deviceCode || '-' }}</text>
|
||||||
@@ -41,23 +34,22 @@
|
|||||||
</view>
|
</view>
|
||||||
<!-- <view style="border-bottom: 2rpx solid #c7c7c7;padding-bottom:20rpx;"></view> -->
|
<!-- <view style="border-bottom: 2rpx solid #c7c7c7;padding-bottom:20rpx;"></view> -->
|
||||||
<!-- 缴费金额输入 -->
|
<!-- 缴费金额输入 -->
|
||||||
<view style="border-bottom: 2rpx solid #ededed;margin:10rpx 0rpx;"></view>
|
<!-- <view style="border-bottom: 2rpx solid #ededed; margin: 10rpx 0rpx"></view>
|
||||||
<view class="input-section" style="display: flex;">
|
<view class="input-section" style="display: flex;">
|
||||||
<text class="amount-input" style="width: auto;margin: 0rpx 20rpx;">¥</text>
|
<text class="amount-input" style="width: auto;margin: 0rpx 20rpx;">¥</text>
|
||||||
<input type="digit" v-model="payNum" class="amount-input" placeholder="点击输入缴费金额">
|
<input type="digit" v-model="payNum" class="amount-input" placeholder="点击输入缴费金额">
|
||||||
</input>
|
</input>
|
||||||
</view>
|
</view> -->
|
||||||
<view style="border-bottom: 2rpx solid #ededed;margin:10rpx 0rpx;"></view>
|
<view style="border-bottom: 2rpx solid #ededed; margin: 10rpx 0rpx"></view>
|
||||||
<view class="arrears-row" v-if="outstandingPayment == true">
|
<view class="arrears-row" v-if="outstandingPayment == true">
|
||||||
<text class="arrears-text">当前欠费金额¥{{ arrearsAmount }}元</text>
|
<text class="arrears-text">当前欠费金额¥{{ arrearsAmount }}元</text>
|
||||||
<text class="auto-fill-btn" @click="handleAutoFill">点击自动填入</text>
|
<!-- <text class="auto-fill-btn" @click="handleAutoFill">点击自动填入</text> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="arrears-row" v-if="outstandingPayment == false">
|
<view class="arrears-row" v-if="outstandingPayment == false">
|
||||||
<text class="arrears-text">暂未查询到欠费</text>
|
<text class="arrears-text">暂未查询到欠费</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 2. 缴费成功页 -->
|
<!-- 2. 缴费成功页 -->
|
||||||
@@ -66,110 +58,96 @@
|
|||||||
<view class="success-icon">
|
<view class="success-icon">
|
||||||
<text class="icon-check">✓</text>
|
<text class="icon-check">✓</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 主标题 -->
|
<!-- 主标题 -->
|
||||||
<view class="title">缴费成功</view>
|
<view class="title">缴费成功</view>
|
||||||
|
|
||||||
<!-- 提示文案 -->
|
<!-- 提示文案 -->
|
||||||
<view class="desc">
|
<view class="desc">成功缴纳{{ paymentItem.type || '' }}费用 ¥{{ payNum || payAmount }}元</view>
|
||||||
成功缴纳{{ paymentItem.type || '' }}费用 ¥{{ payNum || payAmount }}元
|
|
||||||
</view>
|
</view>
|
||||||
|
<view class="container" v-if="currentStep === 3">
|
||||||
|
<view class="fail-icon"><text class="icon-fail">✕</text></view>
|
||||||
|
<view class="title">缴费失败</view>
|
||||||
|
<view class="desc">未能完成缴费,请重新尝试</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
<!-- 立即缴费按钮 -->
|
<!-- 立即缴费按钮 -->
|
||||||
<view class="btn-section" v-if="currentStep === 1">
|
<view class="btn-section" v-if="currentStep === 1">
|
||||||
<button class="pay-btn" @click="handlePay">立即缴费</button>
|
<button class="pay-btn" @click="handlePay">立即缴费</button>
|
||||||
</view>
|
</view>
|
||||||
<!-- 返回按钮 -->
|
<!-- 返回按钮 -->
|
||||||
<view class="btn-section" v-if="currentStep === 2">
|
<view class="btn-section" v-if="currentStep === 2 || currentStep === 3">
|
||||||
<button class="pay-btn" @click="handleBackToList">返回生活缴费</button>
|
<button class="pay-btn" @click="handleBackToList">返回生活缴费</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import { showApiError } from '../api/request.js';
|
||||||
ref,
|
import { ref, reactive, onMounted, computed } from 'vue';
|
||||||
reactive,
|
import { onShow, onReady, onReachBottom, onLoad, onUnload, onPullDownRefresh } from '@dcloudio/uni-app';
|
||||||
onMounted,
|
|
||||||
computed
|
|
||||||
|
|
||||||
} from 'vue'
|
|
||||||
import {
|
|
||||||
onShow,
|
|
||||||
onReady,
|
|
||||||
onReachBottom,
|
|
||||||
onLoad,
|
|
||||||
onUnload,
|
|
||||||
onPullDownRefresh
|
|
||||||
} from '@dcloudio/uni-app'
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getTopUp,
|
getTopUp,
|
||||||
getToWxPay,
|
getToWxPay,
|
||||||
getopenIdByCode,
|
getopenIdByCode,
|
||||||
postSubscribeAuth
|
postSubscribeAuth,
|
||||||
} from '/pageSubPack/api/apiSub.js'
|
getBankMiniProgramParams,
|
||||||
|
resolvePaymentResult,
|
||||||
|
getPaymentReturnResult,
|
||||||
|
clearPaymentReturnResult
|
||||||
|
} from '/pageSubPack/api/apiSub.js';
|
||||||
|
|
||||||
// 响应式数据
|
// 响应式数据
|
||||||
const statusBarHeight = ref(20)
|
const statusBarHeight = ref(20);
|
||||||
const outstandingPayment = ref(true)
|
const outstandingPayment = ref(true);
|
||||||
const storageValue = uni.getStorageSync('arrearsPayment')
|
const storageValue = uni.getStorageSync('arrearsPayment');
|
||||||
const paymentItem = reactive(typeof storageValue === 'object' && storageValue !== null ? storageValue : {})
|
const paymentItem = reactive(typeof storageValue === 'object' && storageValue !== null ? storageValue : {});
|
||||||
const currentStep = ref(1)
|
const currentStep = ref(1);
|
||||||
const payAmount = ref('0.00')
|
const payAmount = ref('0.00');
|
||||||
const arrearsAmount = ref('0.00')
|
const arrearsAmount = ref('0.00');
|
||||||
const payNum = ref('')
|
const payNum = ref('');
|
||||||
|
|
||||||
// 页面加载时初始化数据
|
// 页面加载时初始化数据
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
initPaymentData()
|
initPaymentData();
|
||||||
checkAllSubscribeStatus()
|
checkAllSubscribeStatus();
|
||||||
})
|
});
|
||||||
|
|
||||||
// 初始化缴费数据
|
// 初始化缴费数据
|
||||||
const initPaymentData = () => {
|
const initPaymentData = () => {
|
||||||
if (paymentItem) {
|
if (paymentItem) {
|
||||||
arrearsAmount.value = Math.abs(paymentItem.balance || 0).toFixed(2)
|
arrearsAmount.value = Math.abs(paymentItem.balance || 0).toFixed(2);
|
||||||
payAmount.value = Math.abs(paymentItem.balance || 0)
|
payAmount.value = Math.abs(paymentItem.balance || 0);
|
||||||
outstandingPayment.value = paymentItem.balance < 0
|
outstandingPayment.value = paymentItem.balance < 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 自动填充欠费金额
|
// 自动填充欠费金额
|
||||||
const handleAutoFill = () => {
|
const handleAutoFill = () => {
|
||||||
payNum.value = arrearsAmount.value
|
payNum.value = arrearsAmount.value;
|
||||||
uni.vibrateShort({
|
uni.vibrateShort({
|
||||||
type: 'light'
|
type: 'light'
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
// 返回
|
// 返回
|
||||||
const goBack = () => {
|
const goBack = () => {
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: '/pages/paymentIndex/paymentIndex'
|
url: '/pages/paymentIndex/paymentIndex'
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
// 立即缴费
|
// 立即缴费
|
||||||
const handlePay = () => {
|
const handlePay = () => {
|
||||||
if (!payNum.value || Number(payNum.value) <= 0) {
|
// if (!payNum.value || Number.isNaN(Number(payNum.value)) || Number(payNum.value) <= 0) {
|
||||||
uni.showToast({
|
// uni.showToast({
|
||||||
title: '请输入正确的缴费金额',
|
// title: '请输入正确的缴费金额',
|
||||||
icon: 'none'
|
// icon: 'none'
|
||||||
})
|
// });
|
||||||
return
|
// return;
|
||||||
}
|
// }
|
||||||
requestPayOrder()
|
requestPayOrder();
|
||||||
}
|
};
|
||||||
// 统一下单后后端返回的支付参数
|
// 统一下单后后端返回的支付参数
|
||||||
const payInfo = ref({
|
const payInfo = ref({
|
||||||
appId: '', // 公众号/小程序ID
|
appId: '', // 公众号/小程序ID
|
||||||
@@ -178,14 +156,14 @@
|
|||||||
package: '', // 数据包 如 prepay_id=xxx
|
package: '', // 数据包 如 prepay_id=xxx
|
||||||
signType: 'MD5', // 签名方式
|
signType: 'MD5', // 签名方式
|
||||||
paySign: '' // 签名
|
paySign: '' // 签名
|
||||||
})
|
});
|
||||||
|
|
||||||
// 1. 先请求后端接口生成预支付订单
|
// 1. 先请求后端接口生成预支付订单
|
||||||
const requestPayOrder = async () => {
|
const requestPayOrder = async () => {
|
||||||
try {
|
try {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '发起支付中'
|
title: '发起支付中'
|
||||||
})
|
});
|
||||||
|
|
||||||
// // 获取 openid
|
// // 获取 openid
|
||||||
// const loginRes = await wx.login()
|
// const loginRes = await wx.login()
|
||||||
@@ -210,7 +188,10 @@
|
|||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
// const openid = openIdRes.data
|
// const openid = openIdRes.data
|
||||||
const openid = uni.getStorageSync('openid')
|
const openid = uni.getStorageSync('openid');
|
||||||
|
// 对接日照银行
|
||||||
|
RZBank();
|
||||||
|
return;
|
||||||
|
|
||||||
// 调用充值接口创建订单
|
// 调用充值接口创建订单
|
||||||
console.log('1111111111', paymentItem);
|
console.log('1111111111', paymentItem);
|
||||||
@@ -221,185 +202,248 @@
|
|||||||
deviceCode: paymentItem.deviceCode,
|
deviceCode: paymentItem.deviceCode,
|
||||||
// type: paymentItem.type == '水表' ? '2' : paymentItem.type == '电表' ? '1' : ''
|
// type: paymentItem.type == '水表' ? '2' : paymentItem.type == '电表' ? '1' : ''
|
||||||
type: '2'
|
type: '2'
|
||||||
})
|
});
|
||||||
uni.hideLoading()
|
uni.hideLoading();
|
||||||
|
|
||||||
const topUpData = topUpRes
|
const topUpData = topUpRes;
|
||||||
console.log(topUpData);
|
console.log(topUpData);
|
||||||
if (topUpData.code !== 200) {
|
if (topUpData.code !== 200) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: topUpData.msg || '下单失败',
|
title: topUpData.msg || '下单失败',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
});
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 调用微信支付接口获取支付参数
|
// 调用微信支付接口获取支付参数
|
||||||
const payRes = await getToWxPay({
|
const payRes = await getToWxPay({
|
||||||
orderId: topUpData.data.orderId,
|
orderId: topUpData.data.orderId,
|
||||||
openid: openid,
|
openid: openid
|
||||||
// rechargeAmount: payNum.value || payAmount.value,
|
// rechargeAmount: payNum.value || payAmount.value,
|
||||||
// type: paymentItem.type == '水表' ? '2' : paymentItem.type == '电表' ? '1' : ''
|
// type: paymentItem.type == '水表' ? '2' : paymentItem.type == '电表' ? '1' : ''
|
||||||
})
|
});
|
||||||
|
|
||||||
if (payRes.code !== 200) {
|
if (payRes.code !== 200) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: payRes.msg || '获取支付参数失败',
|
title: payRes.msg || '获取支付参数失败',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
});
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
const payData = payRes.data
|
const payData = payRes.data;
|
||||||
console.log('payData', payData);
|
console.log('payData', payData);
|
||||||
// 赋值支付参数
|
// 赋值支付参数
|
||||||
payInfo.value = {
|
payInfo.value = {
|
||||||
appId: payData.appId,
|
appId: payData.appId,
|
||||||
timeStamp: payData.timeStamp,
|
timeStamp: payData.timeStamp,
|
||||||
nonceStr: payData.nonceStr,
|
nonceStr: payData.nonceStr,
|
||||||
package: payData.package.startsWith('prepay_id=') ? payData.package : 'prepay_id=' + payData
|
package: payData.package.startsWith('prepay_id=') ? payData.package : 'prepay_id=' + payData.package,
|
||||||
.package,
|
|
||||||
signType: payData.signType,
|
signType: payData.signType,
|
||||||
paySign: payData.paySign
|
paySign: payData.paySign
|
||||||
}
|
};
|
||||||
|
|
||||||
// 2. 调起微信支付
|
// 2. 调起微信支付
|
||||||
wx.requestPayment({
|
wx.requestPayment({
|
||||||
...payInfo.value,
|
...payInfo.value,
|
||||||
success(res) {
|
success(res) {
|
||||||
console.log('支付成功', res)
|
console.log('支付成功', res);
|
||||||
currentStep.value = 2
|
currentStep.value = 2;
|
||||||
},
|
},
|
||||||
fail(err) {
|
fail(err) {
|
||||||
console.log('支付失败', err)
|
console.log('支付失败', err);
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '支付取消或失败',
|
title: '支付取消或失败',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
handleWaterElecSubscribe()
|
handleWaterElecSubscribe();
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
uni.hideLoading()
|
uni.hideLoading();
|
||||||
console.log('请求异常', err)
|
console.log('请求异常', err);
|
||||||
showApiError(err)
|
showApiError(err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// RZBank 日照银行
|
||||||
|
const deviceTypeMap = { 电费: '1', 水费: '2' };
|
||||||
|
const navigatedToPayment = ref(false);
|
||||||
|
async function RZBank() {
|
||||||
|
// 1. 准备参数
|
||||||
|
const token = uni.getStorageSync('token') || '';
|
||||||
|
const userId = uni.getStorageSync('userId') || '';
|
||||||
|
if (token) {
|
||||||
|
// 设备类型映射:电费→1(电表),水费→2(水表)
|
||||||
|
const mappedDeviceType = deviceTypeMap[paymentItem.type] || paymentItem.deviceType || '';
|
||||||
|
// 直接从本地参数拼 path 查询字符串传给支付小程序,不走接口
|
||||||
|
const params = {
|
||||||
|
acct: userId,
|
||||||
|
orderType: '20',
|
||||||
|
deviceCode: paymentItem.deviceCode || '',
|
||||||
|
deviceType: mappedDeviceType,
|
||||||
|
billId: paymentItem.billId || '',
|
||||||
|
residentUserId: userId,
|
||||||
|
token: token
|
||||||
|
};
|
||||||
|
const queryString = Object.keys(params)
|
||||||
|
.map((k) => encodeURIComponent(k) + '=' + encodeURIComponent(params[k]))
|
||||||
|
.join('&');
|
||||||
|
// 2. 拉起小程序
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.showLoading({ title: '加载中...', mask: true });
|
||||||
|
try {
|
||||||
|
const res = await getBankMiniProgramParams(params);
|
||||||
|
uni.hideLoading();
|
||||||
|
if (res.code !== 200 || !res.data) {
|
||||||
|
uni.showToast({ title: res.msg || '获取支付参数失败', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
navigatedToPayment.value = true;
|
||||||
|
wx.navigateToMiniProgram({
|
||||||
|
appId: 'wxc0189436c58b59cd',
|
||||||
|
path: 'pages/pay/pay',
|
||||||
|
extraData: res.data.extraData,
|
||||||
|
envVersion: 'trial',
|
||||||
|
success: () => {
|
||||||
|
console.log('已跳转到日照银行支付小程序');
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
navigatedToPayment.value = false;
|
||||||
|
console.error('跳转日照银行支付失败', err);
|
||||||
|
uni.showToast({ title: '拉起支付失败', icon: 'none' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 没有token, 重新登录
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onShow(() => {
|
||||||
|
// 从日照银行支付小程序返回后,根据返回结果显示成功/失败页
|
||||||
|
if (navigatedToPayment.value) {
|
||||||
|
navigatedToPayment.value = false;
|
||||||
|
const info = getPaymentReturnResult();
|
||||||
|
// 有缴费,返回缴费金额,显示成功缴费xx元。
|
||||||
|
if (info !== null) {
|
||||||
|
payNum.value = info.orderAmt;
|
||||||
|
}
|
||||||
|
const result = resolvePaymentResult(info);
|
||||||
|
clearPaymentReturnResult();
|
||||||
|
currentStep.value = result === 'success' ? 2 : 3;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// 【双模板ID】你提供的 水表+电表 催缴模板
|
// 【双模板ID】你提供的 水表+电表 催缴模板
|
||||||
const TEMPLATE_IDS = {
|
const TEMPLATE_IDS = {
|
||||||
water: 'DowYnoGKNtl_eYycRCq-nt7DAoFjH7aVcGUQciZl1v0',
|
water: 'DowYnoGKNtl_eYycRCq-nt7DAoFjH7aVcGUQciZl1v0',
|
||||||
elec: 'PE7Neemv0z77JnBIPmb-Qg2Q3pJSUDGaILCryFCxmaw'
|
elec: 'PE7Neemv0z77JnBIPmb-Qg2Q3pJSUDGaILCryFCxmaw'
|
||||||
}
|
};
|
||||||
// 转成数组(微信API要求)
|
// 转成数组(微信API要求)
|
||||||
const TEMPLATE_ID_ARRAY = Object.values(TEMPLATE_IDS)
|
const TEMPLATE_ID_ARRAY = Object.values(TEMPLATE_IDS);
|
||||||
|
|
||||||
|
|
||||||
// 1. 检测 水表+电表 订阅状态
|
// 1. 检测 水表+电表 订阅状态
|
||||||
const checkAllSubscribeStatus = () => {
|
const checkAllSubscribeStatus = () => {
|
||||||
uni.getSetting({
|
uni.getSetting({
|
||||||
withSubscriptions: true,
|
withSubscriptions: true,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
const itemSettings = res.subscriptionsSetting?.itemSettings || {}
|
const itemSettings = res.subscriptionsSetting?.itemSettings || {};
|
||||||
console.log('水表订阅状态:', itemSettings[TEMPLATE_IDS.water])
|
console.log('水表订阅状态:', itemSettings[TEMPLATE_IDS.water]);
|
||||||
console.log('电表订阅状态:', itemSettings[TEMPLATE_IDS.elec])
|
console.log('电表订阅状态:', itemSettings[TEMPLATE_IDS.elec]);
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// 2. 点击开启订阅(主方法)
|
// 2. 点击开启订阅(主方法)
|
||||||
const handleWaterElecSubscribe = () => {
|
const handleWaterElecSubscribe = () => {
|
||||||
uni.getSetting({
|
uni.getSetting({
|
||||||
withSubscriptions: true,
|
withSubscriptions: true,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
const itemSettings = res.subscriptionsSetting?.itemSettings || {}
|
const itemSettings = res.subscriptionsSetting?.itemSettings || {};
|
||||||
const waterStatus = itemSettings[TEMPLATE_IDS.water]
|
const waterStatus = itemSettings[TEMPLATE_IDS.water];
|
||||||
const elecStatus = itemSettings[TEMPLATE_IDS.elec]
|
const elecStatus = itemSettings[TEMPLATE_IDS.elec];
|
||||||
|
|
||||||
// 如果任意一个被永久拒绝 → 引导去设置
|
// 如果任意一个被永久拒绝 → 引导去设置
|
||||||
if ((waterStatus === 'reject' || waterStatus === 'ban') ||
|
if (waterStatus === 'reject' || waterStatus === 'ban' || elecStatus === 'reject' || elecStatus === 'ban') {
|
||||||
(elecStatus === 'reject' || elecStatus === 'ban')) {
|
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '开启消息通知',
|
title: '开启消息通知',
|
||||||
content: '请前往设置页打开水表/电表提醒开关',
|
content: '请前往设置页打开水表/电表提醒开关',
|
||||||
confirmText: '去设置',
|
confirmText: '去设置',
|
||||||
success: (modalRes) => {
|
success: (modalRes) => {
|
||||||
if (modalRes.confirm) uni.openSetting()
|
if (modalRes.confirm) uni.openSetting();
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 正常弹出授权框
|
// 正常弹出授权框
|
||||||
requestMultiSubscribe()
|
requestMultiSubscribe();
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// 3. 调用微信授权(根据类型传对应模板)
|
// 3. 调用微信授权(根据类型传对应模板)
|
||||||
const requestMultiSubscribe = () => {
|
const requestMultiSubscribe = () => {
|
||||||
const tmplIds = paymentItem.type == '水表' ? [TEMPLATE_IDS.water] : paymentItem.type == '电表' ? [TEMPLATE_IDS.elec] : TEMPLATE_ID_ARRAY
|
const tmplIds = paymentItem.type == '水表' ? [TEMPLATE_IDS.water] : paymentItem.type == '电表' ? [TEMPLATE_IDS.elec] : TEMPLATE_ID_ARRAY;
|
||||||
uni.requestSubscribeMessage({
|
uni.requestSubscribeMessage({
|
||||||
tmplIds: tmplIds,
|
tmplIds: tmplIds,
|
||||||
success: async (res) => {
|
success: async (res) => {
|
||||||
console.log('双模板授权结果:', res)
|
console.log('双模板授权结果:', res);
|
||||||
|
|
||||||
let successCount = 0
|
let successCount = 0;
|
||||||
// 水表授权成功
|
// 水表授权成功
|
||||||
if (res[TEMPLATE_IDS.water] === 'accept') successCount++
|
if (res[TEMPLATE_IDS.water] === 'accept') successCount++;
|
||||||
// 电表授权成功
|
// 电表授权成功
|
||||||
if (res[TEMPLATE_IDS.elec] === 'accept') successCount++
|
if (res[TEMPLATE_IDS.elec] === 'accept') successCount++;
|
||||||
|
|
||||||
if (successCount > 0) {
|
if (successCount > 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: `已开启${successCount}项提醒`,
|
title: `已开启${successCount}项提醒`,
|
||||||
icon: 'success'
|
icon: 'success'
|
||||||
})
|
});
|
||||||
// 保存用户openid到后端
|
// 保存用户openid到后端
|
||||||
await saveUserSubscribe()
|
await saveUserSubscribe();
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '已取消授权',
|
title: '已取消授权',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: () => {
|
fail: () => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '授权失败',
|
title: '授权失败',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
});
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// 4. 传给后端:保存订阅信息
|
// 4. 传给后端:保存订阅信息
|
||||||
const saveUserSubscribe = async () => {
|
const saveUserSubscribe = async () => {
|
||||||
|
|
||||||
const res = await postSubscribeAuth({
|
const res = await postSubscribeAuth({
|
||||||
openid: uni.getStorageSync('openid'),
|
openid: uni.getStorageSync('openid'),
|
||||||
templateIds: paymentItem.type == '水表' ? [TEMPLATE_IDS.water] : paymentItem.type == '电表' ? [TEMPLATE_IDS.elec] : TEMPLATE_ID_ARRAY,
|
templateIds: paymentItem.type == '水表' ? [TEMPLATE_IDS.water] : paymentItem.type == '电表' ? [TEMPLATE_IDS.elec] : TEMPLATE_ID_ARRAY
|
||||||
// deviceCode: paymentItem.deviceCode,
|
// deviceCode: paymentItem.deviceCode,
|
||||||
// deviceType: paymentItem.type == '水表' ? '2' : paymentItem.type == '电表' ? '1' : ''
|
// deviceType: paymentItem.type == '水表' ? '2' : paymentItem.type == '电表' ? '1' : ''
|
||||||
})
|
});
|
||||||
if (res.data == 200) {
|
if (res.data == 200) {
|
||||||
console.log('111111111111111:', res)
|
console.log('111111111111111:', res);
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: `${res.msg}`,
|
title: `${res.msg}`,
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
});
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 返回缴费列表
|
// 返回缴费列表
|
||||||
const handleBackToList = () => {
|
const handleBackToList = () => {
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: '/pages/paymentIndex/paymentIndex'
|
url: '/pages/paymentIndex/paymentIndex'
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
page {
|
page {
|
||||||
@@ -421,12 +465,9 @@
|
|||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
padding: 0px 40rpx;
|
padding: 0px 40rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background-color: #
|
background-color: #/* fff */;
|
||||||
/* fff */
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* 1. 物业费详情页 */
|
/* 1. 物业费详情页 */
|
||||||
.pay-page {
|
.pay-page {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -445,7 +486,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.outstandingPaymentClass {
|
.outstandingPaymentClass {
|
||||||
color: #E34D59;
|
color: #e34d59;
|
||||||
}
|
}
|
||||||
|
|
||||||
.paymentClass {
|
.paymentClass {
|
||||||
@@ -455,7 +496,6 @@
|
|||||||
.info-section {
|
.info-section {
|
||||||
padding-top: 20rpx;
|
padding-top: 20rpx;
|
||||||
/* margin-bottom: 40rpx; */
|
/* margin-bottom: 40rpx; */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-item {
|
.info-item {
|
||||||
@@ -486,12 +526,10 @@
|
|||||||
font-size: 50rpx;
|
font-size: 50rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-section {
|
.input-section {
|
||||||
/* padding: 030rpx; */
|
/* padding: 030rpx; */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.amount-input {
|
.amount-input {
|
||||||
@@ -533,7 +571,6 @@
|
|||||||
z-index: 999;
|
z-index: 999;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.password-modal {
|
.password-modal {
|
||||||
@@ -787,4 +824,21 @@
|
|||||||
width: 100vw;
|
width: 100vw;
|
||||||
height: 46px;
|
height: 46px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fail-icon {
|
||||||
|
width: 220rpx;
|
||||||
|
height: 220rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: #fa5151;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-top: 200rpx;
|
||||||
|
margin-bottom: 60rpx;
|
||||||
|
}
|
||||||
|
.icon-fail {
|
||||||
|
color: #fff;
|
||||||
|
font-size: 130rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="contentStyle" style="">
|
<view class="contentStyle" style="">
|
||||||
<view class="status-bar"></view>
|
<view class="status-bar"></view>
|
||||||
<uni-nav-bar :title="arrearsPayment" left-icon="left" @clickLeft="goBack" backgroundColor="transparent"
|
<uni-nav-bar :title="arrearsPayment" left-icon="left" @clickLeft="goBack" backgroundColor="transparent" :border="false"></uni-nav-bar>
|
||||||
:border="false">
|
|
||||||
</uni-nav-bar>
|
|
||||||
|
|
||||||
<!-- 表单区域 -->
|
<!-- 表单区域 -->
|
||||||
<scroll-view class="page" scroll-y="true">
|
<scroll-view class="page" scroll-y="true">
|
||||||
@@ -13,8 +11,7 @@
|
|||||||
<!-- 未欠费 -->
|
<!-- 未欠费 -->
|
||||||
<!-- v-if="arrearsPayment=='暖气费'" -->
|
<!-- v-if="arrearsPayment=='暖气费'" -->
|
||||||
<view class="no-arrears-section">
|
<view class="no-arrears-section">
|
||||||
<image src="https://wuyeadmin.bugtc.com/images/propertyImgs/noArrears.png"
|
<image :src="`${imgBaseUrl}/images/propertyImgs/noArrears.png`" class="background-image-style"></image>
|
||||||
class="background-image-style"></image>
|
|
||||||
<text class="noArrearsText">暂未查到欠费</text>
|
<text class="noArrearsText">暂未查到欠费</text>
|
||||||
<view class="recordText">
|
<view class="recordText">
|
||||||
<text>{{ '最近充值:' + paymentItem.LastRechargeTime || '-' }}</text>
|
<text>{{ '最近充值:' + paymentItem.LastRechargeTime || '-' }}</text>
|
||||||
@@ -33,8 +30,7 @@
|
|||||||
<view v-if="arrearsPayment == '物业费'">
|
<view v-if="arrearsPayment == '物业费'">
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<text class="info-label">户名</text>
|
<text class="info-label">户名</text>
|
||||||
<text
|
<text class="info-value">{{ paymentItem.villageName + paymentItem.fullAddress || '-' }}</text>
|
||||||
class="info-value">{{paymentItem.villageName+ paymentItem.fullAddress || '-' }}</text>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<text class="info-label">户主</text>
|
<text class="info-label">户主</text>
|
||||||
@@ -79,47 +75,34 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import { ref, reactive, onMounted, computed } from 'vue';
|
||||||
ref,
|
import { onShow, onReady, onReachBottom, onLoad, onUnload, onPullDownRefresh } from '@dcloudio/uni-app';
|
||||||
reactive,
|
import { baseUrl, imgBaseUrl } from '/pageSubPack/api/request.js';
|
||||||
onMounted,
|
|
||||||
computed
|
|
||||||
|
|
||||||
} from 'vue'
|
|
||||||
import {
|
|
||||||
onShow,
|
|
||||||
onReady,
|
|
||||||
onReachBottom,
|
|
||||||
onLoad,
|
|
||||||
onUnload,
|
|
||||||
onPullDownRefresh
|
|
||||||
} from '@dcloudio/uni-app'
|
|
||||||
|
|
||||||
// 响应式数据
|
// 响应式数据
|
||||||
const statusBarHeight = ref(20)
|
const statusBarHeight = ref(20);
|
||||||
const paymentItem = reactive(uni.getStorageSync('arrearsPayment') || {})
|
const paymentItem = reactive(uni.getStorageSync('arrearsPayment') || {});
|
||||||
const arrearsPayment = computed(() => paymentItem.type || '缴费')
|
const arrearsPayment = computed(() => paymentItem.type || '缴费');
|
||||||
|
|
||||||
// 生命周期
|
// 生命周期
|
||||||
onShow(() => {})
|
onShow(() => {});
|
||||||
onMounted(() => {})
|
onMounted(() => {});
|
||||||
onReady(() => {})
|
onReady(() => {});
|
||||||
|
|
||||||
// 方法
|
// 方法
|
||||||
const goBack = () => {
|
const goBack = () => {
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: '/pages/paymentIndex/paymentIndex'
|
url: '/pages/paymentIndex/paymentIndex'
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
// 以下为原代码保留的方法(未使用但保持功能完整)
|
// 以下为原代码保留的方法(未使用但保持功能完整)
|
||||||
const handlePay = () => {}
|
const handlePay = () => {};
|
||||||
const closePasswordModal = () => {}
|
const closePasswordModal = () => {};
|
||||||
const selectBank = () => {}
|
const selectBank = () => {};
|
||||||
const inputPassword = () => {}
|
const inputPassword = () => {};
|
||||||
const deletePassword = () => {}
|
const deletePassword = () => {};
|
||||||
const handleConfirmPay = () => {}
|
const handleConfirmPay = () => {};
|
||||||
const handleBackToList = () => {}
|
const handleBackToList = () => {};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="contentStyle" style="">
|
<view class="contentStyle" style="">
|
||||||
<view class="status-bar"></view>
|
<view class="status-bar"></view>
|
||||||
<uni-nav-bar title="缴费记录" left-icon="left" @clickLeft="goBack" backgroundColor="transparent" :border="false">
|
<uni-nav-bar title="缴费记录" left-icon="left" @clickLeft="goBack" backgroundColor="transparent" :border="false"></uni-nav-bar>
|
||||||
</uni-nav-bar>
|
<view class="page">
|
||||||
|
|
||||||
<!-- 表单区域 -->
|
|
||||||
<scroll-view class="page" scroll-y="true">
|
|
||||||
|
|
||||||
<!-- 累计缴费 -->
|
<!-- 累计缴费 -->
|
||||||
<view class="total-box">
|
<view class="total-box">
|
||||||
<view class="top-box">
|
<view class="top-box">
|
||||||
@@ -16,7 +12,7 @@
|
|||||||
|
|
||||||
<view class="chart-box">
|
<view class="chart-box">
|
||||||
<view v-if="chartData.length === 0" class="empty-state">
|
<view v-if="chartData.length === 0" class="empty-state">
|
||||||
<uni-icons type="info" size="60" color="#ccc"></uni-icons>
|
<uni-icons type="info" size="30" color="#ccc"></uni-icons>
|
||||||
<text class="empty-text">
|
<text class="empty-text">
|
||||||
{{ '暂无数据' }}
|
{{ '暂无数据' }}
|
||||||
</text>
|
</text>
|
||||||
@@ -31,31 +27,23 @@
|
|||||||
<view class="chart-month">{{ item.month }}</view>
|
<view class="chart-month">{{ item.month }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 缴费明细 -->
|
<!-- 缴费明细(分页滚动) -->
|
||||||
|
<scroll-view class="list-scroll" scroll-y="true" @scrolltolower="loadMore">
|
||||||
<view class="list-wrapper">
|
<view class="list-wrapper">
|
||||||
<!-- 按月份分组渲染 -->
|
<!-- 按月份分组渲染 -->
|
||||||
<view v-if="monthGroups.length === 0" class="empty-state">
|
<view v-if="monthGroups.length === 0" class="empty-state">
|
||||||
<uni-icons type="info" size="60" color="#ccc"></uni-icons>
|
<uni-icons type="info" size="30" color="#ccc"></uni-icons>
|
||||||
<text class="empty-text">
|
<text class="empty-text">暂无数据</text>
|
||||||
{{ '暂无数据'}}
|
|
||||||
</text>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="month-group" v-for="(item, idx) in monthGroups" :key="idx">
|
<view class="month-group" v-for="(item, idx) in monthGroups" :key="idx">
|
||||||
<view class="month-title">
|
<view class="month-title">{{ item.month }}月 缴费 ¥{{ item.total }}</view>
|
||||||
{{ item.month }}月 缴费 ¥{{ item.total }}元
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="item-list">
|
<view class="item-list">
|
||||||
<view class="bill-item" v-for="bill in item.list" :key="bill.id">
|
<view class="bill-item" v-for="bill in item.list" :key="bill.id">
|
||||||
<view class="bill-icon">
|
<view class="bill-icon">
|
||||||
<image class="iconStyle" src="https://wuyeadmin.bugtc.com/images/propertyImgs/water.png"
|
<image class="iconStyle" :src="bill.icon"></image>
|
||||||
v-if="bill.name=='水表'"></image>
|
|
||||||
<image class="iconStyle" src="https://wuyeadmin.bugtc.com/images/propertyImgs/electric.png"
|
|
||||||
v-if="bill.name=='电表'"></image>
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="bill-info">
|
<view class="bill-info">
|
||||||
<view class="name">{{ bill.name }}</view>
|
<view class="name">{{ bill.name }}</view>
|
||||||
@@ -66,155 +54,191 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import { ref, onMounted, computed } from 'vue';
|
||||||
ref,
|
import { onShow, onReady, onReachBottom, onLoad, onUnload, onPullDownRefresh } from '@dcloudio/uni-app';
|
||||||
onMounted,
|
import { getTopupRecordWithStat } from '/pageSubPack/api/apiSub.js';
|
||||||
computed
|
import { imgBaseUrl } from '../api/request.js';
|
||||||
|
|
||||||
} from 'vue'
|
|
||||||
import {
|
|
||||||
onShow,
|
|
||||||
onReady,
|
|
||||||
onReachBottom,
|
|
||||||
onLoad,
|
|
||||||
onUnload,
|
|
||||||
onPullDownRefresh
|
|
||||||
} from '@dcloudio/uni-app'
|
|
||||||
|
|
||||||
import {
|
|
||||||
getTopupRecordWithStat
|
|
||||||
} from '/pageSubPack/api/apiSub.js'
|
|
||||||
// 响应式数据
|
// 响应式数据
|
||||||
const statusBarHeight = ref(20)
|
const statusBarHeight = ref(20);
|
||||||
const pageNum = ref(1)
|
const pageNum = ref(1);
|
||||||
const pageSize = ref(10)
|
const pageSize = ref(10);
|
||||||
const totalAmount = ref('0.00')
|
const total = ref(0);
|
||||||
const chartData = ref([])
|
const totalAmount = ref('0.00');
|
||||||
const maxPrice = ref(100)
|
const chartData = ref([]);
|
||||||
const barMaxHeight = ref(300)
|
const maxPrice = ref(100);
|
||||||
|
const barMaxHeight = ref(300);
|
||||||
|
const allInfo = ref(null);
|
||||||
|
const billList = ref([]);
|
||||||
|
|
||||||
const billList = ref([])
|
let isFirstLoading = true;
|
||||||
|
|
||||||
|
// 费用名称映射
|
||||||
|
// topup(水电表充值):type 1=电费, 2=水费
|
||||||
|
// bill(物业账单):type 0=物业费, 1=车位费, 2=垃圾处理费
|
||||||
|
const getNameByType = (item) => {
|
||||||
|
if (item.recordType === 'topup') {
|
||||||
|
return item.type == '1' ? '电费' : item.type == '2' ? '水费' : '充值';
|
||||||
|
} else if (item.recordType === 'bill') {
|
||||||
|
return item.type == '0' ? '物业费' : item.type == '1' ? '车位费' : item.type == '2' ? '垃圾处理费' : '账单';
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
};
|
||||||
|
|
||||||
// 图标映射
|
// 图标映射
|
||||||
const iconMap = {
|
const iconMap = {
|
||||||
'水表': 'https://wuyeadmin.bugtc.com/images/propertyImgs/water.png',
|
电费: `${imgBaseUrl}/images/propertyImgs/electric.png`,
|
||||||
'电表': 'https://wuyeadmin.bugtc.com/images/propertyImgs/electric.png',
|
水费: `${imgBaseUrl}/images/propertyImgs/water.png`
|
||||||
'物业费': 'https://wuyeadmin.bugtc.com/images/propertyImgs/property.png',
|
};
|
||||||
'暖气费': 'https://wuyeadmin.bugtc.com/images/propertyImgs/heating.png',
|
// 获取缴费记录(loadMore=true 时分页追加)
|
||||||
'燃气费': 'https://wuyeadmin.bugtc.com/images/propertyImgs/gas.png'
|
const getRecords = async (loadMore = false) => {
|
||||||
}
|
|
||||||
|
|
||||||
// 获取缴费记录
|
|
||||||
const getRecords = async () => {
|
|
||||||
try {
|
try {
|
||||||
|
// 全部加载完毕了
|
||||||
|
|
||||||
|
if (!loadMore) pageNum.value = 1;
|
||||||
const res = await getTopupRecordWithStat({
|
const res = await getTopupRecordWithStat({
|
||||||
residentUserId: uni.getStorageSync('userId'),
|
residentUserId: uni.getStorageSync('userId'),
|
||||||
pageNum: pageNum.value,
|
pageNum: pageNum.value,
|
||||||
pageSize: pageSize.value
|
pageSize: pageSize.value,
|
||||||
})
|
queryType: 1
|
||||||
|
});
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
const records = res.data.records || []
|
isFirstLoading = false;
|
||||||
|
allInfo.value = res.data;
|
||||||
|
total.value = res.data.total;
|
||||||
|
const records = res.data.records || [];
|
||||||
// 转换记录格式
|
// 转换记录格式
|
||||||
billList.value = records.map(item => ({
|
const mappedList = records.map((item) => {
|
||||||
|
const payDate = item.payTime ? item.payTime.split(' ')[0] : '';
|
||||||
|
const parts = payDate.split('-');
|
||||||
|
const name = getNameByType(item);
|
||||||
|
return {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
month: item.rechargeTime && item.rechargeTime.split('-')[1] ? parseInt(item.rechargeTime.split('-')[1], 10) : 1,
|
year: parts[0] ? parseInt(parts[0], 10) : new Date().getFullYear(),
|
||||||
name: item.type == 1 ? '电表' : item.type == 2 ? '水表' : '',
|
month: parts[1] ? parseInt(parts[1], 10) : 1,
|
||||||
account: item.deviceCode || '-',
|
name,
|
||||||
amount: Number(item.rechargeAmount) || 0,
|
account: item.deviceCode || '',
|
||||||
icon: iconMap[item.type == 1 ? '电表' : item.type == 2 ? '水表' : ''] || 'https://wuyeadmin.bugtc.com/images/propertyImgs/water.png'
|
amount: item.amount || 0,
|
||||||
}))
|
recordType: item.recordType || '',
|
||||||
|
icon: iconMap[name] || iconMap['账单']
|
||||||
|
};
|
||||||
|
});
|
||||||
|
billList.value = loadMore ? [...billList.value, ...mappedList] : mappedList;
|
||||||
// 累计缴费金额
|
// 累计缴费金额
|
||||||
const total = records.reduce((sum, item) => sum + (Number(item.rechargeAmount) || 0), 0)
|
totalAmount.value = res.data.totalAmount || '0.00';
|
||||||
totalAmount.value = total.toFixed(2)
|
// 柱状图数据(使用API返回的monthlyStats)
|
||||||
// 更新图表数据(根据 records 计算最近6个月)
|
updateChartData(res.data.monthlyStats || {});
|
||||||
updateChartData()
|
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('获取缴费记录失败', err)
|
console.error('获取缴费记录失败', err);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 更新图表数据(根据 records 计算最近6个月)
|
// 加载更多(触底分页)
|
||||||
const updateChartData = () => {
|
const loadMore = () => {
|
||||||
// 按月份汇总金额
|
const allSize = pageNum.value * pageSize.value;
|
||||||
const monthTotal = {}
|
if (!isFirstLoading && total.value <= allSize) {
|
||||||
billList.value.forEach(bill => {
|
return;
|
||||||
const monthKey = bill.month
|
|
||||||
if (!monthTotal[monthKey]) {
|
|
||||||
monthTotal[monthKey] = 0
|
|
||||||
}
|
}
|
||||||
monthTotal[monthKey] += bill.amount
|
pageNum.value++;
|
||||||
})
|
getRecords(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 更新图表数据(使用API返回的monthlyStats)
|
||||||
|
// monthlyStats格式: { "2026-04": "04月 30.00元", "2026-05": "05月 25.00元", ... }
|
||||||
|
const updateChartData = (monthlyStats) => {
|
||||||
|
const statsMap = {};
|
||||||
|
Object.entries(monthlyStats).forEach(([key, value]) => {
|
||||||
|
const priceMatch = value.match(/([\d.]+)元/);
|
||||||
|
if (priceMatch && key.includes('-')) {
|
||||||
|
const [y, m] = key.split('-');
|
||||||
|
statsMap[key] = {
|
||||||
|
year: parseInt(y, 10),
|
||||||
|
month: parseInt(m, 10),
|
||||||
|
price: parseFloat(priceMatch[1]) || 0
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
// 取最近6个月(当前月往前)
|
// 取最近6个月(当前月往前)
|
||||||
const now = new Date()
|
const now = new Date();
|
||||||
const currentMonth = now.getMonth() + 1 // 1-12
|
const currentMonth = now.getMonth() + 1;
|
||||||
const currentYear = now.getFullYear()
|
const currentYear = now.getFullYear();
|
||||||
const months = []
|
const months = [];
|
||||||
for (let i = 0; i < 6; i++) {
|
for (let i = 0; i < 6; i++) {
|
||||||
let month = currentMonth - i
|
let month = currentMonth - i;
|
||||||
let year = currentYear
|
let year = currentYear;
|
||||||
if (month <= 0) {
|
if (month <= 0) {
|
||||||
month += 12
|
month += 12;
|
||||||
year -= 1
|
year -= 1;
|
||||||
}
|
}
|
||||||
|
const key = `${year}-${String(month).padStart(2, '0')}`;
|
||||||
|
const data = statsMap[key];
|
||||||
months.push({
|
months.push({
|
||||||
month,
|
month,
|
||||||
year
|
year,
|
||||||
})
|
price: data ? data.price : 0
|
||||||
|
});
|
||||||
}
|
}
|
||||||
chartData.value = months.map((m, i) => ({
|
chartData.value = months
|
||||||
|
.map((m, i) => ({
|
||||||
month: (m.year + '').slice(-2) + '年' + m.month + '月',
|
month: (m.year + '').slice(-2) + '年' + m.month + '月',
|
||||||
year: m.year,
|
year: m.year,
|
||||||
sortMonth: m.year * 12 + m.month,
|
sortMonth: m.year * 12 + m.month,
|
||||||
price: monthTotal[m.month] || 0,
|
price: m.price,
|
||||||
index: i
|
index: i
|
||||||
})).sort((a, b) => a.sortMonth - b.sortMonth)
|
}))
|
||||||
const prices = chartData.value.map(c => c.price)
|
.sort((a, b) => a.sortMonth - b.sortMonth);
|
||||||
maxPrice.value = Math.max(...prices, 100)
|
const prices = chartData.value.map((c) => c.price);
|
||||||
}
|
maxPrice.value = Math.max(...prices, 100);
|
||||||
|
};
|
||||||
|
|
||||||
// 计算属性 —— 月份分组
|
// 计算属性 —— 按年-月分组缴费明细
|
||||||
const monthGroups = computed(() => {
|
const monthGroups = computed(() => {
|
||||||
let map = {}
|
const map = {};
|
||||||
billList.value.forEach(bill => {
|
if (allInfo.value !== null) {
|
||||||
if (!map[bill.month]) {
|
const list = Object.entries(allInfo.value.monthlyStats);
|
||||||
map[bill.month] = {
|
list.forEach(([yearmonth, moneyString]) => {
|
||||||
month: bill.month,
|
const money = moneyString.match(/([\d.]+)元/);
|
||||||
total: 0,
|
const month = yearmonth.split('-')[1];
|
||||||
|
map[yearmonth] = {
|
||||||
|
month: parseFloat(yearmonth.split('-')[1]),
|
||||||
|
year: yearmonth.split('-')[0],
|
||||||
|
total: money[1],
|
||||||
list: []
|
list: []
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
billList.value.forEach((item) => {
|
||||||
map[bill.month].list.push(bill)
|
const key = `${item.year}-${String(item.month).padStart(2, '0')}`;
|
||||||
map[bill.month].total += bill.amount
|
map[key].list.push(item);
|
||||||
})
|
});
|
||||||
return Object.values(map).sort((a, b) => b.month - a.month)
|
// 按年月降序排列
|
||||||
})
|
return Object.values(map).sort((a, b) => {
|
||||||
|
if (a.year !== b.year) return b.year - a.year;
|
||||||
|
return b.month - a.month;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// 生命周期
|
// 生命周期
|
||||||
onShow(() => {})
|
|
||||||
onMounted(() => {})
|
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
getRecords()
|
getRecords();
|
||||||
})
|
});
|
||||||
onReady(() => {})
|
|
||||||
|
|
||||||
// 方法
|
// 方法
|
||||||
const barHeight = (price) => {
|
const barHeight = (price) => {
|
||||||
const height = (price / maxPrice.value) * barMaxHeight.value
|
const height = (price / maxPrice.value) * barMaxHeight.value;
|
||||||
return `${height}rpx`
|
return `${height}rpx`;
|
||||||
}
|
};
|
||||||
|
|
||||||
const goBack = () => {
|
const goBack = () => {
|
||||||
uni.switchTab({
|
uni.navigateBack();
|
||||||
url: '/pages/paymentIndex/paymentIndex'
|
};
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@@ -233,9 +257,16 @@
|
|||||||
|
|
||||||
.page {
|
.page {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow-y: auto;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
padding: 0px 40rpx;
|
padding: 0px 40rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-scroll {
|
||||||
|
flex: 1;
|
||||||
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.total-box {
|
.total-box {
|
||||||
@@ -321,7 +352,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
color: #4080FF;
|
color: #4080ff;
|
||||||
margin-right: 24rpx;
|
margin-right: 24rpx;
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,19 +2,12 @@
|
|||||||
<view class="guide-page">
|
<view class="guide-page">
|
||||||
<view class="status-bar"></view>
|
<view class="status-bar"></view>
|
||||||
<!-- 引导内容滑动容器 -->
|
<!-- 引导内容滑动容器 -->
|
||||||
<swiper
|
<swiper class="guide-swiper" :current="currentStep" @change="handleSwiperChange" :disable-scroll="false" :indicator-dots="false" :mode="mode">
|
||||||
class="guide-swiper"
|
|
||||||
:current="currentStep"
|
|
||||||
@change="handleSwiperChange"
|
|
||||||
:disable-scroll="false"
|
|
||||||
:indicator-dots="false"
|
|
||||||
:mode="mode"
|
|
||||||
>
|
|
||||||
<!-- 便捷服务 -->
|
<!-- 便捷服务 -->
|
||||||
<swiper-item>
|
<swiper-item>
|
||||||
<view class="guide-item">
|
<view class="guide-item">
|
||||||
<view class="guide-img">
|
<view class="guide-img">
|
||||||
<image src="https://wuyeadmin.bugtc.com/images/guide1.png" mode="aspectFit" class="img-content"></image>
|
<image :src="`${imgBaseUrl}/images/guide1.png`" mode="aspectFit" class="img-content"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="guide-text">
|
<view class="guide-text">
|
||||||
<view class="guide-title">便捷服务</view>
|
<view class="guide-title">便捷服务</view>
|
||||||
@@ -27,7 +20,7 @@
|
|||||||
<swiper-item>
|
<swiper-item>
|
||||||
<view class="guide-item">
|
<view class="guide-item">
|
||||||
<view class="guide-img">
|
<view class="guide-img">
|
||||||
<image src="https://wuyeadmin.bugtc.com/images/guide2.png" mode="aspectFit" class="img-content"></image>
|
<image :src="`${imgBaseUrl}/images/guide2.png`" mode="aspectFit" class="img-content"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="guide-text">
|
<view class="guide-text">
|
||||||
<view class="guide-title">高效管理</view>
|
<view class="guide-title">高效管理</view>
|
||||||
@@ -40,7 +33,7 @@
|
|||||||
<swiper-item>
|
<swiper-item>
|
||||||
<view class="guide-item">
|
<view class="guide-item">
|
||||||
<view class="guide-img">
|
<view class="guide-img">
|
||||||
<image src="https://wuyeadmin.bugtc.com/images/guide3.png" mode="aspectFit" class="img-content"></image>
|
<image :src="`${imgBaseUrl}/images/guide3.png`" mode="aspectFit" class="img-content"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="guide-text">
|
<view class="guide-text">
|
||||||
<view class="guide-title">安全保障</view>
|
<view class="guide-title">安全保障</view>
|
||||||
@@ -59,11 +52,7 @@
|
|||||||
|
|
||||||
<!-- 操作按钮 -->
|
<!-- 操作按钮 -->
|
||||||
<view class="guide-btn-wrap">
|
<view class="guide-btn-wrap">
|
||||||
<button
|
<button class="guide-btn" :class="{ primary: currentStep === 2 }" @click="handleBtnClick">
|
||||||
class="guide-btn"
|
|
||||||
:class="{ primary: currentStep === 2 }"
|
|
||||||
@click="handleBtnClick"
|
|
||||||
>
|
|
||||||
{{ currentStep === 2 ? '立即体验' : '下一步' }}
|
{{ currentStep === 2 ? '立即体验' : '下一步' }}
|
||||||
</button>
|
</button>
|
||||||
</view>
|
</view>
|
||||||
@@ -72,11 +61,11 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
import { imgBaseUrl } from '@/pageSubPack/api/request.js';
|
||||||
// ========== 响应式数据 ==========
|
// ========== 响应式数据 ==========
|
||||||
// 当前引导步骤(0/1/2)
|
// 当前引导步骤(0/1/2)
|
||||||
const currentStep = ref(0);
|
const currentStep = ref(0);
|
||||||
const mode = ref("default")
|
const mode = ref('default');
|
||||||
|
|
||||||
// ========== 方法 ==========
|
// ========== 方法 ==========
|
||||||
// 滑动swiper切换步骤
|
// 滑动swiper切换步骤
|
||||||
@@ -104,7 +93,7 @@ const handleBtnClick = () => {
|
|||||||
.guide-page {
|
.guide-page {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
background: linear-gradient(to bottom, #E2F0FF, #F6FAFF);
|
background: linear-gradient(to bottom, #e2f0ff, #f6faff);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -1,35 +1,33 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="contentStyle" style="">
|
<view class="contentStyle" style="">
|
||||||
<view class="status-bar"></view>
|
<view class="status-bar"></view>
|
||||||
<uni-nav-bar title="生活缴费" backgroundColor="transparent" :border="false">
|
<uni-nav-bar title="生活缴费" backgroundColor="transparent" :border="false"></uni-nav-bar>
|
||||||
</uni-nav-bar>
|
|
||||||
<view class="topbox">
|
<view class="topbox">
|
||||||
<image class="titleImg" src="https://wuyeadmin.bugtc.com/images/propertyImgs/payTitle.png"></image>
|
<image class="titleImg" :src="`${imgBaseUrl}/images/propertyImgs/payTitle.png`"></image>
|
||||||
<image class="payImg" src="https://wuyeadmin.bugtc.com/images/propertyImgs/payImg.png"></image>
|
<image class="payImg" :src="`${imgBaseUrl}/images/propertyImgs/payImg.png`"></image>
|
||||||
</view>
|
</view>
|
||||||
<scroll-view class="page" scroll-y="true">
|
<scroll-view class="page" scroll-y="true">
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<!-- 未登录提示条 -->
|
<!-- 未登录提示条 -->
|
||||||
<view class="login-tip" v-if="!isLogin" @click="handleLoginPrompt">
|
<view class="login-tip" v-if="!isLogin" @click="handleLoginPrompt">
|
||||||
<image class="login-tip-icon" src="https://wuyeadmin.bugtc.com/images/login/phone.png"></image>
|
<image class="login-tip-icon" :src="`${imgBaseUrl}/images/login/phone.png`"></image>
|
||||||
<text class="login-tip-text">登录后可查看缴费账单</text>
|
<text class="login-tip-text">登录后可查看缴费账单</text>
|
||||||
<text class="login-tip-link">去登录</text>
|
<text class="login-tip-link">去登录</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 账单列表(仅登录后显示) -->
|
<!-- 账单列表(仅登录后显示) -->
|
||||||
<view class="bill-list" v-if="isLogin && paymentList.length > 0">
|
<view class="bill-list" v-if="isLogin && paymentList.length > 0">
|
||||||
|
<view class="bill-item" @click="goToBill(item)" v-for="(item, index) in paymentList" :key="index">
|
||||||
|
<image class="billIcon" :src="waterImg" v-if="item.type == '水费'"></image>
|
||||||
|
<image class="billIcon" :src="electricImg" v-if="item.type == '电费'"></image>
|
||||||
|
|
||||||
<view class="bill-item" @click="goToBill(item)" v-for="item,index in paymentList" :key="index">
|
|
||||||
<image class="billIcon" src="https://wuyeadmin.bugtc.com/images/propertyImgs/water.png"
|
|
||||||
v-if="item.type=='水费'"></image>
|
|
||||||
<image class="billIcon" src="https://wuyeadmin.bugtc.com/images/propertyImgs/electric.png"
|
|
||||||
v-if="item.type=='电费'"></image>
|
|
||||||
<view class="bill-info">
|
<view class="bill-info">
|
||||||
<view class="bill-title">{{item.type}}
|
<view class="bill-title">
|
||||||
|
{{ item.type }}
|
||||||
<view class="bill-status debt" v-if="item.balance < 0">已欠费</view>
|
<view class="bill-status debt" v-if="item.balance < 0">已欠费</view>
|
||||||
<text :class="item.balance<0 ? 'balance-debt' : 'balance-normal'">(余额:{{item.balance|| 0.00}}元)</text>
|
<text :class="item.balance < 0 ? 'balance-debt' : 'balance-normal'">(余额:{{ item.balance || 0.0 }}元)</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="bill-desc">{{item.villageName+"-"+item.buildingName+'-'+formatAddress(item.fullAddress)}}</view>
|
<view class="bill-desc">{{ item.villageName + '-' + item.buildingName + '-' + formatAddress(item.fullAddress) }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="arrow"></view>
|
<view class="arrow"></view>
|
||||||
</view>
|
</view>
|
||||||
@@ -52,29 +50,39 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view style="width: 100%;height: 30rpx;"></view>
|
<view style="width: 100%; height: 30rpx"></view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue';
|
||||||
import { onShow, onLoad } from '@dcloudio/uni-app'
|
import { onShow, onLoad } from '@dcloudio/uni-app';
|
||||||
import { getTopUpSelectByResident, getopenIdByCode, postInsertOpenId } from '/pageSubPack/api/apiSub.js'
|
import { getTopUpSelectByResident, getopenIdByCode, postInsertOpenId } from '/pageSubPack/api/apiSub.js';
|
||||||
import { isLoggedIn, requireAuth } from '/pageSubPack/api/auth.js'
|
import { isLoggedIn, requireAuth } from '/pageSubPack/api/auth.js';
|
||||||
|
import { imgBaseUrl } from '/pageSubPack/api/request.js';
|
||||||
|
|
||||||
const isLogin = ref(false)
|
const isLogin = ref(false);
|
||||||
const paymentList = ref([])
|
const paymentList = ref([]);
|
||||||
|
|
||||||
|
const waterImg = imgBaseUrl + '/images/propertyImgs/water.png';
|
||||||
|
const electricImg = imgBaseUrl + '/images/propertyImgs/electric.png';
|
||||||
|
|
||||||
const addList = ref([
|
const addList = ref([
|
||||||
{
|
{
|
||||||
name: "水表",
|
name: '水表',
|
||||||
type: "water",
|
type: 'water',
|
||||||
icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/water.png",
|
icon: waterImg,
|
||||||
iconClass: "water"
|
iconClass: 'water'
|
||||||
},
|
},
|
||||||
])
|
{
|
||||||
|
name: '电表',
|
||||||
|
type: 'electric',
|
||||||
|
icon: electricImg,
|
||||||
|
iconClass: 'electric'
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
// ===== 刷新登录状态 =====
|
// ===== 刷新登录状态 =====
|
||||||
const refreshLoginState = () => {
|
const refreshLoginState = () => {
|
||||||
@@ -88,24 +96,29 @@
|
|||||||
// ===== openid 相关(仅登录后) =====
|
// ===== openid 相关(仅登录后) =====
|
||||||
const postOpenId = async () => {
|
const postOpenId = async () => {
|
||||||
if (!isLogin.value) return;
|
if (!isLogin.value) return;
|
||||||
|
const openid = uni.getStorageSync('openid');
|
||||||
|
if (openid && typeof openid === 'string' && openid.trim() !== '') {
|
||||||
|
return openid;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const loginRes = await wx.login()
|
const loginRes = await wx.login();
|
||||||
|
// uni.login;
|
||||||
if (!loginRes.code) {
|
if (!loginRes.code) {
|
||||||
console.error('wx.login 失败')
|
console.error('wx.login 失败');
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
const openIdRes = await getopenIdByCode({ code: loginRes.code })
|
const openIdRes = await getopenIdByCode({ code: loginRes.code });
|
||||||
if (openIdRes.code !== 200 || !openIdRes.data) {
|
if (openIdRes.code !== 200 || !openIdRes.data) {
|
||||||
console.error('获取openid失败')
|
console.error('获取openid失败');
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
uni.setStorageSync('openid', openIdRes.data)
|
uni.setStorageSync('openid', openIdRes.data);
|
||||||
await postInsertOpenId({
|
await postInsertOpenId({
|
||||||
openid: openIdRes.data,
|
openid: openIdRes.data,
|
||||||
residentUserId: uni.getStorageSync('userId')
|
residentUserId: uni.getStorageSync('userId')
|
||||||
})
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('postOpenId 报错:', err)
|
console.error('postOpenId 报错:', err);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -115,10 +128,10 @@
|
|||||||
try {
|
try {
|
||||||
const res = await getTopUpSelectByResident({
|
const res = await getTopUpSelectByResident({
|
||||||
residentUserId: uni.getStorageSync('userId')
|
residentUserId: uni.getStorageSync('userId')
|
||||||
})
|
});
|
||||||
paymentList.value = res.data || []
|
paymentList.value = res.rows || [];
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('列表接口报错:', err)
|
console.error('列表接口报错:', err);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -127,7 +140,6 @@
|
|||||||
refreshLoginState();
|
refreshLoginState();
|
||||||
uni.hideTabBar({ animation: false });
|
uni.hideTabBar({ animation: false });
|
||||||
if (isLogin.value) {
|
if (isLogin.value) {
|
||||||
postOpenId();
|
|
||||||
getPayList();
|
getPayList();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -135,6 +147,7 @@
|
|||||||
onShow(() => {
|
onShow(() => {
|
||||||
refreshLoginState();
|
refreshLoginState();
|
||||||
if (isLogin.value) {
|
if (isLogin.value) {
|
||||||
|
postOpenId();
|
||||||
getPayList();
|
getPayList();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -165,8 +178,8 @@
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uni.setStorageSync('arrearsPayment', item)
|
uni.setStorageSync('arrearsPayment', item);
|
||||||
uni.redirectTo({ url: '/pageSubPack/payment-list/arrearsPayment' })
|
uni.navigateTo({ url: '/pageSubPack/payment-list/arrearsPayment' });
|
||||||
};
|
};
|
||||||
|
|
||||||
// 点击缴费记录
|
// 点击缴费记录
|
||||||
@@ -181,7 +194,7 @@
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uni.redirectTo({ url: '/pageSubPack/payment-list/paymentRecord' })
|
uni.navigateTo({ url: '/pageSubPack/payment-list/paymentRecord' });
|
||||||
};
|
};
|
||||||
|
|
||||||
// 点击新增缴费(水表/电表等)
|
// 点击新增缴费(水表/电表等)
|
||||||
@@ -197,22 +210,25 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (type.name == '燃气' || type.name == '暖气') {
|
if (type.name == '燃气' || type.name == '暖气') {
|
||||||
uni.redirectTo({ url: '/pageSubPack/payment-list/selectPaymentEntity' })
|
uni.navigateTo({ url: '/pageSubPack/payment-list/selectPaymentEntity' });
|
||||||
} else if (type.name == '水表' || type.name == '电表') {
|
} else if (type.name == '水表' || type.name == '电表') {
|
||||||
uni.redirectTo({ url: '/pageSubPack/payment-list/addHydropower' })
|
uni.navigateTo({ url: '/pageSubPack/payment-list/addHydropower' });
|
||||||
}
|
}
|
||||||
uni.setStorageSync('addPaymentType', type.name)
|
uni.setStorageSync('addPaymentType', type.name);
|
||||||
};
|
};
|
||||||
|
|
||||||
const formatAddress = (addr) => {
|
const formatAddress = (addr) => {
|
||||||
if (!addr) return ''
|
if (!addr) return '';
|
||||||
return addr.replace(/\d+[层楼]\s*/g, '').replace(/单元\s*/g, '-').replace(/\s+/g, '')
|
return addr
|
||||||
|
.replace(/\d+[层楼]\s*/g, '')
|
||||||
|
.replace(/单元\s*/g, '-')
|
||||||
|
.replace(/\s+/g, '');
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
page {
|
page {
|
||||||
background: linear-gradient(180deg, #dfedfd, #F6FAFF);
|
background: linear-gradient(180deg, #dfedfd, #f6faff);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@@ -221,7 +237,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
background: linear-gradient(180deg, #dfedfd, #F6FAFF);
|
background: linear-gradient(180deg, #dfedfd, #f6faff);
|
||||||
}
|
}
|
||||||
|
|
||||||
.page {
|
.page {
|
||||||
@@ -289,7 +305,7 @@
|
|||||||
.bill-item {
|
.bill-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background-color: #F6F9FE;
|
background-color: #f6f9fe;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
padding: 20rpx 20rpx 20rpx 0px;
|
padding: 20rpx 20rpx 20rpx 0px;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
@@ -335,7 +351,7 @@
|
|||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background-color: #E34D59;
|
background-color: #e34d59;
|
||||||
}
|
}
|
||||||
|
|
||||||
.balance-normal {
|
.balance-normal {
|
||||||
@@ -345,7 +361,7 @@
|
|||||||
|
|
||||||
.balance-debt {
|
.balance-debt {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #E34D59;
|
color: #e34d59;
|
||||||
}
|
}
|
||||||
|
|
||||||
.arrow {
|
.arrow {
|
||||||
@@ -389,7 +405,7 @@
|
|||||||
|
|
||||||
.grid-item {
|
.grid-item {
|
||||||
width: calc(25% - 50rpx);
|
width: calc(25% - 50rpx);
|
||||||
background-color: #F6F9FE;
|
background-color: #f6f9fe;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
|
|||||||
Reference in New Issue
Block a user