充值
This commit is contained in:
		
							parent
							
								
									3f513f121a
								
							
						
					
					
						commit
						c43448f961
					
				@ -1,3 +1,3 @@
 | 
				
			|||||||
<view class="yuetitle">
 | 
					<view class="yuetitle">
 | 
				
			||||||
    累计消费
 | 
					    资产记录
 | 
				
			||||||
</view>
 | 
					</view>
 | 
				
			||||||
@ -18,6 +18,9 @@ Component({
 | 
				
			|||||||
   * 组件的方法列表
 | 
					   * 组件的方法列表
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
  methods: {
 | 
					  methods: {
 | 
				
			||||||
 | 
					    recharge(){
 | 
				
			||||||
 | 
					      console.log(234)
 | 
				
			||||||
 | 
					      this.triggerEvent('recharge')
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
				
			|||||||
@ -2,6 +2,6 @@
 | 
				
			|||||||
    <view class="all">总资产</view>
 | 
					    <view class="all">总资产</view>
 | 
				
			||||||
    <view class="money">
 | 
					    <view class="money">
 | 
				
			||||||
        <text>{{money}}</text>
 | 
					        <text>{{money}}</text>
 | 
				
			||||||
        <text class="chong">充值</text>
 | 
					        <text class="chong" bind:tap="recharge">充值</text>
 | 
				
			||||||
    </view>
 | 
					    </view>
 | 
				
			||||||
</view>
 | 
					</view>
 | 
				
			||||||
@ -9,7 +9,8 @@ Page({
 | 
				
			|||||||
        openid:"",
 | 
					        openid:"",
 | 
				
			||||||
        username:"",
 | 
					        username:"",
 | 
				
			||||||
        img:"",
 | 
					        img:"",
 | 
				
			||||||
        frozen_money:""
 | 
					        frozen_money:"",
 | 
				
			||||||
 | 
					        level:1
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -93,7 +94,8 @@ Page({
 | 
				
			|||||||
                this.setData({
 | 
					                this.setData({
 | 
				
			||||||
                    username:res.data.data.nick_name,
 | 
					                    username:res.data.data.nick_name,
 | 
				
			||||||
                    img:res.data.data.head_pic,
 | 
					                    img:res.data.data.head_pic,
 | 
				
			||||||
                    frozen_money:res.data.data.frozen_money
 | 
					                    frozen_money:res.data.data.frozen_money,
 | 
				
			||||||
 | 
					                    level:res.data.data.level
 | 
				
			||||||
                })
 | 
					                })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
				
			|||||||
@ -24,7 +24,7 @@
 | 
				
			|||||||
        </view>
 | 
					        </view>
 | 
				
			||||||
           <view class="option" bindtap="tomember">
 | 
					           <view class="option" bindtap="tomember">
 | 
				
			||||||
            <view>会员中心</view>
 | 
					            <view>会员中心</view>
 | 
				
			||||||
            <view><text style="font-size:28rpx;color:#999;">非会员 </text>></view>
 | 
					            <view><text style="font-size:28rpx;color:#999;">{{level == 2 ? "会员":"非会员"}} </text>></view>
 | 
				
			||||||
        </view>
 | 
					        </view>
 | 
				
			||||||
           <view class="option" bindtap="toyue">
 | 
					           <view class="option" bindtap="toyue">
 | 
				
			||||||
            <view>我的余额</view>
 | 
					            <view>我的余额</view>
 | 
				
			||||||
 | 
				
			|||||||
@ -1,17 +1,19 @@
 | 
				
			|||||||
import bin from "../../utils/bin"
 | 
					import bin from "../../utils/bin"
 | 
				
			||||||
Page({
 | 
					Page({
 | 
				
			||||||
  data: {
 | 
					  data: {
 | 
				
			||||||
    money:"",
 | 
					    money: "",
 | 
				
			||||||
    list:[]
 | 
					    list: [],
 | 
				
			||||||
 | 
					    number: 0,
 | 
				
			||||||
 | 
					    show:false
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  onLoad(a) {
 | 
					  onLoad(a) {
 | 
				
			||||||
    bin.request({
 | 
					    bin.request({
 | 
				
			||||||
      url:"User/validateOpenid"
 | 
					      url: "User/validateOpenid"
 | 
				
			||||||
    }).then((res)=>{
 | 
					    }).then((res) => {
 | 
				
			||||||
      console.log(res)
 | 
					      console.log(res)
 | 
				
			||||||
      if(res.data.code == 200){
 | 
					      if (res.data.code == 200) {
 | 
				
			||||||
        this.setData({
 | 
					        this.setData({
 | 
				
			||||||
          money : res.data.data.user_money
 | 
					          money: res.data.data.user_money
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
@ -19,20 +21,83 @@ Page({
 | 
				
			|||||||
      bin.request({
 | 
					      bin.request({
 | 
				
			||||||
        url: "User/account",
 | 
					        url: "User/account",
 | 
				
			||||||
        urldata: {
 | 
					        urldata: {
 | 
				
			||||||
          user_id : userid,
 | 
					          user_id: userid,
 | 
				
			||||||
          page:0
 | 
					          page: 0
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }).then((res)=>{
 | 
					      }).then((res) => {
 | 
				
			||||||
        console.log(res)
 | 
					        console.log(res)
 | 
				
			||||||
        for(let i in res.data.result){
 | 
					        for (let i in res.data.result) {
 | 
				
			||||||
          let linshi = res.data.result[i].change_time.split(" ")
 | 
					          let linshi = res.data.result[i].change_time.split(" ")
 | 
				
			||||||
          res.data.result[i].date = linshi[0]
 | 
					          res.data.result[i].date = linshi[0]
 | 
				
			||||||
          res.data.result[i].time = linshi[1]
 | 
					          res.data.result[i].time = linshi[1]
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        this.setData({
 | 
					        this.setData({
 | 
				
			||||||
          list:res.data.result
 | 
					          list: res.data.result
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  number(a) {
 | 
				
			||||||
 | 
					    console.log(a)
 | 
				
			||||||
 | 
					    this.setData({
 | 
				
			||||||
 | 
					      number: a.detail.value
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  recharge(){
 | 
				
			||||||
 | 
					    if(this.data.number == 0){
 | 
				
			||||||
 | 
					      wx.showToast({
 | 
				
			||||||
 | 
					        title:"请输入充值金额",
 | 
				
			||||||
 | 
					        icon:"none"
 | 
				
			||||||
 | 
					      })
 | 
				
			||||||
 | 
					    }else{
 | 
				
			||||||
 | 
					      bin.getuserid().then((id)=>{
 | 
				
			||||||
 | 
					        bin.request({
 | 
				
			||||||
 | 
					          url:"User/user_recharge",
 | 
				
			||||||
 | 
					          data:{
 | 
				
			||||||
 | 
					            user_id:id,
 | 
				
			||||||
 | 
					            account:this.data.number
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        }).then((res)=>{
 | 
				
			||||||
 | 
					          let t =this;
 | 
				
			||||||
 | 
					          console.log(res);
 | 
				
			||||||
 | 
					          wx.requestPayment({
 | 
				
			||||||
 | 
					            timeStamp:res.data.result.wdata.timeStamp + "",
 | 
				
			||||||
 | 
					            nonceStr:res.data.result.wdata.nonceStr,
 | 
				
			||||||
 | 
					            package:res.data.result.wdata.package,
 | 
				
			||||||
 | 
					            signType: res.data.result.wdata.signType,
 | 
				
			||||||
 | 
					            paySign:res.data.result.wdata.sign,
 | 
				
			||||||
 | 
					            success(res){
 | 
				
			||||||
 | 
					              // console.log(res)
 | 
				
			||||||
 | 
					              wx.showToast({
 | 
				
			||||||
 | 
					                title:"充值成功",
 | 
				
			||||||
 | 
					                icon:"none"
 | 
				
			||||||
 | 
					              })
 | 
				
			||||||
 | 
					              t.setData({
 | 
				
			||||||
 | 
					                show:false
 | 
				
			||||||
 | 
					              })
 | 
				
			||||||
 | 
					              t.onLoad()
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            fail(err){
 | 
				
			||||||
 | 
					              wx.showToast({
 | 
				
			||||||
 | 
					                title:"充值失败",
 | 
				
			||||||
 | 
					                icon:"none"
 | 
				
			||||||
 | 
					              })
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          })
 | 
				
			||||||
 | 
					        })
 | 
				
			||||||
 | 
					      })
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  showrecharge(){
 | 
				
			||||||
 | 
					    console.log(123)
 | 
				
			||||||
 | 
					    this.setData({
 | 
				
			||||||
 | 
					      show:true
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  onClose(){
 | 
				
			||||||
 | 
					    this.setData({
 | 
				
			||||||
 | 
					      show:false
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
@ -3,6 +3,7 @@
 | 
				
			|||||||
    "usingComponents": {
 | 
					    "usingComponents": {
 | 
				
			||||||
        "yuetop": "/components/yue/yuetop/yuetop",
 | 
					        "yuetop": "/components/yue/yuetop/yuetop",
 | 
				
			||||||
        "yuetitle": "/components/yue/yuetitle/yuetitle",
 | 
					        "yuetitle": "/components/yue/yuetitle/yuetitle",
 | 
				
			||||||
        "yuedetail": "/components/yue/yuedetail/yuedetail"
 | 
					        "yuedetail": "/components/yue/yuedetail/yuedetail",
 | 
				
			||||||
 | 
					        "van-popup": "/utils/dist/popup/index"
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -1,8 +1,35 @@
 | 
				
			|||||||
.yue {
 | 
					.yue {
 | 
				
			||||||
    .title {
 | 
					  .title {
 | 
				
			||||||
        margin-top: 40rpx
 | 
					    margin-top: 40rpx;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  .detail {
 | 
				
			||||||
 | 
					    margin-top: 41rpx;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  .recharge {
 | 
				
			||||||
 | 
					    width: 617rpx;
 | 
				
			||||||
 | 
					    height: 115rpx;
 | 
				
			||||||
 | 
					    display: flex;
 | 
				
			||||||
 | 
					    align-items: center;
 | 
				
			||||||
 | 
					    justify-content: center;
 | 
				
			||||||
 | 
					    >text{
 | 
				
			||||||
 | 
					        margin-right: 20rpx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    .detail {
 | 
					    >view{
 | 
				
			||||||
        margin-top: 41rpx;
 | 
					        padding-left: 25rpx;
 | 
				
			||||||
 | 
					        height: 52rpx;
 | 
				
			||||||
 | 
					        border-left: #eaeaea solid 1rpx;
 | 
				
			||||||
 | 
					        font-size: 26rpx;
 | 
				
			||||||
 | 
					        color: #09bb07;
 | 
				
			||||||
 | 
					        line-height: 52rpx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					    >input{
 | 
				
			||||||
 | 
					        width: 398rpx;
 | 
				
			||||||
 | 
					        height: 50rpx;
 | 
				
			||||||
 | 
					        font-size: 26rpx;
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,11 +1,18 @@
 | 
				
			|||||||
<view class="yue">
 | 
					<view class="yue">
 | 
				
			||||||
    <yuetop money="{{money}}"></yuetop>
 | 
					    <yuetop bindrecharge="showrecharge" money="{{money}}"></yuetop>
 | 
				
			||||||
    <view class="title">
 | 
					    <view class="title">
 | 
				
			||||||
        <yuetitle></yuetitle>
 | 
					        <yuetitle></yuetitle>
 | 
				
			||||||
    </view>
 | 
					    </view>
 | 
				
			||||||
    <view class="detail" wx:for="{{list}}" wx:key="{{index}}">
 | 
					    <view class="detail" wx:for="{{list}}" wx:key="{{index}}">
 | 
				
			||||||
        <yuedetail money="{{item.user_money}}" date="{{item.date}}" time="{{item.time}}"></yuedetail>
 | 
					        <yuedetail money="{{item.user_money}}" date="{{item.date}}" time="{{item.time}}"></yuedetail>
 | 
				
			||||||
    </view>
 | 
					    </view>
 | 
				
			||||||
 | 
					    <van-popup show="{{ show}}" bind:close="onClose" custom-style="border-radius:15rpx;">
 | 
				
			||||||
 | 
					        <view class="recharge">
 | 
				
			||||||
 | 
					            <text>¥</text>
 | 
				
			||||||
 | 
					            <input type="number" bindinput="number" />
 | 
				
			||||||
 | 
					            <view bind:tap="recharge">确定</view>
 | 
				
			||||||
 | 
					        </view>
 | 
				
			||||||
 | 
					    </van-popup>
 | 
				
			||||||
    <!-- <view class="detail">
 | 
					    <!-- <view class="detail">
 | 
				
			||||||
        <yuedetail></yuedetail>
 | 
					        <yuedetail></yuedetail>
 | 
				
			||||||
    </view>
 | 
					    </view>
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1 @@
 | 
				
			|||||||
.yue .title {
 | 
					.yue .title{margin-top:40rpx}.yue .detail{margin-top:41rpx}.yue .recharge{width:617rpx;height:115rpx;display:flex;align-items:center;justify-content:center}.yue .recharge>text{margin-right:20rpx}.yue .recharge>view{padding-left:25rpx;height:52rpx;border-left:#eaeaea solid 1rpx;font-size:26rpx;color:#09bb07;line-height:52rpx}.yue .recharge>input{width:398rpx;height:50rpx;font-size:26rpx}
 | 
				
			||||||
  margin-top: 40rpx;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.yue .detail {
 | 
					 | 
				
			||||||
  margin-top: 41rpx;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user