Browse Source

接口完善,数据渲染

yh
杨豪 3 years ago
parent
commit
43515d661d
  1. 14
      api/http.js
  2. 22
      api/store.js
  3. 33
      api/user.js
  4. 23
      app.js
  5. 1
      app.json
  6. 7
      app.wxss
  7. 9
      pages/companyInfo/index.js
  8. 6
      pages/companyInfo/index.wxml
  9. 4
      pages/companyInfo/index.wxss
  10. 99
      pages/goodsDetail/index.js
  11. 38
      pages/goodsDetail/index.wxml
  12. 57
      pages/goodsDetail/index.wxss
  13. 21
      pages/goodsList/index.js
  14. 11
      pages/goodsList/index.wxml
  15. 5
      pages/goodsList/index.wxss
  16. 65
      pages/home/index.js
  17. 17
      pages/home/index.wxml
  18. 3
      pages/home/index.wxss
  19. 11
      pages/login/index.js
  20. 7
      pages/user/cashOut/index.js
  21. 3
      pages/user/cashOut/index.wxml
  22. 11
      pages/user/cashOut/index.wxss
  23. 33
      pages/user/index.js
  24. 3
      pages/user/index.json
  25. 48
      pages/user/index.wxml
  26. 29
      pages/user/profit/index.js
  27. 27
      pages/user/profit/index.wxml
  28. 17
      project.private.config.json

14
api/http.js

@ -3,7 +3,8 @@ const baseURL = 'http://192.168.0.112:8088/api/';
export function $http(methods,url,params){ export function $http(methods,url,params){
var header = { var header = {
'content-type': 'application/json', 'content-type': 'application/json',
'Authorization' : wx.getStorageSync('token') || '' 'Authorization' :'Bearer '+ wx.getStorageSync('token') || '',
'dept': '22'
}; };
return new Promise((resolve,reject)=>{ return new Promise((resolve,reject)=>{
wx.showLoading({ wx.showLoading({
@ -21,8 +22,17 @@ export function $http(methods,url,params){
wx.navigateTo({ wx.navigateTo({
url: '/pages/login/index', url: '/pages/login/index',
}) })
return
}
if(res.data.success){
resolve(res);
} else{
wx.showToast({
title: '服务器错误,请稍后再试!',
icon : 'none'
})
reject(err)
} }
resolve(res);
}, },
fail: err=> { fail: err=> {
wx.hideLoading(); wx.hideLoading();

22
api/store.js

@ -0,0 +1,22 @@
const http = require('./http.js')
/*
* 商品分类
* */
export function getCategory() {
return http.$http('get','category');
}
/*
* 商品列表
* */
export function getProducts(q) {
return http.$http('get','products',q)
}
/*
* 商品详情
* */
export function getProductDetail(id) {
return http.$http('get',"/product/detail/" + id)
}

33
api/user.js

@ -1,12 +1,25 @@
const http = require('./http.js') const http = require('./http.js')
//绑定手机号
export function bingPhone(){ export function bingPhone(){
return new Promise((resolve,reject)=> { return http.$http()
http.$http().then((res)=>{ }
if(res.success){ //获取用户信息
resolve(res) export function getUserInfo(){
} else{ return http.$http('get','userinfo')
resolve(res) }
}
}) //立即咨询
}) export function saleLeads(data){
} return http.$http('post','user/saleLeads',data)
}
// 获取我的团队
export function getMyTeam(){
return http.$http('get','getTeam')
}
// 积分动态
export function getIntegralList(data){
return http.$http('get','integral/list',data)
}

23
app.js

@ -2,7 +2,6 @@
const http = require('./api/http.js') const http = require('./api/http.js')
App({ App({
onLaunch() { onLaunch() {
// 登录
}, },
login(){ login(){
return new Promise((resolve,reject)=>{ return new Promise((resolve,reject)=>{
@ -17,10 +16,23 @@ App({
let data = { let data = {
code: result.code, code: result.code,
iv: res.iv, iv: res.iv,
encryptedData:res.encryptedData encryptedData: res.encryptedData
} }
console.log(data)
http.$http('post','wxapp/auth',data).then((result)=>{ http.$http('post','wxapp/auth',data).then((result)=>{
console.log('数据已返回') if(result.data.success){
wx.setStorageSync('token', result.data.data.token)
wx.setStorageSync('userInfo', result.data.data.user)
wx.showToast({
title: '授权成功!',
icon: 'none'
})
} else{
wx.showToast({
title: result.data.msg,
icon: 'none'
})
}
resolve(result) resolve(result)
}) })
} }
@ -33,6 +45,7 @@ App({
}) })
}, },
globalData: { globalData: {
$http: http.$http http: http.$http,
products: []
} }
}) })

1
app.json

@ -1,5 +1,6 @@
{ {
"pages":[ "pages":[
"pages/home/index", "pages/home/index",
"pages/goodsList/index", "pages/goodsList/index",
"pages/goodsDetail/index", "pages/goodsDetail/index",

7
app.wxss

@ -11,7 +11,6 @@ image {
box-sizing: border-box; box-sizing: border-box;
} }
image{ image{
/* border-radius: 8rpx; */
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
@ -96,3 +95,9 @@ image{
margin: 60rpx auto; margin: 60rpx auto;
} }
.loading-status{
text-align: center;
font-size: 28rpx;
color: #B9B9B9;
}

9
pages/companyInfo/index.js

@ -1,21 +1,24 @@
// pages/companyInfo/index.js // pages/companyInfo/index.js
const app = getApp()
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
products: app.globalData.products
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.setData({
products: app.globalData.products
})
}, },
toList(){ toList(){
wx.navigateTo({ wx.switchTab({
url: '/pages/goodsList/index', url: '/pages/goodsList/index',
}) })
}, },

6
pages/companyInfo/index.wxml

@ -13,9 +13,9 @@
<image src="../../images/title2.png"></image> <image src="../../images/title2.png"></image>
</view> </view>
<view class="list-box acea-row row-between"> <view class="list-box acea-row row-between">
<view class="item"><image src="../../images/jixiang.png" mode="aspectFill"></image></view> <view class="item" wx:for="{{products}}" wx:key="index">
<view class="item"><image src="../../images/jixiang.png" mode="aspectFill"></image></view> <image src="{{item.image}}" mode="aspectFill"></image>
<view class="item"><image src="../../images/jixiang.png" mode="aspectFill"></image></view> </view>
</view> </view>
</view> </view>
<view class="submit-btn" bindtap="toList">更多商品</view> <view class="submit-btn" bindtap="toList">更多商品</view>

4
pages/companyInfo/index.wxss

@ -25,8 +25,8 @@
.introduse-box{ .introduse-box{
padding: 12rpx 0; padding: 12rpx 0;
color: #0B204C; color: #0B204C;
font-size: 24rpx; font-size: 28rpx;
line-height: 34rpx; line-height: 42rpx;
font-weight: 500; font-weight: 500;
text-indent: 1em; text-indent: 1em;
} }

99
pages/goodsDetail/index.js

@ -1,42 +1,101 @@
// pages/goodsDetail/index.js // pages/goodsDetail/index.js
const app = getApp()
const user = require('../../api/user.js')
const store = require('../../api/store.js')
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
showMask: false,
form:{
name: '',
phone: '',
id: ''
},
detail: {}
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.setData({
'form.id': options.id
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getProductDetail()
},
getProductDetail(){
store.getProductDetail(this.data.form.id).then((res)=>{
console.log('detail',res)
res.data.data.storeInfo.description.replace(/\<img/gi, '<img style="max-width:100%;height:auto;"')
this.setData({
detail: res.data.data
})
})
},
showMaskDialog(){
this.setData({
showMask: true
})
},
hideMaskDialog(){
this.setData({
showMask: false
})
},
stopProp(){},
inpName(e){
this.setData({
'form.name': e.detail.value
})
},
inpPhone(e){
this.setData({
'form.phone': e.detail.value
})
},
//提交咨询
submitInfo(){
if(this.data.form.name == '' ){
return this.alertMessage('请输入您的姓名')
} else if(this.data.form.phone == ''){
return this.alertMessage('请输入您的电话')
}
user.saleLeads(this.data.form).then((res)=>{
wx.showModal({
title: '温馨提示',
content: '恭喜您预约成功,稍后会有专属服务老师与您联系。',
showCancel: false
})
this.setData({
showMask: false
})
})
},
alertMessage(msg){
wx.showToast({
title: msg,
icon: 'none'
})
}, },
toHome(){ toHome(){
wx.navigateTo({ wx.switchTab({
url: '/pages/home/index', url: '/pages/home/index',
}) })
}, },
toList(){ toList(){
wx.navigateTo({ wx.switchTab({
url: '/pages/goodsList/index', url: '/pages/goodsList/index',
}) })
}, },
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
@ -70,6 +129,10 @@ Page({
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage: function () { onShareAppMessage: function () {
return{
title: this.data.detail.storeInfo.storeName,
imageUrl: this.data.detail.storeInfo.image,
path: '/pages/goodsDetail/index?id='+ this.data.detail.storeInfo.id
}
} }
}) })

38
pages/goodsDetail/index.wxml

@ -2,23 +2,21 @@
<view class="detail-page"> <view class="detail-page">
<view class="swiper-box"> <view class="swiper-box">
<swiper> <swiper>
<block> <block wx:for="{{detail.storeInfo.sliderImageArr}}" wx:key="index">
<swiper-item> <swiper-item>
<view class="swiper-item"> <image src="{{item}}" mode="aspectFill"></image>
<image src="../../images/jixiang.png" mode="widthFix"></image>
</view>
</swiper-item> </swiper-item>
</block> </block>
</swiper> </swiper>
</view> </view>
<view class="goods-info-box acea-row row-between"> <view class="goods-info-box acea-row row-between">
<view class="info-l-box"> <view class="info-l-box">
<view class="name line1">瑞梦思·布胡斯智能床垫</view> <view class="name line1">{{detail.storeInfo.storeName}}</view>
<view class="price"><text class="fz20">¥</text>129000-289000</view> <view class="price"><text class="fz20">¥</text>{{detail.storeInfo.price}}</view>
<view class="old-price">原价:¥<text class="row-line">99999</text></view> <view class="old-price">原价:¥<text class="row-line">{{detail.storeInfo.otPrice}}</text></view>
</view> </view>
<view class="info-r-box"> <view class="info-r-box">
<view>销量:999+</view> <view>销量:{{detail.storeInfo.sales}}</view>
<button open-type="share" class="share-btn acea-row row-center-wrapper"> <button open-type="share" class="share-btn acea-row row-center-wrapper">
<image src="../../images/share.png"></image> <image src="../../images/share.png"></image>
<text>分享</text> <text>分享</text>
@ -31,10 +29,7 @@
<view class="row-line"></view> <view class="row-line"></view>
</view> </view>
<view class="produce-detail"> <view class="produce-detail">
<image src="../../images/jixiang.png" mode="widthFix"></image> <rich-text nodes="{{detail.storeInfo.description}}"></rich-text>
<image src="../../images/jixiang.png" mode="widthFix"></image>
<image src="../../images/chongsu.png" mode="widthFix"></image>
<image src="../../images/chongsu.png" mode="widthFix"></image>
</view> </view>
<view class="footer-box acea-row row-between-wrapper"> <view class="footer-box acea-row row-between-wrapper">
<view class="icons-box acea-row"> <view class="icons-box acea-row">
@ -47,9 +42,22 @@
<text>商品列表</text> <text>商品列表</text>
</view> </view>
</view> </view>
<view class="submit-btn">立即咨询</view> <view class="submit-btn" bindtap="showMaskDialog">立即预约</view>
</view> </view>
<view class="mask-box"> <view class="mask-box" wx:if="{{showMask}}" bindtap="hideMaskDialog">
<view class="form">
<image src="../../images/company-bg.png" class="info-bg"></image>
<view class="inp-box" catchtap="stopProp">
<view class="inp-item acea-row row-middle">
<text class="label">您的姓名:</text>
<input type="text" placeholder="请输入您的姓名" bindinput="inpName" value="{{form.name}}" />
</view>
<view class="inp-item acea-row row-middle" catchtap="stopProp">
<text class="label">您的电话:</text>
<input type="text" maxlength="11" placeholder="请输入您的电话" bindinput="inpPhone" value="{{form.phone}}" />
</view>
</view>
<view class="submit-btn submit-btn2" catchtap="submitInfo">立即预约</view>
</view>
</view> </view>
</view> </view>

57
pages/goodsDetail/index.wxss

@ -118,4 +118,61 @@
} }
.submit-btn{ .submit-btn{
margin: 0; margin: 0;
}
.mask-box{
width: 100%;
height: 100%;
background: rgba(0,0,0,.6);
position: fixed;
top: 0;
left: 0;
}
.form{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
width: 690rpx;
min-height: 370rpx;
background: #fff;
border-radius: 12rpx;
font-size: 24rpx;
color: #1D1D1D;
}
.form .info-bg{
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
.inp-box{
width: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 3;
padding: 32px 130rpx;
}
.inp-item{
width: 100%;
height: 50rpx;
border: 2rpx solid #1D1D1D;
border-radius: 8rpx;
padding: 0rpx 30rpx;
margin-bottom: 40rpx;
}
.inp-item input{
width: 60%;
}
.label{
margin-right: 4rpx;
}
.submit-btn2{
position: absolute;
bottom: 46rpx;
left: 50%;
transform: translateX(-50%);
z-index: 3;
} }

21
pages/goodsList/index.js

@ -1,22 +1,35 @@
// pages/goodsList/index.js // pages/goodsList/index.js
const app = getApp()
const user = require('../../api/user.js')
const store = require('../../api/store.js')
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
products: [],
loadingStatus: '没有更多了。。。'
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
console.log(this.data.products)
this.getProducts()
},
//获取产品列表
getProducts(){
store.getCategory().then((res)=>{
this.setData({
products: res.data.data[0].children[0].products
})
})
}, },
toDetail(e){ toDetail(e){
let id = e.currentTarget.dataset.id
wx.navigateTo({ wx.navigateTo({
url: '/pages/goodsDetail/index', url: '/pages/goodsDetail/index?id=' + id,
}) })
}, },
/** /**

11
pages/goodsList/index.wxml

@ -1,16 +1,17 @@
<!--pages/goodsList/index.wxml--> <!--pages/goodsList/index.wxml-->
<view class="goodsList-page"> <view class="goodsList-page">
<view class="goods-list"> <view class="goods-list">
<view class="goods-item acea-row" wx:for="{{3}}" :key="index" bindtap="toDetail" data-id="id"> <view class="goods-item acea-row" wx:for="{{products}}" wx:key="index" bindtap="toDetail" data-id="{{item.id}}">
<image src="../../images/jixiang.png" mode="aspectFill"></image> <image src="{{item.image}}" mode="aspectFill"></image>
<view class="goods-info"> <view class="goods-info">
<view class="name line2">瑞梦思·夏季新款独家定制款独家定制智能款独家定制智能智能床垫</view> <view class="name line2">{{item.storeName}}</view>
<view class="desc">高级智能床垫·安心休息</view> <view class="desc">{{item.storeInfo}}</view>
<view class="price"> <view class="price">
<text class="s-word">¥</text> <text class="s-word">¥</text>
<text>129000</text> <text>{{item.price}}</text>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="loading-status">{{loadingStatus}}</view>
</view> </view>

5
pages/goodsList/index.wxss

@ -45,4 +45,9 @@
} }
.price .s-word{ .price .s-word{
font-size: 24rpx; font-size: 24rpx;
}
.loading-status{
text-align: center;
font-size: 28rpx;
color: #B9B9B9;
} }

65
pages/home/index.js

@ -1,6 +1,7 @@
// pages/home/index.js // pages/home/index.js
const app = getApp() const app = getApp()
const user = require('../../api/user.js') const user = require('../../api/user.js')
const store = require('../../api/store.js')
Page({ Page({
/** /**
@ -10,8 +11,11 @@ Page({
isAuth: false, //是否认证 isAuth: false, //是否认证
authorize: false, authorize: false,
canIUseGetUserProfile: false, canIUseGetUserProfile: false,
name: '', form: {
phone: '' name: '',
phone: '',
},
products: []
}, },
/** /**
@ -19,25 +23,54 @@ Page({
*/ */
onLoad: function (options) { onLoad: function (options) {
// this.getUserInfo() // this.getUserInfo()
console.log(app)
if (wx.getUserProfile) { if (wx.getUserProfile) {
this.setData({ this.setData({
canIUseGetUserProfile: true canIUseGetUserProfile: true
}) })
} }
app.globalData.$http() this.getProducts()
},
//获取产品列表
getProducts(){
store.getCategory().then((res)=>{
this.setData({
products: res.data.data[0].children[0].products
})
app.globalData.products = res.data.data[0].children[0].products
})
}, },
getUserInfoProfile(){ getUserInfoProfile(){
app.login().then((res)=>{ app.login().then((res)=>{
console.log(res) if(res.data.success){
this.setData({
isAuth: true
})
}
})
},
inpName(e){
this.setData({
'form.name': e.detail.value
})
},
inpPhone(e){
this.setData({
'form.phone': e.detail.value
}) })
}, },
submitInfo(){ submitInfo(){
if(this.data.name == '' ){ if(this.data.form.name == '' ){
return this.alertMessage('请输入您的姓名') return this.alertMessage('请输入您的姓名')
} else if(this.data.phone == ''){ } else if(this.data.form.phone == ''){
return this.alertMessage('请输入您的电话') return this.alertMessage('请输入您的电话')
} }
user.saleLeads(this.data.form).then((res)=>{
wx.showModal({
title: '温馨提示',
content: '恭喜您预约成功,稍后会有专属服务老师与您联系。',
showCancel: false
})
})
}, },
alertMessage(msg){ alertMessage(msg){
wx.showToast({ wx.showToast({
@ -45,9 +78,10 @@ Page({
icon: 'none' icon: 'none'
}) })
}, },
toDetial(){ toDetial(e){
let id = e.currentTarget.dataset.id
wx.navigateTo({ wx.navigateTo({
url: '/pages/goodsDetail/index', url: '/pages/goodsDetail/index?id='+ id,
}) })
}, },
toCompany(){ toCompany(){
@ -55,18 +89,15 @@ Page({
url: '/pages/companyInfo/index', url: '/pages/companyInfo/index',
}) })
}, },
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
if(wx.getStorageSync('token')){
this.setData({
isAuth: true
})
}
}, },
/** /**

17
pages/home/index.wxml

@ -19,11 +19,8 @@
<view class="title">商品介绍</view> <view class="title">商品介绍</view>
<view class="row-line"></view> <view class="row-line"></view>
</view> </view>
<view class="goods-item" bindtap="toDetial"> <view class="goods-item" bindtap="toDetial" wx:for="{{products}}" wx:key="index" data-id="{{item.id}}">
<image src="../../images/jixiang.png" mode="widthFix"></image> <image src="{{item.image}}" mode="widthFix"></image>
</view>
<view class="goods-item">
<image src="../../images/chongsu.png" mode="widthFix"></image>
</view> </view>
</view> </view>
<view class="form-box"> <view class="form-box">
@ -36,16 +33,16 @@
<view class="inp-box"> <view class="inp-box">
<view class="inp-item acea-row row-middle"> <view class="inp-item acea-row row-middle">
<text class="label">您的姓名:</text> <text class="label">您的姓名:</text>
<input type="text" placeholder="请输入您的姓名" /> <input type="text" placeholder="请输入您的姓名" bindinput="inpName" value="{{form.name}}" />
</view> </view>
<view class="inp-item acea-row row-middle"> <view class="inp-item acea-row row-middle">
<text class="label">您的电话:</text> <text class="label">您的电话:</text>
<input type="text" maxlength="11" placeholder="请输入您的电话" /> <input type="text" maxlength="11" placeholder="请输入您的电话" bindinput="inpPhone" value="{{form.phone}}" />
</view> </view>
</view> </view>
</view> </view>
<button class="submit-btn" wx:if="{{canIUseGetUserProfile && !isAuth}}" bindtap="getUserInfoProfile">立即咨询</button> <button class="submit-btn" wx:if="{{canIUseGetUserProfile && !isAuth}}" bindtap="getUserInfoProfile">立即预约</button>
<button class="submit-btn" wx:if="{{!canIUseGetUserProfile && !isAuth}}" open-type="getUserInfo" bindtap="getUserInfo">立即咨询</button> <button class="submit-btn" wx:if="{{!canIUseGetUserProfile && !isAuth}}" open-type="getUserInfo" bindtap="getUserInfo">立即预约</button>
<view class="submit-btn" wx:if="{{isAuth}}" bindtap="submitInfo">立即咨询</view> <view class="submit-btn" wx:if="{{isAuth}}" bindtap="submitInfo">立即预约</view>
</view> </view>
</view> </view>

3
pages/home/index.wxss

@ -121,4 +121,5 @@
.submit-btn{ .submit-btn{
width: 318rpx !important; width: 318rpx !important;
padding: 0 !important; padding: 0 !important;
} }

11
pages/login/index.js

@ -22,14 +22,13 @@ Page({
}, },
getUserProfile(e) { getUserProfile(e) {
// 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗 // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
wx.getUserProfile({ app.login().then((res)=>{
desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 if(res.data.success){
success: (response) => { wx.navigateBack({
wx.showLoading({ delta: 1,
title: '登陆中...',
}) })
} }
}) })
}, },
getPhoneNumber(e) { getPhoneNumber(e) {
if(e.detail.errMsg == 'getPhoneNumber:ok'){ if(e.detail.errMsg == 'getPhoneNumber:ok'){

7
pages/user/cashOut/index.js

@ -5,14 +5,17 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
brokeragePrice: 20
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
console.log(options)
this.setData({
brokeragePrice: options.brokeragePrice
})
}, },
/** /**

3
pages/user/cashOut/index.wxml

@ -4,7 +4,7 @@
<image src="../../../images/profit.png" class="profit-bg"></image> <image src="../../../images/profit.png" class="profit-bg"></image>
<view class="profit-info"> <view class="profit-info">
<view>当前可提现积分<text class="s-word">(积分比例为1:1)</text></view> <view>当前可提现积分<text class="s-word">(积分比例为1:1)</text></view>
<view class="fz70">300</view> <view class="fz70">{{brokeragePrice}}</view>
</view> </view>
</view> </view>
<view class="tips">注:提现需在每月20-26日进行,其他时间不可提现</view> <view class="tips">注:提现需在每月20-26日进行,其他时间不可提现</view>
@ -16,4 +16,5 @@
<view class="colO">全部提现</view> <view class="colO">全部提现</view>
</view> </view>
</view> </view>
<view class="submit-btn">提现</view>
</view> </view>

11
pages/user/cashOut/index.wxss

@ -65,4 +65,15 @@
} }
.colO{ .colO{
color: #F68514; color: #F68514;
}
.submit-btn{
width: 440rpx;
height: 88rpx;
background: #F7C37A;
border-radius: 44rpx;
text-align: center;
line-height: 88rpx;
font-size: 42rpx;
color: #FFFFFF;
margin: 110rpx auto 0;
} }

33
pages/user/index.js

@ -7,32 +7,37 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
userInfo: {}
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
userApi.bingPhone().then(res=>{ // userApi.getMyTeam().then((res)=>{
console.log(res) // console.log(res)
}) // })
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
this.getUserInfo()
},
getUserInfo(){
userApi.getUserInfo().then((res)=> {
this.setData({
userInfo: res.data.data
})
})
},
toCashOut(){
wx.navigateTo({
url: '/pages/user/cashOut/index?brokeragePrice=' + this.data.userInfo.brokeragePrice,
})
}, },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */

3
pages/user/index.json

@ -1,4 +1,5 @@
{ {
"usingComponents": {}, "usingComponents": {},
"navigationBarTitleText": "我的" "navigationBarTitleText": "我的",
"enablePullDownRefresh": true
} }

48
pages/user/index.wxml

@ -1,10 +1,10 @@
<!--pages/user/index.wxml--> <!--pages/user/index.wxml-->
<view class="user-page"> <view class="user-page">
<view class="user-box acea-row row-middle"> <view class="user-box acea-row row-middle">
<view class="avatar"><image src="../../images/logo.png"></image></view> <view class="avatar"><image src="{{userInfo.avatar || '../../images/logo.png'}}"></image></view>
<view class="userInfo"> <view class="userInfo">
<view class="name">赵铁柱</view> <view class="name">{{userInfo.nickname || '瑞梦思'}}</view>
<view class="id-num">ID:2123</view> <view class="id-num">ID:{{userInfo.uid}}</view>
</view> </view>
</view> </view>
<view class="panel-box"> <view class="panel-box">
@ -13,53 +13,57 @@
<view class="profit-box"> <view class="profit-box">
<view class="mt20"> <view class="mt20">
<view>今日收益</view> <view>今日收益</view>
<view class="fz40">200积分</view> <view class="fz40">{{userInfo.todayBrokerage || 0}}积分</view>
</view> </view>
<view class=""> <view class="">
<view>累计收益</view> <view>累计收益</view>
<view class="fz40">200积分</view> <view class="fz40">{{userInfo.brokeragePrice || 0}}积分</view>
</view> </view>
</view> </view>
<view class="col-line"></view> <view class="col-line"></view>
<view class="sale-box"> <view class="sale-box">
<view class="mt20"> <view class="mt20">
<view>推广人数</view> <view>推广人数</view>
<view class="fz40">20人</view> <view class="fz40">{{userInfo.spreadCount || 0}}人</view>
</view> </view>
<view class=""> <view class="">
<view>今日收益</view> <view>今日新增</view>
<view class="fz40">20人</view> <view class="fz40">{{userInfo.todaySpreadNum || 0}}人</view>
</view> </view>
</view> </view>
<view class="to-more-box"> <navigator url="/pages/user/profit/index" hover-class="none">
<image src="../../images/jifen-icon.png" class="jifen-icon"></image> <view class="to-more-box">
<view class="col-text">积分详情</view> <image src="../../images/jifen-icon.png" class="jifen-icon"></image>
<image src="../../images/arror-d.png" class="arror-r-icon"></image> <view class="col-text">积分详情</view>
</view> <image src="../../images/arror-d.png" class="arror-r-icon"></image>
</view>
</navigator>
</view> </view>
</view> </view>
<view class="menu-list"> <view class="menu-list">
<view class="menu-item acea-row row-middle row-between"> <view class="menu-item acea-row row-middle row-between" bindtap="toCashOut">
<view class="item-l acea-row row-middle"> <view class="item-l acea-row row-middle">
<image src="../../images/menu1.png"></image> <image src="../../images/menu1.png"></image>
<text>去提现</text> <text>去提现</text>
</view> </view>
<image src="../../images/arror-r.png" class="arrow-r"></image> <image src="../../images/arror-r.png" class="arrow-r"></image>
</view> </view>
<view class="menu-item acea-row row-middle row-between"> <navigator url="/pages/user/myTeam/index" hover-class="none">
<view class="item-l acea-row row-middle"> <view class="menu-item acea-row row-middle row-between">
<image src="../../images/menu2.png"></image> <view class="item-l acea-row row-middle">
<text>我的团队</text> <image src="../../images/menu2.png"></image>
<text>我的团队</text>
</view>
<image src="../../images/arror-r.png" class="arrow-r"></image>
</view> </view>
<image src="../../images/arror-r.png" class="arrow-r"></image> </navigator>
</view> <!-- <view class="menu-item acea-row row-middle row-between">
<view class="menu-item acea-row row-middle row-between">
<view class="item-l acea-row row-middle"> <view class="item-l acea-row row-middle">
<image src="../../images/menu3.png"></image> <image src="../../images/menu3.png"></image>
<text>设置</text> <text>设置</text>
</view> </view>
<image src="../../images/arror-r.png" class="arrow-r"></image> <image src="../../images/arror-r.png" class="arrow-r"></image>
</view> </view> -->
<view class="menu-item acea-row row-middle row-between"> <view class="menu-item acea-row row-middle row-between">
<view class="item-l acea-row row-middle"> <view class="item-l acea-row row-middle">
<image src="../../images/menu4.png"></image> <image src="../../images/menu4.png"></image>

29
pages/user/profit/index.js

@ -1,18 +1,43 @@
// pages/user/profit/index.js // pages/user/profit/index.js
const app = getApp()
const user = require('../../../api/user.js')
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
userInfo: {},
integralList: [],
page: 1,
pagesize: 300,
loadingStatus: '没有更多了。。。'
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.setData({
userInfo: wx.getStorageSync('userInfo')
})
this.getIntegralList()
},
getIntegralList(){
let data= {
page: this.data.page,
limit: this.data.pagesize
}
user.getIntegralList(data).then((res)=>{
this.setData({
integralList: res.data.data.content
})
})
},
toCashOut(){
wx.navigateTo({
url: '/pages/user/cashOut/index?brokeragePrice=' + this.data.userInfo.brokeragePrice,
})
}, },
/** /**

27
pages/user/profit/index.wxml

@ -2,10 +2,10 @@
<view class="profit-page"> <view class="profit-page">
<view class="user-box acea-row row-middle"> <view class="user-box acea-row row-middle">
<view class="avatar"><image src="../../../images/logo.png"></image></view> <view class="avatar"><image src="{{userInfo.avatar}}"></image></view>
<view class="userInfo"> <view class="userInfo">
<view class="name">赵铁柱</view> <view class="name">{{userInfo.nickname}}</view>
<view class="id-num">ID:2123</view> <view class="id-num">ID:{{userInfo.uid}}</view>
</view> </view>
</view> </view>
@ -15,20 +15,31 @@
<view class="acea-row row-between"> <view class="acea-row row-between">
<view class=""> <view class="">
<view>今日收益</view> <view>今日收益</view>
<view class="fz40">200积分</view> <view class="fz40">{{userInfo.todayBrokerage}}积分</view>
</view> </view>
<view class=""> <view class="">
<view>累计收益</view> <view>累计收益</view>
<view class="fz40">200积分</view> <view class="fz40">{{userInfo.brokeragePrice}}积分</view>
</view> </view>
</view> </view>
<view class="to-cash-out">去提现</view> <view class="to-cash-out" bindtap="toCashOut">去提现</view>
</view> </view>
</view> </view>
<view class="int-list"> <view class="int-list">
<view class="int-t">积分动态</view> <view class="int-t">积分动态</view>
<view class="int-item" wx:for="{{3}}" :key="index"> <view class="int-item" wx:for="{{integralList}}" wx:key="index">
<view>
<view class="title">{{item.title}}</view>
<view class="time colR">{{item.createTime}}</view>
</view>
<view class="">
<view class="title fz40 colR">{{item.pm == 0 ? '-' : '+'}}{{item.number}}积分</view>
<view class="time">{{item.mark}}</view>
</view>
</view>
<view class="loading-status">{{loadingStatus}}</view>
<!-- <view class="int-item">
<view> <view>
<view class="title">禅易风云</view> <view class="title">禅易风云</view>
<view class="time colR">2021-11-26</view> <view class="time colR">2021-11-26</view>
@ -37,6 +48,6 @@
<view class="title fz40 colR">+500积分</view> <view class="title fz40 colR">+500积分</view>
<view class="time">一级收益</view> <view class="time">一级收益</view>
</view> </view>
</view> </view> -->
</view> </view>
</view> </view>

17
project.private.config.json

@ -0,0 +1,17 @@
{
"setting": {},
"condition": {
"plugin": {
"list": []
},
"game": {
"list": []
},
"gamePlugin": {
"list": []
},
"miniprogram": {
"list": []
}
}
}
Loading…
Cancel
Save