Browse Source

接口完善,数据渲染

yh
杨豪 3 years ago
parent
commit
43515d661d
  1. 14
      api/http.js
  2. 22
      api/store.js
  3. 31
      api/user.js
  4. 21
      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. 97
      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. 1
      pages/home/index.wxss
  19. 9
      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. 29
      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){
var header = {
'content-type': 'application/json',
'Authorization' : wx.getStorageSync('token') || ''
'Authorization' :'Bearer '+ wx.getStorageSync('token') || '',
'dept': '22'
};
return new Promise((resolve,reject)=>{
wx.showLoading({
@ -21,8 +22,17 @@ export function $http(methods,url,params){
wx.navigateTo({
url: '/pages/login/index',
})
return
}
if(res.data.success){
resolve(res);
} else{
wx.showToast({
title: '服务器错误,请稍后再试!',
icon : 'none'
})
reject(err)
}
resolve(res);
},
fail: err=> {
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)
}

31
api/user.js

@ -1,12 +1,25 @@
const http = require('./http.js')
//绑定手机号
export function bingPhone(){
return new Promise((resolve,reject)=> {
http.$http().then((res)=>{
if(res.success){
resolve(res)
} else{
resolve(res)
}
})
})
return http.$http()
}
//获取用户信息
export function getUserInfo(){
return http.$http('get','userinfo')
}
//立即咨询
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)
}

21
app.js

@ -2,7 +2,6 @@
const http = require('./api/http.js')
App({
onLaunch() {
// 登录
},
login(){
return new Promise((resolve,reject)=>{
@ -17,10 +16,23 @@ App({
let data = {
code: result.code,
iv: res.iv,
encryptedData:res.encryptedData
encryptedData: res.encryptedData
}
console.log(data)
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)
})
}
@ -33,6 +45,7 @@ App({
})
},
globalData: {
$http: http.$http
http: http.$http,
products: []
}
})

1
app.json

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

7
app.wxss

@ -11,7 +11,6 @@ image {
box-sizing: border-box;
}
image{
/* border-radius: 8rpx; */
width: 100%;
height: 100%;
}
@ -96,3 +95,9 @@ image{
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
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
products: app.globalData.products
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
products: app.globalData.products
})
},
toList(){
wx.navigateTo({
wx.switchTab({
url: '/pages/goodsList/index',
})
},

6
pages/companyInfo/index.wxml

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

4
pages/companyInfo/index.wxss

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

97
pages/goodsDetail/index.js

@ -1,42 +1,101 @@
// pages/goodsDetail/index.js
const app = getApp()
const user = require('../../api/user.js')
const store = require('../../api/store.js')
Page({
/**
* 页面的初始数据
*/
data: {
showMask: false,
form:{
name: '',
phone: '',
id: ''
},
detail: {}
},
/**
* 生命周期函数--监听页面加载
*/
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(){
wx.navigateTo({
wx.switchTab({
url: '/pages/home/index',
})
},
toList(){
wx.navigateTo({
wx.switchTab({
url: '/pages/goodsList/index',
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
@ -70,6 +129,10 @@ Page({
* 用户点击右上角分享
*/
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="swiper-box">
<swiper>
<block>
<block wx:for="{{detail.storeInfo.sliderImageArr}}" wx:key="index">
<swiper-item>
<view class="swiper-item">
<image src="../../images/jixiang.png" mode="widthFix"></image>
</view>
<image src="{{item}}" mode="aspectFill"></image>
</swiper-item>
</block>
</swiper>
</view>
<view class="goods-info-box acea-row row-between">
<view class="info-l-box">
<view class="name line1">瑞梦思·布胡斯智能床垫</view>
<view class="price"><text class="fz20">¥</text>129000-289000</view>
<view class="old-price">原价:¥<text class="row-line">99999</text></view>
<view class="name line1">{{detail.storeInfo.storeName}}</view>
<view class="price"><text class="fz20">¥</text>{{detail.storeInfo.price}}</view>
<view class="old-price">原价:¥<text class="row-line">{{detail.storeInfo.otPrice}}</text></view>
</view>
<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">
<image src="../../images/share.png"></image>
<text>分享</text>
@ -31,10 +29,7 @@
<view class="row-line"></view>
</view>
<view class="produce-detail">
<image src="../../images/jixiang.png" mode="widthFix"></image>
<image src="../../images/jixiang.png" mode="widthFix"></image>
<image src="../../images/chongsu.png" mode="widthFix"></image>
<image src="../../images/chongsu.png" mode="widthFix"></image>
<rich-text nodes="{{detail.storeInfo.description}}"></rich-text>
</view>
<view class="footer-box acea-row row-between-wrapper">
<view class="icons-box acea-row">
@ -47,9 +42,22 @@
<text>商品列表</text>
</view>
</view>
<view class="submit-btn">立即咨询</view>
<view class="submit-btn" bindtap="showMaskDialog">立即预约</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>

57
pages/goodsDetail/index.wxss

@ -119,3 +119,60 @@
.submit-btn{
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
const app = getApp()
const user = require('../../api/user.js')
const store = require('../../api/store.js')
Page({
/**
* 页面的初始数据
*/
data: {
products: [],
loadingStatus: '没有更多了。。。'
},
/**
* 生命周期函数--监听页面加载
*/
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){
let id = e.currentTarget.dataset.id
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-->
<view class="goodsList-page">
<view class="goods-list">
<view class="goods-item acea-row" wx:for="{{3}}" :key="index" bindtap="toDetail" data-id="id">
<image src="../../images/jixiang.png" mode="aspectFill"></image>
<view class="goods-item acea-row" wx:for="{{products}}" wx:key="index" bindtap="toDetail" data-id="{{item.id}}">
<image src="{{item.image}}" mode="aspectFill"></image>
<view class="goods-info">
<view class="name line2">瑞梦思·夏季新款独家定制款独家定制智能款独家定制智能智能床垫</view>
<view class="desc">高级智能床垫·安心休息</view>
<view class="name line2">{{item.storeName}}</view>
<view class="desc">{{item.storeInfo}}</view>
<view class="price">
<text class="s-word">¥</text>
<text>129000</text>
<text>{{item.price}}</text>
</view>
</view>
</view>
</view>
<view class="loading-status">{{loadingStatus}}</view>
</view>

5
pages/goodsList/index.wxss

@ -46,3 +46,8 @@
.price .s-word{
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
const app = getApp()
const user = require('../../api/user.js')
const store = require('../../api/store.js')
Page({
/**
@ -10,8 +11,11 @@ Page({
isAuth: false, //是否认证
authorize: false,
canIUseGetUserProfile: false,
name: '',
phone: ''
form: {
name: '',
phone: '',
},
products: []
},
/**
@ -19,25 +23,54 @@ Page({
*/
onLoad: function (options) {
// this.getUserInfo()
console.log(app)
if (wx.getUserProfile) {
this.setData({
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(){
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(){
if(this.data.name == '' ){
if(this.data.form.name == '' ){
return this.alertMessage('请输入您的姓名')
} else if(this.data.phone == ''){
} else if(this.data.form.phone == ''){
return this.alertMessage('请输入您的电话')
}
user.saleLeads(this.data.form).then((res)=>{
wx.showModal({
title: '温馨提示',
content: '恭喜您预约成功,稍后会有专属服务老师与您联系。',
showCancel: false
})
})
},
alertMessage(msg){
wx.showToast({
@ -45,9 +78,10 @@ Page({
icon: 'none'
})
},
toDetial(){
toDetial(e){
let id = e.currentTarget.dataset.id
wx.navigateTo({
url: '/pages/goodsDetail/index',
url: '/pages/goodsDetail/index?id='+ id,
})
},
toCompany(){
@ -55,18 +89,15 @@ Page({
url: '/pages/companyInfo/index',
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: 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="row-line"></view>
</view>
<view class="goods-item" bindtap="toDetial">
<image src="../../images/jixiang.png" mode="widthFix"></image>
</view>
<view class="goods-item">
<image src="../../images/chongsu.png" mode="widthFix"></image>
<view class="goods-item" bindtap="toDetial" wx:for="{{products}}" wx:key="index" data-id="{{item.id}}">
<image src="{{item.image}}" mode="widthFix"></image>
</view>
</view>
<view class="form-box">
@ -36,16 +33,16 @@
<view class="inp-box">
<view class="inp-item acea-row row-middle">
<text class="label">您的姓名:</text>
<input type="text" placeholder="请输入您的姓名" />
<input type="text" placeholder="请输入您的姓名" bindinput="inpName" value="{{form.name}}" />
</view>
<view class="inp-item acea-row row-middle">
<text class="label">您的电话:</text>
<input type="text" maxlength="11" placeholder="请输入您的电话" />
<input type="text" maxlength="11" placeholder="请输入您的电话" bindinput="inpPhone" value="{{form.phone}}" />
</view>
</view>
</view>
<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>
<view class="submit-btn" wx:if="{{isAuth}}" bindtap="submitInfo">立即咨询</view>
<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>
<view class="submit-btn" wx:if="{{isAuth}}" bindtap="submitInfo">立即预约</view>
</view>
</view>

1
pages/home/index.wxss

@ -122,3 +122,4 @@
width: 318rpx !important;
padding: 0 !important;
}

9
pages/login/index.js

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

7
pages/user/cashOut/index.js

@ -5,14 +5,17 @@ Page({
* 页面的初始数据
*/
data: {
brokeragePrice: 20
},
/**
* 生命周期函数--监听页面加载
*/
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>
<view class="profit-info">
<view>当前可提现积分<text class="s-word">(积分比例为1:1)</text></view>
<view class="fz70">300</view>
<view class="fz70">{{brokeragePrice}}</view>
</view>
</view>
<view class="tips">注:提现需在每月20-26日进行,其他时间不可提现</view>
@ -16,4 +16,5 @@
<view class="colO">全部提现</view>
</view>
</view>
<view class="submit-btn">提现</view>
</view>

11
pages/user/cashOut/index.wxss

@ -66,3 +66,14 @@
.colO{
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;
}

29
pages/user/index.js

@ -7,22 +7,16 @@ Page({
* 页面的初始数据
*/
data: {
userInfo: {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
userApi.bingPhone().then(res=>{
console.log(res)
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
// userApi.getMyTeam().then((res)=>{
// console.log(res)
// })
},
@ -30,9 +24,20 @@ Page({
* 生命周期函数--监听页面显示
*/
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": {},
"navigationBarTitleText": "我的"
"navigationBarTitleText": "我的",
"enablePullDownRefresh": true
}

48
pages/user/index.wxml

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

29
pages/user/profit/index.js

@ -1,18 +1,43 @@
// pages/user/profit/index.js
const app = getApp()
const user = require('../../../api/user.js')
Page({
/**
* 页面的初始数据
*/
data: {
userInfo: {},
integralList: [],
page: 1,
pagesize: 300,
loadingStatus: '没有更多了。。。'
},
/**
* 生命周期函数--监听页面加载
*/
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="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="name">赵铁柱</view>
<view class="id-num">ID:2123</view>
<view class="name">{{userInfo.nickname}}</view>
<view class="id-num">ID:{{userInfo.uid}}</view>
</view>
</view>
@ -15,20 +15,31 @@
<view class="acea-row row-between">
<view class="">
<view>今日收益</view>
<view class="fz40">200积分</view>
<view class="fz40">{{userInfo.todayBrokerage}}积分</view>
</view>
<view class="">
<view>累计收益</view>
<view class="fz40">200积分</view>
<view class="fz40">{{userInfo.brokeragePrice}}积分</view>
</view>
</view>
<view class="to-cash-out">去提现</view>
<view class="to-cash-out" bindtap="toCashOut">去提现</view>
</view>
</view>
<view class="int-list">
<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 class="title">禅易风云</view>
<view class="time colR">2021-11-26</view>
@ -37,6 +48,6 @@
<view class="title fz40 colR">+500积分</view>
<view class="time">一级收益</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