Commit e9c33082 by 高淑倩

modify: 会员中心 _ 积分优惠券父子交互

parent 48151cef
......@@ -9,6 +9,14 @@ Component({
type: Object,
value: {},
},
integralNum: {
type: Number,
value: 0,
},
couponNum: {
type: Number,
value: 0,
},
},
/**
* 页面的初始数据
......@@ -16,9 +24,7 @@ Component({
data: {
personCenter: {},
memberCardNo: "",
memberActivateStatus: false,
integralNum: 0,
couponNum: 0
memberActivateStatus: false
},
attached () {
this.setData({
......@@ -31,43 +37,8 @@ Component({
memberCardNo,
memberActivateStatus
})
// 积分数量
this.getMemberPointInfo()
// 优惠券数量
this.getMemberCouponInfo()
},
methods: {
// 查询积分信息
getMemberPointInfo(){
console.log('getMemberPointInfo')
wx.showLoading({
title: '加载中'
})
wxService.get(`/member/memberPoint/getMyPointInfo`).then(res => {
const { result, data } = res.data
if (result == 0) {
wx.hideLoading()
this.setData({
integralNum: data.point
})
}
})
},
// 查询优惠券数量
getMemberCouponInfo(){
wx.showLoading({
title: '加载中'
})
wxService.post(`/coupon/coupon/memberCouponCount`).then(res => {
const { result, data } = res.data
if (result == 0) {
wx.hideLoading()
this.setData({
couponNum: data[1] || 0
})
}
})
},
toBonusDetails() {
wxService.router(`/pages/integralWater/integralWater`)
},
......
......@@ -16,44 +16,15 @@ wxService.page({
render: null, // 渲染页面数据对象(安全渲染)
renderPageOver: false, // 渲染页面结束
startX: 0,
startY: 0
startY: 0,
integralNum: 0,
couponNum: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// this.setData(
// {
// pages: [],
// groupLoadState: 'complete', // 活动分组加载标志
// homeApiLoading: true,
// render: null, // 渲染页面数据对象(安全渲染)
// isLastPage: false, // 页面段落加载完成
// renderPageOver: false // 渲染页面结束
// },
// () => {
// // this.loadMore()
// }
// )
// handlerDataOnPage = new utils.HandlerDataOnPage()
// renderPage = require('../../utils/renderPage').getRenderPage()
// handlerDataOnPage.init(this, 'pages')
// this.initPage()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.setData(
{
pages: [],
......@@ -73,6 +44,53 @@ wxService.page({
this.initPage()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
// 积分数量
this.getMemberPointInfo()
// 优惠券数量
this.getMemberCouponInfo()
},
// 查询积分信息
getMemberPointInfo(){
wx.showLoading({
title: '加载中'
})
wxService.get(`/member/memberPoint/getMyPointInfo`).then(res => {
const { result, data } = res.data
if (result == 0) {
wx.hideLoading()
this.setData({
integralNum: data.point
})
}
})
},
// 查询优惠券数量
getMemberCouponInfo(){
wx.showLoading({
title: '加载中'
})
wxService.post(`/coupon/coupon/memberCouponCount`).then(res => {
const { result, data } = res.data
if (result == 0) {
wx.hideLoading()
this.setData({
couponNum: data[1] || 0
})
}
})
},
touchStart(e) {
this.setData({
startX: e.changedTouches[0].clientX,
......
......@@ -12,7 +12,7 @@
<!-- 个人中心 {{pItem.customer}}-->
<view class="images-tab pd1530" wx:if="{{pItem.type == 2}}">
<person-center person-data="{{pItem.customer}}" />
<person-center person-data="{{pItem.customer}}" integral-num="{{integralNum}}" coupon-num="{{couponNum}}"/>
</view>
<!-- 图片导航 {{pItem.navigation.images}}-->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment