Browse Source

update

- cardInfo
    - 优化 话费查询,购买功能
feat
JinxChen 1 year ago
parent
commit
77349acd21
4 changed files with 108 additions and 64 deletions
  1. +8
    -2
      README.md
  2. +1
    -1
      src/config/models.js
  3. +29
    -17
      src/views/card-info/index.vue
  4. +70
    -44
      src/views/package-buy/index.vue

+ 8
- 2
README.md View File

@@ -1,7 +1,7 @@
<!--
* @Date: 2022-08-17 16:19:13
* @LastEditors: JinxChen
* @LastEditTime: 2023-04-15 12:59:37
* @LastEditTime: 2023-04-17 11:20:12
* @FilePath: \TelpoH5FrontendWeb\README.md
* @description: 项目说明
-->
@@ -365,4 +365,10 @@ update
`2023.4.15`
update
- packageHome
- 修改 判断imei函数顺序
- 修改 判断imei函数顺序

## v1.0.43
`2023.4.17`
update
- cardInfo
- 优化 话费查询,购买功能

+ 1
- 1
src/config/models.js View File

@@ -5,7 +5,7 @@
* @FilePath: \TelpoH5FrontendWeb\src\config\models.js
* @description:
*/
export const VERSION_MODEL = '1.0.42F'; //版本号
export const VERSION_MODEL = '1.0.43F'; //版本号
export const IMAGE_URL = {
production: 'http://zfb.ssjlai.com/web/',
test: 'http://zfb.ssjlai.com/web/',


+ 29
- 17
src/views/card-info/index.vue View File

@@ -1,12 +1,12 @@
<!--
* @Date: 2022-04-15 10:22:36
* @LastEditors: JinxChen
* @LastEditTime: 2023-03-14 11:42:57
* @LastEditTime: 2023-04-17 11:03:49
* @FilePath: \TelpoH5FrontendWeb\src\views\card-info\index.vue
* @description:
-->
<template>
<div class="card-info-container">
<div class="card-info-container" v-show="isShowPage">
<van-nav-bar title="话费查询"
:left-arrow="false"
:border="true">
@@ -74,6 +74,7 @@ import APIWx from "@/api/wx";
import { APIPay } from "@/api/pay";
import { isNotNull } from "@/utils/index";
import APICore from "@/api/core";
import AppId from "@/config/appId";
export default {
name:'cardInfo',
inject: ["reload"],
@@ -92,7 +93,8 @@ export default {
isUnicom: null, //是否是联通
},
isShowMenu: this.$route.query.isShowMenu,
params: {}
params: {},
isShowPage: false, //是否显示整个页面
}
},
computed: {
@@ -109,6 +111,7 @@ export default {
this.getAuth();
this.getParams();
this.getCardInfo();

},
methods: {
// 获取core token
@@ -127,30 +130,39 @@ export default {
let timeStamp = new Date().getTime();
let code = url.split("&")[0];
if (isNotNull(code)) {
this.$store.commit("wxAuthCode", `${code}`);
this.getOpenId();
this.isShowPage = true;
this.getOpenId(code);
} else {
this.$dialog({
message: '系统繁忙,请重新进入'
})
}
} else {
this.getWxCode();
}
this.params = {...params};
}
},
getWxCode() {
let params = this.params;
let commonUrl = process.env.VUE_APP_BASE_API;
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;
},
// 根据code获取openId
getOpenId() {
let code = this.$store.getters.wxAuthCode;
getOpenId(code) {
let openId = this.$store.getters.openId;
if(isNotNull(openId)) {
console.log("已经存在openId");
} else {
APIPay.getOpenId(code).then(res => {
let data= res.data;
if(data.code === 20000) {
this.$store.commit("openId", data.data.openId);
}
})
}
APIPay.getOpenId(code).then(res => {
let data= res.data;
if(data.code === 20000) {
this.$store.commit("openId", data.data.openId);
}
})
},
//获取小台风物联网卡信息
getCardInfo() {
if( !this.isShowPage ) {return}
this.$toast.loading({ message: '查询中...' });
let reqBody = {
imei: this.$route.query.imei,


+ 70
- 44
src/views/package-buy/index.vue View File

@@ -1,7 +1,7 @@
<!--
* @Date: 2023-03-14 09:32:37
* @LastEditors: JinxChen
* @LastEditTime: 2023-03-23 15:48:00
* @LastEditTime: 2023-04-17 11:19:13
* @FilePath: \TelpoH5FrontendWeb\src\views\package-buy\index.vue
* @description:
-->
@@ -311,6 +311,11 @@ export default {
setTimeout(() => {
this.wxPay(orderData);
}, 1000);
} else if ( res.data.code !== 0){
return this.$dialog.confirm({
message: `请反馈给一线人员,\n${res.data.message}`,
showCancelButton: false
})
}
let wxData = res.data.data;
let outTradeNo = wxData.out_trade_no;
@@ -318,54 +323,75 @@ export default {
//this.checkWxPayResult(outTradeNo);
//this.closeTime();
// 调起微信支付收银台
wx.chooseWXPay({
timestamp: wxData.timeStamp, // 支付签名时间戳,注意微信 jssdk 中的所有使用 timestamp 字段均为小写。但最新版的支付后台生成签名使用的 timeStamp 字段名需大写其中的 S 字符
nonceStr: wxData.nonceStr, // 支付签名随机串,不长于 32 位
package: wxData.package, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*)
signType: wxData.signType, // 微信支付V3的传入 RSA ,微信支付V2的传入格式与V2统一下单的签名格式保持一致
paySign: wxData.paySign, // 支付签名
success: function(res) {
console.log("微信支付成功::", res);
if(packageType === 1) {
// 加油包不用跳转,直接提示支付成功
that.$toast.success({
message: '支付成功'
});
} else {
// 套餐订购,跳转查询页面
that.$router.replace({
name: "payResult",
query: {
outTradeNo: that.outTradeNo,
price: that.price,
rechargeUrl: data.rechargeUrl,
iccid: that.$route.query.iccid,
isAdmin: that.$route.query.isAdmin || false,
serialNo: that.$route.query.imei,
issue: that.packageIssue
}
});
}
},
fail: err => {
console.log("支付出错了::", err);
that.$dialog.confirm({
title: "支付失败",
message: "出错了,请您联系管理员"
});
},
cancel: function(err) {
// 用户取消支付
that.$dialog.confirm({
message: "您取消了支付"
});
}
});
this.onWxPay(wxData,packageType);
})
.catch(error => {
console.log("error", error);
})
},
onWxPay(data,packageType) {
let that = this;
function onBridgeReady() {
WeixinJSBridge.invoke(
"getBrandWCPayRequest",
{
appId: AppId, //公众号ID,由商户传入
timeStamp: data.timeStamp, //时间戳,自1970年以来的秒数
nonceStr: data.nonceStr, //随机串
package: data.package,
signType: data.signType, //微信签名方式:
paySign: data.paySign //微信签名
},
function(res) {
if (res.err_msg == "get_brand_wcpay_request:ok") {
// 使用以上方式判断前端返回,微信团队郑重提示:
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
if(packageType === 1) {
// 加油包不用跳转,直接提示支付成功
that.$toast.success({
message: '支付成功'
});
} else {
that.$router.replace({
name: "payResult",
query: {
outTradeNo: that.outTradeNo,
price: that.price,
rechargeUrl: data.rechargeUrl,
iccid: that.$route.query.iccid,
isAdmin: that.$route.query.isAdmin || false,
serialNo: that.$route.query.imei,
issue: that.packageIssue
}
});
}
} else {
that.$dialog.confirm({
message: "您取消了支付",
showCancelButton: false
});
}
}
);
}
if (typeof WeixinJSBridge == "undefined") {
if (document.addEventListener) {
document.addEventListener(
"WeixinJSBridgeReady",
onBridgeReady,
false
);
} else if (document.attachEvent) {
document.attachEvent("WeixinJSBridgeReady", onBridgeReady);
document.attachEvent(
"onWeixinJSBridgeReady",
onBridgeReady
);
}
} else {
onBridgeReady();
}
},
// 跳转到支付宝花呗外部链接
aliPay(data) {
console.log("选择了支付宝::", data);


Loading…
Cancel
Save