From 4904577a95f91908bfefe84a2d77115217acf545 Mon Sep 17 00:00:00 2001
From: JinxChen <2183691628@qq.com>
Date: Wed, 20 Sep 2023 16:04:47 +0800
Subject: [PATCH] =?UTF-8?q?update=20-=20=E5=85=85=E5=80=BC=E9=A6=96?=
=?UTF-8?q?=E9=A1=B5=20=20=20=20=20-=20=E4=BF=AE=E6=94=B9=20=E9=A1=B5?=
=?UTF-8?q?=E9=9D=A2=E8=B7=B3=E8=BD=AC=E9=80=BB=E8=BE=91=20=20=20=20=20=20?=
=?UTF-8?q?=20=20=20#=20=E6=9C=89=E5=9F=BA=E7=A1=80=E5=A5=97=E9=A4=90?=
=?UTF-8?q?=E6=97=B6=20=20=20=20=20=20=20=20=20=20=20=20=20#=20=E5=B7=B2?=
=?UTF-8?q?=E6=94=AF=E4=BB=98=EF=BC=8C=E8=B7=B3=E8=BD=AC=E8=AF=9D=E8=B4=B9?=
=?UTF-8?q?=E6=9F=A5=E8=AF=A2=E9=A1=B5=E9=9D=A2=20=20=20=20=20=20=20=20=20?=
=?UTF-8?q?=20=20=20=20#=20=E6=9C=AA=E6=94=AF=E4=BB=98=EF=BC=8C=20?=
=?UTF-8?q?=E8=B7=B3=E8=BD=AC=E5=A5=97=E9=A4=90=E5=85=85=E5=80=BC=E9=A1=B5?=
=?UTF-8?q?=E9=9D=A2=20=20=20=20=20=20=20=20=20=20#=20=E6=97=A0=E5=9F=BA?=
=?UTF-8?q?=E7=A1=80=E5=A5=97=E9=A4=90=E6=97=B6=20=20=20=20=20=20=20=20=20?=
=?UTF-8?q?=20=20=20=20#=E6=98=AF=E9=9B=B6=E5=B7=9D=E6=88=96=E8=80=85?=
=?UTF-8?q?=E5=B0=8F=E5=8F=B0=E9=A3=8E=EF=BC=8C=E8=B7=B3=E8=BD=AC=E8=AF=9D?=
=?UTF-8?q?=E8=B4=B9=E6=9F=A5=E8=AF=A2=E9=A1=B5=E9=9D=A2=20=20=20=20=20=20?=
=?UTF-8?q?=20=20=20=20=20=20=20#=E5=90=A6=E5=88=99=E8=B7=B3=E8=BD=AC?=
=?UTF-8?q?=E9=94=99=E8=AF=AF=E9=A1=B5=E9=9D=A2=20=20=20=20=20-=20?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E4=B8=80=E4=B8=AA=E7=89=A9=E8=81=94?=
=?UTF-8?q?=E7=BD=91=E5=8D=A1=E7=9A=84=E9=94=99=E8=AF=AF=E9=A1=B5=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 16 ++++-
src/App.vue | 4 +-
src/config/models.js | 2 +-
src/main.js | 2 +-
src/router/index.js | 4 +-
src/views/error-pages/iotcard-error.vue | 36 ++++++++++
src/views/package-home/index.vue | 87 ++++++++++++++++++++-----
7 files changed, 128 insertions(+), 23 deletions(-)
create mode 100644 src/views/error-pages/iotcard-error.vue
diff --git a/README.md b/README.md
index 5e1a825..15d314f 100644
--- a/README.md
+++ b/README.md
@@ -690,4 +690,18 @@ update
## v1.0.86
`2023.9.18`
update
-- 增加 建模答题错误提示弹窗
\ No newline at end of file
+- 增加 建模答题错误提示弹窗
+
+
+## v1.0.87
+`2023.9.20`
+update
+- 充值首页
+ - 修改 页面跳转逻辑
+ # 有基础套餐时
+ # 已支付,跳转话费查询页面
+ # 未支付, 跳转套餐充值页面
+ # 无基础套餐时
+ #是零川或者小台风,跳转话费查询页面
+ #否则跳转错误页面
+ - 增加 一个物联网卡的错误页面
\ No newline at end of file
diff --git a/src/App.vue b/src/App.vue
index a0db8e9..f03aa8d 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,7 +1,7 @@
@@ -26,7 +26,7 @@ export default {
},
mounted() {
this.debug();
- console.log("当前版本号::", VERSION_MODEL, "当前环境::", process.env.NODE_ENV, this.$title);
+ console.log("当前版本号::", VERSION_MODEL, "当前环境::", process.env.NODE_ENV);
},
methods: {
diff --git a/src/config/models.js b/src/config/models.js
index 10c2755..b1405c7 100644
--- a/src/config/models.js
+++ b/src/config/models.js
@@ -5,7 +5,7 @@
* @FilePath: \TelpoH5FrontendWeb\src\config\models.js
* @description:
*/
-export const VERSION_MODEL = '1.0.86F'; //版本号
+export const VERSION_MODEL = '1.0.87F'; //版本号
export const IMAGE_URL = {
production: 'http://zfb.ssjlai.com/web/',
test: 'http://zfb.ssjlai.com/web/',
diff --git a/src/main.js b/src/main.js
index ba11b5f..e32b116 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,7 +1,7 @@
/*
* @Date: 2022-01-19 10:08:26
* @LastEditors: JinxChen
- * @LastEditTime: 2023-05-30 10:58:58
+ * @LastEditTime: 2023-09-20 14:15:47
* @FilePath: \TelpoH5FrontendWeb\src\main.js
* @description:
*/
diff --git a/src/router/index.js b/src/router/index.js
index 56885cd..428bb46 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -1,7 +1,7 @@
/*
* @Date: 2023-06-01 18:41:50
* @LastEditors: JinxChen
- * @LastEditTime: 2023-06-07 10:40:03
+ * @LastEditTime: 2023-09-20 11:15:50
* @FilePath: \TelpoH5FrontendWeb\src\router\index.js
* @description:
*/
@@ -57,6 +57,8 @@ const routes = [
// 告警详情-中间页
{ path: '/aiCallAlarm', name: 'aiCallAlarm', component: resolve => require(['@/views/ai-call-alarm'], resolve) },
+ // 物联网卡错误页
+ { path: '/iotcardError', name: 'iotcardError', component: resolve => require(['@/views/error-pages/iotcard-error'], resolve) },
];
const router = new VueRouter({
diff --git a/src/views/error-pages/iotcard-error.vue b/src/views/error-pages/iotcard-error.vue
new file mode 100644
index 0000000..4d94f40
--- /dev/null
+++ b/src/views/error-pages/iotcard-error.vue
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
diff --git a/src/views/package-home/index.vue b/src/views/package-home/index.vue
index d5c4756..466aabc 100644
--- a/src/views/package-home/index.vue
+++ b/src/views/package-home/index.vue
@@ -1,7 +1,7 @@
@@ -23,22 +23,53 @@ export default {
return {
params: {}, //获取路由的参数
isRecharge: null, //是否已经支付
+ isHasBasePackage: null, //是否存在基础套餐
+ whiteTitleList: ['小台风', '零川'], //白名单物联网卡列表
+ currentIotTitle: '', //当前设备所属物联网名字
};
},
created() {
- /* this.getToken(); */
this.getAuth();
+ },
+ mounted() {
this.getParams();
},
methods: {
+ // 2023.09.20 修改需求 进入首页同时查套餐和充值状态
+ // 1.无基础套餐卡不是零川或者小台风,跳转错误页面
+ // 2.无基础套餐卡但是零川或者小台风,跳转话费查询页面
+ // 3.如果有基础套餐并且已充值,跳转费查询页面
+ // 4.如果有基础套餐但未充值,跳转套餐充值页面
+ getDevicePayPackage() {
+ return new Promise((resolve, reject) => {
+ APICore.devicePayPackage(this.params.imei)
+ .then(res => {
+ let data = res.data;
+ if (data.code === 106 || data.code === 104) {
+ this.getAuth();
+ setTimeout(() => {
+ this.getDevicePayPackage();
+ }, 1500);
+ } else {
+ // 筛选是否存在基础套餐, producModelId = 1 是基础套餐, 2 是加油包
+ const isHasBasePackage = data.data.packagesList.some(res => {
+ return res.producModelId === 1;
+ });
+ resolve(isHasBasePackage);
+ }
+ }).catch(e => {
+ reject(false);
+ })
+ })
+ },
checkImei() {
let reqBody = {
imei: this.params.imei,
iccid: this.params.iccid || ''
};
APIWx.CheckImei(reqBody).then(res =>{
- console.log("res", res.data.isRecharge);
this.isRecharge = res.data.isRecharge;
+ this.currentIotTitle = res.data.title;
this.getWxCode();
}).catch(e => {
console.log("e", e.message);
@@ -107,16 +138,39 @@ export default {
getWxCode() {
let params = this.params;
let commonUrl = process.env.VUE_APP_BASE_API;
- // todo 暂时去掉
- if(this.isRecharge) {
- // 如果是已经支付,但未激活,跳转激活界面
- /* this.$router.replace({
- name: 'cardActive',
- query: {
- imei: params.imei,
- iccid: params.iccid
- }
- }) */
+ let isWhiteTitle = this.whiteTitleList.includes(this.currentIotTitle) > 0;
+ let cardInfoBaseUrl = encodeURIComponent(`${commonUrl}/h5-frontendweb/#/cardInfo?imei=${params.imei}&iccid=${params.iccid}`);
+ let toupBaseUrl = encodeURIComponent(`${commonUrl}/h5-frontendweb/#/${params.routerName}?imei=${params.imei}&iccid=${params.iccid}`);
+ if(this.isHasBasePackage) {
+ // 有套餐
+ if(this.isRecharge) {
+ // 已支付,跳转话费查询页面
+ console.log("有套餐跳转话费查询页面");
+ let wxRedUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${AppId}&redirect_uri=${cardInfoBaseUrl}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`;
+ window.location.href = wxRedUrl;
+ } else if (!this.isRecharge) {
+ // 未支付, 跳转套餐充值页面
+ console.log("跳转套餐充值页面");
+ let wxRedUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${AppId}&redirect_uri=${toupBaseUrl}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`;
+ window.location.href = wxRedUrl;
+ }
+ } else {
+ // 无套餐
+ if(isWhiteTitle) {
+ // 是零川或者小台风,跳转话费查询页面
+ let wxRedUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${AppId}&redirect_uri=${cardInfoBaseUrl}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`;
+ window.location.href = wxRedUrl;
+ console.log("无套餐跳转话费查询页面");
+ } else {
+ // 跳转错误页面;
+ this.$router.replace({
+ name: 'iotcardError'
+ })
+ console.log("跳转错误页面");
+ }
+ }
+ // 2023.09.20 废弃
+ /* if(this.isRecharge) {
let redUrl = encodeURIComponent(`${commonUrl}/h5-frontendweb/#/cardInfo?imei=${params.imei}&iccid=${params.iccid}`);
let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${AppId}&redirect_uri=${redUrl}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`;
window.location.href = url;
@@ -124,23 +178,22 @@ export default {
let redUrl = encodeURIComponent(`${commonUrl}/h5-frontendweb/#/${params.routerName}?imei=${params.imei}&iccid=${params.iccid}`);
let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${AppId}&redirect_uri=${redUrl}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`;
window.location.href = url;
- }
+ } */
},
// 获取url传过来的参数
- getParams() {
+ async getParams() {
let params = this.$route.query;
if (params) {
- console.log("params", params);
this.params = {...params};
this.$store.commit("appId", AppId);
if(params.reqUrl) {
const reqUrl = encodeURI(params.reqUrl);
window.location.href = reqUrl;
} else {
+ this.isHasBasePackage = await this.getDevicePayPackage();
this.checkImei();
}
- console.log("this.params", this.params);
}
},
}