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); } }, }