修改bug
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
let baseUrl = '';
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
baseUrl = 'http://192.168.1.222:8085'; // 开发环境
|
||||
// baseUrl = 'http://wuyeapi.ckdzkj.com';
|
||||
// baseUrl = 'http://192.168.1.222:8080'; // 开发环境
|
||||
baseUrl = 'https://wuyeapi.ckdzkj.com';
|
||||
} else {
|
||||
baseUrl = 'https://wuyeapi.ckdzkj.com'; // 生产环境
|
||||
}
|
||||
|
||||
@@ -13,14 +13,7 @@
|
||||
<uni-easyinput class="input-content" type="number" v-model="phoneNumber"
|
||||
placeholder="请输入手机号" :inputBorder="false" maxlength="11" :placeholderStyle="placeholderStyle">
|
||||
</uni-easyinput>
|
||||
<!-- <input
|
||||
class="input-content"
|
||||
type="number"
|
||||
placeholder="请输入手机号"
|
||||
v-model="phoneNumber"
|
||||
maxlength="11"
|
||||
@input="checkForm"
|
||||
/> -->
|
||||
|
||||
</view>
|
||||
|
||||
<!-- 验证码输入框 + 获取验证码按钮 -->
|
||||
@@ -277,15 +270,6 @@ const doLogin = () => {
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
// 模拟登录请求
|
||||
// uni.showLoading({
|
||||
// title: '登录中...'
|
||||
// });
|
||||
// uni.showToast({
|
||||
// title:"登录成功",
|
||||
// icon:'success'
|
||||
// })
|
||||
// 登录成功后上报推送 CID
|
||||
// #ifdef APP-PLUS
|
||||
const cid = uni.getStorageSync('push_cid')
|
||||
|
||||
@@ -130,8 +130,11 @@
|
||||
<text class="label">手机号码</text>
|
||||
<input class="input" v-model="form.phone" placeholder="请输入手机号" placeholder-class="ph"
|
||||
type="tel" />
|
||||
<button class="code-btn" :disabled="cd>0" @click="sendCode">
|
||||
<!-- <button class="code-btn" :disabled="cd>0" @click="sendCode">
|
||||
{{ cd > 0 ? cd+'s' : '获取验证码' }}
|
||||
</button> -->
|
||||
<button class="get-verify-btn" :disabled=" countDown > 0 || !canGetVerify" @click="getVerifyCode">
|
||||
{{ countDown > 0 ? `${countDown}s后重新获取` : '获取验证码' }}
|
||||
</button>
|
||||
</view>
|
||||
|
||||
@@ -237,7 +240,9 @@
|
||||
import {
|
||||
ref,
|
||||
onMounted,
|
||||
reactive
|
||||
reactive,
|
||||
onUnmounted,
|
||||
computed
|
||||
} from 'vue'
|
||||
import {
|
||||
onReachBottom,
|
||||
@@ -350,8 +355,8 @@
|
||||
const type = ref('')
|
||||
const currentStep = ref(0)
|
||||
const showPopup = ref(false)
|
||||
const cd = ref(0)
|
||||
const timer = ref(null)
|
||||
const countDown = ref(0)
|
||||
let timer = null
|
||||
const showCardType = ref(false)
|
||||
const showRelation = ref(false)
|
||||
|
||||
@@ -363,6 +368,54 @@
|
||||
const idCardBackUpload = useImageUpload({
|
||||
uploadUrl: '/api/resident/file/uploadImage'
|
||||
})
|
||||
|
||||
// ========== 计算属性 ==========
|
||||
// 是否可以获取验证码(手机号格式正确)
|
||||
const canGetVerify = computed(() => {
|
||||
// 手机号正则:11位数字,以1开头
|
||||
const phoneReg = /^1[3-9]\d{9}$/;
|
||||
return phoneReg.test(form.phone);
|
||||
});
|
||||
// 获取验证码
|
||||
const getVerifyCode = () => {
|
||||
if (!canGetVerify.value) return;
|
||||
let params = {
|
||||
phone:form.phone,
|
||||
scene:'house_bind'
|
||||
}
|
||||
uni.showLoading({ title: '发送中...', mask: true });
|
||||
getHouseAuthSendSmsCode(params).then(res =>{
|
||||
if(res.code === 200){
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '验证码已发送',
|
||||
icon: 'success'
|
||||
});
|
||||
// 开始60秒倒计时
|
||||
if (timer) clearInterval(timer);
|
||||
countDown.value = 60;
|
||||
timer = setInterval(() => {
|
||||
countDown.value--;
|
||||
if (countDown.value <= 0) {
|
||||
clearInterval(timer);
|
||||
timer = null;
|
||||
}
|
||||
}, 1000);
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: '验证码发送失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}).catch(err => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: err.msg||'网络异常',
|
||||
icon: 'none'
|
||||
});
|
||||
})
|
||||
|
||||
};
|
||||
// ==================== 获取列表数据 ====================
|
||||
const getDetail = async () => {
|
||||
|
||||
@@ -372,7 +425,7 @@
|
||||
})
|
||||
|
||||
const data = res
|
||||
console.log(data);
|
||||
// console.log('列表返回数据',data);
|
||||
if (data.code === 200) {
|
||||
uni.setStorageSync('communityName', data.data.villageName)
|
||||
uni.setStorageSync('buildingName', data.data.buildingName)
|
||||
@@ -381,7 +434,7 @@
|
||||
uni.setStorageSync('houseNumberName', data.data.houseNo)
|
||||
uni.setStorageSync('communityId', data.data.villageId)
|
||||
uni.setStorageSync('buildingId', data.data.buildingId)
|
||||
uni.setStorageSync('unitId', data.data.unitNo)
|
||||
uni.setStorageSync('unitId', data.data.unitNoId)
|
||||
uni.setStorageSync('floorId', data.data.floorNo)
|
||||
uni.setStorageSync('houseNumberId', data.data.houseId)
|
||||
uni.setStorageSync('houseStatus', data.data.houseStatus)
|
||||
@@ -491,12 +544,6 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const openCardType = () => {
|
||||
showCardType.value = true
|
||||
}
|
||||
@@ -519,42 +566,6 @@
|
||||
showPopup.value = false;
|
||||
upDataListNum.value++
|
||||
}
|
||||
const sendCode = () => {
|
||||
if (!/^1[3-9]\d{9}$/.test(form.phone)) {
|
||||
return uni.showToast({
|
||||
title: '手机号格式错误',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
cd.value = 60
|
||||
timer.value = setInterval(() => {
|
||||
cd.value--
|
||||
if (cd.value <= 0) clearInterval(timer)
|
||||
}, 1000)
|
||||
|
||||
let params = {
|
||||
phone: form.phone,
|
||||
scene: "house_bind"
|
||||
}
|
||||
getHouseAuthSendSmsCode(params).then(res => {
|
||||
if (res.code === 200) {
|
||||
uni.showToast({
|
||||
title: '发送成功',
|
||||
icon: 'success'
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'error'
|
||||
});
|
||||
}
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.msg || '发送失败',
|
||||
icon: 'none'
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
// 下一步
|
||||
const goNext = () => {
|
||||
@@ -745,7 +756,7 @@
|
||||
|
||||
const updateMethod = async (params) => {
|
||||
await upDateMyHouse(params).then(res => {
|
||||
console.log('33333', res)
|
||||
// console.log('33333', res)
|
||||
if (res.code === 200) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
@@ -771,9 +782,6 @@
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 选择项点击事件(可替换为picker/弹窗选择)
|
||||
const selectItem = (type) => {
|
||||
console.log(type);
|
||||
@@ -859,6 +867,13 @@
|
||||
formData.isDefault = e.detail.value
|
||||
uni.setStorageSync('houseIsDefault', e.detail.value)
|
||||
}
|
||||
// ========== 生命周期 ==========
|
||||
// 页面卸载时清除定时器
|
||||
onUnmounted(() => {
|
||||
if (timer) {
|
||||
clearInterval(timer);
|
||||
}
|
||||
});
|
||||
|
||||
const goBack = () => {
|
||||
uni.removeStorageSync('communityId');
|
||||
@@ -1018,6 +1033,32 @@
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
/* 获取验证码按钮 */
|
||||
.get-verify-btn {
|
||||
position: absolute;
|
||||
right: 10rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 200rpx;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
background-color: #007aff;
|
||||
color: #fff;
|
||||
border-radius: 35rpx;
|
||||
font-size: 28rpx;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* 获取验证码按钮禁用状态 */
|
||||
.get-verify-btn:disabled {
|
||||
background-color: #ccc;
|
||||
color: #fff;
|
||||
border-radius: 50px;
|
||||
}
|
||||
.get-verify-btn::after{
|
||||
border-radius: 50px;
|
||||
}
|
||||
|
||||
/* .item-arrow {
|
||||
font-size: 40rpx;
|
||||
|
||||
@@ -148,13 +148,13 @@
|
||||
uni.setStorageSync('houseIsDefault', e.detail.value)
|
||||
uni.showToast({
|
||||
title: '设置默认房屋成功',
|
||||
icon: 'success'
|
||||
icon: 'none'
|
||||
});
|
||||
} else {
|
||||
// uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: `${res.msg}`,
|
||||
icon: 'error'
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
|
||||
@@ -108,12 +108,6 @@
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app'
|
||||
|
||||
import {
|
||||
getPushSingle
|
||||
} from '/pageSubPack/api/api.js'
|
||||
import {
|
||||
getBankMiniProgramParams
|
||||
} from '/pageSubPack/api/apiSub.js'
|
||||
|
||||
// 响应式数据
|
||||
const outstandingPayment = ref(true)
|
||||
@@ -172,14 +166,7 @@
|
||||
}
|
||||
|
||||
// 立即缴费 — 通过微信拉起日照银行小程序进行支付
|
||||
const handlePay = async () => {
|
||||
// if (!payNum.value || Number(payNum.value) <= 0) {
|
||||
// uni.showToast({
|
||||
// title: '请输入正确的缴费金额',
|
||||
// icon: 'none'
|
||||
// })
|
||||
// return
|
||||
// }
|
||||
const handlePay = () => {
|
||||
const amount = arrearsAmount.value
|
||||
|
||||
try {
|
||||
@@ -189,45 +176,25 @@
|
||||
const deviceTypeMap = { '电费': '1', '水费': '2' }
|
||||
const mappedDeviceType = deviceTypeMap[paymentItem.type] || paymentItem.deviceType || ''
|
||||
|
||||
const res = await getBankMiniProgramParams({
|
||||
// 直接从本地参数拼 path 查询字符串传给支付小程序,不走接口
|
||||
const token = uni.getStorageSync('token') || ''
|
||||
const params = {
|
||||
acct: uni.getStorageSync('userId'),
|
||||
orderType: '10',
|
||||
orderAmount: String(Math.round(Number(amount) * 100)),
|
||||
// orderAmount: String(Math.round(Number(arrearsAmount.value) * 100)),
|
||||
orderType: '20',
|
||||
deviceCode: paymentItem.deviceCode || '',
|
||||
deviceType: mappedDeviceType,
|
||||
billId: paymentItem.billId || '',
|
||||
residentUserId: uni.getStorageSync('userId'),
|
||||
goodName: paymentItem.name || switchStatus(paymentItem.type) || '',
|
||||
remark:'服务费'
|
||||
})
|
||||
// goodName: paymentItem.name || switchStatus(paymentItem.type) || '',
|
||||
// remark: '服务费',
|
||||
token: token
|
||||
}
|
||||
const queryString = Object.keys(params).map(k =>
|
||||
encodeURIComponent(k) + '=' + encodeURIComponent(params[k])
|
||||
).join('&')
|
||||
|
||||
uni.hideLoading()
|
||||
|
||||
if (res.code !== 200 || !res.data) {
|
||||
uni.showToast({ title: res.msg || '获取支付参数失败', icon: 'none' })
|
||||
return
|
||||
}
|
||||
console.log('resres返回数据', res)
|
||||
// console.log('resres', res.data)
|
||||
|
||||
const { appId, path, extraData } = res.data
|
||||
console.log('navigateToMiniProgram参数:', { appId, path, extraData })
|
||||
|
||||
// 校验必要参数
|
||||
if (!appId) {
|
||||
console.error('缺少appId,无法拉起支付小程序', res.data)
|
||||
uni.showToast({ title: '获取支付参数失败:缺少appId', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
// 把支付金额和token拼接到 extraData 查询字符串中传入中间小程序,实现免登录
|
||||
const token = uni.getStorageSync('token') || ''
|
||||
const payAmountStr = String(payAmount.value)
|
||||
const orderAmountStr = String(Math.round(Number(amount) * 100))
|
||||
const custId = uni.getStorageSync('custId') || ''
|
||||
const extraDataWithAmount = extraData + '&payAmount=' + encodeURIComponent(payAmountStr) + '&orderAmount=' + encodeURIComponent(orderAmountStr) + '&token=' + encodeURIComponent(token) + '&custId=' + encodeURIComponent(custId)
|
||||
console.log('传入中间小程序的extraData:', extraDataWithAmount)
|
||||
console.log('传入中间小程序的path参数:', queryString)
|
||||
// #ifdef APP-PLUS
|
||||
// 原生App:通过微信SDK拉起小程序
|
||||
plus.share.getServices((services) => {
|
||||
@@ -241,21 +208,11 @@
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
weixin.launchMiniProgram({
|
||||
id: 'gh_a765aef0172c',
|
||||
// appId: 'wx40625124315d2de1',
|
||||
type:1, // 0 正式版 / 1测试版 / 2预览版
|
||||
path: 'pageSubPack/payment-list/arrearsPayment',
|
||||
extraData: extraDataWithAmount,
|
||||
type: 1, // 0 正式版 / 1测试版 / 2预览版
|
||||
path: 'pages/arrearsPayment/arrearsPayment?' + queryString,
|
||||
}, (res) => {
|
||||
console.log('ress-------------',res)
|
||||
// if (res.retCode === 'SUCCESS') {
|
||||
// console.log('成功拉起日照银行小程序(App)', res.retCode)
|
||||
// } else {
|
||||
// console.log('拉起日照银行小程序返回失败(App======)', res.retMsg)
|
||||
// }
|
||||
|
||||
console.log('回调---回调结果(App)', JSON.stringify(res))
|
||||
}, (err) => {
|
||||
console.error('err---拉起失败(App)', JSON.stringify(err))
|
||||
@@ -263,27 +220,10 @@
|
||||
})
|
||||
})
|
||||
// #endif
|
||||
|
||||
// // #ifdef MP-WEIXIN
|
||||
// // 微信小程序:直接navigateToMiniProgram
|
||||
// uni.navigateToMiniProgram({
|
||||
// appId: appId,
|
||||
// path: path || '',
|
||||
// extraData: extraData,
|
||||
// envVersion: 'develop',
|
||||
// success: () => {
|
||||
// console.log('成功拉起日照银行小程序(微信)')
|
||||
// },
|
||||
// fail: (err) => {
|
||||
// console.error('拉起日照银行小程序失败(微信)', JSON.stringify(err))
|
||||
// uni.showToast({ title: err.errMsg || err.msg || '拉起支付小程序失败', icon: 'none' })
|
||||
// }
|
||||
// })
|
||||
// // #endif
|
||||
} catch (err) {
|
||||
uni.hideLoading()
|
||||
console.error('获取支付参数异常', err)
|
||||
uni.showToast({ title: err.msg || '请求异常,请重试', icon: 'none' })
|
||||
console.error('拉起支付小程序异常', err)
|
||||
uni.showToast({ title: '请求异常,请重试', icon: 'none' })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -83,9 +83,6 @@
|
||||
import {
|
||||
getPushSingle
|
||||
} from '/pageSubPack/api/api.js'
|
||||
import {
|
||||
getBankMiniProgramParams
|
||||
} from '/pageSubPack/api/apiSub.js'
|
||||
|
||||
// 响应式数据
|
||||
const outstandingPayment = ref(true)
|
||||
@@ -152,8 +149,9 @@
|
||||
}
|
||||
|
||||
// 立即缴费 — 通过微信拉起日照银行小程序进行支付
|
||||
const handlePay = async () => {
|
||||
const handlePay = () => {
|
||||
const amount = arrearsAmount.value
|
||||
console.log('saaaaaaa', paymentItem)
|
||||
|
||||
try {
|
||||
uni.showLoading({ title: '加载中...' })
|
||||
@@ -162,46 +160,25 @@
|
||||
const deviceTypeMap = { '物业费': '3', '车位费': '4', '垃圾处理费': '5' }
|
||||
const mappedDeviceType = deviceTypeMap[switchStatus(paymentItem.type)] || paymentItem.deviceType || ''
|
||||
|
||||
const res = await getBankMiniProgramParams({
|
||||
// 直接从本地参数拼 path 查询字符串传给支付小程序,不走接口
|
||||
const token = uni.getStorageSync('token') || ''
|
||||
const params = {
|
||||
acct: uni.getStorageSync('userId'),
|
||||
orderType: '10',
|
||||
orderAmount: String(Math.round(Number(amount) * 100)),
|
||||
deviceCode: paymentItem.deviceCode || '',
|
||||
deviceType: mappedDeviceType,
|
||||
billId: paymentItem.billId || '',
|
||||
billId: paymentItem.id || '',
|
||||
residentUserId: uni.getStorageSync('userId'),
|
||||
goodName: paymentItem.name || switchStatus(paymentItem.type) || '',
|
||||
remark:'服务费'
|
||||
})
|
||||
// goodName: paymentItem.name || switchStatus(paymentItem.type) || '',
|
||||
// remark: '服务费',
|
||||
token: token
|
||||
}
|
||||
const queryString = Object.keys(params).map(k =>
|
||||
encodeURIComponent(k) + '=' + encodeURIComponent(params[k])
|
||||
).join('&')
|
||||
|
||||
uni.hideLoading()
|
||||
|
||||
if (res.code !== 200 || !res.data) {
|
||||
uni.showToast({ title: res.msg || '获取支付参数失败', icon: 'none' })
|
||||
return
|
||||
}
|
||||
console.log('resres返回数据', res)
|
||||
|
||||
const { appId, path, extraData } = res.data
|
||||
console.log('navigateToMiniProgram参数:', { appId, path, extraData })
|
||||
|
||||
// 校验必要参数
|
||||
if (!appId) {
|
||||
console.error('缺少appId,无法拉起支付小程序', res.data)
|
||||
uni.showToast({ title: '获取支付参数失败:缺少appId', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
// 把 extraData 对象和支付金额、token拼成查询字符串传入中间小程序,实现免登录
|
||||
const token = uni.getStorageSync('token') || ''
|
||||
const payAmountStr = String(payAmount.value)
|
||||
const orderAmountStr = String(Math.round(Number(amount) * 100))
|
||||
// extraData 是对象,先转为 query string 再拼接额外参数
|
||||
const extraDataStr = typeof extraData === 'object' && extraData !== null
|
||||
? Object.keys(extraData).map(k => encodeURIComponent(k) + '=' + encodeURIComponent(extraData[k])).join('&')
|
||||
: (extraData || '')
|
||||
const extraDataWithAmount = extraDataStr + '&payAmount=' + encodeURIComponent(payAmountStr) + '&orderAmount=' + encodeURIComponent(orderAmountStr) + '&token=' + encodeURIComponent(token)
|
||||
console.log('传入中间小程序的extraData:', extraDataWithAmount)
|
||||
console.log('传入中间小程序的path参数:', queryString)
|
||||
// #ifdef APP-PLUS
|
||||
// 原生App:通过微信SDK拉起小程序
|
||||
plus.share.getServices((services) => {
|
||||
@@ -215,21 +192,11 @@
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
weixin.launchMiniProgram({
|
||||
id: 'gh_a765aef0172c',
|
||||
// appId: 'wx40625124315d2de1',
|
||||
type:1, // 0 正式版 / 1测试版 / 2预览版
|
||||
path: 'pageSubPack/payment-list/arrearsPayment',
|
||||
extraData: extraData,
|
||||
type: 1, // 0 正式版 / 1测试版 / 2预览版
|
||||
path: 'pages/arrearsPayment/arrearsPayment?' + queryString,
|
||||
}, (res) => {
|
||||
console.log('ress-------------',res)
|
||||
// if (res.retCode === 'SUCCESS') {
|
||||
// console.log('成功拉起日照银行小程序(App)', res.retCode)
|
||||
// } else {
|
||||
// console.log('拉起日照银行小程序返回失败(App======)', res.retMsg)
|
||||
// }
|
||||
|
||||
console.log('回调---日照银行小程序回调结果(App)', JSON.stringify(res))
|
||||
}, (err) => {
|
||||
console.error('拉起日照银行小程序失败(App)', JSON.stringify(err))
|
||||
@@ -237,27 +204,10 @@
|
||||
})
|
||||
})
|
||||
// #endif
|
||||
|
||||
// // #ifdef MP-WEIXIN
|
||||
// // 微信小程序:直接navigateToMiniProgram
|
||||
// uni.navigateToMiniProgram({
|
||||
// appId: appId,
|
||||
// path: path || '',
|
||||
// extraData: extraData,
|
||||
// envVersion: 'develop',
|
||||
// success: () => {
|
||||
// console.log('成功拉起日照银行小程序(微信)')
|
||||
// },
|
||||
// fail: (err) => {
|
||||
// console.error('拉起日照银行小程序失败(微信)', JSON.stringify(err))
|
||||
// uni.showToast({ title: err.errMsg || err.msg || '拉起支付小程序失败', icon: 'none' })
|
||||
// }
|
||||
// })
|
||||
// // #endif
|
||||
} catch (err) {
|
||||
uni.hideLoading()
|
||||
console.error('获取支付参数异常', err)
|
||||
uni.showToast({ title: err.msg || '请求异常,请重试', icon: 'none' })
|
||||
console.error('拉起支付小程序异常', err)
|
||||
uni.showToast({ title: '请求异常,请重试', icon: 'none' })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -240,14 +240,14 @@
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '获取失败',
|
||||
icon: 'error'
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} catch (err) {
|
||||
const msg = err?.msg || (typeof err === 'string' ? err : '获取失败')
|
||||
uni.showToast({
|
||||
title: msg,
|
||||
icon: 'error'
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user