Pārlūkot izejas kodu

Merge branch 'test' into develop

develop
chenJinxu pirms 5 mēnešiem
vecāks
revīzija
34e6ec490a
8 mainītis faili ar 736 papildinājumiem un 539 dzēšanām
  1. +22
    -0
      README.md
  2. +1
    -1
      src/config/models.js
  3. +346
    -286
      src/views/card-info/index.vue
  4. +7
    -2
      src/views/health/psychological-main/index.vue
  5. +5
    -4
      src/views/health/psychological/report/index.vue
  6. +183
    -141
      src/views/package-buy/index.vue
  7. +77
    -63
      src/views/package-home/index.vue
  8. +95
    -42
      src/views/package-list/index.vue

+ 22
- 0
README.md Parādīt failu

@@ -1158,3 +1158,25 @@ update
update

- ‘7天’,‘30天’文字 改成 ‘前7天’,‘前30天’,

## v1.0.125

`2024.5.27`
update

- 增加 周报详情不显示对比条件

## v1.0.126

`2024.6.18`
fix

- 修复 心理首页页面显示空白的问题

## v1.0.127

`2024.6.21`
update

- 增加 app打开充值h5跳转到话费查询页面
- 增加 app点击订购套餐提示

+ 1
- 1
src/config/models.js Parādīt failu

@@ -8,7 +8,7 @@
import store from "@/store";
// 情绪模型
const appTypeList = ['1'];
export const VERSION_MODEL = '1.0.124F'; //版本号
export const VERSION_MODEL = '1.0.127F'; //版本号
export const IMAGE_URL = {
production: 'http://zfb.ssjlai.com/web/',
test: 'http://zfb.ssjlai.com/web/',


+ 346
- 286
src/views/card-info/index.vue Parādīt failu

@@ -7,19 +7,14 @@
-->
<template>
<div class="card-info-container" v-show="isShowPage">
<van-nav-bar title="话费查询"
:left-arrow="false"
:border="true">
<van-nav-bar title="话费查询" :left-arrow="false" :border="true">
</van-nav-bar>
<div class="check-container">
<!-- header -->
<div class="header">
<!-- banner -->
<div class="banner">
<van-image
:src="logo"
round
>
<van-image :src="logo" round>
</van-image>
<div class="right-message">
<p>{{ setMeal.msisdn }}</p>
@@ -28,7 +23,15 @@
<p class="padding-left">ICCID:{{ setMeal.iccid || '--' }}</p>
<p class="padding-left">语音通话接听免费,免漫游费。禁止手机使用</p>
<div class="action">
<div class="action-item"><p>{{ setMeal.realname || '--' }}</p></div> <span> | </span> <div class="action-item"><p>{{ setMeal.cardState || '--' }}</p></div> <span> | </span> <div class="btn"><p @click="onRefresh">刷新</p></div>
<div class="action-item">
<p>{{ setMeal.realname || '--' }}</p>
</div> <span> | </span>
<div class="action-item">
<p>{{ setMeal.cardState || '--' }}</p>
</div> <span> | </span>
<div class="btn">
<p @click="onRefresh">刷新</p>
</div>
</div>
</div>
<!-- 套餐详情 -->
@@ -53,11 +56,13 @@
<!-- 套餐操作 -->
<div class="card-details-menu">
<div class="meal-item" @click="onMealBuy">
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAADgUlEQVRYR+2XTWhUVxTH/+cl5IPQUhG0ASlWWoRaF22hSDeCRUT6gV+LUnEkQt+5b9GAUdRu2odupGDEQOa9+1IKRgUZLZUq1I1SF10VFdSNFqGKdBZtJ0UYTWi5R26ZFJmMvnvnRVDJ3QzDPR+/9z9zzpxHeMoPPeV8mAMsWqFnT8Esyz43xmxoevJTSqlDRdVox3+Ggs2ARPQaAGHmV9pJUNQnt8Ra6whA2RjzahRFvxVN6OvvArgcwBUR2aKUOuqboKh9LqCIUJZlfwI4wcyqaEJf/1xAGzBN09NEtISZl/kmKGrvBKi13gVgv4icICIpmrSVPxGdDsPwWPOdE2CWZe+JyM8AqgD+nmXAAMBSAEeYudQWYKVS6ZqYmLBgZWbeOZuASZKsCoLgnJ29URR93xagddJa/wSgh5lXzCZgmqYJEW3u6upaMDAwMNk2YJZl+0RkN4CXmPleA/pTAB94At9m5i+sT6VS6ajVar8DOKeUsrFmHKffoPXKsmyNiJw1xrwfRdH5BuBXAFoGfgy0BVxt7/PKa22cAUdGRl7s7u6uEdHeMAz3eqrW0ny6vPV6feHQ0ND9Qgo2FLsIoDatQBFIl/J6KdgAtBvNtmq1Oi+O43+TJFkcBEEsIp15sEQ0NTU1tWdwcPAP1/J6A46NjW0yxthh/W4Yhr+Uy+V3Ojo6jg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At9m5i+sT6VS6ajVar8DOKeUsrFmHKffoPXKsmyNiJw1xrwfRdH5BuBXAFoGfgy0BVxt7/PKa22cAUdGRl7s7u6uEdHeMAz3eqrW0ny6vPV6feHQ0ND9Qgo2FLsIoDatQBFIl/J6KdgAtBvNtmq1Oi+O43+TJFkcBEEsIp15sEQ0NTU1tWdwcPAP1/J6A46NjW0yxthh/W4Yhr+Uy+V3Ojo6jgDIBQRgO3Q9M9+0iV3K6w04Ojr6cmdnp+26Hcx8ME+1R927ltcbsFHmX0XkqlKqeal15nXp3ulgzl087aC1/haAhTvrTDTT8A0Aix/XvW0Dpmk6QEQW8haA/wZ2m+ckM3+Z5+utYJqmrxPRDQCfMfM3eQmK3vsC2uV1nTGmQkR2/bdz0eX0AvirsVKdsu84Lk5eTRLHcdDf32/3tU9EZIKI7Gh5oZHseouk9uHtGkUichfAP0Q0H8DxarW6OY5j4wLprGCapiUiOiwie5j560ZH7yIiu8huVUqNP5zQ1/5RsD6A3xHRm8xsVfn/aK2vi8g1pdTGJkAv+9kAtO8li5j5rSbAyyJyRyn1UROgl31hQK31dgAHjDEfR1F0xgZMkuTDIAh+aPXP4mtfGHB4eLi3r6/vAoC3RcR+gohWArhUr9dXNq9LvvaFAW2A8fHxvsnJyR3GmLX2exAEP/b09BwolUr1Vgl87VvFcG4Sl5HwJGzmAIuqOqfgc6/gA38wwThLucAeAAAAAElFTkSuQmCC"
alt="" />
<p>套餐订购</p>
</div>
<div class="meal-item" @click="onRecordCheck">
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAD6UlEQVRYR+2YXWgcVRiG3+9sshtSiUaKmFAvSlEReiFuKSKWoNbUm17401DFH0KTOWdCDLheCHrhoCBi1MhKMnMmCaEJuZFaGhRrTVFaQW8MXigiFmqVyipYwRKM7GTOJyfsStimmbS72QbN3C3n7JyH9/t5vzOEDf7QBufDJmC1EdpUsFLBfD7fkk6n3wVwVCk1k6RwooJa605mlgBuTH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1ADxsIYrFYltTU9PjzDxmIQH8AcD+7lNKBRVhrI+Ck5OTWxYWFn4FMC2lVBMTE01RFE3Y6aQE9IKU8o2V7LUuORgEwZNENMXMLwohdjDzYwCuB/AzM7+plLJD6Yr2WhdArfUJAHZeBDNfJKIjQoipnp6eU3ZQXaU66xNirfUMETUAmJqfn5/J5XILSS2j7kWyRqDKbfVR8CrhltyrLjm4YQCJ6B4A/04lSWC2sh3HeV5rbW+C1sqW22lhbm5uVzabLdbM6ojoVgBlm0risxV9Qin1ge/7u4UQT1UCSilf+1+FuCbXzuWyl0b+bwD0SymHk0Kyrhf3S/oLkT3vTvtVQQixs7e397eqAO2fq/n0sQKgdZgfmfl1pdSZJLilnrSWTddyzyZgtepvKvifV/Af4cRYRyl1cksAAAAASUVORK5CYII="
alt="" />
<p>订购记录</p>
</div>
</div>
@@ -76,325 +81,380 @@ import { isNotNull } from "@/utils/index";
import APICore from "@/api/core";
import AppId from "@/config/appId";
export default {
name:'cardInfo',
inject: ["reload"],
data(){
return {
//套餐信息
setMeal: {
expireTime: '', //套餐过期时间
residueVoiceData: '', //剩余语音
availableData: '', //流量套餐
residueFlow: '', //剩余流量
iccid: this.$route.query.iccid, //iccid
cardState: '', //卡激活状态
realname: '', //是否已实名 1是 0 否
msisdn: '', //msisdn
isUnicom: null, //是否是联通
},
isShowMenu: this.$route.query.isShowMenu,
params: {},
isShowPage: false, //是否显示整个页面
code: '', //微信授权code
}
},
computed: {
// 顶部图标
logo(){
if(this.setMeal.isUnicom !== null) {
return this.setMeal.isUnicom ? require('@/assets/img/unicom.png') : require('@/assets/img/yidong_logo.png')
} else {
return null
}
}
},
created() {
this.getAuth();
this.getToken();
this.getParams();
this.getCardInfo();

},
methods: {
// 获取core token
getAuth() {
let manufactorId = "5bf13062-a41e-4d00-ba14-1101aad12650";
APICore.getAuth({ manufactorId: manufactorId }).then(res => {
this.$store.commit("gatewayToken", res.data.data);
});
},
// 获取token
getToken() {
let manufacturerNo = '9f166b07-ff83-4991-84dc-ca6ad4a6b95b';
return new Promise((resolve) => {
APIPay.getToken(manufacturerNo).then(res => {
let data = res.data;
if(data.code === 20000) {
this.$store.commit("token", data.token);
resolve(true);
}
});
})
name: 'cardInfo',
inject: ["reload"],
data() {
return {
//套餐信息
setMeal: {
expireTime: '', //套餐过期时间
residueVoiceData: '', //剩余语音
availableData: '', //流量套餐
residueFlow: '', //剩余流量
iccid: this.$route.query.iccid, //iccid
cardState: '', //卡激活状态
realname: '', //是否已实名 1是 0 否
msisdn: '', //msisdn
isUnicom: null, //是否是联通
},
isShowMenu: this.$route.query.isShowMenu,
params: {},
isShowPage: false, //是否显示整个页面
code: '', //微信授权code
}
},
// 获取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];
this.code = code;
if (isNotNull(code)) {
this.isShowPage = true;
if(!params.isHasCode) {
this.getOpenId(code);
}
} else {
this.$dialog({
message: '系统繁忙,请重新进入'
})
}
computed: {
// 顶部图标
logo() {
if (this.setMeal.isUnicom !== null) {
return this.setMeal.isUnicom ? require('@/assets/img/unicom.png') : require('@/assets/img/yidong_logo.png')
} else {
this.getWxCode();
return null
}
},
isWeChat() {
const ua = window.navigator.userAgent.toLowerCase();
return /micromessenger/.test(ua);
}
},
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;
async mounted() {
await this.getAuth();
await this.getToken();
await this.getParams();
await this.getCardInfo();
},
// 根据code获取openId
getOpenId(code) {
let openId = this.$store.getters.openId;
APIPay.getOpenId(code).then( async res => {
let data= res.data;
if(data.code === 20000) {
this.$store.commit("openId", data.data.openId);
}else if (data.state === false) {
console.log("token过期");
let hasToken = await this.getToken();
if(hasToken) {
this.getOpenId(this.code);
} else {
this.$dialog({
message: '系统繁忙,请重新进入'
})
methods: {
// 获取core token
getAuth() {
let manufactorId = "5bf13062-a41e-4d00-ba14-1101aad12650";
return new Promise((resolve) => {
APICore.getAuth({ manufactorId: manufactorId }).then(res => {
this.$store.commit("gatewayToken", res.data.data);
});
resolve(true)
})
},
// 获取token
getToken() {
let manufacturerNo = '9f166b07-ff83-4991-84dc-ca6ad4a6b95b';
return new Promise((resolve) => {
APIPay.getToken(manufacturerNo).then(res => {
let data = res.data;
if (data.code === 20000) {
this.$store.commit("token", data.token);

}
});
resolve(true);
})
},
// 获取url传过来的参数
getParams() {
let params = this.$route.query;
return new Promise(resolve => {
if (params) {
this.params = { ...params };
let url = window.location.href.split("?code=")[1];
if (isNotNull(url) && window.location.href.indexOf("code") > -1 && this.isWeChat) {
let timeStamp = new Date().getTime();
let code = url.split("&")[0];
this.code = code;
if (isNotNull(code)) {
this.isShowPage = true;
if (!params.isHasCode) {
this.getOpenId(code);
}
} else {
this.$dialog({
message: '系统繁忙,请重新进入'
})
}
} else {
if (this.isWeChat) {
this.getWxCode();
} else {
this.isShowPage = true;
}

}
}
}
})
},
//获取小台风物联网卡信息
getCardInfo() {
if( !this.isShowPage ) {return}
this.$toast.loading({ message: '查询中...' });
let reqBody = {
imei: this.$route.query.imei,
iccid: this.$route.query.iccid || ''
}
APIWx.GetCardInfo(reqBody)
.then(res => {
resolve(true);
})

},
getWxCode() {
let params = this.params;
let commonUrl = process.env.NODE_ENV === "production" ? process.env.VUE_APP_BASE_API : 'https://id.gdssjl.com';
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(code) {
let openId = this.$store.getters.openId;
APIPay.getOpenId(code).then(async res => {
let data = res.data;
if (data.stateCode === 1 ) {
let item = data.data;
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;
this.setMeal.realname = Number(item.realname) === 1 ? '已实名' : '未实名';
this.setMeal.msisdn = item.msisdn;
// 截取msisdn 前三位, 148 是移动,其它都是联通
this.setMeal.isUnicom = item.msisdn.slice(0,3) === '148' ? false : true;
this.$toast.success({
message: "查询成功",
duration: 1500
});
if (data.code === 20000) {
this.$store.commit("openId", data.data.openId);
} else if (data.state === false) {
console.log("token过期");
let hasToken = await this.getToken();
if (hasToken) {
/* this.getOpenId(this.code); */
this.getWxCode();
} else {
this.$dialog({
message: '系统繁忙,请重新进入'
})
}
} else {
this.getWxCode();
}
})
.catch(error => {
console.log("接口报错了", error);
}).finally(() => {
this.$toast.clear();
},
//获取小台风物联网卡信息
getCardInfo() {
if (!this.isShowPage) { return }
return new Promise((resolve) => {
this.$toast.loading({ message: '查询中...' });
let reqBody = {
imei: this.$route.query.imei,
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 = 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;
this.setMeal.realname = Number(item.realname) === 1 ? '已实名' : '未实名';
this.setMeal.msisdn = item.msisdn;
// 截取msisdn 前三位, 148 是移动,其它都是联通
this.setMeal.isUnicom = item.msisdn.slice(0, 3) === '148' ? false : true;
this.$toast.success({
message: "查询成功",
duration: 1500
});
} else {
this.$toast.success({
message: `${data.message}`,
duration: 1500
});
}
})
.catch(error => {
console.log("接口报错了", error);
}).finally(() => {
setTimeout(() => {
this.$toast.clear();
}, 1500);

})
resolve(true)
})

},
// 返回
onNavBack() {
/* this.$router.push({ name: 'device'}); */
},
// onRefresh 刷新
onRefresh() {
this.reload();
},
// 购买套餐
onMealBuy() {
this.$router.replace({
name: 'packageBuy',
query: { imei: this.$route.query.imei, iccid: this.$route.query.iccid, isShowMenu: this.isShowMenu }
})
},
// 返回
onNavBack() {
/* this.$router.push({ name: 'device'}); */
},
// onRefresh 刷新
onRefresh() {
this.reload();
},
// 购买套餐
onMealBuy() {
this.$router.replace({
name: 'packageBuy',
query: { imei: this.$route.query.imei, iccid: this.$route.query.iccid, isShowMenu: this.isShowMenu}
})
},
// 订购记录
onRecordCheck () {
this.$router.replace({
name: 'buyRecord',
query: { imei: this.$route.query.imei, iccid: this.$route.query.iccid, isShowMenu: this.isShowMenu}
})
}
},
// 订购记录
onRecordCheck() {
this.$router.replace({
name: 'buyRecord',
query: { imei: this.$route.query.imei, iccid: this.$route.query.iccid, isShowMenu: this.isShowMenu }
})
}

}
}
}
</script>

<style scoped lang="scss">
.card-info-container {
max-height: 100vh;
width: 100%;
position: relative;
background-color: #fff;
p {
font-size: 16px;
color: #9B9B9B;
}
.check-container {
height: calc(100vh - 88px);
padding: 8px 10px;
.card-info-container {
max-height: 100vh;
width: 100%;
position: relative;
background-color: #fff;

p {
font-size: 16px;
color: #9B9B9B;
}

.check-container {
height: calc(100vh - 88px);
padding: 8px 10px;
display: flex;
justify-content: flex-start;
align-items: center;
flex-direction: column;

.header {
height: 200px;
width: 100%;
display: flex;
justify-content: flex-start;
align-items: center;
justify-content: space-around;
flex-direction: column;
.header {
height: 200px;
width: 100%;
align-items: flex-start;
border: 1px solid #fff;
box-shadow: rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;

.padding-left {
padding-left: 10px;
}

.banner {
height: 75px;
margin: 10px 0;
padding-left: 5px;
display: flex;
justify-content: space-around;
flex-direction: column;
align-items: flex-start;
border: 1px solid #fff;
box-shadow: rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;
.padding-left {
padding-left: 10px;
}
.banner {
justify-content: flex-start;
align-items: center;

.van-image {
height: 75px;
margin: 10px 0;
padding-left: 5px;
display: flex;
justify-content: flex-start;
align-items: center;
.van-image {
height: 75px;
width: 75px;
border: 5px solid #E0EEFF;
}
.right-message {
text-align: center;
margin-left: 10px;
p {
font-size: 18px;
color: #64A9FF;
}
}
width: 75px;
border: 5px solid #E0EEFF;
}
.action {
height: 35px;

.right-message {
text-align: center;
padding-left: 10px;
width: 100%;
display: flex;
justify-content: flex-start;
align-items: center;
margin-left: 10px;

p {
font-size: 16px;
font-size: 18px;
color: #64A9FF;
}
span {
display: block;
color: #9B9B9B;
font-size: 16px;
padding: 0 8px;
}
.btn {
height: 25px;
width: 75px;
line-height: 25px;
text-align: center;
background-color: #64A9FF;
border-radius: 10px;
p {
color: #fff;
}
}
}
}
.card-details {
height: 75px;

.action {
height: 35px;
text-align: center;
padding-left: 10px;
width: 100%;
display: flex;
justify-content: space-between;
justify-content: flex-start;
align-items: center;
margin-top: 20px;
border: 1px solid #fff;
box-shadow: rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;
.set-meal {
flex: 1;
height: 50px;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;

p {
font-size: 16px;
color: #64A9FF;
}

span {
display: block;
color: #9B9B9B;
font-size: 16px;
padding: 0 8px;
}

.btn {
height: 25px;
width: 75px;
line-height: 25px;
text-align: center;
background-color: #64A9FF;
border-radius: 10px;

p {
font-size: 16px;
padding: 5px 0;
}
.font-orange {
color: orange;
color: #fff;
}
}
.set-meal:nth-of-type(2) {
border-left: 1px solid #DDDDDD;
border-right: 1px solid #DDDDDD;
}
}
.card-details-menu {
height: 75px;
width: 100%;
}

.card-details {
height: 75px;
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 20px;
border: 1px solid #fff;
box-shadow: rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;

.set-meal {
flex: 1;
height: 50px;
display: flex;
justify-content: flex-start;
justify-content: center;
align-items: center;
margin-top: 20px;
border: 1px solid #fff;
box-shadow: rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;
.meal-item {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
padding-left: 10px;
img {
height: 45px;
width: 40px
}
p {
font-size: 14px;
padding: 5px 0;
}
flex-direction: column;

p {
font-size: 16px;
padding: 5px 0;
}

.font-orange {
color: orange;
}
}
.tips-container {
width: 100%;

.set-meal:nth-of-type(2) {
border-left: 1px solid #DDDDDD;
border-right: 1px solid #DDDDDD;
}
}

.card-details-menu {
height: 75px;
width: 100%;
display: flex;
justify-content: flex-start;
align-items: center;
margin-top: 20px;
border: 1px solid #fff;
box-shadow: rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;

.meal-item {
flex: 1;
display: flex;
justify-content: flex-start;
align-items: flex-start;
justify-content: center;
align-items: center;
flex-direction: column;
padding-left: 10px;

img {
height: 45px;
width: 40px
}

p {
margin: 10px;
color: red;
font-size: 14px;
padding: 5px 0;
}
}
}

.tips-container {
width: 100%;
display: flex;
justify-content: flex-start;
align-items: flex-start;
flex-direction: column;

p {
margin: 10px;
color: red;
}
}
}
}
</style>

+ 7
- 2
src/views/health/psychological-main/index.vue Parādīt failu

@@ -202,8 +202,13 @@ export default {
/* imgUrl = require(`@/assets/img/psychological/${name}_${level}.png`); */
let numLevel = Number(level);
console.log(`@/assets/img/psychological/${name}_${numLevel}.png`);
imgUrl = require(`@/assets/img/psychological/${name}_${numLevel + 1
}.png`);
if (numLevel < 0) {
imgUrl = require(`@/assets/img/psychological/${name}_1.png`);
} else {
imgUrl = require(`@/assets/img/psychological/${name}_${numLevel + 1}.png`);
}


/* switch(level) {
case '0':
imgUrl = require(`@/assets/img/psychological/${name}_${numLevel + 1}.png`);


+ 5
- 4
src/views/health/psychological/report/index.vue Parādīt failu

@@ -63,7 +63,7 @@
}}</label>
</div>

<div class="status">
<div class="status" v-if="isShowCompare">
<img :src="calcImg(item.percentage, item.lastPercentage)" alt="" />
<span :style="{
color:
@@ -126,8 +126,8 @@
item.days
}}</span>
<span class="day-text">天</span>
<img :src="calcWeekImg(item.days, item.lastDay)" alt="" />
<span class="day-text status">{{
<img :src="calcWeekImg(item.days, item.lastDay)" alt="" v-if="isShowCompare" />
<span class="day-text status" v-if="isShowCompare">{{
calcWeekImg(item.days, item.lastDay, true)
}}</span>
</p>
@@ -249,7 +249,7 @@ export default {
weekResult: {},
upImg: require("@/assets/img/psychological/up.png"),
downImg: require("@/assets/img/psychological/down.png"),
isShowCompare: null, //是否显示周对比
};
},
created() {
@@ -694,6 +694,7 @@ export default {
this.weekResult.Summary = this.$replaceAll(data.Summary, '抑郁', '忧郁')
this.weekResult.Advice = this.$replaceAll(data.Advice, '抑郁', '忧郁')
this.emoName = this.calcTitle(data.Type);
this.isShowCompare = data.LastweekData;
}
let None = {
count: data.None,


+ 183
- 141
src/views/package-buy/index.vue Parādīt failu

@@ -14,28 +14,17 @@
</van-nav-bar>
<!-- 套餐内容 -->
<div class="package-container">
<van-tabs
type="line"
v-model="active"
color="#1890ff"
background="#fafafa"
swipeable
line-width="20%"
line-height="4px"
>
<van-tabs type="line" v-model="active" color="#1890ff" background="#fafafa" swipeable line-width="20%"
line-height="4px">
<van-tab title="加油包">
<div class="refuel-package" v-if="refuelPackageList.length > 0">
<div
class="refuel-item"
v-for="(item, index) in refuelPackageList"
:key="index"
>
<div class="refuel-item" v-for="(item, index) in refuelPackageList" :key="index">
<div class="title">
<p>{{item.packagesName}}</p>
<p>{{ item.packagesName }}</p>
</div>
<div class="bottom">
<span>
{{item.packagesPrice}}
{{ item.packagesPrice }}
<span class="price-span">元</span>
</span>
<div class="btn-button" @click="onBuyRefuel(item)">
@@ -51,11 +40,7 @@
</van-tab>
<van-tab title="基础套餐">
<div class="base-package" v-if="basePackageList.length > 0">
<div
class="base-item"
v-for="(item, index) in basePackageList"
:key="index"
>
<div class="base-item" v-for="(item, index) in basePackageList" :key="index">
<div class="base-item-content">
<!-- <div class="title">
<p>{{item.packagesName}}</p>
@@ -65,24 +50,20 @@
</div>
<div class="details">
<p>
<span
class="orange large"
>¥{{(item.packagesPrice/(item.packageIssue === 0 ? 1: item.packageIssue)).toFixed(0)}}</span>元/月,
<span class="orange large">¥{{ (item.packagesPrice / (item.packageIssue === 0 ?
1 :
item.packageIssue)).toFixed(0) }}</span>元/月,
</p>
<p class="total">
<span>合计</span>
<span class="orange price">{{item.packagesPrice}}元</span>
<span class="orange price">{{ item.packagesPrice }}元</span>
</p>
</div>
<div class="radios-con">
<div class="pay-type">
<p>支付方式:</p>
</div>
<van-radio-group
v-model="radio"
direction="horizontal"
@change="onRaidoChange"
>
<van-radio-group v-model="radio" direction="horizontal" @change="onRaidoChange">
<van-radio name="1">
<template #default>
<div class="radio-con">
@@ -134,38 +115,38 @@ import AppId from "@/config/appId";
import { APIPay } from "@/api/pay";
let wx = require("weixin-js-sdk"); // TODO 再封装,可拦截错误提示等操作
export default {
name:'',
data(){
return {
basePackageList: [], //基础套餐
refuelPackageList: [], //加油包
outTradeNo: "", //订单号
price: "", //价格,
isShowNoData: false, //是否显示无套餐内容, 默认false
radio: '1', //支付方式单选按钮默认值
payProductId: null, //套餐id
packageIssue: null, //套餐分期
payType: '1', //支付方式 1 微信, 2 支付宝,支付宝又分为花呗和全额支付,全额支付分期数传0 或者1 ,花呗则传 3 6 12
active: 0, //tabs默认选择的下标
}
},
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";
APICore.getAuth({ manufactorId: manufactorId }).then(res => {
this.$store.commit("gatewayToken", res.data.data);
});
name: '',
data() {
return {
basePackageList: [], //基础套餐
refuelPackageList: [], //加油包
outTradeNo: "", //订单号
price: "", //价格,
isShowNoData: false, //是否显示无套餐内容, 默认false
radio: '1', //支付方式单选按钮默认值
payProductId: null, //套餐id
packageIssue: null, //套餐分期
payType: '1', //支付方式 1 微信, 2 支付宝,支付宝又分为花呗和全额支付,全额支付分期数传0 或者1 ,花呗则传 3 6 12
active: 0, //tabs默认选择的下标
}
},
// 获取微信授权
getWxAutograph(){
let that = this;
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";
APICore.getAuth({ manufactorId: manufactorId }).then(res => {
this.$store.commit("gatewayToken", res.data.data);
});
},
// 获取微信授权
getWxAutograph() {
let that = this;
return new Promise((resolve, reject) => {
APIWx.createJSSDK({
sUrl: window.location.href.split("#")[0],
@@ -192,10 +173,10 @@ export default {
console.log(err);
});
});
},
// 获取套餐列表数据
getDevicePayPackage() {
this.$toast.loading({
},
// 获取套餐列表数据
getDevicePayPackage() {
this.$toast.loading({
message: "加载中",
duration: 1500
});
@@ -211,7 +192,7 @@ export default {
} else if (res.data.code === 0 && res.data.data === null) {
this.isShowNoData = true;
} else {
if(res.data.data === null) {
if (res.data.data === null) {
this.isShowNoData = false;
} else {
let data = res.data.data.packagesList;
@@ -242,19 +223,32 @@ export default {
this.$toast.clear();
}, 1500);
});
},
// 购买加油包
onBuyRefuel(data){
console.log("加油包", data);
this.price = data.packagesPrice;
this.wxPay(data,1);
},
// 购买基础套餐
onBuyBase(data) {
console.log("基础包", data);
this.price = data.packagesPrice;
let payTypeToPackAgeId = data.payTypeList;
if (this.payType == '2') {
},
// 购买加油包
onBuyRefuel(data) {
console.log("加油包", data);
if (!this.isWeChat) {
return this.$dialog.confirm({
message: '请用微信客户端打开此页。',
showCancelButton: false,
})
}
this.price = data.packagesPrice;
this.wxPay(data, 1);
},
// 购买基础套餐
onBuyBase(data) {
console.log("基础包", data);
console.log("isWeChat", this.isWeChat);
if (!this.isWeChat) {
return this.$dialog.confirm({
message: '请用微信客户端打开此页。',
showCancelButton: false,
})
}
this.price = data.packagesPrice;
let payTypeToPackAgeId = data.payTypeList;
if (this.payType == '2') {
// 全额
this.payProductId = payTypeToPackAgeId.filter(item => {
return item.payType == '2'
@@ -279,7 +273,7 @@ export default {
})[0].productId;
this.packageIssue = 0;
console.log("this.payProductId3", this.payProductId);
if(openId === null || openId === 'null') {
if (openId === null || openId === 'null') {
this.$dialog.confirm({
message: '获取OpenId失败,请您重新进入',
showCancelButton: false,
@@ -288,56 +282,56 @@ export default {
this.wxPay(data);
}
}
},
// 支付类型切换
onRaidoChange(value) {
console.log("选择的支付类型是", value);
this.payType = value;
},
// 微信支付
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.payTypeList[0].productId, //套餐id
packageName:
orderData.productModel + "," + orderData.packagesName, //套餐名字
packagePayType: '1', //支付类型, 默认微信
pkId: data.packagesCardId,
packageIssue: orderData.packageIssue, //分期
packagePrice: orderData.packagesPrice * 100
};
},
// 支付类型切换
onRaidoChange(value) {
console.log("选择的支付类型是", value);
this.payType = value;
},
// 微信支付
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.payTypeList[0].productId, //套餐id
packageName:
orderData.productModel + "," + orderData.packagesName, //套餐名字
packagePayType: '1', //支付类型, 默认微信
pkId: data.packagesCardId,
packageIssue: orderData.packageIssue, //分期
packagePrice: orderData.packagesPrice * 100
};
// 1.获取微信预下单Id
APICore.payLiveBaseDevice(reqBody)
.then(res => {
if (res.data.code === 104 || res.data.code === 106) {
this.getAuth();
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;
that.outTradeNo = wxData.out_trade_no;
//this.checkWxPayResult(outTradeNo);
//this.closeTime();
// 调起微信支付收银台
this.onWxPay(wxData,packageType);
})
.catch(error => {
console.log("error", error);
})
},
onWxPay(data,packageType) {
APICore.payLiveBaseDevice(reqBody)
.then(res => {
if (res.data.code === 104 || res.data.code === 106) {
this.getAuth();
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;
that.outTradeNo = wxData.out_trade_no;
//this.checkWxPayResult(outTradeNo);
//this.closeTime();
// 调起微信支付收银台
this.onWxPay(wxData, packageType);
})
.catch(error => {
console.log("error", error);
})
},
onWxPay(data, packageType) {
let that = this;
function onBridgeReady() {
WeixinJSBridge.invoke(
@@ -350,13 +344,13 @@ export default {
signType: data.signType, //微信签名方式:
paySign: data.paySign //微信签名
},
function(res) {
function (res) {
if (res.err_msg == "get_brand_wcpay_request:ok") {
// 使用以上方式判断前端返回,微信团队郑重提示:
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
if(packageType === 1) {
// 加油包不用跳转,直接提示支付成功
// 2023.06.09 修改充值成功提示如下:
if (packageType === 1) {
// 加油包不用跳转,直接提示支付成功
// 2023.06.09 修改充值成功提示如下:
that.$toast.success({
message: '充值成功,请重启设备后,恢复正常使用。'
});
@@ -375,7 +369,7 @@ export default {
});
}
} else {
let cancelMessage = packageType === 1 ? '立即订购': '套餐订购'
let cancelMessage = packageType === 1 ? '立即订购' : '套餐订购'
that.$dialog.confirm({
message: `请点击“${cancelMessage}”支付`,
showCancelButton: false
@@ -402,8 +396,8 @@ export default {
onBridgeReady();
}
},
// 跳转到支付宝花呗外部链接
aliPay(data) {
// 跳转到支付宝花呗外部链接
aliPay(data) {
console.log("选择了支付宝::", data);
this.$toast.loading({
message: "加载中"
@@ -462,12 +456,19 @@ export default {
.finally(() => {
this.$toast.clear();
});
},
},
computed: {
isWeChat() {
const ua = window.navigator.userAgent.toLowerCase();
return /micromessenger/.test(ua);
}

},
created() {
// 套餐列表
this.getDevicePayPackage();
},
},
created() {
// 套餐列表
this.getDevicePayPackage();
},
}
</script>
<style lang="scss">
@@ -475,21 +476,26 @@ export default {
.van-tabs {
min-height: 100vh;
background: #fafafa;

&.blue {
background: #1890ff !important;
}

.van-tabs__wrap {
height: 50px;
width: 100%;

.van-tabs__nav {
.van-tab {
@include center();
padding: 0;

span {
color: #333333;
font-size: 16px;
padding: 4px;
}

&.van-tab--active {
span {
color: #1890ff;
@@ -507,13 +513,16 @@ export default {
.package-buy-container {
height: 100vh;
overflow: hidden;

.package-container {
height: calc(100vh - 88px);
background: #fafafa;

.refuel-package {
height: calc(100vh - 88px);
padding: 10px 20px;
overflow: scroll;

.refuel-item {
padding: 10px;
margin-bottom: 20px;
@@ -525,41 +534,50 @@ export default {
border-left: 3px solid #1890ff;
box-shadow: rgba(60, 64, 67, 0.3) 0px 1px 2px 0px,
rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;

p,
span {
font-size: 16px;
}

.title {
text-align: left;
padding-top: 10px;
font-weight: 500;
}

.tips {
margin-top: 10px;

p {
font-size: 14px;
}
}

.bottom {
padding-top: 20px;
display: flex;
justify-content: space-between;
align-items: center;

span {
font-size: 20px;
color: #fca842;
font-weight: bold;

.price-span {
margin-left: 5px;
font-size: 14px;
}
}

.btn-button {
height: 35px;
width: 100px;
@include center();
background-color: #fca842;
border-radius: 17px;

p {
font-size: 14px;
color: #fff;
@@ -568,6 +586,7 @@ export default {
}
}
}

.base-package {
height: calc(100vh - 88px);
position: relative;
@@ -579,39 +598,48 @@ export default {
rgba(14, 30, 37, 0.32) 0 2px 16px 0;
padding: 15px 10px;
background-color: #fff;

/* border-radius: 5px; */
.title {
display: flex;
justify-content: flex-start;

p {
font-size: 16px;
font-weight: bold;
}
}

.details {
display: flex;
justify-content: flex-start;
align-items: center;

p {
height: 40px;
@include center();
font-size: 14px;
padding: 5px 0 5px 10px;
}

.total {
font-size: 16px;
padding: 0;
}

.orange {
color: orange;
}

.large {
font-size: 26px;
margin: 0 2px;
}

.price {
font-size: 16px;
}

/* .buy-btn {
height: 30px;
width: 100px;
@@ -627,18 +655,22 @@ export default {
}
} */
}

.remark {
display: flex;
justify-content: flex-start;

p {
font-size: 14px;
padding: 5px 10px;
/* font-weight: bold; */
}
}

.package-buy {
@include center();
padding: 5px 8px;

.buy-btn {
height: 40px;
width: 200px;
@@ -648,6 +680,7 @@ export default {
align-items: center;
background: orange;
border-radius: 20px;

p {
font-size: 16px;
padding: 0;
@@ -655,12 +688,14 @@ export default {
}
}
}

.radios-con {
/* padding: 20px 10px; */
/* @include center(); */
/* align-items: center; */
padding: 10px 0 10px 10px;
font-size: 14px;

/* box-shadow: rgba(14, 30, 37, 0.12) 0 3px 5px 0,
rgba(14, 30, 37, 0.32) 0 2px 16px 0; */
img {
@@ -668,8 +703,10 @@ export default {
width: 20px;
margin: 2px;
}

.pay-type {
text-align: left;

p {
font-size: 14px;
padding: 0 0 10px 0;
@@ -679,10 +716,12 @@ export default {
.radio-con {
@include center();
}

.van-cell-text {
display: flex;
justify-content: flex-start;
align-items: center;

span {
font-size: 14px;
padding: 0 5px;
@@ -690,14 +729,17 @@ export default {
}
}
}

.content {
font-size: 14px;
}
}

.data-null {
height: calc(100vh - 88px);
@include center();
flex-direction: column;

span {
font-size: 14px;
}


+ 77
- 63
src/views/package-home/index.vue Parādīt failu

@@ -31,6 +31,12 @@ export default {
created() {
this.getAuth();
},
computed: {
isWeChat() {
const ua = window.navigator.userAgent.toLowerCase();
return /micromessenger/.test(ua);
}
},
mounted() {
this.getParams();
},
@@ -42,27 +48,27 @@ export default {
// 4.如果有基础套餐但未充值,跳转套餐充值页面
getDevicePayPackage() {
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 是加油包
this.isHasBasePackage = data.data.packagesList.some(res => {
return res.producModelId === 1;
});
}
}).catch(() => {})
.then(res => {
let data = res.data;
if (data.code === 106 || data.code === 104) {
this.getAuth();
setTimeout(() => {
this.getDevicePayPackage();
}, 1500);
} else {
// 筛选是否存在基础套餐, producModelId = 1 是基础套餐, 2 是加油包
this.isHasBasePackage = data.data.packagesList.some(res => {
return res.producModelId === 1;
});
}
}).catch(() => { })
},
checkImei() {
let reqBody = {
imei: this.params.imei,
iccid: this.params.iccid || ''
};
APIWx.CheckImei(reqBody).then(res =>{
APIWx.CheckImei(reqBody).then(res => {
this.isRecharge = res.data.isRecharge;
this.currentIotTitle = res.data.title;
this.getWxCode();
@@ -82,19 +88,19 @@ export default {
let url = window.location.href.split("?code=")[1];
console.log("获取授权code的url", url);
this.getWxCode();
/* if (
isNotNull(url) ||
window.location.href.indexOf("code") > -1
) {
let timeStamp = new Date().getTime();
let code = url.split("&")[0];
console.log("code", code);
if (isNotNull(code)) {
this.getWxCode();
}
} else {
this.getWxCode();
} */
/* if (
isNotNull(url) ||
window.location.href.indexOf("code") > -1
) {
let timeStamp = new Date().getTime();
let code = url.split("&")[0];
console.log("code", code);
if (isNotNull(code)) {
this.getWxCode();
}
} else {
this.getWxCode();
} */
} else {
this.getWxCode();
console.log("当前浏览器内核并非支付宝或者微信");
@@ -107,15 +113,15 @@ export default {
this.$store.commit("gatewayToken", res.data.data);
});
},
// 获取token
// 获取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) {
if (data.code === 20000) {
this.$store.commit("token", data.token);
console.log("token的数据", localStorage.getItem('token'))
console.log("token的数据", localStorage.getItem('token'))
}
})
},
@@ -123,8 +129,8 @@ export default {
getOpenId(code) {
//let code = this.$store.getters.wxAuthCode;
APIPay.getOpenId(code).then(res => {
let data= res.data;
if(data.code === 20000) {
let data = res.data;
if (data.code === 20000) {
this.$store.commit("openId", data.data.openId);
}
})
@@ -132,38 +138,47 @@ export default {
// 获取微信code
getWxCode() {
let params = this.params;
let commonUrl = process.env.VUE_APP_BASE_API;
let commonUrl = process.env.NODE_ENV === "production" ? process.env.VUE_APP_BASE_API : 'https://id.gdssjl.com';
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("无套餐跳转话费查询页面");
if (this.isWeChat) {

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=${cardInfoBaseUrl}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`;
window.location.href = wxRedUrl;
}
} else {
// 跳转错误页面;
this.$router.replace({
name: 'iotcardError'
})
console.log("跳转错误页面");
// 无套餐
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("跳转错误页面");
}
}
} else {
this.$router.replace({
name: "cardInfo",
query: { imei: this.params.imei, iccid: this.params.iccid, isShowMenu: true, isHasCode: true }
});
}

// 2023.09.20 废弃
/* if(this.isRecharge) {
let redUrl = encodeURIComponent(`${commonUrl}/h5-frontendweb/#/cardInfo?imei=${params.imei}&iccid=${params.iccid}`);
@@ -180,9 +195,9 @@ export default {
getParams() {
let params = this.$route.query;
if (params) {
this.params = {...params};
this.params = { ...params };
this.$store.commit("appId", AppId);
if(params.reqUrl) {
if (params.reqUrl) {
const reqUrl = encodeURI(params.reqUrl);
window.location.href = reqUrl;
} else {
@@ -195,5 +210,4 @@ export default {
};
</script>

<style scoped lang="scss">
</style>
<style scoped lang="scss"></style>

+ 95
- 42
src/views/package-list/index.vue Parādīt failu

@@ -9,7 +9,7 @@
<div class="package-list-container">
<van-nav-bar :left-arrow="false" :border="true">
<template #title>
<h5 style="font-size: 16px">{{topupTitle}}</h5>
<h5 style="font-size: 16px">{{ topupTitle }}</h5>
</template>
</van-nav-bar>
<!-- 灰色线条 -->
@@ -22,12 +22,7 @@
<p>暂无相关套餐数据,请您联系管理员~</p>
</div>
<!-- 套餐订购 -->
<div
class="package-order-container"

v-for="(item, index) in packageOrderList"
:key="index"
>
<div class="package-order-container" v-for="(item, index) in packageOrderList" :key="index">
<!-- 推荐 -->
<div class="recom" v-show="false">
<div class="shape"></div>
@@ -38,7 +33,8 @@
<!-- 套餐内容 -->
<div class="order-content">
<div class="title">
<p>{{item.packageName}}<!-- :{{(item.packagesPrice/item.packageIssue).toFixed(0)}}元/月 --></p>
<p>{{ item.packageName }}<!-- :{{(item.packagesPrice/item.packageIssue).toFixed(0)}}元/月 -->
</p>
</div>
<div class="remark">
<p>每月200分钟通话时长,1G流量</p>
@@ -46,10 +42,11 @@
<div class="details">
<p>

<span class="orange large">¥{{(item.packagesPrice/(item.packageIssue === 0 ? 1: item.packageIssue)).toFixed(0)}}</span>元/月,
<span class="orange large">¥{{ (item.packagesPrice / (item.packageIssue === 0 ? 1 :
item.packageIssue)).toFixed(0)}}</span>元/月,
</p>
<p class="total">
<span>合计</span><span class="orange price">{{item.packagesPrice}}元</span>
<span>合计</span><span class="orange price">{{ item.packagesPrice }}元</span>
</p>
</div>
<!-- <div class="package-buy">
@@ -61,12 +58,12 @@
<div class="pay-type">
<p>支付方式:</p>
</div>
<van-radio-group v-model="radio" direction="horizontal" @change="onRaidoChange">
<van-radio-group v-model="radio" direction="horizontal" @change="onRaidoChange">
<van-radio name="1">
<template #default>
<div class="radio-con">
<span>微信</span>
<img src="../../assets/wx-pay.png"/>
<img src="../../assets/wx-pay.png" />
</div>
</template>
</van-radio>
@@ -74,7 +71,7 @@
<template #default>
<div class="radio-con">
<span>支付宝</span>
<img src="../../assets/alipay.png"/>
<img src="../../assets/alipay.png" />
</div>
</template>
</van-radio>
@@ -82,7 +79,7 @@
<template #default>
<div class="radio-con">
<span>12期花呗</span>
<img src="../../assets/antpay.png"/>
<img src="../../assets/antpay.png" />
</div>
</template>
</van-radio>
@@ -144,6 +141,13 @@ export default {
code: ''
};
},
computed: {
isWeChat() {
const ua = window.navigator.userAgent.toLowerCase();
return /micromessenger/.test(ua);
}

},
created() {
this.getAuth();
this.getToken();
@@ -158,8 +162,8 @@ export default {
// 根据code获取openId
getOpenId(code) {
APIPay.getOpenId(code).then(res => {
let data= res.data;
if(data.code === 20000) {
let data = res.data;
if (data.code === 20000) {
this.openId = data.data.openId;
this.$store.commit("openId", data.data.openId);
} else if (data.state === false) {
@@ -169,7 +173,7 @@ export default {
}
})
},
// 获取b端接口的token
// 获取b端接口的token
getAuth() {
let manufactorId = "5bf13062-a41e-4d00-ba14-1101aad12650";
APICore.getAuth({ manufactorId: manufactorId }).then(res => {
@@ -182,16 +186,16 @@ export default {
APIPay.getToken(manufacturerNo).then(res => {
console.log("token的数据", res.data)
let data = res.data;
if(data.code === 20000) {
if (data.code === 20000) {
this.$store.commit("token", data.token);
console.log("token的数据", localStorage.getItem('token'))
console.log("token的数据", localStorage.getItem('token'))
}
})
},
getCode() {
let url = window.location.href.split("?code=")[1];
console.log("url", url);
if (isNotNull(url) ||window.location.href.indexOf("code") > -1) {
if (isNotNull(url) || window.location.href.indexOf("code") > -1) {
let code = url.split("&")[0];
this.code = code;
if (isNotNull(code)) {
@@ -209,7 +213,7 @@ export default {
let params = this.$route.query;
console.log("params", params);
if (params) {
this.params = {...params};
this.params = { ...params };
}
},
// 获取基本套餐信息
@@ -230,7 +234,7 @@ export default {
} else if (res.data.code === 0 && res.data.data === null) {
this.isShowNoData = true;
} else {
if(res.data.data === null) {
if (res.data.data === null) {
this.isShowNoData = false;
} else {
let data = res.data.data.packagesList;
@@ -271,7 +275,7 @@ export default {
APIWx.createJSSDK({
sUrl: window.location.href.split("#")[0],
userId: '',
appId: this.params.appId || AppId
appId: this.params.appId || AppId
})
.then(res => {
let item = res.data.data;
@@ -300,6 +304,12 @@ export default {
// 遍历数据找到属于三种支付方式对应的套餐id, 1 微信 2 支付宝全额 3 支付宝分期
let payTypeToPackAgeId = data.payTypeList;
console.log("购买的套餐数据data", payTypeToPackAgeId);
if (!this.isWeChat) {
return this.$dialog.confirm({
message: '请用微信客户端打开此页。',
showCancelButton: false,
})
}
// 需要区分是要用微信支付还是支付宝花呗支付
if (this.payType === '2') {
// 全额
@@ -326,7 +336,7 @@ export default {
})[0].productId;
this.packageIssue = 0;
console.log("this.payProductId3", this.payProductId);
if(openId === null || openId === 'null') {
if (openId === null || openId === 'null') {
this.$dialog.confirm({
message: '获取OpenId失败,请您重新进入',
showCancelButton: false,
@@ -367,7 +377,7 @@ export default {
message: `${res.data.message}`,
showCancelButton: false
})
} else if ( res.data.code !== 0){
} else if (res.data.code !== 0) {
return this.$dialog.confirm({
message: `请反馈给一线人员,\n${res.data.message}`,
showCancelButton: false
@@ -453,7 +463,7 @@ export default {
signType: data.signType, //微信签名方式:
paySign: data.paySign //微信签名
},
function(res) {
function (res) {
if (res.err_msg == "get_brand_wcpay_request:ok") {
// 使用以上方式判断前端返回,微信团队郑重提示:
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
@@ -575,6 +585,7 @@ export default {
.package-list-container {
background-color: white;
height: 100vh;

.topup-container {
position: relative;
/* margin: 20px; */
@@ -585,14 +596,17 @@ export default {
background-color: white;
overflow: scroll;
height: calc(100vh - 88px);

.main {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;

.tips {
padding: 10px;
}

.noData_container {
margin: 100px auto 0;
height: 120px;
@@ -603,15 +617,19 @@ export default {
align-items: flex-end;
font-size: 16px;
color: #999;

p {
font-size: 16px;
}

/* @include colorAndFont(#999, 28); */
}

p {
padding: 10px;
font-size: 16px;
}

.cancel-button {
width: 30vw;
border-radius: 5px;
@@ -623,6 +641,7 @@ export default {
align-items: center;
font-size: 16px;
}

.package-order-container {
position: relative;
margin: 10px 0;
@@ -630,6 +649,7 @@ export default {
z-index: 999;
box-shadow: rgba(14, 30, 37, 0.12) 0 3px 5px 0,
rgba(14, 30, 37, 0.32) 0 2px 16px 0;

.recom {
position: absolute;
top: -7px;
@@ -640,11 +660,13 @@ export default {
transform: rotate(-45deg);
text-align: center;
z-index: 9999;

p {
padding: 0;
color: white;
font-size: 14px;
}

.shape {
position: absolute;
top: -1px;
@@ -653,6 +675,7 @@ export default {
border-width: 0 21px 21px;
border-color: transparent transparent white;
}

.square {
height: 15px;
width: 35px;
@@ -663,40 +686,50 @@ export default {
font-size: 14px;
}
}

.order-content {
padding: 15px 10px;

.title {
display: flex;
justify-content: flex-start;

p {
font-size: 16px;
font-weight: bold;
}
}

.details {
display: flex;
justify-content: flex-start;
align-items: center;

p {
height: 40px;
@include center();
font-size: 14px;
padding: 5px 0 5px 10px;
}

.total {
font-size: 16px;
padding: 0;
}

.orange {
color: orange;
}

.large {
font-size: 26px;
margin: 0 2px;
}

.price {
font-size: 16px;
}

/* .buy-btn {
height: 30px;
width: 100px;
@@ -712,41 +745,48 @@ export default {
}
} */
}

.remark {
display: flex;
justify-content: flex-start;

p {
font-size: 14px;
padding: 5px 10px;
padding: 5px 10px;
/* font-weight: bold; */
}
}

.package-buy {
@include center();
padding: 5px 8px;
@include center();
.buy-btn {
height: 40px;
width: 200px;
padding: 0 5px;
display: flex;
justify-content: center;
align-items: center;
background: orange;
border-radius: 20px;
p {
font-size: 16px;
padding: 0;
color: white;
}

.buy-btn {
height: 40px;
width: 200px;
padding: 0 5px;
display: flex;
justify-content: center;
align-items: center;
background: orange;
border-radius: 20px;

p {
font-size: 16px;
padding: 0;
color: white;
}
}
}

.radios-con {
/* padding: 20px 10px; */
/* @include center(); */
/* align-items: center; */
padding: 10px 0 10px 10px;
font-size: 14px;

/* box-shadow: rgba(14, 30, 37, 0.12) 0 3px 5px 0,
rgba(14, 30, 37, 0.32) 0 2px 16px 0; */
img {
@@ -754,8 +794,10 @@ export default {
width: 20px;
margin: 2px;
}

.pay-type {
text-align: left;

p {
font-size: 14px;
padding: 0 0 10px 0;
@@ -765,10 +807,12 @@ export default {
.radio-con {
@include center();
}

.van-cell-text {
display: flex;
justify-content: flex-start;
align-items: center;

span {
font-size: 14px;
padding: 0 5px;
@@ -776,18 +820,21 @@ export default {
}
}
}

.content {
font-size: 14px;
}
}
}
}

.gray-line {
height: 10px;
width: 100%;
background: #f2f4f5;

}

.order-description {
height: 60px;
display: flex;
@@ -795,15 +842,18 @@ export default {
align-items: flex-start;
flex-direction: column;
padding: 5px 0 10px 10px;

h5 {
font-size: 14px;
padding: 10px 0 0 0;
}
}

.pay-radios {
position: relative;
top: 0;
width: 100%;

/* background-color: red; */
/* padding: 0 15px; */
.radios-con {
@@ -812,15 +862,18 @@ export default {
align-items: center;
font-size: 18px;
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;

img {
height: 35px;
width: auto;
}

.van-cell-text {
display: flex;
justify-content: flex-start;
align-items: center;

span {
padding: 0 5px;
}


Notiek ielāde…
Atcelt
Saglabāt