123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485 |
- <template>
- <view class="content">
- <view class="top_box">
- <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>
- <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.price }" @click="seletChange(item, index)" v-for="(item, index) in list" :key="index">
- {{ item.price | parseFloatNum }}元
- </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="type-left">
- <view class="icon iconfont iconweixin"></view>
- <view class="tit">微信充值</view>
- </view>
- <view class="right"><radio value="weixin" color=" #EB001C" :checked="type == 'weixin'" /></view>
- </view>
- <button class="add-btn up" :class="{ 'active-bg': payLoding }" @click="!payLoding ? confirm() : ''">立即充值</button>
- </view>
- </template>
- <script>
- import { getMoneyStyle } from '@/utils/rocessor.js';
- // #ifdef H5
- import { rechargeWechat, rechargeIndex } from '@/api/wallet.js';
- // #endif
- // #ifdef MP
- import { rechargeWechat, rechargeRoutine, rechargeIndex } from '@/api/wallet.js';
- // #endif
- import { mapState } from 'vuex';
- import { spreadCommission, userBalance,moneyChong } from '@/api/wallet.js';
- export default {
- filters: {
- getMoneyStyle,
- // 去处小数点后的0
- parseFloatNum(clock) {
- return parseFloat(clock);
- }
- },
- data() {
- return {
- type: 'weixin',
- money: '', //充值金额
- payLoding: false ,//是否加载中
- list: [
- '300',
- '200',
- '150',
- '100',
- '50'
- ],
- now_money:'',
- seletNum: '300', // 选中
- zhuyi: [],
- quota: '', // 送的钱
- typeText: 0, // 0-微信 1-佣金
- };
- },
- onLoad(options) {
- this.loadData();
- },
- computed: {
- // #ifdef H5
- ...mapState(['weichatObj', 'userInfo'])
- // #endif
- // #ifdef MP
- ...mapState(['userInfo'])
- // #endif
- },
- methods: {
- // 跳转
- navTo(url) {
- uni.navigateTo({
- url: url
- });
- },
- changeNum() {
- this.seletNum = this.money = '';
- console.log(this.seletNum, this.money);
- },
- seletChange(item, index) {
- this.seletNum = item.price;
- this.seletMoney = item.price;
- this.money = item.price
- },
- // 切换选中对象
- 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;
- });
- },
- // 提交
- confirm() {
- let obj = this;
- obj.payLoding = true;
- if( !obj.money ) {
- obj.$api.msg('请输入金额');
- 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()
- }
- });
- }
- });
- obj.payLoding = false;
- })
- .catch(e => {
- obj.payLoding = false;
- console.log(e);
- });
- // #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
- },
- }
- };
- </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: #F21F5D;
- }
- margin-top: 100rpx;
- 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: #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;
- }
- </style>
|