|
@@ -1,12 +1,8 @@
|
|
|
<template>
|
|
|
<view class="content">
|
|
|
<view class="yue">
|
|
|
- <view class="font">
|
|
|
- 当前余额
|
|
|
- </view>
|
|
|
- <view class="money">
|
|
|
- {{ nowmoney | getMoneyStyle }}
|
|
|
- </view>
|
|
|
+ <view class="font">当前余额</view>
|
|
|
+ <view class="money">{{ nowmoney | getMoneyStyle }}</view>
|
|
|
</view>
|
|
|
<view class="row-box">
|
|
|
<view class="title">充值金额</view>
|
|
@@ -16,9 +12,7 @@
|
|
|
</view>
|
|
|
<view class="xian"></view>
|
|
|
<view class="moneyBtn-box">
|
|
|
- <view class="moneyBtn" v-for="(item,index) in moneyList" :class="{'current' : choose == index}" :key="index" @click="changemoney(item,index)">
|
|
|
- {{ item }}元
|
|
|
- </view>
|
|
|
+ <view class="moneyBtn" v-for="(item, index) in moneyList" :class="{ current: choose == index }" :key="index" @click="changemoney(item, index)">{{ item }}元</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
@@ -30,24 +24,31 @@
|
|
|
<view class="icon iconfont iconweixin1"></view>
|
|
|
<view class="title-box">
|
|
|
<view class="title"><text>微信充值</text></view>
|
|
|
-
|
|
|
</view>
|
|
|
<view class="right"><radio value="weixin" color="#6EAB4E" :checked="type == 'weixin'" /></view>
|
|
|
</view>
|
|
|
</label>
|
|
|
<!-- #endif -->
|
|
|
- <!-- <label>
|
|
|
+ <!-- #ifdef APP-PLUS -->
|
|
|
+ <label>
|
|
|
<view class="box">
|
|
|
- <view class="icon iconfont"><image class="yongjing" src="http://xmpt.liuniu946.com/img/yongjing.png"></image></view>
|
|
|
+ <view class="icon iconfont iconweixin1"></view>
|
|
|
<view class="title-box">
|
|
|
- <view class="title"><text>佣金充值</text></view>
|
|
|
- <view class="node">可用佣金¥{{ yongMoney }}</view>
|
|
|
-
|
|
|
+ <view class="title"><text>微信充值</text></view>
|
|
|
</view>
|
|
|
- <view class="right"><radio value="yongjing" color=" #5dbc7c" :checked="type == 'yongjing'" /></view>
|
|
|
+ <view class="right"><radio value="weixin" color="#6EAB4E" :checked="type == 'weixin'" /></view>
|
|
|
</view>
|
|
|
- </label> -->
|
|
|
-
|
|
|
+ </label>
|
|
|
+ <label>
|
|
|
+ <view class="box">
|
|
|
+ <view class="icon iconfont iconzhifubao"></view>
|
|
|
+ <view class="title-box">
|
|
|
+ <view class="title"><text>支付宝充值</text></view>
|
|
|
+ </view>
|
|
|
+ <view class="right"><radio value="ali" color="#6EAB4E" :checked="type == 'ali'" /></view>
|
|
|
+ </view>
|
|
|
+ </label>
|
|
|
+ <!-- #endif -->
|
|
|
</radio-group>
|
|
|
</view>
|
|
|
<button class="add-btn up" :class="{ 'active-bg': payLoding }" @click="!payLoding ? confirm() : ''">确认充值</button>
|
|
@@ -55,18 +56,19 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-
|
|
|
import { getMoneyStyle } from '@/utils/rocessor.js';
|
|
|
-import { userBalance,extractBank } from '@/api/wallet.js'
|
|
|
+import { userBalance, extractBank } from '@/api/wallet.js';
|
|
|
// #ifdef H5
|
|
|
import { rechargeWechat } from '@/api/wallet.js';
|
|
|
// #endif
|
|
|
// #ifdef MP
|
|
|
import { rechargeRoutine } from '@/api/wallet.js';
|
|
|
// #endif
|
|
|
+// #ifdef APP-PLUS
|
|
|
+import { rechargeApp,rechargeAli } from '@/api/wallet.js';
|
|
|
+// #endif
|
|
|
import { mapState } from 'vuex';
|
|
|
// #ifdef H5
|
|
|
-
|
|
|
import weixinObj from '@/plugin/jweixin-module/index.js';
|
|
|
// #endif
|
|
|
export default {
|
|
@@ -81,30 +83,29 @@ export default {
|
|
|
// #endif
|
|
|
// #ifdef APP-PLUS
|
|
|
typeText: 1,
|
|
|
- type: 'yongjing',
|
|
|
+ type: 'ali',
|
|
|
// #endif
|
|
|
money: '', //充值金额
|
|
|
payLoding: false, //是否加载中
|
|
|
- moneyList: [300,200,150,100,50],
|
|
|
+ moneyList: [300, 200, 150, 100, 50],
|
|
|
nowmoney: '',
|
|
|
choose: -1,
|
|
|
- yongMoney:'',
|
|
|
+ yongMoney: ''
|
|
|
};
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
const obj = this;
|
|
|
- if(options.type == '1'){
|
|
|
- obj.type = 'yongjing',
|
|
|
- obj.typeText = 1
|
|
|
+ if (options.type == '1') {
|
|
|
+ (obj.type = 'ali'), (obj.typeText = 1);
|
|
|
}
|
|
|
},
|
|
|
onShow() {
|
|
|
userBalance({}).then(({ data }) => {
|
|
|
- console.log(data)
|
|
|
+ console.log(data);
|
|
|
this.nowmoney = data.now_money;
|
|
|
});
|
|
|
extractBank({}).then(({ data }) => {
|
|
|
- this.yongMoney = (data.commissionCount*1).toFixed(2);//累积佣金
|
|
|
+ this.yongMoney = (data.commissionCount * 1).toFixed(2); //累积佣金
|
|
|
});
|
|
|
},
|
|
|
computed: {
|
|
@@ -121,39 +122,36 @@ export default {
|
|
|
},
|
|
|
// 切换选中对象
|
|
|
tabRadio(e) {
|
|
|
- console.log(e)
|
|
|
- if ( e.detail.value == 'weixin' ) {
|
|
|
- this.typeText = 0
|
|
|
- }
|
|
|
- else {
|
|
|
- this.typeText = 1
|
|
|
+ console.log(e);
|
|
|
+ if (e.detail.value == 'weixin') {
|
|
|
+ this.typeText = 0;
|
|
|
+ } else {
|
|
|
+ console.log(12346)
|
|
|
+ this.typeText = 1;
|
|
|
}
|
|
|
- this.type = e;
|
|
|
- console.log(this.typeText);
|
|
|
+ this.type = e.detail.value;
|
|
|
},
|
|
|
// 提交
|
|
|
confirm() {
|
|
|
let obj = this;
|
|
|
obj.payLoding = true;
|
|
|
- if( obj.money == ''){
|
|
|
+ if (obj.money == '') {
|
|
|
obj.$api.msg('请输入充值金额');
|
|
|
obj.payLoding = false;
|
|
|
return;
|
|
|
}
|
|
|
- if( obj.type == 'yongjin' && obj.money > parseInt(obj.yongMoney) ) {
|
|
|
+ if (obj.type == 'yongjin' && obj.money > parseInt(obj.yongMoney)) {
|
|
|
obj.$api.msg('佣金不足');
|
|
|
obj.payLoding = false;
|
|
|
return;
|
|
|
}
|
|
|
// #ifdef H5
|
|
|
- // rechargeWechat({ price: this.money, from: this.type })
|
|
|
- rechargeWechat({ price: this.money, from: 'weixin',
|
|
|
- type: this.typeText})
|
|
|
+ rechargeWechat({ price: this.money, from: 'weixin', type: this.typeText })
|
|
|
.then(e => {
|
|
|
- console.log(e)
|
|
|
- if ( obj.type == 'weixin' ){
|
|
|
+ console.log(e);
|
|
|
+ if (obj.type == 'weixin') {
|
|
|
let da = e.data.data;
|
|
|
- console.log(weixinObj,"weixin")
|
|
|
+ console.log(weixinObj, 'weixin');
|
|
|
weixinObj.chooseWXPay({
|
|
|
timestamp: da.timestamp,
|
|
|
nonceStr: da.nonceStr,
|
|
@@ -161,20 +159,18 @@ export default {
|
|
|
signType: da.signType,
|
|
|
paySign: da.paySign,
|
|
|
success: function(res) {
|
|
|
-
|
|
|
uni.showToast({
|
|
|
title: '充值成功',
|
|
|
duration: 2000,
|
|
|
position: 'top'
|
|
|
});
|
|
|
-
|
|
|
}
|
|
|
});
|
|
|
obj.payLoding = false;
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
uni.navigateTo({
|
|
|
url: '/pages/money/rechargeSuccess'
|
|
|
- })
|
|
|
+ });
|
|
|
obj.payLoding = false;
|
|
|
console.log(e, '佣金');
|
|
|
}
|
|
@@ -185,23 +181,22 @@ export default {
|
|
|
});
|
|
|
// #endif
|
|
|
// #ifdef MP
|
|
|
- rechargeRoutine({ price: this.money})
|
|
|
+ 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.redirectTo({
|
|
|
- url: '/pages/money/paySuccess'
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- })
|
|
|
-
|
|
|
+ wx.requestPayment({
|
|
|
+ timeStamp: da.timestamp,
|
|
|
+ nonceStr: da.nonceStr,
|
|
|
+ package: da.package,
|
|
|
+ signType: da.signType,
|
|
|
+ paySign: da.paySign,
|
|
|
+ success: function(res) {
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '/pages/money/paySuccess'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
obj.payLoding = false;
|
|
|
})
|
|
|
.catch(e => {
|
|
@@ -209,6 +204,62 @@ export default {
|
|
|
console.log(e);
|
|
|
});
|
|
|
// #endif
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ console.log(this.money)
|
|
|
+ if(this.typeText == 0){
|
|
|
+ rechargeApp({ price: this.money })
|
|
|
+ .then(e => {
|
|
|
+ let da = e.data;
|
|
|
+ let data = {
|
|
|
+ appid:da.appid,
|
|
|
+ noncestr: da.noncestr,
|
|
|
+ package: da.package,
|
|
|
+ partnerid:da.partnerid,
|
|
|
+ prepayid:da.prepayid,
|
|
|
+ timestamp: da.timestamp,
|
|
|
+ sign:da.sign
|
|
|
+ };
|
|
|
+ uni.requestPayment({
|
|
|
+ provider: 'wxpay',
|
|
|
+ orderInfo: data,
|
|
|
+ success(res) {
|
|
|
+ console.log(res)
|
|
|
+ },
|
|
|
+ fail(res) {
|
|
|
+ console.log("微信掉起失败")
|
|
|
+ console.log(res,'失败')
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ obj.payLoding = false;
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ obj.payLoding = false;
|
|
|
+ console.log(e);
|
|
|
+ });
|
|
|
+ }else {
|
|
|
+ rechargeAli({ price: this.money }).then(e =>{
|
|
|
+ console.log(e, 'url');
|
|
|
+ const url = e.msg;
|
|
|
+ uni.requestPayment({
|
|
|
+ provider: 'alipay',
|
|
|
+ orderInfo: url,
|
|
|
+ success: res => {
|
|
|
+ console.log(res);
|
|
|
+ uni.showToast({
|
|
|
+ title: '支付成功',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ },
|
|
|
+ fail: e => {
|
|
|
+ console.log(e);
|
|
|
+ },
|
|
|
+ complete: () => {}
|
|
|
+ });
|
|
|
+ obj.payLoding = false;
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // #endif
|
|
|
},
|
|
|
//获取订单列表
|
|
|
loadData(source) {
|
|
@@ -237,9 +288,9 @@ export default {
|
|
|
navItem.loadingType = 'more';
|
|
|
}, 600);
|
|
|
},
|
|
|
- changemoney(item,index){
|
|
|
+ changemoney(item, index) {
|
|
|
this.choose = index;
|
|
|
- this.money = item
|
|
|
+ this.money = item;
|
|
|
}
|
|
|
}
|
|
|
};
|
|
@@ -255,7 +306,7 @@ page {
|
|
|
color: $base-color;
|
|
|
}
|
|
|
&.up {
|
|
|
- background: #6EAB4E;
|
|
|
+ background: #6eab4e;
|
|
|
color: #fff;
|
|
|
}
|
|
|
display: flex;
|
|
@@ -306,7 +357,7 @@ page {
|
|
|
.xian {
|
|
|
width: 700rpx;
|
|
|
height: 1rpx;
|
|
|
- background: #E6E6E6;
|
|
|
+ background: #e6e6e6;
|
|
|
margin-bottom: 16rpx;
|
|
|
}
|
|
|
.moneyBtn-box {
|
|
@@ -317,7 +368,7 @@ page {
|
|
|
margin-right: 30rpx;
|
|
|
width: 210rpx;
|
|
|
height: 70rpx;
|
|
|
- background: #F0F0F0;
|
|
|
+ background: #f0f0f0;
|
|
|
border-radius: 4px;
|
|
|
margin-top: 30rpx;
|
|
|
text-align: center;
|
|
@@ -342,7 +393,6 @@ page {
|
|
|
.yongjing {
|
|
|
width: 48rpx;
|
|
|
height: 48rpx;
|
|
|
-
|
|
|
}
|
|
|
.iconweixin1 {
|
|
|
color: #18bf16;
|
|
@@ -376,22 +426,22 @@ page {
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
padding: 30rpx 48rpx 30rpx 26rpx;
|
|
|
- background: #FFFFFF;
|
|
|
- .font{
|
|
|
+ background: #ffffff;
|
|
|
+ .font {
|
|
|
font-size: 28rpx;
|
|
|
font-family: PingFang SC;
|
|
|
font-weight: 500;
|
|
|
color: #333333;
|
|
|
}
|
|
|
- .money{
|
|
|
+ .money {
|
|
|
font-size: 30rpx;
|
|
|
font-family: PingFang SC;
|
|
|
font-weight: bold;
|
|
|
- color: #EF041F;
|
|
|
+ color: #ef041f;
|
|
|
}
|
|
|
}
|
|
|
.current {
|
|
|
- background: #6EAB4E !important;
|
|
|
+ background: #6eab4e !important;
|
|
|
color: #fff !important;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|