|
@@ -4,9 +4,7 @@
|
|
|
<text class="yue-tit">当前余额:</text>
|
|
|
<text class="yue-num">¥{{ now_money | parseFloatNum }}</text>
|
|
|
</view>
|
|
|
-
|
|
|
<view class="line_box"></view>
|
|
|
-
|
|
|
<view class="cz_box">
|
|
|
<view class="cz_wrap">
|
|
|
<text class="cz_tit">¥</text>
|
|
@@ -20,24 +18,8 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <!-- <view class="line_box"></view> -->
|
|
|
-
|
|
|
- <!-- <view class="row-box">
|
|
|
- <view class="title">充值金额</view>
|
|
|
- <view class="row">
|
|
|
- <text class="tit">¥</text>
|
|
|
- <input class="input" type="number" v-model="money" placeholder="请输入充值金额" placeholder-class="placeholder" />
|
|
|
- </view>
|
|
|
- </view> -->
|
|
|
-
|
|
|
- <!-- <view class="rechar-box">
|
|
|
- <view class="rechar-title">注意事项</view>
|
|
|
- <view class="rechar-text" v-for="(item, index) in zhuyi" :key="index">
|
|
|
- <text>{{ index + 1 }}.{{item}}</text>
|
|
|
- </view>
|
|
|
- </view> -->
|
|
|
<view class="line_box"></view>
|
|
|
- <view class="cz-type">
|
|
|
+ <!-- <view class="cz-type" @click="type = 'weixin'">
|
|
|
<view class="type-left">
|
|
|
<view class="icon iconfont iconweixin"></view>
|
|
|
<view class="tit">微信充值</view>
|
|
@@ -45,15 +27,20 @@
|
|
|
<view class="right">
|
|
|
<radio value="weixin" color=" #EB001C" :checked="type == 'weixin'" />
|
|
|
</view>
|
|
|
+ </view> -->
|
|
|
+ <!-- #ifdef APP-PLUS -->
|
|
|
+ <view class="cz-type" @click="type = 'ali'">
|
|
|
+ <view class="type-left">
|
|
|
+ <view class="icon iconfont iconzhifubao"></view>
|
|
|
+ <view class="tit">支付宝充值</view>
|
|
|
+ </view>
|
|
|
+ <view class="right">
|
|
|
+ <radio value="ali" color=" #EB001C" :checked="type == 'ali'" />
|
|
|
+ </view>
|
|
|
</view>
|
|
|
+ <!-- #endif -->
|
|
|
<button class="add-btn up" :class="{ 'active-bg': payLoding }"
|
|
|
@click="!payLoding ? confirm() : ''">立即充值</button>
|
|
|
-
|
|
|
- <!-- <view class="aaa">
|
|
|
- <view class="bbb">
|
|
|
- 22222
|
|
|
- </view>
|
|
|
- </view> -->
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -61,17 +48,21 @@
|
|
|
import {
|
|
|
getMoneyStyle
|
|
|
} from '@/utils/rocessor.js';
|
|
|
+
|
|
|
// #ifdef H5
|
|
|
import {
|
|
|
rechargeWechat,
|
|
|
- rechargeIndex
|
|
|
+ rechargeAli
|
|
|
} from '@/api/wallet.js';
|
|
|
// #endif
|
|
|
// #ifdef MP
|
|
|
import {
|
|
|
- rechargeWechat,
|
|
|
rechargeRoutine,
|
|
|
- rechargeIndex
|
|
|
+ } from '@/api/wallet.js';
|
|
|
+ // #endif
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ import {
|
|
|
+ rechargeAli
|
|
|
} from '@/api/wallet.js';
|
|
|
// #endif
|
|
|
import {
|
|
@@ -174,67 +165,96 @@
|
|
|
obj.payLoding = false;
|
|
|
return;
|
|
|
}
|
|
|
- // #ifdef H5
|
|
|
- rechargeWechat({
|
|
|
- price: this.money,
|
|
|
- from: this.type,
|
|
|
- }).then(e => {
|
|
|
- let da = e.data.data;
|
|
|
- obj.weichatObj.chooseWXPay({
|
|
|
- timestamp: da.timestamp,
|
|
|
- nonceStr: da.nonceStr,
|
|
|
- package: da.package,
|
|
|
- signType: da.signType,
|
|
|
- paySign: da.paySign,
|
|
|
- success: function(res) {
|
|
|
- uni.showToast({
|
|
|
- title: '充值成功',
|
|
|
- duration: 2000,
|
|
|
- position: 'top',
|
|
|
- success: function(res) {
|
|
|
- uni.navigateBack()
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ // 微信支付
|
|
|
+ if(obj.type=='weixin'){
|
|
|
+ // #ifdef H5
|
|
|
+ rechargeWechat({
|
|
|
+ price: this.money,
|
|
|
+ from: this.type,
|
|
|
+ }).then(e => {
|
|
|
+ let da = e.data.data;
|
|
|
+ obj.weichatObj.chooseWXPay({
|
|
|
+ timestamp: da.timestamp,
|
|
|
+ nonceStr: da.nonceStr,
|
|
|
+ package: da.package,
|
|
|
+ signType: da.signType,
|
|
|
+ paySign: da.paySign,
|
|
|
+ success: function(res) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '充值成功',
|
|
|
+ duration: 2000,
|
|
|
+ position: 'top',
|
|
|
+ success: function(res) {
|
|
|
+ uni.navigateBack()
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ obj.payLoding = false;
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ obj.payLoding = false;
|
|
|
+ console.log(e);
|
|
|
});
|
|
|
- obj.payLoding = false;
|
|
|
- })
|
|
|
- .catch(e => {
|
|
|
- obj.payLoding = false;
|
|
|
- console.log(e);
|
|
|
- });
|
|
|
- // #endif
|
|
|
- // #ifdef MP
|
|
|
- rechargeRoutine({
|
|
|
+ // #endif
|
|
|
+ // #ifdef MP
|
|
|
+ rechargeRoutine({
|
|
|
+ price: this.money
|
|
|
+ })
|
|
|
+ .then(e => {
|
|
|
+ let da = e.data;
|
|
|
+ wx.requestPayment({
|
|
|
+ timeStamp: da.timestamp,
|
|
|
+ nonceStr: da.nonceStr,
|
|
|
+ package: da.package,
|
|
|
+ signType: da.signType,
|
|
|
+ paySign: da.paySign,
|
|
|
+ success: function(res) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '充值成功',
|
|
|
+ duration: 2000,
|
|
|
+ position: 'top',
|
|
|
+ success: function(res) {
|
|
|
+ uni.navigateBack()
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+ obj.payLoding = false;
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ obj.payLoding = false;
|
|
|
+ console.log(e);
|
|
|
+ });
|
|
|
+ // #endif
|
|
|
+ }
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ if(obj.type=='ali'){
|
|
|
+ rechargeAli({
|
|
|
price: this.money
|
|
|
- })
|
|
|
- .then(e => {
|
|
|
- let da = e.data;
|
|
|
- wx.requestPayment({
|
|
|
- timeStamp: da.timestamp,
|
|
|
- nonceStr: da.nonceStr,
|
|
|
- package: da.package,
|
|
|
- signType: da.signType,
|
|
|
- paySign: da.paySign,
|
|
|
- success: function(res) {
|
|
|
+ }).then((data)=>{
|
|
|
+ const url = data.msg;
|
|
|
+ uni.requestPayment({
|
|
|
+ provider: 'alipay',
|
|
|
+ orderInfo: url,
|
|
|
+ success: res => {
|
|
|
uni.showToast({
|
|
|
- title: '充值成功',
|
|
|
- duration: 2000,
|
|
|
- position: 'top',
|
|
|
- success: function(res) {
|
|
|
- uni.navigateBack()
|
|
|
- }
|
|
|
+ title: '支付成功',
|
|
|
+ duration: 2000
|
|
|
});
|
|
|
+ obj.paySuccessTo();
|
|
|
},
|
|
|
-
|
|
|
- })
|
|
|
-
|
|
|
- obj.payLoding = false;
|
|
|
- })
|
|
|
- .catch(e => {
|
|
|
+ fail: e => {
|
|
|
+ console.log(e);
|
|
|
+ },
|
|
|
+ complete: () => {}
|
|
|
+ });
|
|
|
obj.payLoding = false;
|
|
|
- console.log(e);
|
|
|
- });
|
|
|
+ return
|
|
|
+ }).catch()
|
|
|
+ }
|
|
|
// #endif
|
|
|
},
|
|
|
}
|
|
@@ -424,7 +444,9 @@
|
|
|
.iconweixin {
|
|
|
color: #36cb59;
|
|
|
}
|
|
|
-
|
|
|
+ .iconzhifubao{
|
|
|
+ color: #08aaec;
|
|
|
+ }
|
|
|
.tit {
|
|
|
margin-left: 12rpx;
|
|
|
font-size: 30rpx;
|