This commit is contained in:
2022-10-11 16:51:51 +08:00
18 changed files with 1243 additions and 354 deletions

View File

@@ -15,7 +15,7 @@
</view>
<view class="num">{{frozenScore || '0.0000'}}</view>
</view>
<button class="transfer" size="mini" @click="dtShow = true">充值</button>
<button class="transfer" size="mini" @click="dtSelect">充值</button>
<button class="transfer" size="mini" @click="onTransfer('AccountTransfer')">转账</button>
</view>
<block v-if="logs.length > 0">
@@ -85,6 +85,9 @@
},
methods: {
dtSelect(type){
this.onTransfer('AccountRecharge');
return
// 充值选项
switch(type){
case 'wchat':
this.onTransfer('AccountRecharge');

145
pages/account/hmState.vue Normal file
View File

@@ -0,0 +1,145 @@
<template>
<view>
<view class="vertical results">
<block v-if="loding">
<u-loading-icon mode="circle" size="58" color="#34CE98"></u-loading-icon>
<view class="circle-toast">
<view class="sub-title">已等待{{time}}</view>
<view class="sub-title">查询支付结果中请耐心等待...</view>
</view>
</block>
<block v-else>
<view v-if="success">
<uni-icons type="checkbox-filled" size="88" color="#34CE98"></uni-icons>
<view class="title">支付成功</view>
<view class="sub-title">{{remove}}</view>
<button class="results-button" type="default" size="default" @click="navBack">返回</button>
</view>
<view v-else>
<uni-icons type="info-circle-fill" size="88" color="#34CE98"></uni-icons>
<view class="title">{{code === 0 ? '查询失败' : '订单不存在'}}</view>
<view class="sub-title">{{code === 0 ? '暂未查询到您的支付信息,如支付成功未到账请联系管理员': '暂未查询到您的订单信息'}}</view>
<button class="results-button" type="default" size="default" @click="navBack">返回</button>
</view>
</block>
</view>
</view>
</template>
<script>
import { hmState } from '@/apis/interfaces/pay.js'
var outTime;
export default {
data() {
return {
type : 'recharge',
hash : '',
time : 0,
loding : false,
success : false,
code : 0,
remove : '充值成功预计10秒内到账可在账户交易记录中查询以实际到账时间为准如充值失败金额将原路退还'
};
},
created() {
this.type = this.$Route.query.type
if(this.type === 'vip') this.remove = '恭喜您成功开通共力生态会员'
if(this.type === 'buy') this.remove = '订单支出成功,可在个人中心中订单中查询您购物的订单'
this.queryState()
},
methods:{
queryState(){
this.loding = true
let outTimeN = 0
outTime = setInterval(() => {
hmState(this.type, this.$Route.query.orderId).then(res => {
outTimeN += 1
this.time = outTimeN
if(res.code === 1){
clearInterval(outTime)
this.success = true
this.loding = false
}
if(res.code === 0 && outTimeN >= 10){
clearInterval(outTime)
this.code = 0
this.loding = false
}
if(res.code === 2){
clearInterval(outTime)
this.code = 2
this.loding = false
}
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
}, 1000)
},
navBack(){
uni.navigateBack()
}
},
onUnload() {
clearInterval(outTime)
}
}
</script>
<style lang="scss" scoped>
.results{
height: 100vh;
box-sizing: border-box;
text-align: center;
padding-left: $padding * 3;
padding-right: $padding * 3;
padding-bottom: 20vh;
.title{
font-size: $title-size + 8;
color: $text-color;
font-weight: bold;
line-height: 80rpx;
padding: $padding 0;
}
.sub-title{
color: $text-gray;
line-height: 40rpx;
}
.hash{
background-color: white;
padding: $padding * 2;
border-radius: $radius-lg;
margin-top: $margin * 2;
font-size: $title-size;
color: $text-color;
.hash-title{
padding-bottom: $padding;
}
.hash-text{
word-break:break-all;
}
}
.results-button{
width: 100%;
margin-top: $margin * 3;
height: 90rpx;
line-height: 90rpx;
border-radius: 45rpx;
background-color: $main-color;
color: white;
font-size: $title-size;
font-weight: bold;
&::after{
display: none;
}
}
.circle-toast{
padding-top: 60rpx;
.sub-title{
line-height: 60rpx;
}
}
}
</style>

View File

@@ -24,20 +24,36 @@
</view>
<view class="recharge-btn">
<button :disabled="this.priceValue === ''" @click="onRecharge">充值</button>
<view class="recharge-text">提示暂时仅支持使用微信支付充值</view>
<view class="recharge-text">提示暂时仅支持使用支付宝支付充值</view>
</view>
</view>
</template>
<script>
var hmAppPay = uni.requireNativePlugin('TestModule');
import { hmPay } from '@/apis/interfaces/pay.js';
import { recharge, payment, paymentpre } from "@/apis/interfaces/account"
export default {
data() {
return {
priceValue: '',
paymentpre: []
orderId : '',
paymentpre: [],
hmPayState: false
};
},
onShow() {
if(this.hmPayState){
this.$Router.replace({
name : 'hmState',
params : {
type : 'recharge',
orderId : this.orderId
}
})
return
}
},
created() {
paymentpre().then(res => {
this.paymentpre = res
@@ -81,6 +97,21 @@
},
// 获取充值信息
getPayInfo(order_id){
if(plus.runtime.isApplicationExist({
pname : 'com.eg.android.AlipayGphone',
action : 'alipay://'
})){
uni.showLoading({
title: '获取支付信息'
})
this.getHmPayInfo(order_id)
}else{
uni.showToast({
title: '支付失败,请安装支付宝',
icon : 'none'
})
}
return
payment({order_id}).then(res => {
uni.requestPayment({
provider: 'wxpay',
@@ -107,8 +138,28 @@
icon : 'none'
})
})
},
// 河马支付
getHmPayInfo(order_id){
this.orderId = order_id
hmPay(order_id).then(res => {
try{
hmAppPay.gotoNativePage(JSON.stringify(res.params))
this.hmPayState = true
}catch(e){
uni.showToast({
title: e
})
}
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
}
},
// 充值记录
onNavigationBarButtonTap() {
this.$Router.push({name: 'AccountLog'})
}

View File

@@ -24,7 +24,7 @@
<view class="vip-content-title">距离<text>{{nextIdentity.identity_text}}</text>还需条件</view>
<view class="vip-up-conditions">
<view class="vip-up-conditions-item"><text>10/10</text>家庭会员</view>
<view class="vip-up-conditions-item"><text>9/100</text>邀请家族会员</view>
<view class="vip-up-conditions-item"><text>9/100</text>邀请家族会员</view>
<view class="vip-up-conditions-item"><text>10/10000</text>伙伴</view>
</view>
</block>
@@ -63,6 +63,8 @@
</template>
<script>
var hmAppPay = uni.requireNativePlugin('TestModule');
import { vipHmPay } from '@/apis/interfaces/vip.js';
import { vip, vipPay, payInfo } from '@/apis/interfaces/vip.js'
export default {
data() {
@@ -98,11 +100,24 @@
need : '-',
current: '-',
rate: 0
}
},
// 河马付
orderId : '',
hmPayState: false
};
},
onShow() {
this.getVipInfo()
if(this.hmPayState){
this.$Router.replace({
name : 'hmState',
params : {
type : 'vip',
orderId : this.orderId
}
})
return
}
},
methods: {
// 获取会员信息
@@ -136,6 +151,18 @@
uni.showLoading({
title: '获取支付信息'
})
if(plus.runtime.isApplicationExist({
pname : 'com.eg.android.AlipayGphone',
action : 'alipay://'
})){
this.getHmPayInfo(res.id)
}else{
uni.showToast({
title: '支付失败,请安装支付宝',
icon : 'none'
})
}
return
this.wxPay(res.id)
}
}).catch(err => {
@@ -145,6 +172,26 @@
})
})
},
// 河马支付
getHmPayInfo(order_id){
this.orderId = order_id
vipHmPay(order_id).then(res => {
try{
hmAppPay.gotoNativePage(JSON.stringify(res))
this.hmPayState = true
}catch(e){
uni.showToast({
title: e
})
}
}).catch(err => {
console.log(err)
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
// 微信支付
wxPay(orderId){
payInfo(orderId).then(orderInfo => {