Commit a274844c6934079ebe6dee84f384b84f0db59ca9

Authored by pengye
1 parent 67403146

在我的页面显示昵称、头像、收藏数量、卡券数量、消费金金额

<!--pack-activity/pack/buyFreeCoupon.wxml-->
<nav backgroundColor="#f6f6fd">向商家付款</nav>
<view class="sellInfo">
<image src="{{seller.seller_image}}" mode="" />
<image src="{{seller.seller_image}}" mode="aspectFill" />
<view class="font32r">{{seller.sellername}}</view>
</view>
<view class="payBox">
... ...
// pages/me/consumeAmount.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
})
\ No newline at end of file
... ...
{
"usingComponents": {
"nav": "/components/nav/nav"
}
}
\ No newline at end of file
... ...
<!--pages/me/consumeAmount.wxml-->
<wxs src="../../utils/util.wxs" module="util" />
<nav>我的消费金</nav>
\ No newline at end of file
... ...
/* pages/me/consumeAmount.wxss */
\ No newline at end of file
... ...
... ... @@ -121,6 +121,7 @@ Page({
})
list.sort((a, b) => a.is_examine - b.is_examine);
list.sort((a, b) => b.noShow - a.noShow);
list = list.filter(item=>{return (item.recharge_name || item.aname)})
this.setData({
list,
isShow:true,
... ... @@ -184,7 +185,7 @@ Page({
},
// 计算免费券有效期的起始、结束日期
setTimeRange(cdate, startOffset, endOffset) {
console.log(cdate, startOffset, endOffset);
// console.log(cdate, startOffset, endOffset);
const startDate = new Date((cdate * 1 + startOffset * 86400) * 1000);
startDate.setHours(0, 0, 0, 0);
const useStime = util.unixtoTime(startDate.getTime() / 1000, 'YYYY-MM-DD');
... ...
... ... @@ -3,7 +3,7 @@
<nav>卡券</nav>
<scroll-view class="list" style="height:{{contentHeight}}px;" scroll-y>
<block wx:if="{{list.length>0}}">
<view wx:for="{{list}}" bindtap="todetail" data-item="{{item}}" wx:if="{{item.recharge_name || item.aname}}" class="preferentialItems {{item.noShow == '0' ? 'noStyle':''}}">
<view wx:for="{{list}}" bindtap="todetail" data-item="{{item}}" class="preferentialItems {{item.noShow == '0' ? 'noStyle':''}}">
<view class="itemLeft">
<text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
<view class="discountText1 font20r {{item.arule.is_accumulation == '1'?'discountText2':'discountText3'}}" wx:if="{{item.is_type == '3'}}">{{item.arule.is_accumulation == '1' ? '可' : '不可'}}叠加</view>
... ...
... ... @@ -15,6 +15,11 @@ Page({
id:55214,
},
shownotice:false,
collection: '', //顾客收藏的店铺列表数量
customer_activity: '', //用户未使用优惠券列表数量
nickname: '', //昵称
headimgurl: '', //头像
price: '', //消费金
},
/**
* 生命周期函数--监听页面加载
... ... @@ -69,6 +74,52 @@ Page({
user:res.data
})
})
this.getlist()
this.GetCollectionSellerList()
this.getInfo()
},
// 获取用户昵称、头像
getInfo() {
App.Wechat.CheckUserHavePhone({
openid: getApp().openid,
}).then(res => {
let data = res.data;
if (data) {
this.setData({
nickname: data.nickname ? data.nickname : '',
headimgurl: data.headimgurl ? data.headimgurl : '',
price: data.price ? data.price : '0.00',
})
}
})
},
// 顾客收藏的店铺列表
GetCollectionSellerList() {
App.Customer.GetCollectionSellerList({
openid: getApp().openid,
offset: '1',
size: '9000',
}).then(res => {
this.setData({
'collection': res.data.length,
})
})
},
//获取用户未使用优惠券列表数量
getlist() {
App.Activity.GetNewRechargeListByOpenid({
openid: getApp().openid,
}).then((res) => {
if (res.ret == 200) {
let list = res.data;
list = list.filter(item => {
return (item.recharge_name || item.aname)
})
this.setData({
'customer_activity': list.length,
})
}
})
},
/**
... ...
<!--pages/me/index.wxml-->
<view class="meHeader flex-ll" style="padding-top: {{headertop+44}}px;height: {{48*ratio}}rpx;padding-bottom: {{headertop-20>0 ? 150 : 130}}rpx;">
<view class="avatar">
<open-data type="userAvatarUrl"></open-data>
<image src="{{headimgurl?headimgurl:'https://nosqn.colorcun.com/defaultAvatar.png'}}" mode="" />
</view>
<view>
<view class="name"><open-data type="userNickName"></open-data></view>
<!--<view class="info">查看并编辑个人资料</view>-->
<view class="name">{{nickname?nickname:'微信用户'}}</view>
</view>
</view>
<nav backgroundColor="rgba(0,0,0,0)" color="#ffffff">周到安排</nav>
... ... @@ -15,7 +14,7 @@
<view class="block-rev money flex-lr">
<navigator url="/pages/me/follow" class="money-item">
<view class="flex-vc">
<view class="money-value">{{user.collection||0}}</view>
<view class="money-value">{{collection||0}}</view>
<view class="money-title">我的收藏</view>
</view>
</navigator>
... ... @@ -33,10 +32,16 @@
</navigator> -->
<navigator url="./coupon_news" class="money-item">
<view class="flex-vc">
<view class="money-value">{{user.customer_activity}}</view>
<view class="money-value">{{customer_activity}}</view>
<view class="money-title">卡券</view>
</view>
</navigator>
<navigator url="/pages/me/consumeAmount" class="money-item">
<view class="flex-vc">
<view class="money-value">¥{{price}}</view>
<view class="money-title">消费金</view>
</view>
</navigator>
</view>
<view class="block-rev">
<navigator url="/pages/me/list" open-type="redirect">
... ...