123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600 |
- <template>
- <view class="content">
- <view class="top_box">
- <text class="yue-tit">当前余额:</text>
- <!-- | parseFloatNum -->
- <text class="yue-num">{{ (now_money*1).toFixed(3)}}USDT</text>
- </view>
- <view class="line_box"></view>
- <view class="cz_box">
- <view class="cz_wrap">
- <text class="cz_tit">USDT</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 }" @click="seletChange(item, index)"
- v-for="(item, index) in list" :key="index">
- {{ item}}USDT
- </view>
- </view>
- </view>
- <view class="line_box"></view>
- <button class="add-btn up" @click="!payLoding ? confirm() : ''">立即充值</button>
- <view class="curtain" :class="{'ishiden':isHiden}" @touchmove.stop.prevent="moveHandle">
- <view class="psw-wrapper">
- <view class="psw-title">请输入支付密码</view>
- <input type="password" v-model="password" class="psw-ipt" />
- <view class="psw-btn">
- <text @click="cancel">取消</text>
- <text class="psw-qd" @click="pswQd">确定</text>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- miningDateils,
- buyMining,
- mymining,
- charge
- } from '@/api/calculation.js';
- import {
- recharge,
- wallet
- } from '@/api/finance.js';
- import {
- getMoneyStyle
- } from '@/utils/rocessor.js';
- // import { rechargeWechat, rechargeIndex } from '@/api/wallet.js';
- // import { rechargeWechat, rechargeRoutine, rechargeIndex } from '@/api/wallet.js';
- import {
- mapState
- } from 'vuex';
- // import { spreadCommission, userBalance,moneyChong } from '@/api/wallet.js';
- export default {
- // filters: {
- // getMoneyStyle,
- // // 去处小数点后的0
- // parseFloatNum(clock) {
- // return parseFloat(clock);
- // }
- // },
- data() {
- return {
-
- password:'',
- type: 'weixin',
- money: '', //充值金额
- payLoding: false, //是否加载中
- isHiden: true,//是否显示
- list: [
- "300",
- "200",
- "150",
- "100",
- "50"
- ],
- now_money: '',
- seletNum: '300', // 选中
- zhuyi: [],
- quota: '', // 送的钱
- typeText: 0, // 0-微信 1-佣金
- };
- },
- onLoad(options) {
- this.loadData();
- },
- onShow() {
- this.loadData();
- },
- computed: {
- // #ifdef H5
- // ...mapState(['weichatObj', 'userInfo'])
- // #endif
- // #ifdef MP
- ...mapState(['userInfo'])
- // #endif
- },
- methods: {
- pswQd() {
- let obj = this;
- if (obj.password === '') {
- obj.$api.msg('请输入交易密码!');
- return
- }
- obj.isHiden = true
- console.log(obj.id ,'131',obj.num,'12',obj.password);
- charge({
- trade_psw: obj.password,
- num:obj.money
- }
- )
- .then(data => {
- obj.$api.msg(data.msg);
- obj.password = '';
- obj.num = 1;
- setTimeout(function() {
- uni.navigateTo({
- url: '/pages/user/charge'
- });
- }, 1500);
- })
- .catch(e => {
- obj.password = '';
- obj.num = 1;
- if (e.msg == '交易密码错误') {
- return;
- }
- console.log(e);
- var reg = new RegExp('购买矿机所需的');
- if (e.msg.match(reg) == -1) {} else {
- setTimeout(function() {
- uni.navigateTo({
- url: '/pages/finance/recharge'
- });
- }, 1500);
- }
- });
- },
- cancel() {
- this.password = ''
- this.isHiden = true
- },
- buy() {
- this.isHiden = false
- },
- // 跳转
- navTo(url) {
- uni.navigateTo({
- url: url
- });
- },
- changeNum() {
- this.seletNum = this.money = '';
- console.log(this.seletNum, this.money);
- },
- seletChange(item, index) {
- this.seletNum = item;
- this.seletMoney = item;
- this.money = item
- },
- // 切换选中对象
- // tabRadio(e) {
- // this.type = e.detail.value;
- // if (e.detail.value == 'weixin') {
- // this.typeText = 0
- // } else {
- // this.typeText = 1
- // }
- // },
- // 充值金额
- rechargeXuan(item) {
- this.money = item.price;
- this.quota = item.quota;
- },
- // loadData() {
- // moneyChong({}).then(({
- // data
- // }) => {
- // console.log(data, "123456789");
- // this.list = data.recharge_quota;
- // });
- // userBalance({}).then(({
- // data
- // }) => {
- // this.now_money = data.now_money;
- // });
- // },
- //获取余额
- loadData() {
- let obj = this
- wallet().then(res => {
- console.log(res, 'da2');
- obj.now_money = res.data.back.USDT.money.money
- })
- },
- // 提交
- confirm() {
- //是否输入金额,如不是提示充值金额
-
- let obj = this;
- obj.isHiden = false
- obj.payLoding = true;
- if (!obj.money) {
- obj.$api.msg('请输入金额');
- obj.payLoding = false;
- return;
- }
- },
- }
- };
- </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, #fff, #f3f3f3);
- background: #141E47;
- border: 3rpx solid #141E47;
- 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: #FFFFFF;
- background: #141E47;
- }
- margin-top: 100rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- width: 604rpx;
- height: 90rpx;
- border: 2rpx solid #FFFFFF;
- border-radius: 10rpx;
- font-size: 36rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #F21F5D;
- line-height: 90rpx;
- text-align: center;
- }
- .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: linear-gradient(143.2747deg, #ff6a00, #ee0979) !important;
- color: #FFFFFF !important;
- }
-
- .curtain {
- position: fixed;
- width: 100%;
- height: 100%;
- top: 0;
- background-color: rgba($color: #000000, $alpha: 0.2);
-
- .psw-wrapper {
- position: fixed;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -100%);
- width: 548.6rpx;
- height: 344.4rpx;
- background-color: #FFFFFF;
- border-radius: 15rpx 15rpx;
-
- .psw-title {
- width: 100%;
- font-size: 35rpx;
- padding: 43rpx 0 49rpx;
- text-align: center;
- font-weight: 800;
- }
-
- .psw-ipt {
- display: block;
- background-color: #dce3ed;
- height: 90rpx;
- width: 464rpx;
- padding-left: 30rpx;
- margin: 0 auto;
- font-size: 80rpx;
- }
-
- .psw-btn text {
- display: inline-block;
- text-align: center;
- width: 50%;
- padding-top: 29rpx;
- font-size: 35rpx;
- }
-
- .psw-qd {
- color: #5771DF;
- }
- }
- }
- .ishiden {
- display: none;
- }
- </style>
|