init project

This commit is contained in:
limqhz
2020-06-21 16:27:58 +08:00
commit e8fe10b5fb
178 changed files with 9964 additions and 0 deletions

171
pages/myAccount/index.js Normal file
View File

@@ -0,0 +1,171 @@
// pages/myAccount/index.js
const app = getApp();
import {
getCurrentPageUrl
} from './../../utils/util.js'
Page({
/**
* 页面的初始数据
*/
data: {
selectIndex: 0,
member: {},
recharges: [],
isWxLogin: false,
gohome: true,
isUnClick: false,
options: {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
this.setData({
options: options
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
this.getData();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
return {
title: '智慧云馆'
}
},
// 余额提现
pushWithdraw() {
wx.navigateTo({
url: '/pages/withdrawal/index?money=' + this.data.member.money,
})
},
// 我的账单
pushBills() {
wx.navigateTo({
url: '/pages/myBills/index',
})
},
// 选择充值金额
selectPrice(e) {
let index = e.currentTarget.dataset.index;
this.setData({
selectIndex: index
})
},
// 点击微信支付
clickBuy() {
if (this.data.isUnClick) {
return;
}
this.data.isUnClick = true;
app.$api.orderRecharge({
rechargeId: this.data.recharges[this.data.selectIndex].id
}).then(res => {
app.$pay.wxPay(res.pay).then(res => {
if (this.data.options.isPass == 1) {
wx.redirectTo({
url: '/pages/facialCapturing/index?isPass=' + 1,
})
} else {
this.getData();
this.data.isUnClick = false;
}
}, err => {
this.data.isUnClick = false;
})
}, err => {
if (err.data.err_code == 30022) {
this.setData({
isWxLogin: true,
})
}
this.data.isUnClick = false;
})
},
// 获取数据
getData() {
wx.showLoading({
title: '加载中...',
mask: true,
})
app.$api.recharges({}).then(res => {
this.setData({
member: res.member,
recharges: res.recharges
})
}, err => {});
},
// 取消授权登录
cancelDeleteDialog() {
this.setData({
isWxLogin: false
})
},
// 授权微信
getUserInfo(e) {
app.$pay.payWxLoing(e.detail).then(res => {
wx.showToast({
title: '绑定成功',
duration: 2000,
})
this.setData({
isWxLogin: false
})
}, err => {
this.setData({
isWxLogin: false
})
})
}
})

View File

@@ -0,0 +1,7 @@
{
"navigationBarTitleText": "我的账户",
"usingComponents": {
"header": "/component/header/header",
"confirm-dialog": "/component/confirmDialog/confirmDialog"
}
}

View File

@@ -0,0 +1,32 @@
<!--pages/myAccount/index.wxml-->
<header title="我的账户"></header>
<view class='container' wx:if="{{recharges.length > 0}}">
<view class='header'>
<view class='item' bindtap='pushWithdraw'>
<image src='../../images/2@3x.png' mode='aspectFit'></image>
<text>余额提现</text>
</view>
<view class='item'>
<text>¥{{member.money}}</text>
<text>当前余额</text>
</view>
<view class='item' bindtap='pushBills'>
<image src='../../images/1@3x.png' mode='aspectFit'></image>
<text>我的账单</text>
</view>
</view>
<view class='title'>快速充值</view>
<view class='list'>
<view class='cell {{selectIndex == index ? "isActive" : ""}}' wx:for="{{recharges}}" wx:key="{{index}}" data-index='{{index}}' bindtap='selectPrice'>
<view class='top'>
<text>¥</text>
<text>{{item.rechargeMoney}}</text>
</view>
<view class='bottom'>到账: ¥{{item.toMoney}}</view>
</view>
</view>
<view class='footer-btn' bindtap='clickBuy'>微信充值</view>
</view>
<confirm-dialog title="提示" message="请先绑定微信" confirmBtnTitle="绑定" isUserInfo="{{true}}" bindcancelselect="cancelDeleteDialog" bindgetuserinfo="getUserInfo" wx:if="{{isWxLogin}}"></confirm-dialog>

105
pages/myAccount/index.wxss Normal file
View File

@@ -0,0 +1,105 @@
/* pages/myAccount/index.wxss */
.container {
min-height: calc(100vh - 190rpx);
padding: 30rpx;
padding-top: 160rpx;
}
.header {
display: flex;
justify-content: space-around;
align-items: center;
height: 200rpx;
background: #1a191e;
border-radius: 20rpx;
}
.header .item {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 86rpx;
}
.header .item>image {
width: 42rpx;
height: 42rpx;
}
.header .item>text {
margin-top: 20rpx;
font-size: 24rpx;
line-height: 24rpx;
color: rgba(255, 255, 255, 0.6);
}
.header .item>text:first-child {
/* margin-top: -10rpx; */
color: #f3515c;
font-size: 36rpx;
line-height: 30rpx;
font-weight: bold;
}
.title {
margin-top: 50rpx;
margin-bottom: 40rpx;
color: #fff;
font-size: 24rpx;
line-height: 24rpx;
}
.list {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.list .cell {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: calc((100% - 88rpx)/ 3);
height: 140rpx;
margin-bottom: 20rpx;
border: 8rpx solid #3b3945;
border-radius: 16rpx;
color: rgba(255, 255, 255, 0.6);
}
.list .cell.isActive {
color: #ffda2e;
border-color: #ffda2e;
}
.list .cell .top>text:first-child {
font-size: 20rpx;
line-height: 20rpx;
}
.list .cell .top>text:last-child {
font-size: 32rpx;
font-weight: bold;
line-height: 32rpx;
}
.list .cell .bottom {
margin-top: 20rpx;
font-size: 24rpx;
line-height: 24rpx;
}
.footer-btn {
height: 80rpx;
margin: 100rpx;
margin-bottom: 0rpx;
background: #ffda2e;
color: #252330;
line-height: 80rpx;
text-align: center;
font-size: 30rpx;
border-radius: 40rpx;
}