|
|
@@ -0,0 +1,488 @@
|
|
|
+<template>
|
|
|
+ <view class="content" :class="['qn-page-' + theme]">
|
|
|
+ <view class="now">
|
|
|
+ <view>当前余额:</view>
|
|
|
+ <view class="now-money">¥{{Number(userInfo.memberBalance) || 0 }}</view>
|
|
|
+ </view>
|
|
|
+ <view class="main-jg"></view>
|
|
|
+ <view class="add-wrapper">
|
|
|
+ <view class="add-box">
|
|
|
+ <view class="add-log">¥</view>
|
|
|
+ <input type="text" v-model="money" placeholder="请输入充值金额" placeholder-class="place"
|
|
|
+ @keyup="clearNoNum()" />
|
|
|
+ </view>
|
|
|
+ <view class="jg" style="height: 1px; background-color: #E6E6E6;"></view>
|
|
|
+ <view class="add-tags">
|
|
|
+ <view class="tag" v-for="(item, index) in addTags" :key="item" @click="tagClick(index)"
|
|
|
+ :class="{ 'primary-lg': currentIndex === index && money == addTags[index].money }">
|
|
|
+ <view class="">
|
|
|
+ <text>{{ item.money }}</text>
|
|
|
+ 元
|
|
|
+ </view>
|
|
|
+ <view class="give">
|
|
|
+ 赠送:<text>{{ item.give }}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="main-jg"></view>
|
|
|
+ <button class="add-btn up primary-lg" :class="{ 'active-bg': payLoding }"
|
|
|
+ @click="!payLoding ? confirm() : ''">立即充值</button>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import {
|
|
|
+ mapState
|
|
|
+ } from 'vuex';
|
|
|
+
|
|
|
+ export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ userInfo: {},
|
|
|
+ type: 'weixin',
|
|
|
+ money: '', //充值金额
|
|
|
+ payLoding: false, //是否加载中
|
|
|
+ addTags: [],
|
|
|
+ currentIndex: 0,
|
|
|
+ addMoney: 0,
|
|
|
+ isSect: false, //是否选择微信充值
|
|
|
+ new_money: 0,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ onLoad(options) {
|
|
|
+ this.getCustomerInfo()
|
|
|
+ this.getRechargeList()
|
|
|
+ },
|
|
|
+ computed: {},
|
|
|
+ methods: {
|
|
|
+ getCustomerInfo() {
|
|
|
+ this.$u.api.getCustomerInfo().then(({
|
|
|
+ data
|
|
|
+ }) => {
|
|
|
+ console.log(data);
|
|
|
+ this.userInfo = data;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getRechargeList() {
|
|
|
+ this.$u.api.getRechargeList({
|
|
|
+ page: 1,
|
|
|
+ pageSize: 100
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res);
|
|
|
+ this.addTags = res.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 跳转
|
|
|
+ navTo(url) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: url
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 切换选中对象
|
|
|
+ tabRadio(e) {
|
|
|
+ this.type = e;
|
|
|
+ },
|
|
|
+ // 提交
|
|
|
+ confirm() {
|
|
|
+ let obj = this;
|
|
|
+ if (this.money == 0) {
|
|
|
+ return this.$api.msg('请输入充值金额');
|
|
|
+ }
|
|
|
+ obj.payLoding = true;
|
|
|
+ obj.$u.api.recharge({
|
|
|
+ // price: this.money
|
|
|
+ request_id: obj.userInfo.id,
|
|
|
+ pay_type: 1,
|
|
|
+ money: obj.money,
|
|
|
+ source: obj.$common.source()
|
|
|
+ })
|
|
|
+ .then(e => {
|
|
|
+ let da = e.data.data;
|
|
|
+ console.log(da,'da');
|
|
|
+ try{
|
|
|
+ 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?isshow=false'
|
|
|
+ // });
|
|
|
+ uni.showToast({
|
|
|
+ title: '充值成功'
|
|
|
+ });
|
|
|
+ setTimeout(()=> {
|
|
|
+ uni.navigateBack()
|
|
|
+ })
|
|
|
+ },fail(e) {
|
|
|
+ console.log(e);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }catch(e){
|
|
|
+ console.log(e,'e');
|
|
|
+ //TODO handle the exception
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ obj.payLoding = false;
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ obj.payLoding = false;
|
|
|
+ console.log(e);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //获取订单列表
|
|
|
+ loadData(source) {
|
|
|
+ console.log(source);
|
|
|
+ //这里是将订单挂载到tab列表下
|
|
|
+ let index = this.tabCurrentIndex;
|
|
|
+ let navItem = this.navList[index];
|
|
|
+ let state = navItem.state;
|
|
|
+ if (source === 'tabChange' && navItem.loaded === true) {
|
|
|
+ //tab切换只有第一次需要加载数据
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (navItem.loadingType === 'loading') {
|
|
|
+ //防止重复加载
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ navItem.loadingType = 'loading';
|
|
|
+ setTimeout(() => {
|
|
|
+ let orderList = [];
|
|
|
+ orderList.forEach(item => {
|
|
|
+ navItem.orderList.push(item);
|
|
|
+ });
|
|
|
+ //loaded新字段用于表示数据加载完毕,如果为空可以显示空白页
|
|
|
+ this.$set(navItem, 'loaded', true);
|
|
|
+ //判断是否还有数据, 有改为 more, 没有改为noMore
|
|
|
+ navItem.loadingType = 'more';
|
|
|
+ }, 600);
|
|
|
+ },
|
|
|
+ tagClick(index) {
|
|
|
+ this.currentIndex = index;
|
|
|
+ this.money = this.addTags[index].money;
|
|
|
+ },
|
|
|
+ clearNoNum() {
|
|
|
+ this.money = this.money.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3');
|
|
|
+ // switch (this.money) {
|
|
|
+ // case '300':
|
|
|
+ // this.currentIndex = 0;
|
|
|
+ // break;
|
|
|
+ // case '200':
|
|
|
+ // this.currentIndex = 1;
|
|
|
+ // break;
|
|
|
+ // case '150':
|
|
|
+ // this.currentIndex = 2;
|
|
|
+ // break;
|
|
|
+ // case '100':
|
|
|
+ // this.currentIndex = 3;
|
|
|
+ // break;
|
|
|
+ // case '50':
|
|
|
+ // this.currentIndex = 4;
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ // let item = this.addTags.find(item=> {
|
|
|
+ // return item.money == this.money
|
|
|
+ // })
|
|
|
+ this.addTags.forEach((item, index) => {
|
|
|
+ if (item.money * 1 == this.money * 1) {
|
|
|
+ this.currentIndex = index
|
|
|
+ console.log(this.currentIndex);
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+ btnClick() {
|
|
|
+ this.isSect = !this.isSect
|
|
|
+ },
|
|
|
+ userBalance() {
|
|
|
+ userBalance().then(res => {
|
|
|
+ this.new_money = res.data.now_money
|
|
|
+ console.log(res)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+ page {
|
|
|
+ height: 100%;
|
|
|
+ background-color: #fff;
|
|
|
+ }
|
|
|
+
|
|
|
+ .add-btn {
|
|
|
+ &.modified {
|
|
|
+ color: $base-color;
|
|
|
+ }
|
|
|
+
|
|
|
+ &.up {
|
|
|
+ background-color: $base-color;
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ width: 604rpx;
|
|
|
+ height: 90rpx;
|
|
|
+ margin: 0 auto;
|
|
|
+ margin-top: 30rpx;
|
|
|
+ font-size: $font-lg;
|
|
|
+ border-radius: 10rpx;
|
|
|
+ // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
|
|
|
+ }
|
|
|
+
|
|
|
+ .row-box {
|
|
|
+ margin-top: 30rpx;
|
|
|
+ padding: 20rpx 30rpx;
|
|
|
+ background: #fff;
|
|
|
+
|
|
|
+ .title {
|
|
|
+ font-size: 28rpx;
|
|
|
+ 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;
|
|
|
+
|
|
|
+ .icon {
|
|
|
+ font-size: 48rpx;
|
|
|
+ padding-right: 20rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .iconweixin1 {
|
|
|
+ color: #18bf16;
|
|
|
+ }
|
|
|
+
|
|
|
+ .iconzhifubao {
|
|
|
+ color: #08aaec;
|
|
|
+ }
|
|
|
+
|
|
|
+ .title-box {
|
|
|
+ flex-grow: 1;
|
|
|
+ text-align: left;
|
|
|
+
|
|
|
+ .title {
|
|
|
+ font-size: $font-base + 2upx;
|
|
|
+ color: $font-color-base;
|
|
|
+ }
|
|
|
+
|
|
|
+ .node {
|
|
|
+ font-size: $font-sm;
|
|
|
+ color: $font-color-light;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /deep/ .uni-radio-input {
|
|
|
+ width: 45rpx;
|
|
|
+ height: 45rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .active-bg {
|
|
|
+ background-color: red !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ .now {
|
|
|
+ width: 100%;
|
|
|
+ height: 86rpx;
|
|
|
+ padding: 0 26rpx 0 47rpx;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ line-height: 86rpx;
|
|
|
+ background-color: #fff;
|
|
|
+ // margin-bottom: 21rpx;
|
|
|
+
|
|
|
+ view {
|
|
|
+ font-size: 28rpx;
|
|
|
+ font-weight: 500;
|
|
|
+ color: #333333;
|
|
|
+ }
|
|
|
+
|
|
|
+ .now-money {
|
|
|
+ font-size: 32rpx;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .add-wrapper {
|
|
|
+ width: 750rpx;
|
|
|
+ height: 338rpx;
|
|
|
+ padding-left: 30rpx;
|
|
|
+ background: #ffffff;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ // margin-bottom: 22rpx;
|
|
|
+ .add-box {
|
|
|
+ width: 100%;
|
|
|
+ height: 103rpx;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding: 0 39rpx 0 10rpx;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ .add-log {
|
|
|
+ font-size: 37rpx;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+
|
|
|
+ input {
|
|
|
+ width: 218rpx;
|
|
|
+ height: 30rpx;
|
|
|
+ font-size: 32rpx;
|
|
|
+ font-weight: 500;
|
|
|
+ color: #000;
|
|
|
+ line-height: 40px;
|
|
|
+ text-align: right;
|
|
|
+
|
|
|
+ .place {
|
|
|
+ color: #bfbfbf;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .jg {
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+
|
|
|
+ .add-tags {
|
|
|
+ // height: 234rpx;
|
|
|
+ padding-top: 47rpx;
|
|
|
+ padding-bottom: 17rpx;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ flex-wrap: wrap;
|
|
|
+
|
|
|
+ // justify-content: space-between;
|
|
|
+ .tag {
|
|
|
+ width: 210rpx;
|
|
|
+ // height: 140rpx;
|
|
|
+ padding-top: 10rpx;
|
|
|
+ padding-bottom: 10rpx;
|
|
|
+ background-color: #f0f0f0;
|
|
|
+ border-radius: 4rpx;
|
|
|
+ margin: 0 30rpx 30rpx 0;
|
|
|
+ text-align: center;
|
|
|
+ // line-height: 70rpx;
|
|
|
+ font-size: 22rpx;
|
|
|
+
|
|
|
+ text {
|
|
|
+ font-size: 32rpx;
|
|
|
+ font-weight: 500;
|
|
|
+ }
|
|
|
+
|
|
|
+ .give {
|
|
|
+ font-size: 24rpx;
|
|
|
+
|
|
|
+ text {
|
|
|
+ font-size: 24rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .action {
|
|
|
+ color: #fff;
|
|
|
+ background-color: #901b21;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .btn-wrapper {
|
|
|
+ padding: 49rpx 32rpx 0 40rpx;
|
|
|
+ height: 183rpx;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ background-color: #fff;
|
|
|
+
|
|
|
+ .iconweixin1 {
|
|
|
+ color: #18bf16;
|
|
|
+ font-size: 48rpx;
|
|
|
+ display: flex;
|
|
|
+
|
|
|
+ view {
|
|
|
+ // display: inline-block;
|
|
|
+ height: 48rpx;
|
|
|
+ text-align: 48rpx;
|
|
|
+ padding-left: 20rpx;
|
|
|
+ // padding-top: 10rpx;
|
|
|
+ color: #000000;
|
|
|
+ font-size: 30rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .btn {
|
|
|
+ width: 36rpx;
|
|
|
+ height: 36rpx;
|
|
|
+ border: 4rpx #901b21 solid;
|
|
|
+ border-radius: 8rpx 8rpx;
|
|
|
+
|
|
|
+ image {
|
|
|
+ // display: none;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+
|
|
|
+ .action {
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .actiont {
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .main-jg {
|
|
|
+ width: 100%;
|
|
|
+ height: 21rpx;
|
|
|
+ background-color: #f8f6f6;
|
|
|
+ }
|
|
|
+</style>
|