Commit a274844c6934079ebe6dee84f384b84f0db59ca9

Authored by pengye
1 parent 67403146

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

1 <!--pack-activity/pack/buyFreeCoupon.wxml--> 1 <!--pack-activity/pack/buyFreeCoupon.wxml-->
2 <nav backgroundColor="#f6f6fd">向商家付款</nav> 2 <nav backgroundColor="#f6f6fd">向商家付款</nav>
3 <view class="sellInfo"> 3 <view class="sellInfo">
4 - <image src="{{seller.seller_image}}" mode="" /> 4 + <image src="{{seller.seller_image}}" mode="aspectFill" />
5 <view class="font32r">{{seller.sellername}}</view> 5 <view class="font32r">{{seller.sellername}}</view>
6 </view> 6 </view>
7 <view class="payBox"> 7 <view class="payBox">
  1 +// pages/me/consumeAmount.js
  2 +Page({
  3 +
  4 + /**
  5 + * 页面的初始数据
  6 + */
  7 + data: {
  8 +
  9 + },
  10 +
  11 + /**
  12 + * 生命周期函数--监听页面加载
  13 + */
  14 + onLoad(options) {
  15 +
  16 + },
  17 +
  18 + /**
  19 + * 生命周期函数--监听页面初次渲染完成
  20 + */
  21 + onReady() {
  22 +
  23 + },
  24 +
  25 + /**
  26 + * 生命周期函数--监听页面显示
  27 + */
  28 + onShow() {
  29 +
  30 + },
  31 +
  32 + /**
  33 + * 生命周期函数--监听页面隐藏
  34 + */
  35 + onHide() {
  36 +
  37 + },
  38 +
  39 + /**
  40 + * 生命周期函数--监听页面卸载
  41 + */
  42 + onUnload() {
  43 +
  44 + },
  45 +
  46 + /**
  47 + * 页面相关事件处理函数--监听用户下拉动作
  48 + */
  49 + onPullDownRefresh() {
  50 +
  51 + },
  52 +
  53 + /**
  54 + * 页面上拉触底事件的处理函数
  55 + */
  56 + onReachBottom() {
  57 +
  58 + },
  59 +})
  1 +{
  2 + "usingComponents": {
  3 + "nav": "/components/nav/nav"
  4 + }
  5 +}
  1 +<!--pages/me/consumeAmount.wxml-->
  2 +<wxs src="../../utils/util.wxs" module="util" />
  3 +<nav>我的消费金</nav>
  1 +/* pages/me/consumeAmount.wxss */
@@ -121,6 +121,7 @@ Page({ @@ -121,6 +121,7 @@ Page({
121 }) 121 })
122 list.sort((a, b) => a.is_examine - b.is_examine); 122 list.sort((a, b) => a.is_examine - b.is_examine);
123 list.sort((a, b) => b.noShow - a.noShow); 123 list.sort((a, b) => b.noShow - a.noShow);
  124 + list = list.filter(item=>{return (item.recharge_name || item.aname)})
124 this.setData({ 125 this.setData({
125 list, 126 list,
126 isShow:true, 127 isShow:true,
@@ -184,7 +185,7 @@ Page({ @@ -184,7 +185,7 @@ Page({
184 }, 185 },
185 // 计算免费券有效期的起始、结束日期 186 // 计算免费券有效期的起始、结束日期
186 setTimeRange(cdate, startOffset, endOffset) { 187 setTimeRange(cdate, startOffset, endOffset) {
187 - console.log(cdate, startOffset, endOffset); 188 + // console.log(cdate, startOffset, endOffset);
188 const startDate = new Date((cdate * 1 + startOffset * 86400) * 1000); 189 const startDate = new Date((cdate * 1 + startOffset * 86400) * 1000);
189 startDate.setHours(0, 0, 0, 0); 190 startDate.setHours(0, 0, 0, 0);
190 const useStime = util.unixtoTime(startDate.getTime() / 1000, 'YYYY-MM-DD'); 191 const useStime = util.unixtoTime(startDate.getTime() / 1000, 'YYYY-MM-DD');
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 <nav>卡券</nav> 3 <nav>卡券</nav>
4 <scroll-view class="list" style="height:{{contentHeight}}px;" scroll-y> 4 <scroll-view class="list" style="height:{{contentHeight}}px;" scroll-y>
5 <block wx:if="{{list.length>0}}"> 5 <block wx:if="{{list.length>0}}">
6 - <view wx:for="{{list}}" bindtap="todetail" data-item="{{item}}" wx:if="{{item.recharge_name || item.aname}}" class="preferentialItems {{item.noShow == '0' ? 'noStyle':''}}"> 6 + <view wx:for="{{list}}" bindtap="todetail" data-item="{{item}}" class="preferentialItems {{item.noShow == '0' ? 'noStyle':''}}">
7 <view class="itemLeft"> 7 <view class="itemLeft">
8 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text> 8 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
9 <view class="discountText1 font20r {{item.arule.is_accumulation == '1'?'discountText2':'discountText3'}}" wx:if="{{item.is_type == '3'}}">{{item.arule.is_accumulation == '1' ? '可' : '不可'}}叠加</view> 9 <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({ @@ -15,6 +15,11 @@ Page({
15 id:55214, 15 id:55214,
16 }, 16 },
17 shownotice:false, 17 shownotice:false,
  18 + collection: '', //顾客收藏的店铺列表数量
  19 + customer_activity: '', //用户未使用优惠券列表数量
  20 + nickname: '', //昵称
  21 + headimgurl: '', //头像
  22 + price: '', //消费金
18 }, 23 },
19 /** 24 /**
20 * 生命周期函数--监听页面加载 25 * 生命周期函数--监听页面加载
@@ -69,6 +74,52 @@ Page({ @@ -69,6 +74,52 @@ Page({
69 user:res.data 74 user:res.data
70 }) 75 })
71 }) 76 })
  77 + this.getlist()
  78 + this.GetCollectionSellerList()
  79 + this.getInfo()
  80 + },
  81 + // 获取用户昵称、头像
  82 + getInfo() {
  83 + App.Wechat.CheckUserHavePhone({
  84 + openid: getApp().openid,
  85 + }).then(res => {
  86 + let data = res.data;
  87 + if (data) {
  88 + this.setData({
  89 + nickname: data.nickname ? data.nickname : '',
  90 + headimgurl: data.headimgurl ? data.headimgurl : '',
  91 + price: data.price ? data.price : '0.00',
  92 + })
  93 + }
  94 + })
  95 + },
  96 + // 顾客收藏的店铺列表
  97 + GetCollectionSellerList() {
  98 + App.Customer.GetCollectionSellerList({
  99 + openid: getApp().openid,
  100 + offset: '1',
  101 + size: '9000',
  102 + }).then(res => {
  103 + this.setData({
  104 + 'collection': res.data.length,
  105 + })
  106 + })
  107 + },
  108 + //获取用户未使用优惠券列表数量
  109 + getlist() {
  110 + App.Activity.GetNewRechargeListByOpenid({
  111 + openid: getApp().openid,
  112 + }).then((res) => {
  113 + if (res.ret == 200) {
  114 + let list = res.data;
  115 + list = list.filter(item => {
  116 + return (item.recharge_name || item.aname)
  117 + })
  118 + this.setData({
  119 + 'customer_activity': list.length,
  120 + })
  121 + }
  122 + })
72 }, 123 },
73 124
74 /** 125 /**
1 <!--pages/me/index.wxml--> 1 <!--pages/me/index.wxml-->
2 <view class="meHeader flex-ll" style="padding-top: {{headertop+44}}px;height: {{48*ratio}}rpx;padding-bottom: {{headertop-20>0 ? 150 : 130}}rpx;"> 2 <view class="meHeader flex-ll" style="padding-top: {{headertop+44}}px;height: {{48*ratio}}rpx;padding-bottom: {{headertop-20>0 ? 150 : 130}}rpx;">
3 <view class="avatar"> 3 <view class="avatar">
4 - <open-data type="userAvatarUrl"></open-data> 4 + <image src="{{headimgurl?headimgurl:'https://nosqn.colorcun.com/defaultAvatar.png'}}" mode="" />
5 </view> 5 </view>
6 <view> 6 <view>
7 - <view class="name"><open-data type="userNickName"></open-data></view>  
8 - <!--<view class="info">查看并编辑个人资料</view>--> 7 + <view class="name">{{nickname?nickname:'微信用户'}}</view>
9 </view> 8 </view>
10 </view> 9 </view>
11 <nav backgroundColor="rgba(0,0,0,0)" color="#ffffff">周到安排</nav> 10 <nav backgroundColor="rgba(0,0,0,0)" color="#ffffff">周到安排</nav>
@@ -15,7 +14,7 @@ @@ -15,7 +14,7 @@
15 <view class="block-rev money flex-lr"> 14 <view class="block-rev money flex-lr">
16 <navigator url="/pages/me/follow" class="money-item"> 15 <navigator url="/pages/me/follow" class="money-item">
17 <view class="flex-vc"> 16 <view class="flex-vc">
18 - <view class="money-value">{{user.collection||0}}</view> 17 + <view class="money-value">{{collection||0}}</view>
19 <view class="money-title">我的收藏</view> 18 <view class="money-title">我的收藏</view>
20 </view> 19 </view>
21 </navigator> 20 </navigator>
@@ -33,10 +32,16 @@ @@ -33,10 +32,16 @@
33 </navigator> --> 32 </navigator> -->
34 <navigator url="./coupon_news" class="money-item"> 33 <navigator url="./coupon_news" class="money-item">
35 <view class="flex-vc"> 34 <view class="flex-vc">
36 - <view class="money-value">{{user.customer_activity}}</view> 35 + <view class="money-value">{{customer_activity}}</view>
37 <view class="money-title">卡券</view> 36 <view class="money-title">卡券</view>
38 </view> 37 </view>
39 </navigator> 38 </navigator>
  39 + <navigator url="/pages/me/consumeAmount" class="money-item">
  40 + <view class="flex-vc">
  41 + <view class="money-value">¥{{price}}</view>
  42 + <view class="money-title">消费金</view>
  43 + </view>
  44 + </navigator>
40 </view> 45 </view>
41 <view class="block-rev"> 46 <view class="block-rev">
42 <navigator url="/pages/me/list" open-type="redirect"> 47 <navigator url="/pages/me/list" open-type="redirect">