用户代理申请功能

This commit is contained in:
chenbo 2020-03-26 17:00:29 +08:00
parent 9dd851c164
commit 78ceda87ef
4 changed files with 89 additions and 17 deletions

View File

@ -13,17 +13,26 @@
</view>
<view class='wrapper'>
<view class='nav acea-row row-middle'>
<view class='item' hover-class='none' bindtap="goBrokerage">
<view class='item' hover-class='none' wx:if="{{userInfo.userLevel==2}}" bindtap="goBrokerage">
<view class='title'>当前佣金</view>
<view class='num'>¥ {{remainAmount || 0.00}}</view>
<view class='text'><text class='iconfont icon-jinbi1' style="color:#FF654B;margin-right:8rpx;"></text> {{remainAmount || 0.00}}</view>
</view>
<view class='item' hover-class='none' bindtap="goBrokerage">
<view class='item' hover-class='none' wx:else>
<view class='title'>用户类型</view>
<view class='text'><text class='iconfont icon-jingyanzhi' style="color:#FF654B;margin-right:8rpx;"></text>
{{userInfo.userLevelDesc || "普通会员"}}</view>
</view>
<view class='item' hover-class='none' wx:if="{{userInfo.userLevel==2}}" bindtap="goBrokerage">
<view class='title'>总收益</view>
<view class='num'>¥ {{totalAmount || 0}}</view>
<view class='text'><text class='iconfont icon-qiandai' style="color:#FF654B;margin-right:8rpx;"></text> {{totalAmount || 0}}</view>
</view>
<view class='item' hover-class='none' wx:else>
<view class='title'>注册时间</view>
<view class='text'><text class='iconfont icon-shenhezhong' style="color:#FF654B;margin-right:8rpx;"></text>{{userInfo.registerDate || "2019-10-01"}}</view>
</view>
<view class='item' hover-class='none' bindtap='goPages' data-url='/pages/ucenter/couponList/couponList'>
<view class='title'>优惠券</view>
<view class='num'>{{couponCount || 0}}</view>
<view class='text'><text class='iconfont icon-youhuiquan' style="color:#FF654B;margin-right:8rpx;"></text>{{couponCount || 0}}</view>
</view>
</view>
<view class='myOrder'>

View File

@ -16,6 +16,7 @@
.user .wrapper .nav .item~.item{border-left:1px solid #eee;}
.user .wrapper .nav .item .title{font-size:28rpx;color:#666;}
.user .wrapper .nav .item .num{margin-top:16rpx;font-size:36rpx;color:rgb(223, 8, 8);}
.user .wrapper .nav .item .text{margin-top:16rpx;font-size:30rpx;}
.user .wrapper .myOrder{background-color:#fff;border-radius:10rpx;margin-top:15rpx;}
.user .wrapper .myOrder .title,.user .wrapper .myService .title{height:88rpx;padding:0 30rpx;border-bottom:1px dashed #ddd;font-size:30rpx;color:#282828;}
.user .wrapper .myOrder .title .allOrder{font-size:26rpx;color:#666;}
@ -36,6 +37,7 @@
position: absolute;
background: #b4282d;
color: #fff;
font-size: 28rpx;
border-radius: 50%;
margin-top: 0rpx;
margin-left: 40rpx;

View File

@ -8,8 +8,9 @@ Page({
* 页面的初始数据
*/
data: {
userInfo:{},
hasLogin: false
userInfo: {},
hasLogin: false,
userSharedUrl: ''
},
/**
@ -18,15 +19,56 @@ Page({
onLoad: function (options) {
},
onShow: function() {
onShow: function () {
let that = this;
//获取用户的登录信息
let userInfo = wx.getStorageSync('userInfo');
this.setData({
userInfo: userInfo,
hasLogin: true
});
//如果无分享推广码,则需要获取分享二维码
if (this.data.hasLogin && this.data.userSharedUrl == '') {
that.getUserSharedUrl();
}
},
getPhoneNumber:function(e) {
getUserSharedUrl: function () {
let that = this;
util.request(api.GetSharedUrl).then(function (res) {
that.setData({
userSharedUrl: res.data.userSharedUrl
});
});
},
applyAgency: function () {
let that = this;
if (!this.data.hasLogin) {
wx.showToast({
title: '绑定失败:请先登录',
icon: 'none',
duration: 2000
});
return;
}
util.request(api.ApplyAgency, { desc: "代理申请" }, 'POST').then(function (res) {
if (res.errno === 0) {
let userInfo = wx.getStorageSync('userInfo');
userInfo.status = 3;//设置用户的状态为申请代理中...
wx.setStorageSync('userInfo', userInfo);
that.setData({
userInfo: userInfo,
hasLogin: true
});
wx.showToast({
title: '申请成功,等待管理员审批',
icon: 'success',
duration: 2000
});
}
});
},
getPhoneNumber: function (e) {
let that = this;
if (e.detail.errMsg !== "getPhoneNumber:ok") {
// 拒绝授权
@ -45,7 +87,7 @@ Page({
util.request(api.AuthBindPhone, {
iv: e.detail.iv,
encryptedData: e.detail.encryptedData
}, 'POST').then(function(res) {
}, 'POST').then(function (res) {
if (res.errno === 0) {
let userInfo = wx.getStorageSync('userInfo');
userInfo.phone = res.data.phone;//设置手机号码
@ -62,12 +104,12 @@ Page({
}
});
},
exitLogin: function() {
exitLogin: function () {
wx.showModal({
title: '',
confirmColor: '#b4282d',
content: '退出登录?',
success: function(res) {
success: function (res) {
if (!res.confirm) {
return;
}

View File

@ -19,6 +19,22 @@
<text class='iconfont icon-suozi'></text>
</view>
</view>
<view class='item acea-row row-between-wrapper'>
<view>代理申请</view>
<view class='input acea-row row-between-wrapper' wx:if="{{userInfo.userLevel==2}}">
<input type='text' disabled='true' value='{{userInfo.userLevelDesc}}' class='id'></input>
<text class='iconfont icon-huangguan'></text>
</view>
<view class='input acea-row row-between-wrapper' wx:elif="{{userInfo.status == 3}}">
<input type='text' disabled='true' value='代理申请中,请耐心等待管理员审批...' class='id'></input>
<text class='iconfont icon-huangguan'></text>
</view>
<button name='phone' class='phone' wx:else hover-class='none' bindtap="applyAgency" >
点击申请
</button>
</view>
<view class='item acea-row row-between-wrapper'>
<view>ID号</view>
<view class='input acea-row row-between-wrapper'>
@ -27,6 +43,9 @@
</view>
</view>
</view>
<view wx:if="{{userSharedUrl && userSharedUrl!=''}}" style="text-align:center;background-color:#fff;">
<image class="img" src="{{userSharedUrl}}" style="width:600rpx;height:600rpx;"></image>
</view>
<button class='modifyBnt' bindtap="exitLogin">退 出</button>
</view>
</form>