Compare commits
7 Commits
a82c8da013
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| ba0585c8aa | |||
| 4f6426dc02 | |||
| 6ca716e56c | |||
| f5f6885318 | |||
| 5379380d33 | |||
| b2275c2636 | |||
| ff60913b5b |
@@ -23,26 +23,48 @@ const install = (Vue, vm) => {
|
|||||||
return config;
|
return config;
|
||||||
};
|
};
|
||||||
// 响应拦截,判断状态码是否通过
|
// 响应拦截,判断状态码是否通过
|
||||||
|
// 防止多次跳转登录页
|
||||||
|
let isRedirectingToLogin = false;
|
||||||
|
|
||||||
Vue.prototype.$u.http.interceptor.response = (res) => {
|
Vue.prototype.$u.http.interceptor.response = (res) => {
|
||||||
// 如果把originalData设置为了true,这里得到将会是服务器返回的所有的原始数据
|
// 如果把originalData设置为了true,这里得到将会是服务器返回的所有的原始数据
|
||||||
// 判断可能变成了res.statueCode,或者res.data.code之类的,请打印查看结果
|
// 判断可能变成了res.statueCode,或者res.data.code之类的,请打印查看结果
|
||||||
if(res.statusCode == 200) {
|
if(res.statusCode == 200) {
|
||||||
return res.data;
|
return res.data;
|
||||||
} else if(res.statusCode == 301) {
|
} else if(res.statusCode == 301) {
|
||||||
vm.$u.toast('警告:' + res.msg);
|
vm.$u.toast('警告:' + res.msg);
|
||||||
return false;
|
return false;
|
||||||
} else if(res.statusCode == 401 || res.statusCode == 403) {
|
} else if(res.statusCode == 401 || res.statusCode == 403) {
|
||||||
const currentPage = vm.$route.path;
|
// 防止多次跳转
|
||||||
|
if (isRedirectingToLogin) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// 判断当前页面是否为登录页
|
// 判断当前页面是否为登录页
|
||||||
// 登录成功修改token与用户信息
|
const pages = getCurrentPages();
|
||||||
vm.$u.vuex('vuex_token', '');
|
const currentPage = pages[pages.length - 1];
|
||||||
vm.$u.vuex('vuex_user', {});
|
const currentPath = currentPage ? currentPage.route : '';
|
||||||
uni.removeStorageSync('userInfo');
|
|
||||||
if (currentPage !== '/pages-biz/login/login') {
|
if (currentPath !== 'pages-biz/login/login') {
|
||||||
uni.navigateTo({
|
isRedirectingToLogin = true;
|
||||||
url: '/pages-biz/login/login'
|
|
||||||
});
|
// 清除 token 和用户信息
|
||||||
|
vm.$u.vuex('vuex_token', '');
|
||||||
|
vm.$u.vuex('vuex_user', {});
|
||||||
|
uni.removeStorageSync('userInfo');
|
||||||
|
|
||||||
vm.$u.toast('认证失败,请重新登录');
|
vm.$u.toast('认证失败,请重新登录');
|
||||||
|
|
||||||
|
// 使用 reLaunch 清空页面栈,避免返回时出现问题
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages-biz/login/login',
|
||||||
|
complete: () => {
|
||||||
|
// 跳转完成后重置标记
|
||||||
|
setTimeout(() => {
|
||||||
|
isRedirectingToLogin = false;
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} else if(res.statusCode == 500) {
|
} else if(res.statusCode == 500) {
|
||||||
|
|||||||
@@ -82,10 +82,15 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.fetchContractList();
|
// fetchContractList 移到 onShow 中,等 token 校验通过后再加载
|
||||||
},
|
},
|
||||||
onShow() {
|
async onShow() {
|
||||||
this.$checkToken(this.$getToken());
|
try {
|
||||||
|
await this.$checkToken(this.$getToken())
|
||||||
|
this.fetchContractList()
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
filteredAssets() {
|
filteredAssets() {
|
||||||
@@ -143,8 +148,16 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
submitForm() {
|
submitForm() {
|
||||||
|
const token = this.$getToken()
|
||||||
|
if (!token) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请先登录',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
let userInfo = uni.getStorageSync('userInfo');
|
let userInfo = uni.getStorageSync('userInfo');
|
||||||
if(!userInfo.cusNo) {
|
if(!userInfo || !userInfo.cusNo) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '您还未实名',
|
title: '您还未实名',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
|
|||||||
@@ -68,6 +68,8 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
checkOaAuth() {
|
checkOaAuth() {
|
||||||
|
const token = this.$getToken()
|
||||||
|
if (!token) return
|
||||||
const userInfo = uni.getStorageSync('userInfo')
|
const userInfo = uni.getStorageSync('userInfo')
|
||||||
if (!userInfo || !userInfo.oaAuth) {
|
if (!userInfo || !userInfo.oaAuth) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
@@ -173,12 +175,17 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onShow() {
|
|
||||||
this.$checkToken(this.$getToken())
|
|
||||||
this.checkOaAuth()
|
|
||||||
},
|
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.fetchApplys()
|
// fetchApplys 移到 onShow 中,等 token 校验通过后再加载
|
||||||
|
},
|
||||||
|
async onShow() {
|
||||||
|
try {
|
||||||
|
await this.$checkToken(this.$getToken())
|
||||||
|
this.checkOaAuth()
|
||||||
|
this.fetchApplys()
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -78,15 +78,22 @@
|
|||||||
this.scrollTop = e.scrollTop;
|
this.scrollTop = e.scrollTop;
|
||||||
this.updateNavbarStyle(e.scrollTop);
|
this.updateNavbarStyle(e.scrollTop);
|
||||||
},
|
},
|
||||||
onShow() {
|
|
||||||
this.$checkToken(this.$getToken())
|
|
||||||
this.checkOaAuth()
|
|
||||||
},
|
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.fetchFallback();
|
// fetchFallback 移到 onShow 中,等 token 校验通过后再加载
|
||||||
|
},
|
||||||
|
async onShow() {
|
||||||
|
try {
|
||||||
|
await this.$checkToken(this.$getToken())
|
||||||
|
this.checkOaAuth()
|
||||||
|
this.fetchFallback()
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
checkOaAuth() {
|
checkOaAuth() {
|
||||||
|
const token = this.$getToken()
|
||||||
|
if (!token) return
|
||||||
const userInfo = uni.getStorageSync('userInfo')
|
const userInfo = uni.getStorageSync('userInfo')
|
||||||
if (!userInfo || !userInfo.oaAuth) {
|
if (!userInfo || !userInfo.oaAuth) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
@@ -159,8 +166,13 @@
|
|||||||
},
|
},
|
||||||
addFallback() {
|
addFallback() {
|
||||||
const content = this.newMessageContent.trim();
|
const content = this.newMessageContent.trim();
|
||||||
|
const token = this.$getToken()
|
||||||
|
if (!token) {
|
||||||
|
uni.showToast({ title: '请先登录', icon: 'none' });
|
||||||
|
return
|
||||||
|
}
|
||||||
let userInfo = uni.getStorageSync('userInfo');
|
let userInfo = uni.getStorageSync('userInfo');
|
||||||
if(!userInfo.cusNo) {
|
if(!userInfo || !userInfo.cusNo) {
|
||||||
uni.showToast({ title: '您还未实名', icon: 'none' });
|
uni.showToast({ title: '您还未实名', icon: 'none' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
this.updateNavbarStyle(e.scrollTop);
|
this.updateNavbarStyle(e.scrollTop);
|
||||||
},
|
},
|
||||||
onShow(){
|
onShow(){
|
||||||
this.$checkToken(this.$getToken())
|
this.$checkToken(this.$getToken()).catch(() => {})
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
// 从路由参数中获取留言ID
|
// 从路由参数中获取留言ID
|
||||||
|
|||||||
@@ -92,7 +92,7 @@
|
|||||||
this.loadBills();
|
this.loadBills();
|
||||||
},
|
},
|
||||||
onShow(){
|
onShow(){
|
||||||
this.$checkToken(this.$getToken())
|
this.$checkToken(this.$getToken()).catch(() => {})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 切换年份选择器显示
|
// 切换年份选择器显示
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ export default {
|
|||||||
this.loadBillDetail(id);
|
this.loadBillDetail(id);
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
this.$checkToken(this.$getToken()).catch(() => {})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
loadBillDetail(id) {
|
loadBillDetail(id) {
|
||||||
|
|||||||
@@ -96,11 +96,16 @@
|
|||||||
for (let i = 5; i >= 1; i--) {
|
for (let i = 5; i >= 1; i--) {
|
||||||
this.years.push(year - i);
|
this.years.push(year - i);
|
||||||
}
|
}
|
||||||
this.fetchPayRecord();
|
// fetchPayRecord 移到 onShow 中,等 token 校验通过后再加载
|
||||||
},
|
},
|
||||||
onShow() {
|
async onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
try {
|
||||||
this.checkOaAuth()
|
await this.$checkToken(this.$getToken())
|
||||||
|
this.checkOaAuth()
|
||||||
|
this.fetchPayRecord()
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// ✅ 删除和 scroll-view 冲突的 onReachBottom
|
// ✅ 删除和 scroll-view 冲突的 onReachBottom
|
||||||
watch: {
|
watch: {
|
||||||
@@ -112,6 +117,8 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
checkOaAuth() {
|
checkOaAuth() {
|
||||||
|
const token = this.$getToken()
|
||||||
|
if (!token) return
|
||||||
const userInfo = uni.getStorageSync('userInfo')
|
const userInfo = uni.getStorageSync('userInfo')
|
||||||
if (!userInfo || !userInfo.oaAuth) {
|
if (!userInfo || !userInfo.oaAuth) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
@@ -167,8 +174,13 @@
|
|||||||
this.resetAndLoad();
|
this.resetAndLoad();
|
||||||
},
|
},
|
||||||
formatMoney(val) {
|
formatMoney(val) {
|
||||||
if (!val && val !== 0) return '—';
|
if (val === null || val === undefined || isNaN(val)) return '—';
|
||||||
return '¥' + Number(val).toFixed(2);
|
val = Number(val);
|
||||||
|
if (val >= 100000) {
|
||||||
|
const wan = val / 10000;
|
||||||
|
return '¥' + wan + '万';
|
||||||
|
}
|
||||||
|
return '¥' + val.toFixed(2);
|
||||||
},
|
},
|
||||||
resetAndLoad(){
|
resetAndLoad(){
|
||||||
this.loadStatus = 'more';
|
this.loadStatus = 'more';
|
||||||
|
|||||||
@@ -70,11 +70,18 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.loadContracts();
|
// loadContracts 移到 onShow 中,等 token 校验通过后再加载
|
||||||
},
|
},
|
||||||
onShow() {
|
async onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
try {
|
||||||
this.checkOaAuth()
|
await this.$checkToken(this.$getToken())
|
||||||
|
// token 有效,继续执行
|
||||||
|
this.checkOaAuth()
|
||||||
|
this.loadContracts()
|
||||||
|
} catch (e) {
|
||||||
|
// token 无效,$checkToken 内部已处理跳转登录页
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// ✅ 删除和 scroll-view 冲突的 onReachBottom
|
// ✅ 删除和 scroll-view 冲突的 onReachBottom
|
||||||
computed: {
|
computed: {
|
||||||
@@ -84,6 +91,8 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
checkOaAuth() {
|
checkOaAuth() {
|
||||||
|
const token = this.$getToken()
|
||||||
|
if (!token) return
|
||||||
const userInfo = uni.getStorageSync('userInfo')
|
const userInfo = uni.getStorageSync('userInfo')
|
||||||
if (!userInfo || !userInfo.oaAuth) {
|
if (!userInfo || !userInfo.oaAuth) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
|
|||||||
@@ -92,9 +92,13 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onShow() {
|
async onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
try {
|
||||||
this.getContractDetail()
|
await this.$checkToken(this.$getToken())
|
||||||
|
this.getContractDetail()
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
|
|||||||
@@ -43,11 +43,16 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() { // ✅ 修复生命周期拼写
|
onLoad() { // ✅ 修复生命周期拼写
|
||||||
this.fetchMessageList();
|
// fetchMessageList 移到 onShow 中,等 token 校验通过后再加载
|
||||||
},
|
},
|
||||||
onShow() {
|
async onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
try {
|
||||||
this.checkOaAuth()
|
await this.$checkToken(this.$getToken())
|
||||||
|
this.checkOaAuth()
|
||||||
|
this.fetchMessageList()
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// ✅ 删除和 scroll-view 冲突的 onReachBottom
|
// ✅ 删除和 scroll-view 冲突的 onReachBottom
|
||||||
computed: {
|
computed: {
|
||||||
@@ -57,6 +62,8 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
checkOaAuth() {
|
checkOaAuth() {
|
||||||
|
const token = this.$getToken()
|
||||||
|
if (!token) return
|
||||||
const userInfo = uni.getStorageSync('userInfo')
|
const userInfo = uni.getStorageSync('userInfo')
|
||||||
if (!userInfo || !userInfo.oaAuth) {
|
if (!userInfo || !userInfo.oaAuth) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
this.$checkToken(this.$getToken()).catch(() => {})
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
this.id = e.id
|
this.id = e.id
|
||||||
|
|||||||
@@ -36,11 +36,16 @@ export default {
|
|||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.cusNo = options.cusNo;
|
this.cusNo = options.cusNo;
|
||||||
this.loadAssets();
|
// loadAssets 移到 onShow 中,等 token 校验通过后再加载
|
||||||
},
|
},
|
||||||
onShow() {
|
async onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
try {
|
||||||
this.checkOaAuth()
|
await this.$checkToken(this.$getToken())
|
||||||
|
this.checkOaAuth()
|
||||||
|
this.loadAssets()
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// ✅ 删除和 scroll-view 冲突的 onReachBottom
|
// ✅ 删除和 scroll-view 冲突的 onReachBottom
|
||||||
computed: {
|
computed: {
|
||||||
@@ -50,6 +55,8 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
checkOaAuth() {
|
checkOaAuth() {
|
||||||
|
const token = this.$getToken()
|
||||||
|
if (!token) return
|
||||||
const userInfo = uni.getStorageSync('userInfo')
|
const userInfo = uni.getStorageSync('userInfo')
|
||||||
if (!userInfo || !userInfo.oaAuth) {
|
if (!userInfo || !userInfo.oaAuth) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
|
|||||||
@@ -96,10 +96,15 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options){
|
onLoad(options){
|
||||||
this.fetchReserve()
|
// fetchReserve 移到 onShow 中,等 token 校验通过后再加载
|
||||||
},
|
},
|
||||||
onShow() {
|
async onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
try {
|
||||||
|
await this.$checkToken(this.$getToken())
|
||||||
|
this.fetchReserve()
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// ✅ 删除 scroll-view 冲突的 onReachBottom
|
// ✅ 删除 scroll-view 冲突的 onReachBottom
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@@ -82,14 +82,21 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.loadBills();
|
// loadBills 移到 onShow 中,等 token 校验通过后再加载
|
||||||
},
|
},
|
||||||
onShow() {
|
async onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
try {
|
||||||
this.checkOaAuth()
|
await this.$checkToken(this.$getToken())
|
||||||
|
this.checkOaAuth()
|
||||||
|
this.loadBills()
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
checkOaAuth() {
|
checkOaAuth() {
|
||||||
|
const token = this.$getToken()
|
||||||
|
if (!token) return
|
||||||
const userInfo = uni.getStorageSync('userInfo')
|
const userInfo = uni.getStorageSync('userInfo')
|
||||||
if (!userInfo || !userInfo.oaAuth) {
|
if (!userInfo || !userInfo.oaAuth) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
@@ -155,8 +162,9 @@
|
|||||||
formatMoney(val) {
|
formatMoney(val) {
|
||||||
if (val === null || val === undefined || isNaN(val)) return '—';
|
if (val === null || val === undefined || isNaN(val)) return '—';
|
||||||
val = Number(val);
|
val = Number(val);
|
||||||
if (val >= 10000) {
|
if (val >= 100000) {
|
||||||
return '¥' + (val / 10000).toFixed(2) + '万';
|
const wan = val / 10000;
|
||||||
|
return '¥' + wan + '万';
|
||||||
}
|
}
|
||||||
return '¥' + val.toFixed(2);
|
return '¥' + val.toFixed(2);
|
||||||
},
|
},
|
||||||
@@ -233,7 +241,7 @@
|
|||||||
}, { WT: token });
|
}, { WT: token });
|
||||||
|
|
||||||
if (res.code !== 200) {
|
if (res.code !== 200) {
|
||||||
uni.showToast({ title: res.msg, icon: 'none' });
|
uni.showToast({ title: res.message, icon: 'none' });
|
||||||
this.isPaying = false;
|
this.isPaying = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -248,20 +256,20 @@
|
|||||||
signType: order.miniPayRequest.signType,
|
signType: order.miniPayRequest.signType,
|
||||||
paySign: order.miniPayRequest.paySign,
|
paySign: order.miniPayRequest.paySign,
|
||||||
success: () => {
|
success: () => {
|
||||||
|
this.isPaying = false;
|
||||||
billList.forEach(b => b.checked = false);
|
billList.forEach(b => b.checked = false);
|
||||||
this.updateSelected();
|
this.updateSelected();
|
||||||
this.refresh();
|
this.refresh();
|
||||||
this.isPaying = false;
|
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
this.payFailCallback(err, orderId);
|
|
||||||
this.isPaying = false;
|
this.isPaying = false;
|
||||||
|
this.payFailCallback(err, orderId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('支付请求异常', error);
|
console.error('支付请求异常', error);
|
||||||
uni.showToast({ title: '支付请求失败', icon: 'none' });
|
uni.showToast({ title: '支付请求失败: ' + error, icon: 'none' });
|
||||||
this.isPaying = false;
|
this.isPaying = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -274,11 +282,9 @@
|
|||||||
} else if (err.errMsg?.includes("fail")) {
|
} else if (err.errMsg?.includes("fail")) {
|
||||||
reason = "支付失败,请重试";
|
reason = "支付失败,请重试";
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$u.get(`/bill/paycallback`, {
|
this.$u.post(`/bill/paycallback?orderId=${orderId}&payResult=FAIL`, {}, {
|
||||||
orderId: orderId,
|
WT: this.$getToken() }).then(res => {
|
||||||
payResult: "FAIL"
|
|
||||||
}, { WT: this.$getToken() }).then(res => {
|
|
||||||
console.log("回调成功", res)
|
console.log("回调成功", res)
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.log("回调失败", err)
|
console.log("回调失败", err)
|
||||||
|
|||||||
@@ -80,15 +80,22 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.loadBills();
|
// loadBills 移到 onShow 中,等 token 校验通过后再加载
|
||||||
},
|
},
|
||||||
onShow() {
|
async onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
try {
|
||||||
this.checkOaAuth()
|
await this.$checkToken(this.$getToken())
|
||||||
|
this.checkOaAuth()
|
||||||
|
this.loadBills()
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// ❌ 已删除冲突的 onReachBottom
|
// ❌ 已删除冲突的 onReachBottom
|
||||||
methods: {
|
methods: {
|
||||||
checkOaAuth() {
|
checkOaAuth() {
|
||||||
|
const token = this.$getToken()
|
||||||
|
if (!token) return
|
||||||
const userInfo = uni.getStorageSync('userInfo')
|
const userInfo = uni.getStorageSync('userInfo')
|
||||||
if (!userInfo || !userInfo.oaAuth) {
|
if (!userInfo || !userInfo.oaAuth) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
@@ -157,8 +164,9 @@
|
|||||||
formatMoney(val) {
|
formatMoney(val) {
|
||||||
if (val === null || val === undefined || isNaN(val)) return '—';
|
if (val === null || val === undefined || isNaN(val)) return '—';
|
||||||
val = Number(val);
|
val = Number(val);
|
||||||
if (val >= 10000) {
|
if (val >= 100000) {
|
||||||
return '¥' + (val / 10000).toFixed(2) + '万';
|
const wan = val / 10000;
|
||||||
|
return '¥' + wan + '万';
|
||||||
}
|
}
|
||||||
return '¥' + val.toFixed(2);
|
return '¥' + val.toFixed(2);
|
||||||
},
|
},
|
||||||
@@ -235,7 +243,7 @@
|
|||||||
}, { WT: token });
|
}, { WT: token });
|
||||||
|
|
||||||
if (res.code !== 200) {
|
if (res.code !== 200) {
|
||||||
uni.showToast({ title: res.msg, icon: 'none' });
|
uni.showToast({ title: res.message, icon: 'none' });
|
||||||
this.isPaying = false;
|
this.isPaying = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -250,20 +258,20 @@
|
|||||||
signType: order.miniPayRequest.signType,
|
signType: order.miniPayRequest.signType,
|
||||||
paySign: order.miniPayRequest.paySign,
|
paySign: order.miniPayRequest.paySign,
|
||||||
success: () => {
|
success: () => {
|
||||||
|
this.isPaying = false;
|
||||||
billList.forEach(b => b.checked = false);
|
billList.forEach(b => b.checked = false);
|
||||||
this.updateSelected();
|
this.updateSelected();
|
||||||
this.refresh();
|
this.refresh();
|
||||||
this.isPaying = false;
|
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
this.payFailCallback(err, orderId);
|
|
||||||
this.isPaying = false;
|
this.isPaying = false;
|
||||||
|
this.payFailCallback(err, orderId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('支付请求异常', error);
|
console.error('支付请求异常', error);
|
||||||
uni.showToast({ title: '支付请求失败', icon: 'none' });
|
uni.showToast({ title: '支付请求失败: ' + error, icon: 'none' });
|
||||||
this.isPaying = false;
|
this.isPaying = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -277,10 +285,8 @@
|
|||||||
reason = "支付失败,请重试";
|
reason = "支付失败,请重试";
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$u.get(`/bill/paycallback`, {
|
this.$u.post(`/bill/paycallback?orderId=${orderId}&payResult=FAIL`, {}, {
|
||||||
orderId: orderId,
|
WT: this.$getToken() }).then(res => {
|
||||||
payResult: "FAIL"
|
|
||||||
}, { WT: this.$getToken() }).then(res => {
|
|
||||||
console.log("回调成功", res)
|
console.log("回调成功", res)
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.log("回调失败", err)
|
console.log("回调失败", err)
|
||||||
|
|||||||
@@ -77,15 +77,22 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.loadBills();
|
// loadBills 移到 onShow 中,等 token 校验通过后再加载
|
||||||
},
|
},
|
||||||
onShow() {
|
async onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
try {
|
||||||
this.checkOaAuth()
|
await this.$checkToken(this.$getToken())
|
||||||
|
this.checkOaAuth()
|
||||||
|
this.loadBills()
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// ❌ 已删除冲突的 onReachBottom
|
// ❌ 已删除冲突的 onReachBottom
|
||||||
methods: {
|
methods: {
|
||||||
checkOaAuth() {
|
checkOaAuth() {
|
||||||
|
const token = this.$getToken()
|
||||||
|
if (!token) return
|
||||||
const userInfo = uni.getStorageSync('userInfo')
|
const userInfo = uni.getStorageSync('userInfo')
|
||||||
if (!userInfo || !userInfo.oaAuth) {
|
if (!userInfo || !userInfo.oaAuth) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
@@ -154,8 +161,9 @@
|
|||||||
formatMoney(val) {
|
formatMoney(val) {
|
||||||
if (val === null || val === undefined || isNaN(val)) return '—';
|
if (val === null || val === undefined || isNaN(val)) return '—';
|
||||||
val = Number(val);
|
val = Number(val);
|
||||||
if (val >= 10000) {
|
if (val >= 100000) {
|
||||||
return '¥' + (val / 10000).toFixed(2) + '万';
|
const wan = val / 10000;
|
||||||
|
return '¥' + wan + '万';
|
||||||
}
|
}
|
||||||
return '¥' + val.toFixed(2);
|
return '¥' + val.toFixed(2);
|
||||||
},
|
},
|
||||||
@@ -211,7 +219,7 @@
|
|||||||
const res = await this.$u.post(url, params, { WT: token });
|
const res = await this.$u.post(url, params, { WT: token });
|
||||||
|
|
||||||
if (res.code !== 200) {
|
if (res.code !== 200) {
|
||||||
uni.showToast({ title: res.msg, icon: 'none' });
|
uni.showToast({ title: res.message, icon: 'none' });
|
||||||
this.isPaying = false;
|
this.isPaying = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -226,20 +234,20 @@
|
|||||||
signType: order.miniPayRequest.signType,
|
signType: order.miniPayRequest.signType,
|
||||||
paySign: order.miniPayRequest.paySign,
|
paySign: order.miniPayRequest.paySign,
|
||||||
success: () => {
|
success: () => {
|
||||||
|
this.isPaying = false;
|
||||||
billList.forEach(b => b.checked = false);
|
billList.forEach(b => b.checked = false);
|
||||||
this.updateSelected();
|
this.updateSelected();
|
||||||
this.refresh();
|
this.refresh();
|
||||||
this.isPaying = false;
|
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
this.payFailCallback(err, orderId);
|
|
||||||
this.isPaying = false;
|
this.isPaying = false;
|
||||||
|
this.payFailCallback(err, orderId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('支付请求异常', error);
|
console.error('支付请求异常', error);
|
||||||
uni.showToast({ title: '支付请求失败', icon: 'none' });
|
uni.showToast({ title: '支付请求失败: ' + error, icon: 'none' });
|
||||||
this.isPaying = false;
|
this.isPaying = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -252,10 +260,7 @@
|
|||||||
reason = "支付失败,请重试";
|
reason = "支付失败,请重试";
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$u.get(`/bill/paycallback`, {
|
this.$u.post(`/bill/paycallback?orderId=${orderId}&payResult=FAIL`, {}, {
|
||||||
orderId: orderId,
|
|
||||||
payResult: "FAIL"
|
|
||||||
}, {
|
|
||||||
WT: this.$getToken()
|
WT: this.$getToken()
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
console.log("回调成功")
|
console.log("回调成功")
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
this.$checkToken(this.$getToken()).catch(() => {})
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.fetchDataList();
|
this.fetchDataList();
|
||||||
|
|||||||
@@ -145,6 +145,8 @@
|
|||||||
opacity: 0,
|
opacity: 0,
|
||||||
extraIcons: [] // 右侧额外图标
|
extraIcons: [] // 右侧额外图标
|
||||||
},
|
},
|
||||||
|
// 用户信息(响应式)
|
||||||
|
userInfo: uni.getStorageSync('userInfo') || {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -163,9 +165,9 @@
|
|||||||
staticHost() {
|
staticHost() {
|
||||||
return this.$config.staticUrl
|
return this.$config.staticUrl
|
||||||
},
|
},
|
||||||
user() {
|
user() {
|
||||||
return uni.getStorageSync('userInfo') || {}
|
return this.userInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -179,15 +181,19 @@
|
|||||||
onUnload() {
|
onUnload() {
|
||||||
uni.$off('updateAvatar')
|
uni.$off('updateAvatar')
|
||||||
},
|
},
|
||||||
onShow() {
|
async onShow() {
|
||||||
this.$checkToken(this.$getToken())
|
try {
|
||||||
this.loadUserInfo()
|
await this.$checkToken(this.$getToken())
|
||||||
this.countHandlingReserve()
|
this.loadUserInfo()
|
||||||
this.countUnHandleContract()
|
this.countHandlingReserve()
|
||||||
this.countUnpayRentBills()
|
this.countUnHandleContract()
|
||||||
this.countUnpayWaeBills()
|
this.countUnpayRentBills()
|
||||||
this.countUnreadMsg()
|
this.countUnpayWaeBills()
|
||||||
this.countUnpaidRentMargin()
|
this.countUnreadMsg()
|
||||||
|
this.countUnpaidRentMargin()
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
@@ -206,17 +212,20 @@
|
|||||||
}).then(obj => {
|
}).then(obj => {
|
||||||
if(obj.flag){
|
if(obj.flag){
|
||||||
console.log("更新缓存中用户信息")
|
console.log("更新缓存中用户信息")
|
||||||
uni.setStorageSync('userInfo', {
|
const newUserInfo = {
|
||||||
userType: obj.data.userType,
|
userType: obj.data.userType,
|
||||||
oaAuth: obj.data.oaAuth,
|
oaAuth: obj.data.oaAuth,
|
||||||
cusNo: obj.data.cusNo,
|
cusNo: obj.data.cusNo,
|
||||||
userName: obj.data.userName,
|
userName: obj.data.userName,
|
||||||
openId: obj.data.openId,
|
openId: obj.data.openId,
|
||||||
subscribe: obj.data.subscribeMsg
|
subscribe: obj.data.subscribeMsg
|
||||||
})
|
}
|
||||||
|
uni.setStorageSync('userInfo', newUserInfo)
|
||||||
|
// 更新响应式数据
|
||||||
|
this.userInfo = newUserInfo
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
logout() {
|
logout() {
|
||||||
this.$u.vuex('vuex_token', '');
|
this.$u.vuex('vuex_token', '');
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 30 KiB |
Reference in New Issue
Block a user