This commit is contained in:
pplokijuhyg 2019-12-28 16:31:20 +08:00
parent 3f513f121a
commit c43448f961
10 changed files with 130 additions and 31 deletions

View File

@ -1,3 +1,3 @@
<view class="yuetitle">
累计消费
资产记录
</view>

View File

@ -18,6 +18,9 @@ Component({
* 组件的方法列表
*/
methods: {
recharge(){
console.log(234)
this.triggerEvent('recharge')
}
}
})

View File

@ -2,6 +2,6 @@
<view class="all">总资产</view>
<view class="money">
<text>{{money}}</text>
<text class="chong">充值</text>
<text class="chong" bind:tap="recharge">充值</text>
</view>
</view>

View File

@ -9,7 +9,8 @@ Page({
openid:"",
username:"",
img:"",
frozen_money:""
frozen_money:"",
level:1
},
/**
@ -93,7 +94,8 @@ Page({
this.setData({
username:res.data.data.nick_name,
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
})
}

View File

@ -24,7 +24,7 @@
</view>
<view class="option" bindtap="tomember">
<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 class="option" bindtap="toyue">
<view>我的余额</view>

View File

@ -2,7 +2,9 @@ import bin from "../../utils/bin"
Page({
data: {
money: "",
list:[]
list: [],
number: 0,
show:false
},
onLoad(a) {
bin.request({
@ -34,5 +36,68 @@ Page({
})
})
})
},
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
})
}
})

View File

@ -3,6 +3,7 @@
"usingComponents": {
"yuetop": "/components/yue/yuetop/yuetop",
"yuetitle": "/components/yue/yuetitle/yuetitle",
"yuedetail": "/components/yue/yuedetail/yuedetail"
"yuedetail": "/components/yue/yuedetail/yuedetail",
"van-popup": "/utils/dist/popup/index"
}
}

View File

@ -1,8 +1,35 @@
.yue {
.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;
}
>view{
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;
}
}
}

View File

@ -1,11 +1,18 @@
<view class="yue">
<yuetop money="{{money}}"></yuetop>
<yuetop bindrecharge="showrecharge" money="{{money}}"></yuetop>
<view class="title">
<yuetitle></yuetitle>
</view>
<view class="detail" wx:for="{{list}}" wx:key="{{index}}">
<yuedetail money="{{item.user_money}}" date="{{item.date}}" time="{{item.time}}"></yuedetail>
</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">
<yuedetail></yuedetail>
</view>

View File

@ -1,7 +1 @@
.yue .title {
margin-top: 40rpx;
}
.yue .detail {
margin-top: 41rpx;
}
.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}