|
|
@@ -1,538 +1,666 @@
|
|
|
-<template>
|
|
|
- <view :style="viewColor">
|
|
|
- <form @submit="submitSub" report-submit='true'>
|
|
|
- <view class="payment-top acea-row row-column row-center-wrapper">
|
|
|
- <span class="name">我的余额</span>
|
|
|
- <view class="pic">
|
|
|
- ¥<span class="pic-font">{{ userinfo.now_money || 0 }}</span>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="payment">
|
|
|
- <view class="nav acea-row row-around row-middle">
|
|
|
- <view class="item" :class="active==index?'on':''" v-for="(item,index) in navRecharge" :key="index" @click="navRecharges(index)">{{item}}</view>
|
|
|
- </view>
|
|
|
-
|
|
|
- <view class='tip picList' v-if='!active'>
|
|
|
- <view class="pic-box pic-box-color acea-row row-center-wrapper row-column" :class="activePic == index ? 'pic-box-color-active' : ''"
|
|
|
- v-for="(item, index) in picList" :key="index" @click="picCharge(index, item)">
|
|
|
- <view class="pic-number-pic">
|
|
|
- {{ item.data.price }}<span class="pic-number"> 元</span>
|
|
|
- </view>
|
|
|
- <view class="pic-number">赠送:{{ item.data.give }} 元</view>
|
|
|
- </view>
|
|
|
- <view class="pic-box pic-box-color acea-row row-center-wrapper" :class="rechar_id == 0 ? 'pic-box-color-active' : ''"
|
|
|
- @click="picCharge(picList.length)">
|
|
|
- <input type="number" :placeholder="otherValue" v-model="money" class="pic-box-money pic-number-pic" :class="rechar_id == 0 ? 'pic-box-color-active' : ''" />
|
|
|
- </view>
|
|
|
- <view class="tips-box">
|
|
|
- <view class="tips mt-30">注意事项:</view>
|
|
|
- <view class="tips-samll" v-for="item in rechargeAttention" :key="item">
|
|
|
- {{ item }}
|
|
|
- </view>
|
|
|
- </view>
|
|
|
-
|
|
|
- </view>
|
|
|
- <view class="tip" v-else>
|
|
|
- <view class='input'><text>¥</text><input placeholder="0.00" type='number' placeholder-class='placeholder' :value="number"
|
|
|
- name="number"></input></view>
|
|
|
- <view class="tips-title">
|
|
|
- <view style="font-weight: bold; font-size: 26rpx;">提示:</view>
|
|
|
- <view style="margin-top: 10rpx;">当前佣金为 <text class='t-color'>¥{{userinfo.brokerage_price || 0}}</text></view>
|
|
|
- </view>
|
|
|
- <view class="tips-box">
|
|
|
- <view class="tips mt-30">注意事项:</view>
|
|
|
- <view class="tips-samll" v-for="item in rechargeAttention" :key="item">
|
|
|
- {{ item }}
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <button class='but' formType="submit"> {{active ? '立即转入': '立即充值' }}</button>
|
|
|
- </view>
|
|
|
- </form>
|
|
|
- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
|
|
|
- </view>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script>
|
|
|
- // +----------------------------------------------------------------------
|
|
|
- // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
|
|
- // +----------------------------------------------------------------------
|
|
|
- // | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
|
|
- // +----------------------------------------------------------------------
|
|
|
- // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
|
|
- // +----------------------------------------------------------------------
|
|
|
- // | Author: CRMEB Team <admin@crmeb.com>
|
|
|
- // +----------------------------------------------------------------------
|
|
|
- import {
|
|
|
- spreadInfo,
|
|
|
- rechargeRoutine,
|
|
|
- rechargeWechat,
|
|
|
- getRechargeApi,
|
|
|
- rechargeBrokerage
|
|
|
- } from '@/api/user.js';
|
|
|
- import {
|
|
|
- mapGetters
|
|
|
- } from "vuex";
|
|
|
- import authorize from '@/components/Authorize';
|
|
|
- export default {
|
|
|
- components: {
|
|
|
- authorize
|
|
|
- },
|
|
|
- data() {
|
|
|
- let that = this;
|
|
|
- return {
|
|
|
- otherValue: '其他',
|
|
|
- now_money: 0,
|
|
|
- navRecharge: ['账户充值', '佣金转入'],
|
|
|
- active: 0,
|
|
|
- number: '',
|
|
|
- userinfo: {},
|
|
|
- placeholder: "0.00",
|
|
|
- from: '',
|
|
|
- isAuto: false, //没有授权的不会自动授权
|
|
|
- isShowAuth: false, //是否隐藏授权
|
|
|
- picList: [],
|
|
|
- activePic: 0,
|
|
|
- money: "",
|
|
|
- numberPic: '',
|
|
|
- rechar_id: 0,
|
|
|
- rechargeAttention: []
|
|
|
- };
|
|
|
- },
|
|
|
- computed: mapGetters(['isLogin','viewColor']),
|
|
|
- onLoad(options) {
|
|
|
- // #ifdef H5
|
|
|
- this.from = this.$wechat.isWeixin() ? "weixin" : "h5"
|
|
|
- // #endif
|
|
|
- if (this.isLogin) {
|
|
|
- this.getUserInfo();
|
|
|
- this.getRecharge();
|
|
|
- } else {
|
|
|
- this.isAuto = true;
|
|
|
- this.isShowAuth = true
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
-
|
|
|
- /**
|
|
|
- * 选择金额
|
|
|
- */
|
|
|
- picCharge(idx, item) {
|
|
|
- this.activePic = idx;
|
|
|
- if (item === undefined) {
|
|
|
- this.rechar_id = 0;
|
|
|
- this.numberPic = "";
|
|
|
- this.otherValue = ''
|
|
|
- } else {
|
|
|
- this.otherValue = '其他'
|
|
|
- this.money = "";
|
|
|
- this.rechar_id = item.id;
|
|
|
- this.numberPic = item.data.price;
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 充值额度选择
|
|
|
- */
|
|
|
- getRecharge() {
|
|
|
- getRechargeApi()
|
|
|
- .then(res => {
|
|
|
- this.picList = res.data.recharge_quota;
|
|
|
- if (this.picList[0]) {
|
|
|
- this.rechar_id = this.picList[0].id;
|
|
|
- this.numberPic = this.picList[0].data.price;
|
|
|
- }
|
|
|
- this.rechargeAttention = res.data.recharge_attention || [];
|
|
|
- })
|
|
|
- .catch(res => {
|
|
|
- this.$dialog.toast({
|
|
|
- mes: res
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- onLoadFun: function() {
|
|
|
- this.isShowAuth = false;
|
|
|
- this.getUserInfo();
|
|
|
- this.getRecharge();
|
|
|
- },
|
|
|
- // 授权关闭
|
|
|
- authColse: function(e) {
|
|
|
- this.isShowAuth = e
|
|
|
- },
|
|
|
- navRecharges: function(index) {
|
|
|
- this.active = index;
|
|
|
- },
|
|
|
- /**
|
|
|
- * 获取用户信息
|
|
|
- */
|
|
|
- getUserInfo: function() {
|
|
|
- let that = this;
|
|
|
- spreadInfo().then(res => {
|
|
|
- that.$set(that, 'userinfo', res.data);
|
|
|
- })
|
|
|
- },
|
|
|
- /*
|
|
|
- * 用户充值
|
|
|
- */
|
|
|
- submitSub: function(e) {
|
|
|
- let that = this
|
|
|
- let value = e.detail.value.number;
|
|
|
- // 转入余额
|
|
|
- if (that.active) {
|
|
|
- if (parseFloat(value) < 0 || parseFloat(value) == NaN || value == undefined || value == "") {
|
|
|
- return that.$util.Tips({
|
|
|
- title: '请输入金额'
|
|
|
- });
|
|
|
+<template>
|
|
|
+ <view class="content">
|
|
|
+ <view class="top_box">
|
|
|
+ <text class="yue-tit">当前余额:</text>
|
|
|
+ <text class="yue-num">¥{{ now_money }}</text>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view class="line_box"></view>
|
|
|
+
|
|
|
+ <view class="cz_box">
|
|
|
+ <view class="cz_wrap">
|
|
|
+ <text class="cz_tit">¥</text>
|
|
|
+ <input class="cz_input" type="number" v-model="money" @focus="changeNum()" placeholder="请输入充值金额" placeholder-class="placeholder" />
|
|
|
+ </view>
|
|
|
+ <view class="zc_list_box">
|
|
|
+ <view class="zc_list_price" :class="{ seletPrice: seletNum == item.data.price }" @click="seletChange(item, index)" v-for="(item, index) in list" :key="index">
|
|
|
+ {{ item.data.price }}元
|
|
|
+ </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" @click.stop="changePayType('weixin')">
|
|
|
+ <view class="type-left">
|
|
|
+ <view class="icon iconfont iconweixin"></view>
|
|
|
+ <view class="tit">微信充值</view>
|
|
|
+ </view>
|
|
|
+ <view class="right" v-show="loaded"><radio value="weixin" color="#EB001C" :checked="type == 'weixin'" /></view>
|
|
|
+ </view> -->
|
|
|
+ <view class="cz-type" @click.stop="changePayType('alipay')">
|
|
|
+ <view class="type-left">
|
|
|
+ <view class="icon iconfont iconzhifubao"></view>
|
|
|
+ <view class="tit">支付宝充值</view>
|
|
|
+ </view>
|
|
|
+ <view class="right"><radio value="weixin" color="#EB001C" :checked="type == 'alipay'" /></view>
|
|
|
+ </view>
|
|
|
+ <button class="add-btn up" :class="{ 'active-bg': payLoding }" @click="!payLoding ? submitSub() : ''">立即充值</button>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+// +----------------------------------------------------------------------
|
|
|
+// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
|
|
+// +----------------------------------------------------------------------
|
|
|
+// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
|
|
+// +----------------------------------------------------------------------
|
|
|
+// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
|
|
+// +----------------------------------------------------------------------
|
|
|
+// | Author: CRMEB Team <admin@crmeb.com>
|
|
|
+// +----------------------------------------------------------------------
|
|
|
+import { spreadInfo, rechargeRoutine, rechargeWechat, getRechargeApi, rechargeBrokerage } from '@/api/user.js';
|
|
|
+import { mapGetters } from 'vuex';
|
|
|
+import authorize from '@/components/Authorize';
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ authorize
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ let that = this;
|
|
|
+ return {
|
|
|
+ type: 'alipay',
|
|
|
+ otherValue: '其他',
|
|
|
+ payLoding: false, //是否加载中
|
|
|
+ now_money: 0,
|
|
|
+ list: [{ data: { price: '' } }],
|
|
|
+ seletNum: '300', // 选中
|
|
|
+ navRecharge: ['账户充值', '佣金转入'],
|
|
|
+ active: 0,
|
|
|
+ number: '',
|
|
|
+ userinfo: {},
|
|
|
+ placeholder: '0.00',
|
|
|
+ from: '',
|
|
|
+ isAuto: false, //没有授权的不会自动授权
|
|
|
+ isShowAuth: false, //是否隐藏授权
|
|
|
+ picList: [],
|
|
|
+ activePic: 0,
|
|
|
+ money: '',
|
|
|
+ numberPic: '',
|
|
|
+ rechar_id: 0,
|
|
|
+ rechargeAttention: []
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: mapGetters(['isLogin', 'viewColor']),
|
|
|
+ onLoad(options) {
|
|
|
+ // #ifdef H5
|
|
|
+ this.from = this.$wechat.isWeixin() ? 'weixin' : 'h5';
|
|
|
+ // #endif
|
|
|
+ if (this.isLogin) {
|
|
|
+ this.getUserInfo();
|
|
|
+ this.getRecharge();
|
|
|
+ } else {
|
|
|
+ this.isAuto = true;
|
|
|
+ this.isShowAuth = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ //选择支付方式
|
|
|
+ changePayType(type) {
|
|
|
+ this.type = type;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 充值额度选择
|
|
|
+ */
|
|
|
+ getRecharge() {
|
|
|
+ getRechargeApi()
|
|
|
+ .then(res => {
|
|
|
+ console.log(res);
|
|
|
+ this.list = res.data.recharge_quota;
|
|
|
+ })
|
|
|
+ .catch(res => {
|
|
|
+ this.$dialog.toast({
|
|
|
+ mes: res
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ onLoadFun: function() {
|
|
|
+ this.isShowAuth = false;
|
|
|
+ this.getUserInfo();
|
|
|
+ this.getRecharge();
|
|
|
+ },
|
|
|
+ // 授权关闭
|
|
|
+ authColse: function(e) {
|
|
|
+ this.isShowAuth = e;
|
|
|
+ },
|
|
|
+ navRecharges: function(index) {
|
|
|
+ this.active = index;
|
|
|
+ },
|
|
|
+ seletChange(item, index) {
|
|
|
+ this.seletNum = item.data.price;
|
|
|
+ this.seletMoney = item.data.price;
|
|
|
+ this.money = item.data.price;
|
|
|
+ },
|
|
|
+ changeNum() {
|
|
|
+ this.seletNum = this.money = '';
|
|
|
+ console.log(this.seletNum, this.money);
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 获取用户信息
|
|
|
+ */
|
|
|
+ getUserInfo: function() {
|
|
|
+ let that = this;
|
|
|
+ spreadInfo().then(res => {
|
|
|
+ this.now_money = res.data.now_money;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /*
|
|
|
+ * 用户充值
|
|
|
+ */
|
|
|
+ submitSub: function(e) {
|
|
|
+ let that = this;
|
|
|
+ let value = this.money;
|
|
|
+ // 转入余额
|
|
|
+ if (that.active) {
|
|
|
+ if (parseFloat(value) < 0 || parseFloat(value) == NaN || value == undefined || value == '') {
|
|
|
+ return that.$util.Tips({
|
|
|
+ title: '请输入金额'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (parseFloat(value) > that.userinfo.brokerage_price) {
|
|
|
+ return that.$util.Tips({
|
|
|
+ title: '剩余可用佣金不足' + parseFloat(value)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ uni.showModal({
|
|
|
+ title: '转入余额',
|
|
|
+ content: '转入余额后无法再次转出,确认是否转入余额',
|
|
|
+ success(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ rechargeBrokerage({
|
|
|
+ brokerage: parseFloat(value)
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ // that.$set(that, 'userinfo.now_money', that.$util.$h.Add(value, that.userinfo.now_money))
|
|
|
+ return that.$util.Tips(
|
|
|
+ {
|
|
|
+ title: '转入成功',
|
|
|
+ icon: 'success'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ tab: 5,
|
|
|
+ url: '/pages/users/user_money/index'
|
|
|
+ }
|
|
|
+ );
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ return that.$util.Tips({
|
|
|
+ title: err
|
|
|
+ });
|
|
|
+ });
|
|
|
+ } else if (res.cancel) {
|
|
|
+ return that.$util.Tips({
|
|
|
+ title: '已取消'
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
- if(parseFloat(value) > that.userinfo.brokerage_price){
|
|
|
- return that.$util.Tips({
|
|
|
- title: '剩余可用佣金不足' + parseFloat(value)
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // uni.showLoading({
|
|
|
+ // title: '正在支付',
|
|
|
+ // mask: true
|
|
|
+ // });
|
|
|
+
|
|
|
+ if (this.rechar_id == 0) {
|
|
|
+ if (parseFloat(that.money) === 0) {
|
|
|
+ return that.$util.Tips({
|
|
|
+ title: '充值金额金额不能为0!'
|
|
|
});
|
|
|
- }
|
|
|
- uni.showModal({
|
|
|
- title: '转入余额',
|
|
|
- content: '转入余额后无法再次转出,确认是否转入余额',
|
|
|
- success(res) {
|
|
|
- if (res.confirm) {
|
|
|
- rechargeBrokerage({
|
|
|
- brokerage: parseFloat(value),
|
|
|
- }).then(res => {
|
|
|
- // that.$set(that, 'userinfo.now_money', that.$util.$h.Add(value, that.userinfo.now_money))
|
|
|
- return that.$util.Tips({
|
|
|
- title: '转入成功',
|
|
|
- icon: 'success'
|
|
|
- }, {
|
|
|
- tab: 5,
|
|
|
- url: '/pages/users/user_money/index'
|
|
|
- });
|
|
|
- }).catch(err => {
|
|
|
- return that.$util.Tips({
|
|
|
- title: err
|
|
|
- })
|
|
|
- });
|
|
|
- } else if (res.cancel) {
|
|
|
- return that.$util.Tips({
|
|
|
- title: '已取消'
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- })
|
|
|
-
|
|
|
- } else {
|
|
|
- uni.showLoading({
|
|
|
- title: '正在支付',
|
|
|
- mask:true
|
|
|
- })
|
|
|
-
|
|
|
- if (this.rechar_id == 0) {
|
|
|
- if (parseFloat(that.money)=== 0) {
|
|
|
- return that.$util.Tips({
|
|
|
- title: '充值金额金额不能为0!'
|
|
|
- });
|
|
|
- }
|
|
|
- if (!that.money) {
|
|
|
- return that.$util.Tips({
|
|
|
- title: '请填写充值金额!'
|
|
|
- });
|
|
|
- }
|
|
|
- if (!Number(that.money)) {
|
|
|
- return that.$util.Tips({
|
|
|
- title: '请填写正确的金额!'
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- // #ifdef MP
|
|
|
- // let money = parseFloat(this.money);
|
|
|
- rechargeWechat({
|
|
|
- price: that.rechar_id == 0 ? that.money : that.numberPic,
|
|
|
- type: 'routine',
|
|
|
- recharge_id: this.rechar_id
|
|
|
- }).then(res => {
|
|
|
- uni.hideLoading();
|
|
|
- let jsConfig = res.data.config;
|
|
|
- uni.requestPayment({
|
|
|
- timeStamp: jsConfig.timestamp,
|
|
|
- nonceStr: jsConfig.nonceStr,
|
|
|
- package: jsConfig.package,
|
|
|
- signType: jsConfig.signType,
|
|
|
- paySign: jsConfig.paySign,
|
|
|
- success: function(res) {
|
|
|
- that.$set(that, 'userinfo.now_money', that.$util.$h.Add(value, that.userinfo.now_money));
|
|
|
- return that.$util.Tips({
|
|
|
- title: '支付成功',
|
|
|
- icon: 'success'
|
|
|
- }, {
|
|
|
- tab: 5,
|
|
|
- url: '/pages/users/user_money/index'
|
|
|
- });
|
|
|
- },
|
|
|
- fail: function() {
|
|
|
- return that.$util.Tips({
|
|
|
- title: '支付失败'
|
|
|
- });
|
|
|
- },
|
|
|
- complete: function(res) {
|
|
|
- if (res.errMsg == 'requestPayment:cancel') return that.$util.Tips({
|
|
|
- title: '取消支付'
|
|
|
- });
|
|
|
- }
|
|
|
- })
|
|
|
- }).catch(err => {
|
|
|
- uni.hideLoading();
|
|
|
- return that.$util.Tips({
|
|
|
- title: err
|
|
|
- })
|
|
|
- });
|
|
|
- // #endif
|
|
|
- // #ifdef H5
|
|
|
- rechargeWechat({
|
|
|
- price: that.rechar_id == 0 ? that.money : that.numberPic,
|
|
|
- type: that.from,
|
|
|
- recharge_id: that.rechar_id
|
|
|
- }).then(res => {
|
|
|
- if(res.data.type== 'h5'){
|
|
|
- let host = window.location.protocol+"//"+window.location.host;
|
|
|
- let url = `${host}/pages/users/user_money/index`
|
|
|
- let eUrl = encodeURIComponent(url)
|
|
|
- let locations = `${res.data.config.mweb_url}&redirect_url=${eUrl}`
|
|
|
- setTimeout(() => {
|
|
|
- location.href = locations;
|
|
|
- }, 100);
|
|
|
- }else{
|
|
|
- uni.hideLoading();
|
|
|
- const jsConfig = res.data.config;
|
|
|
- jsConfig.timeStamp = jsConfig.timestamp;
|
|
|
- that.$wechat.pay(jsConfig).then(res => {
|
|
|
- that.$set(that, 'userinfo.now_money', that.$util.$h.Add(value, that.userinfo.now_money));
|
|
|
- return that.$util.Tips({
|
|
|
- title: '支付成功',
|
|
|
- icon: 'success'
|
|
|
- }, {
|
|
|
- tab: 5,
|
|
|
- url: '/pages/users/user_money/index'
|
|
|
- });
|
|
|
- }).catch(res => {
|
|
|
- if (res.errMsg == 'chooseWXPay:cancel') return that.$util.Tips({
|
|
|
- title: '取消支付'
|
|
|
- }, {
|
|
|
- tab: 5,
|
|
|
- url: goPages + '?status=0'
|
|
|
- });
|
|
|
- })
|
|
|
- }
|
|
|
- }).catch(error=>{
|
|
|
- return that.$util.Tips({
|
|
|
- title: error
|
|
|
- });
|
|
|
- })
|
|
|
- // #endif
|
|
|
- // #ifdef APP-PLUS
|
|
|
- rechargeWechat({
|
|
|
- price: that.rechar_id == 0 ? that.money : that.numberPic,
|
|
|
- recharge_id: that.rechar_id,
|
|
|
- type: 'weixin'
|
|
|
- }).then(res => {
|
|
|
- uni.hideLoading();
|
|
|
- uni.requestPayment({
|
|
|
- orderInfo: {
|
|
|
- ...res.data.config,
|
|
|
- timeStamp: res.data.config.timestamp,
|
|
|
- },
|
|
|
- provider: 'wxpay',
|
|
|
- success(res) {
|
|
|
- return that.$util.Tips({
|
|
|
- title: '支付成功',
|
|
|
- icon: 'success'
|
|
|
- }, {
|
|
|
- tab: 5,
|
|
|
- url: '/pages/users/user_money/index'
|
|
|
- });
|
|
|
- },
|
|
|
- fail: function(rej) {
|
|
|
- console.log(rej);
|
|
|
- return that.$util.Tips({
|
|
|
- title: '支付失败'
|
|
|
- });
|
|
|
- },
|
|
|
- complete: function(res) {
|
|
|
- if (res.errMsg == 'requestPayment:cancel') return that.$util.Tips({
|
|
|
- title: '取消支付'
|
|
|
- });
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
- // #endif
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-</script>
|
|
|
-
|
|
|
-<style lang="scss">
|
|
|
- page {
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- background-color: #fff;
|
|
|
- }
|
|
|
-
|
|
|
- .payment {
|
|
|
- position: relative;
|
|
|
- top: -60rpx;
|
|
|
- width: 100%;
|
|
|
- background-color: #fff;
|
|
|
- border-radius: 10rpx;
|
|
|
- padding-top: 25rpx;
|
|
|
- border-top-right-radius: 39rpx;
|
|
|
- border-top-left-radius: 39rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .payment .nav {
|
|
|
- height: 75rpx;
|
|
|
- line-height: 75rpx;
|
|
|
- padding: 0 100rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .payment .nav .item {
|
|
|
- font-size: 30rpx;
|
|
|
- color: #333;
|
|
|
- }
|
|
|
-
|
|
|
- .payment .nav .item.on {
|
|
|
- font-weight: bold;
|
|
|
- border-bottom: 4rpx solid var(--view-theme);
|
|
|
- }
|
|
|
- .t-color{color:var(--view-theme);}
|
|
|
- .payment .input {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
- border-bottom: 1px dashed #dddddd;
|
|
|
- margin: 60rpx auto 0 auto;
|
|
|
- padding-bottom: 20rpx;
|
|
|
- font-size: 56rpx;
|
|
|
- color: #333333;
|
|
|
- flex-wrap: nowrap;
|
|
|
- }
|
|
|
- .payment .input text {
|
|
|
- padding-left: 106rpx;
|
|
|
- }
|
|
|
- .payment .input input {
|
|
|
- padding-right: 106rpx;
|
|
|
- width: 300rpx;
|
|
|
- height: 94rpx;
|
|
|
- text-align: center;
|
|
|
- font-size: 70rpx;
|
|
|
- }
|
|
|
- .payment .placeholder {
|
|
|
- color: #d0d0d0;
|
|
|
- height: 100%;
|
|
|
- line-height: 94rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .payment .tip {
|
|
|
- font-size: 26rpx;
|
|
|
- color: #888888;
|
|
|
- padding: 0 30rpx;
|
|
|
- margin-top: 25rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .payment .but {
|
|
|
- color: #fff;
|
|
|
- font-size: 30rpx;
|
|
|
- width: 700rpx;
|
|
|
- height: 86rpx;
|
|
|
- border-radius: 50rpx;
|
|
|
- margin: 46rpx auto 0 auto;
|
|
|
- line-height: 86rpx;
|
|
|
- background-color: var(--view-theme);
|
|
|
- }
|
|
|
-
|
|
|
- .payment-top {
|
|
|
- width: 100%;
|
|
|
- height: 350rpx;
|
|
|
- background-color: var(--view-theme);
|
|
|
-
|
|
|
- .name {
|
|
|
- font-size: 26rpx;
|
|
|
- color: rgba(255, 255, 255, 0.8);
|
|
|
- margin-top: -38rpx;
|
|
|
- margin-bottom: 30rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .pic {
|
|
|
- font-size: 32rpx;
|
|
|
- color: #fff;
|
|
|
- }
|
|
|
-
|
|
|
- .pic-font {
|
|
|
- font-size: 78rpx;
|
|
|
- color: #fff;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .picList {
|
|
|
- display: flex;
|
|
|
- flex-wrap: wrap;
|
|
|
- margin: 30rpx 0;
|
|
|
-
|
|
|
- .pic-box {
|
|
|
- width: 32%;
|
|
|
- height: auto;
|
|
|
- border-radius: 20rpx;
|
|
|
- margin-top: 21rpx;
|
|
|
- padding: 20rpx 0;
|
|
|
- margin-right: 12rpx;
|
|
|
-
|
|
|
- &:nth-child(3n) {
|
|
|
- margin-right: 0;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .pic-box-color {
|
|
|
- background-color: #f4f4f4;
|
|
|
- color: #656565;
|
|
|
- }
|
|
|
-
|
|
|
- .pic-number {
|
|
|
- font-size: 22rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .pic-number-pic {
|
|
|
- font-size: 38rpx;
|
|
|
- margin-right: 10rpx;
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
-
|
|
|
- .pic-box-color-active {
|
|
|
- background-color: var(--view-theme);
|
|
|
- color: #fff;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .tips-box {
|
|
|
- .tips {
|
|
|
- font-size: 28rpx;
|
|
|
- color: #333333;
|
|
|
- font-weight: 800;
|
|
|
- margin-bottom: 14rpx;
|
|
|
- margin-top: 20rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .tips-samll {
|
|
|
- font-size: 24rpx;
|
|
|
- color: #333333;
|
|
|
- margin-bottom: 14rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .tip-box {
|
|
|
- margin-top: 30rpx;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .tips-title {
|
|
|
- margin-top: 20rpx;
|
|
|
- font-size: 24rpx;
|
|
|
- color: #333;
|
|
|
- }
|
|
|
-</style>
|
|
|
+ }
|
|
|
+ if (!that.money) {
|
|
|
+ return that.$util.Tips({
|
|
|
+ title: '请填写充值金额!'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (!Number(that.money)) {
|
|
|
+ return that.$util.Tips({
|
|
|
+ title: '请填写正确的金额!'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ that.payLoding = true;
|
|
|
+ // #ifdef MP
|
|
|
+ // let money = parseFloat(this.money);
|
|
|
+ rechargeWechat({
|
|
|
+ price: that.rechar_id == 0 ? that.money : that.numberPic,
|
|
|
+ type: 'routine',
|
|
|
+ recharge_id: this.rechar_id
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ uni.hideLoading();
|
|
|
+ let jsConfig = res.data.config;
|
|
|
+ uni.requestPayment({
|
|
|
+ timeStamp: jsConfig.timestamp,
|
|
|
+ nonceStr: jsConfig.nonceStr,
|
|
|
+ package: jsConfig.package,
|
|
|
+ signType: jsConfig.signType,
|
|
|
+ paySign: jsConfig.paySign,
|
|
|
+ success: function(res) {
|
|
|
+ that.$set(that, 'userinfo.now_money', that.$util.$h.Add(value, that.userinfo.now_money));
|
|
|
+ return that.$util.Tips(
|
|
|
+ {
|
|
|
+ title: '支付成功',
|
|
|
+ icon: 'success'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ tab: 5,
|
|
|
+ url: '/pages/users/user_money/index'
|
|
|
+ }
|
|
|
+ );
|
|
|
+ },
|
|
|
+ fail: function() {
|
|
|
+ return that.$util.Tips({
|
|
|
+ title: '支付失败'
|
|
|
+ });
|
|
|
+ },
|
|
|
+ complete: function(res) {
|
|
|
+ if (res.errMsg == 'requestPayment:cancel')
|
|
|
+ return that.$util.Tips({
|
|
|
+ title: '取消支付'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ uni.hideLoading();
|
|
|
+ return that.$util.Tips({
|
|
|
+ title: err
|
|
|
+ });
|
|
|
+ });
|
|
|
+ // #endif
|
|
|
+ // #ifdef H5
|
|
|
+ rechargeWechat({
|
|
|
+ price: that.rechar_id == 0 ? that.money : that.numberPic,
|
|
|
+ type: that.type,
|
|
|
+ recharge_id: that.rechar_id
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ console.log(res);
|
|
|
+ that.payLoding = false;
|
|
|
+ window.location.href = res.data.config.jsConfig.expend.pay_info;
|
|
|
+ // if (res.data.type == 'h5') {
|
|
|
+ // let host = window.location.protocol + '//' + window.location.host;
|
|
|
+ // let url = `${host}/pages/users/user_money/index`;
|
|
|
+ // let eUrl = encodeURIComponent(url);
|
|
|
+ // let locations = `${res.data.config.mweb_url}&redirect_url=${eUrl}`;
|
|
|
+ // setTimeout(() => {
|
|
|
+ // location.href = locations;
|
|
|
+ // }, 100);
|
|
|
+ // } else {
|
|
|
+ // uni.hideLoading();
|
|
|
+ // const jsConfig = res.data.config;
|
|
|
+ // jsConfig.timeStamp = jsConfig.timestamp;
|
|
|
+ // that.$wechat
|
|
|
+ // .pay(jsConfig)
|
|
|
+ // .then(res => {
|
|
|
+ // that.$set(that, 'userinfo.now_money', that.$util.$h.Add(value, that.userinfo.now_money));
|
|
|
+ // return that.$util.Tips(
|
|
|
+ // {
|
|
|
+ // title: '支付成功',
|
|
|
+ // icon: 'success'
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // tab: 5,
|
|
|
+ // url: '/pages/users/user_money/index'
|
|
|
+ // }
|
|
|
+ // );
|
|
|
+ // })
|
|
|
+ // .catch(res => {
|
|
|
+ // if (res.errMsg == 'chooseWXPay:cancel')
|
|
|
+ // return that.$util.Tips(
|
|
|
+ // {
|
|
|
+ // title: '取消支付'
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // tab: 5,
|
|
|
+ // url: goPages + '?status=0'
|
|
|
+ // }
|
|
|
+ // );
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ that.payLoding = false;
|
|
|
+ return that.$util.Tips({
|
|
|
+ title: error
|
|
|
+ });
|
|
|
+ });
|
|
|
+ // #endif
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ rechargeWechat({
|
|
|
+ price: that.rechar_id == 0 ? that.money : that.numberPic,
|
|
|
+ recharge_id: that.rechar_id,
|
|
|
+ type: 'weixin'
|
|
|
+ }).then(res => {
|
|
|
+ uni.hideLoading();
|
|
|
+ uni.requestPayment({
|
|
|
+ orderInfo: {
|
|
|
+ ...res.data.config,
|
|
|
+ timeStamp: res.data.config.timestamp
|
|
|
+ },
|
|
|
+ provider: 'wxpay',
|
|
|
+ success(res) {
|
|
|
+ return that.$util.Tips(
|
|
|
+ {
|
|
|
+ title: '支付成功',
|
|
|
+ icon: 'success'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ tab: 5,
|
|
|
+ url: '/pages/users/user_money/index'
|
|
|
+ }
|
|
|
+ );
|
|
|
+ },
|
|
|
+ fail: function(rej) {
|
|
|
+ console.log(rej);
|
|
|
+ return that.$util.Tips({
|
|
|
+ title: '支付失败'
|
|
|
+ });
|
|
|
+ },
|
|
|
+ complete: function(res) {
|
|
|
+ if (res.errMsg == 'requestPayment:cancel')
|
|
|
+ return that.$util.Tips({
|
|
|
+ title: '取消支付'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ // #endif
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+page {
|
|
|
+ height: 100%;
|
|
|
+ background: #ffffff;
|
|
|
+}
|
|
|
+.top_box {
|
|
|
+ padding: 20rpx 26rpx 20rpx 47rpx;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ .yue-tit {
|
|
|
+ font-size: 28rpx;
|
|
|
+ font-family: PingFang SC;
|
|
|
+ font-weight: 500;
|
|
|
+ color: #333333;
|
|
|
+ }
|
|
|
+ .yue-num {
|
|
|
+ font-size: 30rpx;
|
|
|
+ font-family: PingFang SC;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #ff6f0f;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.line_box {
|
|
|
+ width: 100%;
|
|
|
+ height: 20rpx;
|
|
|
+ background: #f8f8f8;
|
|
|
+}
|
|
|
+.cz_box {
|
|
|
+ padding: 40rpx 20rpx 20rpx;
|
|
|
+ .cz_wrap {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding-bottom: 20rpx;
|
|
|
+ border-bottom: 1px solid #e6e6e6;
|
|
|
+ .cz_tit {
|
|
|
+ font-size: 32rpx;
|
|
|
+ font-family: PingFang SC;
|
|
|
+ font-weight: 500;
|
|
|
+ }
|
|
|
+ .cz_input {
|
|
|
+ text-align: right;
|
|
|
+ font-size: 32rpx;
|
|
|
+ font-family: PingFang SC;
|
|
|
+ font-weight: 500;
|
|
|
+ // color: #BFBFBF;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .zc_list_box {
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ .zc_list_price {
|
|
|
+ width: 202rpx;
|
|
|
+ height: 60rpx;
|
|
|
+ background: #f0f0f0;
|
|
|
+ border-radius: 8rpx;
|
|
|
+ margin-top: 36rpx;
|
|
|
+ margin-right: 50rpx;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ &:nth-child(3n) {
|
|
|
+ margin-right: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .seletPrice {
|
|
|
+ background: linear-gradient(143.2747deg, #ff6a00, #ee0979);
|
|
|
+ color: #ffffff;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.recha-box {
|
|
|
+ padding: 50rpx 30rpx 0;
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ .recha-frame {
|
|
|
+ width: 210rpx;
|
|
|
+ height: 181rpx;
|
|
|
+ border: 1px solid #dbdede;
|
|
|
+ border-radius: 20rpx;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: center;
|
|
|
+ margin-right: 30rpx;
|
|
|
+ margin-bottom: 30rpx;
|
|
|
+ &:nth-child(3n) {
|
|
|
+ margin-right: 0;
|
|
|
+ }
|
|
|
+ .recha-top {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ .recha-img {
|
|
|
+ width: 64rpx;
|
|
|
+ height: 62rpx;
|
|
|
+ }
|
|
|
+ .recha-tit {
|
|
|
+ margin-left: 10rpx;
|
|
|
+ font-size: 36rpx;
|
|
|
+ font-family: PingFang SC;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #333333;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .recha-song {
|
|
|
+ margin-top: 20rpx;
|
|
|
+ font-size: $font-base;
|
|
|
+ font-family: PingFang SC;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #ff9900;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .select-frame {
|
|
|
+ border: 1px solid #ef041f;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.rechar-box {
|
|
|
+ padding: 30rpx 20rpx 0;
|
|
|
+ .rechar-title {
|
|
|
+ font-size: 32rpx;
|
|
|
+ font-family: PingFang SC;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #333333;
|
|
|
+ margin-bottom: 10rpx;
|
|
|
+ }
|
|
|
+ .rechar-text {
|
|
|
+ font-size: 28rpx;
|
|
|
+ font-family: PingFang SC;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #333333;
|
|
|
+ }
|
|
|
+}
|
|
|
+.cz-type {
|
|
|
+ margin-top: 22rpx;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding: 32rpx;
|
|
|
+ align-items: center;
|
|
|
+ .type-left {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ .icon {
|
|
|
+ height: 38rpx;
|
|
|
+ image {
|
|
|
+ width: 48rpx;
|
|
|
+ height: 38rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .iconweixin {
|
|
|
+ color: #36cb59;
|
|
|
+ }
|
|
|
+ .tit {
|
|
|
+ margin-left: 12rpx;
|
|
|
+ font-size: 30rpx;
|
|
|
+ color: #333333;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .type-right {
|
|
|
+ image {
|
|
|
+ width: 36rpx;
|
|
|
+ height: 36rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.add-btn {
|
|
|
+ &.modified {
|
|
|
+ }
|
|
|
+ &.up {
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+ margin: 100rpx auto 0;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ width: 604rpx;
|
|
|
+ height: 90rpx;
|
|
|
+ // border: 2rpx solid #F21F5D;
|
|
|
+ border-radius: 10rpx;
|
|
|
+ font-size: 36rpx;
|
|
|
+ font-family: PingFang SC;
|
|
|
+ font-weight: 500;
|
|
|
+ color: #fff;
|
|
|
+ line-height: 90rpx;
|
|
|
+ text-align: center;
|
|
|
+ background-color: #ff4c4c;
|
|
|
+}
|
|
|
+.row-box {
|
|
|
+ margin-top: 30rpx;
|
|
|
+ padding: 20rpx 30rpx;
|
|
|
+ background: #fff;
|
|
|
+ .title {
|
|
|
+ font-size: $font-base + 2rpx;
|
|
|
+ color: $font-color-dark;
|
|
|
+ }
|
|
|
+ .row {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ position: relative;
|
|
|
+ height: 80rpx;
|
|
|
+ .tit {
|
|
|
+ flex-shrink: 0;
|
|
|
+ width: 40rpx;
|
|
|
+ font-size: 30rpx;
|
|
|
+ color: $font-color-dark;
|
|
|
+ }
|
|
|
+ .input {
|
|
|
+ flex: 1;
|
|
|
+ font-size: 30rpx;
|
|
|
+ color: $font-color-dark;
|
|
|
+ }
|
|
|
+ .iconlocation {
|
|
|
+ font-size: 36rpx;
|
|
|
+ color: $font-color-light;
|
|
|
+ }
|
|
|
+
|
|
|
+ .buttom {
|
|
|
+ color: $font-color;
|
|
|
+ font-size: $font-base;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.list {
|
|
|
+ padding-left: 30rpx;
|
|
|
+ margin-top: 30rpx;
|
|
|
+ background-color: #ffffff;
|
|
|
+ .box {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ width: 100%;
|
|
|
+ height: 120rpx;
|
|
|
+ border-bottom: 1px solid $border-color-light;
|
|
|
+ padding-right: 25rpx;
|
|
|
+ .icon {
|
|
|
+ font-size: 48rpx;
|
|
|
+ padding-right: 20rpx;
|
|
|
+ display: flex;
|
|
|
+ }
|
|
|
+ .yongjing {
|
|
|
+ width: 48rpx;
|
|
|
+ height: 48rpx;
|
|
|
+ }
|
|
|
+ .iconweixin1 {
|
|
|
+ color: #18bf16;
|
|
|
+ }
|
|
|
+ .iconzhifubao {
|
|
|
+ color: #08aaec;
|
|
|
+ }
|
|
|
+ .title-box {
|
|
|
+ flex-grow: 1;
|
|
|
+ text-align: left;
|
|
|
+ .title {
|
|
|
+ font-size: $font-base + 2rpx;
|
|
|
+ color: $font-color-base;
|
|
|
+ }
|
|
|
+ .node {
|
|
|
+ font-size: $font-sm;
|
|
|
+ color: $font-color-light;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+/deep/ .uni-radio-input {
|
|
|
+ width: 45rpx;
|
|
|
+ height: 45rpx;
|
|
|
+}
|
|
|
+
|
|
|
+.active-bg {
|
|
|
+ background: #999 !important;
|
|
|
+ color: #ffffff !important;
|
|
|
+}
|
|
|
+.iconzhifubao {
|
|
|
+ color: #08aaec;
|
|
|
+}
|
|
|
+</style>
|