<template>
|
<view class="content">
|
<view class="header-card" v-if="!loading.page">
|
<view class="header-card-title">总饮水币</view>
|
<view class="header-card-number">{{userInfo.ysb}}</view>
|
<view class="header-card-illustrate" @click="$navTo('/pages/user/setup/documentDisplay?t=16&title=充值说明')">
|
<image class="illustrate-icon" src="/static/icon/icon_info_circle.png_white.png" mode="widthFix"></image>
|
<text class="illustrate-text">充值说明</text>
|
</view>
|
</view>
|
<view class="cell">
|
<view class="cell-item" v-for="(item,index) of list" :key="index">
|
<view class="cell-item-info">{{item.gold}}金币</view>
|
<button class="button cell-item-num" @click="topupHandle(item)">¥{{item.money}}</button>
|
</view>
|
</view>
|
<u-loading-page :loading="loading.page"></u-loading-page>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
loading:{
|
page:true
|
},
|
userInfo:{},
|
list:[],
|
page:1
|
};
|
},
|
onLoad() {
|
this.init()
|
},
|
methods:{
|
init(){
|
this.$apis.user.getUserInfo().then(res=>{
|
this.userInfo = res.data
|
})
|
this.$apis.user.getRechargeList({pageNum:this.page,pageSize:10,type:2}).then(res=>{
|
this.list = res.data
|
this.loading.page = false
|
})
|
},
|
async topupHandle(e){
|
this.$loading()
|
try {
|
let { data } = await this.$apis.user.recharge({id:e.id})
|
uni.login({
|
provider: 'weixin',
|
success: (e) => {
|
this.$apis.user.getPayInfoWx({type:3,OrderNum:data.order,code:e.code}).then(res=>{
|
uni.requestPayment({
|
...res.data,
|
success:ev=>{
|
this.$toast('支付成功')
|
this.init()
|
},
|
fail:err=>{
|
console.log(err);
|
if(err.errMsg == 'requestPayment:fail cancel'){
|
this.$toast('取消支付')
|
}else{
|
this.$toast('支付失败')
|
}
|
},
|
complete:()=>{
|
uni.hideLoading()
|
}
|
})
|
}).catch(e=>{
|
uni.hideLoading()
|
})
|
}
|
})
|
|
} catch (error) {
|
uni.hideLoading()
|
}
|
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
.content{
|
padding: 28rpx;
|
.header-card{
|
margin: 0 auto;
|
width: 694rpx;
|
height: 260rpx;
|
background: #FF2729;
|
border-radius: 20rpx;
|
// box-shadow: 4rpx 4rpx 12rpx rgba(0, 0, 0, 0.05);
|
padding: 19rpx;
|
display: flex;
|
flex-direction: column;
|
.header-card-title{
|
font-size: 27rpx;
|
color: #FFFFFF;
|
line-height: 27rpx;
|
text-align: left;
|
font-style: normal;
|
}
|
.header-card-number{
|
flex: 1;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
font-size: 58rpx;
|
color: #FFFFFF;
|
line-height: 58rpx;
|
}
|
.header-card-illustrate{
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
margin-bottom: 12rpx;
|
.illustrate-icon{
|
width: 27rpx;
|
}
|
.illustrate-text{
|
padding-left: 16rpx;
|
font-size: 24rpx;
|
color: #FFFFFF;
|
line-height: 24rpx;
|
}
|
}
|
}
|
.cell{
|
margin-top: 10rpx;
|
.cell-item{
|
height: 100rpx;
|
display: flex;
|
align-items: center;
|
border-bottom: 2rpx solid rgba(217, 217, 217, 0.4);
|
.cell-item-info{
|
flex: 1;
|
font-size: 31rpx;
|
color: #000000;
|
line-height: 42rpx;
|
}
|
.cell-item-num{
|
font-size: 27rpx;
|
color: #FF2729;
|
line-height: 27rpx;
|
width: 160rpx;
|
height: 58rpx;
|
border-radius: 29rpx;
|
border: 2rpx solid #FB282A;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
}
|
}
|
}
|
</style>
|