JinxChen пре 1 година
родитељ
комит
66c2fc7a00
7 измењених фајлова са 184 додато и 80 уклоњено
  1. +35
    -1
      README.md
  2. +2
    -2
      src/config/models.js
  3. +4
    -3
      src/views/buy-record/index.vue
  4. +51
    -20
      src/views/card-info/index.vue
  5. +83
    -50
      src/views/package-buy/index.vue
  6. +6
    -3
      src/views/package-home/index.vue
  7. +3
    -1
      src/views/package-list/index.vue

+ 35
- 1
README.md Прегледај датотеку

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

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


## v1.0.44
`2023.4.17`
update
- packageHome
- 增加 进入充值首页时已充值跳转到话费查询页面
- cardInfo
- 修复 code重复的问题

## v1.0.45
`2023.4.19`
update
- packageList
- packageBuy
- 增加 下单接口 pkId 参数

## v1.0.46
`2023.4.27`
update
- packageBuy
- 修改 加油包 下单接口 productId 参数,从原来 packagesId 变成 payTypeList[0].productId 即收单系统id

## v1.0.47
`2023.4.28`
fix
- buyRecord
- 修复 购买记录时间格式转换异常导致数据显示不出来的问题

+ 2
- 2
src/config/models.js Прегледај датотеку

@@ -1,11 +1,11 @@
/*
* @Date: 2021-11-20 10:26:39
* @LastEditors: JinxChen
* @LastEditTime: 2023-04-14 10:27:11
* @LastEditTime: 2023-04-28 09:18:52
* @FilePath: \TelpoH5FrontendWeb\src\config\models.js
* @description:
*/
export const VERSION_MODEL = '1.0.42F'; //版本号
export const VERSION_MODEL = '1.0.47F'; //版本号
export const IMAGE_URL = {
production: 'http://zfb.ssjlai.com/web/',
test: 'http://zfb.ssjlai.com/web/',


+ 4
- 3
src/views/buy-record/index.vue Прегледај датотеку

@@ -1,7 +1,7 @@
<!--
* @Date: 2022-11-21 11:04:12
* @LastEditors: JinxChen
* @LastEditTime: 2023-02-26 15:02:53
* @LastEditTime: 2023-04-28 09:16:24
* @FilePath: \TelpoH5FrontendWeb\src\views\buy-record\index.vue
* @description:
-->
@@ -20,7 +20,7 @@
<p>{{item.packageName}}</p>
</div>
<div class="bottom">
<div class="btn-left"><span>{{new Date(item.orderTime).Format("yyyy-MM-dd hh:mm")}}</span></div>
<div class="btn-left"><span>{{item.orderTime}}</span></div>
<div class="btn-right"><span>{{item.packagePrice}}</span><span class="btn-price">元</span></div>
</div>
</div>
@@ -95,7 +95,7 @@ export default {
onNavBack() {
this.$router.replace({
name: "cardInfo",
query: { imei: this.$route.query.imei, iccid: this.$route.query.iccid, isShowMenu: true}
query: { imei: this.$route.query.imei, iccid: this.$route.query.iccid, isShowMenu: true, isHasCode: true}
});
},
// 复制订单号
@@ -156,6 +156,7 @@ export default {
}
}
.name {
text-align: left;
margin-top: 20px;
}
.bottom {


+ 51
- 20
src/views/card-info/index.vue Прегледај датотеку

@@ -1,12 +1,12 @@
<!--
* @Date: 2022-04-15 10:22:36
* @LastEditors: JinxChen
* @LastEditTime: 2023-03-14 11:42:57
* @LastEditTime: 2023-04-17 17:40:01
* @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: {
@@ -107,8 +109,10 @@ export default {
},
created() {
this.getAuth();
this.getToken();
this.getParams();
this.getCardInfo();

},
methods: {
// 获取core token
@@ -117,51 +121,78 @@ export default {
APICore.getAuth({ manufactorId: manufactorId }).then(res => {
this.$store.commit("gatewayToken", res.data.data);
});
},
// 获取token
getToken() {
let manufacturerNo = '9f166b07-ff83-4991-84dc-ca6ad4a6b95b';
APIPay.getToken(manufacturerNo).then(res => {
console.log("token的数据", res.data)
let data = res.data;
if(data.code === 20000) {
this.$store.commit("token", data.token);
console.log("token的数据", localStorage.getItem('token'))
}
})
},
// 获取url传过来的参数
getParams() {
let params = this.$route.query;
if (params) {
this.params = {...params};
let url = window.location.href.split("?code=")[1];
if ( isNotNull(url) || window.location.href.indexOf("code") > -1) {
let timeStamp = new Date().getTime();
let code = url.split("&")[0];
if (isNotNull(code)) {
this.$store.commit("wxAuthCode", `${code}`);
this.getOpenId();
this.isShowPage = true;
if(!params.isHasCode) {
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);
}else if (data.state === false) {
console.log("token过期");
this.getToken();
this.getOpenId(this.code);
}
})
},
//获取小台风物联网卡信息
getCardInfo() {
if( !this.isShowPage ) {return}
this.$toast.loading({ message: '查询中...' });
let reqBody = {
imei: this.$route.query.imei,
iccid: '' || this.$route.query.iccid
iccid: this.$route.query.iccid || ''
}
APIWx.GetCardInfo(reqBody)
.then(res => {
let data = res.data;
if (data.stateCode === 1 ) {
let item = data.data;
this.setMeal.expireTime = this.$dayjs(item.expireTime).format("YYYY-MM-DD");
this.setMeal.expireTime = item.expireTime == '' ? "": this.$dayjs(item.expireTime).format("YYYY-MM-DD");
this.setMeal.residueVoiceData = item.availableVoiceData;
this.setMeal.residueFlow = item.availableData;
this.setMeal.cardState = item.cardState;


+ 83
- 50
src/views/package-buy/index.vue Прегледај датотеку

@@ -1,16 +1,16 @@
<!--
* @Date: 2023-03-14 09:32:37
* @LastEditors: JinxChen
* @LastEditTime: 2023-03-23 15:48:00
* @LastEditTime: 2023-04-27 14:34:26
* @FilePath: \TelpoH5FrontendWeb\src\views\package-buy\index.vue
* @description:
-->
<template>
<div class="package-buy-container">
<van-nav-bar :left-arrow="false" :border="true">
<template #title>
<van-nav-bar :left-arrow="true" title="套餐订购" :border="true" @click-left="onNavBack">
<!-- <template #title>
<h5 style="font-size: 16px">套餐订购</h5>
</template>
</template> -->
</van-nav-bar>
<!-- 套餐内容 -->
<div class="package-container">
@@ -150,6 +150,12 @@ export default {
}
},
methods: {
onNavBack() {
this.$router.replace({
name: "cardInfo",
query: { imei: this.$route.query.imei, iccid: this.$route.query.iccid, isShowMenu: true, isHasCode: true}
});
},
// 获取core token
getAuth() {
let manufactorId = "5bf13062-a41e-4d00-ba14-1101aad12650";
@@ -292,14 +298,16 @@ export default {
wxPay(data, packageType) {
let that = this;
const orderData = data;
console.log("orderData", orderData);
let reqBody = {
openId: this.$store.getters.openId, //openId
imei: that.$route.query.imei, //imei
iccid: that.$route.query.iccid,
productId: orderData.packagesId, //套餐id
productId: orderData.payTypeList[0].productId, //套餐id
packageName:
orderData.productModel + "," + orderData.packagesName, //套餐名字
packagePayType: '1', //支付类型, 默认微信
pkId: data.packagesCardId,
packageIssue: orderData.packageIssue, //分期
packagePrice: orderData.packagesPrice * 100
};
@@ -311,6 +319,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 +331,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);
@@ -379,6 +413,7 @@ export default {
imei: that.$route.query.imei, //imei
iccid: that.$route.query.iccid,
productId: this.payProductId, //套餐id
pkId: data.packagesCardId,
packageName: /* data.productModel + ',' + */data.packagesName, //套餐名字
packagePayType: Number(this.payType), //支付类型
packageIssue: this.packageIssue, //分期
@@ -428,8 +463,6 @@ export default {
},
},
created() {
/* this.getAuth(); */
this.getWxAutograph();
// 套餐列表
this.getDevicePayPackage();
},


+ 6
- 3
src/views/package-home/index.vue Прегледај датотеку

@@ -1,7 +1,7 @@
<!--
* @Date: 2023-02-24 14:18:25
* @LastEditors: JinxChen
* @LastEditTime: 2023-04-15 13:53:30
* @LastEditTime: 2023-04-17 16:34:52
* @FilePath: \TelpoH5FrontendWeb\src\views\package-home\index.vue
* @description:
-->
@@ -110,13 +110,16 @@ export default {
// todo 暂时去掉
if(this.isRecharge) {
// 如果是已经支付,但未激活,跳转激活界面
this.$router.replace({
/* this.$router.replace({
name: 'cardActive',
query: {
imei: params.imei,
iccid: params.iccid
}
})
}) */
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;
} else {
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`;


+ 3
- 1
src/views/package-list/index.vue Прегледај датотеку

@@ -1,7 +1,7 @@
<!--
* @Date: 2022-03-29 16:57:58
* @LastEditors: JinxChen
* @LastEditTime: 2023-04-14 10:25:19
* @LastEditTime: 2023-04-19 15:38:05
* @FilePath: \TelpoH5FrontendWeb\src\views\package-list\index.vue
* @description: TODO 小台风充值h5
-->
@@ -351,6 +351,7 @@ export default {
packageName: /* data.productModel */ data.packagesName, //套餐名字
packagePayType: Number(this.payType), //支付类型
packageIssue: 0, //分期
pkId: data.packagesCardId,
packagePrice: process.env.NODE_ENV === "production" ? data.packagesPrice * 100 : 1 //总金额单位为分,测试环境写死
};
this.$toast.clear();
@@ -509,6 +510,7 @@ export default {
productId: this.payProductId, //套餐id
packageName: /* data.productModel + ',' + */data.packagesName, //套餐名字
packagePayType: Number(this.payType), //支付类型
pkId: data.packagesCardId,
packageIssue: this.packageIssue, //分期
packagePrice: process.env.NODE_ENV === "production" ? data.packagesPrice * 100 : 1 //总金额单位为分,测试环境写死
};


Loading…
Откажи
Сачувај