Commit e9c33082 by 高淑倩

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

parent 48151cef
...@@ -8,7 +8,15 @@ Component({ ...@@ -8,7 +8,15 @@ Component({
personData: { personData: {
type: Object, type: Object,
value: {}, value: {},
}, },
integralNum: {
type: Number,
value: 0,
},
couponNum: {
type: Number,
value: 0,
},
}, },
/** /**
* 页面的初始数据 * 页面的初始数据
...@@ -16,9 +24,7 @@ Component({ ...@@ -16,9 +24,7 @@ Component({
data: { data: {
personCenter: {}, personCenter: {},
memberCardNo: "", memberCardNo: "",
memberActivateStatus: false, memberActivateStatus: false
integralNum: 0,
couponNum: 0
}, },
attached () { attached () {
this.setData({ this.setData({
...@@ -31,43 +37,8 @@ Component({ ...@@ -31,43 +37,8 @@ Component({
memberCardNo, memberCardNo,
memberActivateStatus memberActivateStatus
}) })
// 积分数量
this.getMemberPointInfo()
// 优惠券数量
this.getMemberCouponInfo()
}, },
methods: { 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() { toBonusDetails() {
wxService.router(`/pages/integralWater/integralWater`) wxService.router(`/pages/integralWater/integralWater`)
}, },
......
...@@ -16,44 +16,15 @@ wxService.page({ ...@@ -16,44 +16,15 @@ wxService.page({
render: null, // 渲染页面数据对象(安全渲染) render: null, // 渲染页面数据对象(安全渲染)
renderPageOver: false, // 渲染页面结束 renderPageOver: false, // 渲染页面结束
startX: 0, startX: 0,
startY: 0 startY: 0,
integralNum: 0,
couponNum: 0
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { 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( this.setData(
{ {
pages: [], pages: [],
...@@ -73,6 +44,53 @@ wxService.page({ ...@@ -73,6 +44,53 @@ wxService.page({
this.initPage() 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) { touchStart(e) {
this.setData({ this.setData({
startX: e.changedTouches[0].clientX, startX: e.changedTouches[0].clientX,
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<!-- 个人中心 {{pItem.customer}}--> <!-- 个人中心 {{pItem.customer}}-->
<view class="images-tab pd1530" wx:if="{{pItem.type == 2}}"> <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> </view>
<!-- 图片导航 {{pItem.navigation.images}}--> <!-- 图片导航 {{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