Browse Source

update

- 开放 微信支付
- 修改 支付宝全额支付参数,0表示全额,12表示分期
feat
JinxChen 1 year ago
parent
commit
fd218fca36
5 changed files with 60 additions and 32 deletions
  1. +8
    -1
      README.md
  2. +13
    -0
      src/config/appId.js
  3. +1
    -1
      src/config/models.js
  4. +11
    -9
      src/views/package-home/index.vue
  5. +27
    -21
      src/views/package-list/index.vue

+ 8
- 1
README.md View File

@@ -1,7 +1,7 @@
<!-- <!--
* @Date: 2022-08-17 16:19:13 * @Date: 2022-08-17 16:19:13
* @LastEditors: JinxChen * @LastEditors: JinxChen
* @LastEditTime: 2023-02-25 18:17:53
* @LastEditTime: 2023-02-28 14:55:00
* @FilePath: \TelpoH5FrontendWeb\README.md * @FilePath: \TelpoH5FrontendWeb\README.md
* @description: 项目说明 * @description: 项目说明
--> -->
@@ -227,3 +227,10 @@ update
`2023.2.27` `2023.2.27`
update update
- 优化 支付方式选择页面 - 优化 支付方式选择页面


## v1.0.26
`2023.2.28`
update
- 开放 微信支付
- 修改 支付宝全额支付参数,0表示全额,12表示分期

+ 13
- 0
src/config/appId.js View File

@@ -0,0 +1,13 @@
/*
* @Date: 2022-03-19 19:57:20
* @LastEditors: JinxChen
* @LastEditTime: 2022-10-12 16:50:09
* @FilePath: \ParentWeb\src\config\appId.js
* @description:
*/
const AppId = process.env.NODE_ENV === 'production' ?
'wx23f697736154110b' :
process.env.VUE_APP_BASE_API.indexOf('ai.ssjlai.com') > -1 ?
'wx23f697736154110b':
/* 'wx785c95a3e7f46f72' */'wx5e26f0813859e5f6'; //wx5e26f0813859e5f6 2022.10.12 更改测试公众号
export default AppId;

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

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


+ 11
- 9
src/views/package-home/index.vue View File

@@ -1,12 +1,14 @@
<!-- <!--
* @Date: 2023-02-24 14:18:25 * @Date: 2023-02-24 14:18:25
* @LastEditors: JinxChen * @LastEditors: JinxChen
* @LastEditTime: 2023-02-26 08:56:34
* @LastEditTime: 2023-02-28 14:53:14
* @FilePath: \TelpoH5FrontendWeb\src\views\package-home\index.vue * @FilePath: \TelpoH5FrontendWeb\src\views\package-home\index.vue
* @description: * @description:
--> -->
<template> <template>
<div class="package-home"></div>
<div class="package-home">

</div>
</template> </template>


<script> <script>
@@ -23,9 +25,9 @@ export default {
}; };
}, },
created() { created() {
this.getParams();
this.getToken(); this.getToken();
this.getAuth(); this.getAuth();
this.getParams();
this.checkBrowser(); this.checkBrowser();
}, },
methods: { methods: {
@@ -34,9 +36,9 @@ export default {
const userAgent = window.navigator.userAgent; const userAgent = window.navigator.userAgent;
console.log("浏览器内核", userAgent); console.log("浏览器内核", userAgent);
if (/AlipayClient/.test(userAgent)) { if (/AlipayClient/.test(userAgent)) {
console.log("alipay");
console.log("支付宝");
} else if (/MicroMessenger/.test(userAgent)) { } else if (/MicroMessenger/.test(userAgent)) {
console.log("wx");
console.log("微信");
let url = window.location.href.split("?code=")[1]; let url = window.location.href.split("?code=")[1];
console.log("获取授权code的url", url); console.log("获取授权code的url", url);
if ( if (
@@ -51,10 +53,9 @@ export default {
} }
} else { } else {
this.getWxCode(); this.getWxCode();
console.log("获取token");
} }
} else { } else {
this.getWxCode();
/* this.getWxCode(); */
console.log("当前浏览器内核并非支付宝或者微信"); console.log("当前浏览器内核并非支付宝或者微信");
} }
}, },
@@ -96,7 +97,7 @@ export default {
let redUrl = encodeURIComponent(`${commonUrl}/h5-frontendweb/#/${params.routerName}?imei=${params.imei}&appId=${params.appId}&iccid=${params.iccid}`); let redUrl = encodeURIComponent(`${commonUrl}/h5-frontendweb/#/${params.routerName}?imei=${params.imei}&appId=${params.appId}&iccid=${params.iccid}`);
console.log("redUrl", redUrl); console.log("redUrl", redUrl);
let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${params.appId}&redirect_uri=${redUrl}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`; let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${params.appId}&redirect_uri=${redUrl}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`;
if(params.imei) {
/* if(params.imei) {
this.$router.replace({ this.$router.replace({
name: 'packageList', name: 'packageList',
query: { query: {
@@ -106,7 +107,8 @@ export default {
}) })
} else { } else {
window.location.href = url; window.location.href = url;
}
} */
window.location.href = url;
}, },
// 获取url传过来的参数 // 获取url传过来的参数
getParams() { getParams() {


+ 27
- 21
src/views/package-list/index.vue View File

@@ -1,7 +1,7 @@
<!-- <!--
* @Date: 2022-03-29 16:57:58 * @Date: 2022-03-29 16:57:58
* @LastEditors: JinxChen * @LastEditors: JinxChen
* @LastEditTime: 2023-02-27 18:25:19
* @LastEditTime: 2023-02-28 14:58:08
* @FilePath: \TelpoH5FrontendWeb\src\views\package-list\index.vue * @FilePath: \TelpoH5FrontendWeb\src\views\package-list\index.vue
* @description: TODO 小台风充值h5 * @description: TODO 小台风充值h5
--> -->
@@ -125,7 +125,7 @@
</template> </template>
</van-radio> </van-radio>
</van-radio-group> --> </van-radio-group> -->
<van-radio-group v-model="radio" @change="onRaidoChange">
<!-- <van-radio-group v-model="radio" @change="onRaidoChange">
<van-cell-group border > <van-cell-group border >
<van-cell clickable @click="radio = '1'" center> <van-cell clickable @click="radio = '1'" center>
<template #default> <template #default>
@@ -161,8 +161,9 @@
</template> </template>
</van-cell> </van-cell>
</van-cell-group> </van-cell-group>
</van-radio-group>
</van-radio-group> -->
</div> </div>

</div> </div>
</div> </div>
</template> </template>
@@ -174,6 +175,7 @@ let wx = require("weixin-js-sdk"); // TODO 再封装,可拦截错误提示等
import APICore from "@/api/core"; import APICore from "@/api/core";
import axios from "axios"; import axios from "axios";
import { isNotNull } from "@/utils/index"; import { isNotNull } from "@/utils/index";
import AppId from "@/config/appId";
export default { export default {
name: "packageList", name: "packageList",
data() { data() {
@@ -328,7 +330,7 @@ export default {
APIWx.createJSSDK({ APIWx.createJSSDK({
sUrl: window.location.href.split("#")[0], sUrl: window.location.href.split("#")[0],
userId: '', userId: '',
appId: this.params.appId
appId: this.params.appId || AppId
}) })
.then(res => { .then(res => {
let item = res.data.data; let item = res.data.data;
@@ -359,7 +361,7 @@ export default {
// 需要区分是要用微信支付还是支付宝花呗支付 // 需要区分是要用微信支付还是支付宝花呗支付
if (this.payType === '2') { if (this.payType === '2') {
this.payProductId = process.env.NODE_ENV === "production" ? '1629407413618294784' : '1629405716684029952', //支付宝全额支付 this.payProductId = process.env.NODE_ENV === "production" ? '1629407413618294784' : '1629405716684029952', //支付宝全额支付
this.packageIssue = 1;
this.packageIssue = 0;
this.aliPay(data); this.aliPay(data);
} else if (this.payType === '3') { } else if (this.payType === '3') {
this.payProductId = process.env.NODE_ENV === "production" ? '1629407705558630400': '1629405558344859648', //支付宝花呗支付 this.payProductId = process.env.NODE_ENV === "production" ? '1629407705558630400': '1629405558344859648', //支付宝花呗支付
@@ -370,17 +372,17 @@ export default {
let openId = this.$store.getters.openId; let openId = this.$store.getters.openId;
if(openId === null || openId === 'null') { if(openId === null || openId === 'null') {
this.$dialog.confirm({ this.$dialog.confirm({
message: '微信支付在调整中,请选择其它支付方式',
message: '获取OpenId失败,请您重新进入',
showCancelButton: false, showCancelButton: false,
}) })
} else { } else {
this.packageIssue = 1;
/* this.packageIssue = 1;
this.$dialog.confirm({ this.$dialog.confirm({
message: '微信支付在调整中,请选择其它支付方式', message: '微信支付在调整中,请选择其它支付方式',
showCancelButton: false, showCancelButton: false,
})
}) */
// todo 暂时取消开放微信支付 // todo 暂时取消开放微信支付
//this.wxPay(data);
this.wxPay(data);
console.log("openid为空"); console.log("openid为空");
} }
} }
@@ -526,6 +528,10 @@ export default {
}) })
.catch(error => { .catch(error => {
console.log("error", error); console.log("error", error);
this.$dialog.confirm({
message: `${error.message}`,
showCancelButton: false
})
}) })
.finally(() => { .finally(() => {
this.$toast.clear(); this.$toast.clear();
@@ -561,14 +567,14 @@ export default {
height: 100vh; height: 100vh;
.topup-container { .topup-container {
position: relative; position: relative;
margin: 20px;
/* margin: 20px; */
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
background-color: white; background-color: white;
overflow: scroll; overflow: scroll;
/* height: calc(100vh - 4rem); */
height: calc(100vh - 88px);
.main { .main {
display: flex; display: flex;
justify-content: center; justify-content: center;
@@ -609,10 +615,8 @@ export default {
} }
.package-order-container { .package-order-container {
position: relative; position: relative;
/* height: 140px; */
width: 300px;
margin: 10px 0; margin: 10px 0;
padding: 0 10px;
padding: 0 20px;
z-index: 999; z-index: 999;
box-shadow: rgba(14, 30, 37, 0.12) 0 3px 5px 0, box-shadow: rgba(14, 30, 37, 0.12) 0 3px 5px 0,
rgba(14, 30, 37, 0.32) 0 2px 16px 0; rgba(14, 30, 37, 0.32) 0 2px 16px 0;
@@ -683,19 +687,20 @@ export default {
.price { .price {
font-size: 16px; font-size: 16px;
} }
.buy-btn {
/* .buy-btn {
height: 30px; height: 30px;
width: 90px;
width: 100px;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
background: orange; background: orange;
border-radius: 20px;
border-radius: 45px;
p { p {
font-size: 16px;
padding: 0; padding: 0;
color: white;
color: red;
} }
}
} */
} }
.remark { .remark {
display: flex; display: flex;
@@ -715,8 +720,9 @@ export default {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
background: orange; background: orange;
border-radius: 30px;
border-radius: 20px;
p { p {
font-size: 16px;
padding: 0; padding: 0;
color: white; color: white;
} }
@@ -775,7 +781,7 @@ export default {
justify-content: flex-start; justify-content: flex-start;
align-items: flex-start; align-items: flex-start;
flex-direction: column; flex-direction: column;
padding: 5px 0 10px 25px;
padding: 5px 0 10px 10px;
h5 { h5 {
font-size: 14px; font-size: 14px;
padding: 10px 0 0 0; padding: 10px 0 0 0;


Loading…
Cancel
Save