提交 969d6a98 编写于 作者: D devil

微信小程序钱包开发

上级 215f3d95
......@@ -68,7 +68,7 @@ App({
// 请求地址
request_url: "{{request_url}}",
request_url: 'http://shopxo.com/',
request_url: 'https://dev.shopxo.net/',
// request_url: 'https://dev.shopxo.net/',
// 基础信息
application_title: "{{application_title}}",
......
{
"pages": [
"pages": ["pages/plugins/wallet/user/user",
"pages/index/index",
"pages/goods-category/goods-category",
"pages/cart/cart",
......
const app = getApp();
Page({
data: {
data_bottom_line_status: false,
data_list_loding_status: 1,
data_list_loding_msg: '',
data_base: null,
user_wallet: null,
submit_disabled_status: false,
// 导航
nav_list: [],
},
onLoad(params) { },
onShow() {
this.set_nav_list();
this.init();
},
init(e) {
var user = app.get_user_info(this, "init"),
self = this;
if (user != false) {
// 用户未绑定用户则转到登录页面
if (app.user_is_need_login(user)) {
wx.showModal({
title: '温馨提示',
content: '绑定手机号码',
confirmText: '确认',
cancelText: '暂不',
success: (result) => {
wx.stopPullDownRefresh();
if (result.confirm) {
wx.navigateTo({
url: "/pages/login/login?event_callback=init"
});
}
},
});
} else {
self.get_data();
}
}
},
// 导航
set_nav_list() {
var nav = [
{
icon: "/images/plugins/distribution/user-center-order-icon.png",
title: "账户明细",
url: "/pages/plugins/distribution/order/order",
},
{
icon: "/images/plugins/distribution/user-center-profit-icon.png",
title: "充值记录",
url: "/pages/plugins/distribution/profit/profit",
},
{
icon: "/images/plugins/distribution/user-center-team-icon.png",
title: "提现记录",
url: "/pages/plugins/distribution/team/team",
}
];
this.setData({ nav_list: nav});
},
// 获取数据
get_data() {
var self = this;
wx.request({
url: app.get_request_url("index", "user", "wallet"),
method: "POST",
data: {},
dataType: "json",
success: res => {
wx.hideLoading();
wx.stopPullDownRefresh();
if (res.data.code == 0) {
var data = res.data.data;
self.setData({
data_base: data.base || null,
user_wallet: data.user_wallet || null,
data_list_loding_msg: '',
data_list_loding_status: 0,
data_bottom_line_status: false,
});
} else {
self.setData({
data_bottom_line_status: false,
data_list_loding_status: 2,
data_list_loding_msg: res.data.msg,
});
if (app.is_login_check(res.data, self, 'get_data')) {
app.showToast(res.data.msg);
}
}
},
fail: () => {
wx.hideLoading();
wx.stopPullDownRefresh();
self.setData({
data_bottom_line_status: false,
data_list_loding_status: 2,
data_list_loding_msg: '服务器请求出错',
});
app.showToast("服务器请求出错");
}
});
},
// 下拉刷新
onPullDownRefresh() {
this.get_data();
},
});
\ No newline at end of file
{
"enablePullDownRefresh": true,
"navigationBarBackgroundColor": "#d2364c",
"backgroundColorTop": "#d2364c",
"backgroundColorBottom": "#f5f5f5",
"backgroundTextStyle": "light",
"navigationBarTitleText": "我的钱包"
}
\ No newline at end of file
<!-- 钱包信息 -->
<view class="wallet bg-white">
<view class="item normal oh">
<view class="fl cr-666 name">有效</view>
<view class="fl cr-main money single-text">{{user_wallet.normal_money || '0.00'}}</view>
<view class="fl cr-888 unit">元</view>
</view>
<view class="item frozen oh">
<view class="fl cr-666 name">冻结</view>
<view class="fl money single-text">{{user_wallet.frozen_money || '0.00'}}</view>
<view class="fl cr-888 unit">元</view>
</view>
<view class="item give oh">
<view class="fl cr-666 name">赠送</view>
<view class="fl money single-text">{{user_wallet.give_money || '0.00'}}</view>
<view class="fl cr-888 unit">元</view>
</view>
<view class="submit">
<navigator url="/pages/plugins/wallet/recharge/recharge" hover-class="none" class="fl">
<button size="mini" type="default" hover-class="none" class="submit-recharge">充值</button>
</navigator>
<navigator url="/pages/plugins/wallet/cash/cash" hover-class="none" class="fl">
<button size="mini" type="default" hover-class="none" class="submit-cash">提现</button>
</navigator>
</view>
</view>
<!-- 导航 -->
<view wx:if="{{nav_list.length > 0}}" class="nav spacing-mt oh bg-white">
<block wx:for="{{nav_list}}" wx:key="key">
<navigator url="{{item.url}}" hover-class="none">
<view class="item fl tc">
<image src="{{item.icon}}" mode="scaleToFill" class="dis-block" />
<view class="title">{{item.title}}</view>
</view>
</navigator>
</block>
</view>
\ No newline at end of file
/*
* 基础
*/
.wallet {
padding: 20rpx 10rpx;
position: relative;
}
.wallet .item {
line-height: 56rpx;
}
.wallet .money {
font-weight: 500;
font-size: 36rpx;
margin: 0 10rpx;
max-width: calc(100% - 110rpx);
}
.wallet .frozen .money {
color: #FF9800;
}
.wallet .give .money {
color: #333;
max-width: calc(100% - 360rpx);
}
.wallet .submit {
position: absolute;
right: 10rpx;
bottom: 10rpx;
}
.wallet .submit button {
font-size: 26rpx;
height: 55rpx;
line-height: 55rpx;
color: #fff;
padding: 0 20rpx;
}
.wallet .submit-recharge {
border: 1px solid #d2364c;
background-color: #d2364c;
}
.wallet .submit-cash {
border: 1px solid #5eb95e;
background-color: #5eb95e;
margin-left: 30rpx;
}
/*
* 导航
*/
.nav {
border-top: 1px solid #eee;
}
.nav .item {
padding: 30rpx 0;
width: calc(50% - 1px);
border-bottom: 1px solid #eee;
}
.nav .item:nth-child(odd) {
border-right: 1px solid #eee;
}
.nav .item image {
width: 100rpx;
height: 100rpx;
margin: 0 auto;
}
.nav .item .title {
margin-top: 20rpx;
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册