Commit 53179d3d by 高淑倩

add: 接口

parent 5af4381c
...@@ -16,8 +16,8 @@ wxService.page({ ...@@ -16,8 +16,8 @@ wxService.page({
content: '积分流水', content: '积分流水',
tip: '立即查看' tip: '立即查看'
}, },
desc: [{ "label": "优惠详情", "value": "使用100积分可兑换一张维记鲜牛奶优惠券,凭券可以4.8元优惠价换购维记鲜牛奶236ML一盒!", "type": 2 }, { "label": "有效时间", "value": "2019-07-12 至 2019-08-06", "type": 2 }, { "label": "兑换说明", "value": "1、点击【立即兑换】,即可兑换成功,每人限兑换10张券\n2、在【会员小程序-优惠券】中可查询到已兑换的券;", "type": 2 }, { "label": "使用须知", "value": "1、凭此优惠券,前往广东7-Eleven有售门店,可以优惠价4.8元换购维记鲜牛奶236ML一盒!2、成功领到优惠券后,请务必在有效期内使用,逾期无效;3、一张券限兑换维记鲜牛奶236ML一盒;4、优惠券不设找零、不可兑换现金; 5、请于交易前向收银员出示此优惠券; 6、使用优惠券发生的交易,广东7-Eleven仅按实际支付金额开具发票;7、如发生退货,仅按顾客实际支付金额退款。 ", "type": 2 }] desc: [{ "label": "优惠详情", "value": "使用100积分可兑换一张维记鲜牛奶优惠券,凭券可以4.8元优惠价换购维记鲜牛奶236ML一盒!", "type": 2 }, { "label": "有效时间", "value": "2019-07-12 至 2019-08-06", "type": 2 }, { "label": "兑换说明", "value": "1、点击【立即兑换】,即可兑换成功,每人限兑换10张券\n2、在【会员小程序-优惠券】中可查询到已兑换的券;", "type": 2 }, { "label": "使用须知", "value": "1、凭此优惠券,前往广东7-Eleven有售门店,可以优惠价4.8元换购维记鲜牛奶236ML一盒!2、成功领到优惠券后,请务必在有效期内使用,逾期无效;3、一张券限兑换维记鲜牛奶236ML一盒;4、优惠券不设找零、不可兑换现金; 5、请于交易前向收银员出示此优惠券; 6、使用优惠券发生的交易,广东7-Eleven仅按实际支付金额开具发票;7、如发生退货,仅按顾客实际支付金额退款。 ", "type": 2 }],
activityId: ''
}, },
/** /**
...@@ -26,15 +26,34 @@ wxService.page({ ...@@ -26,15 +26,34 @@ wxService.page({
onLoad: function (options) { onLoad: function (options) {
}, },
getPointDetail() { // 集点详情
getPointDetail(id) {
wx.showLoading({ wx.showLoading({
title: '加载中' title: '加载中'
}) })
const params = { wxService.get(`/sale/touchpoints/pointConsumptionActivity/findById/${id} `).then(res => {
activityId: '', if (res) {
memberId: '' const { result, data } = res.data
if (result == 0) {
wx.hideLoading()
console.log(data)
this.setData({
activityId: data.id
},()=> {
// 会员集点活动统计信息
this.getPointConsumptionCount(id)
})
} }
wxService.post(`/sale/touchpoints/pointConsumptionCount/getPointConsumptionCount`, params).then(res => { }
})
},
// 会员集点活动统计信息
getPointConsumptionCount(activityId) {
const { memberId } = wx.getStorageSync('_baseUserInfo')
wx.showLoading({
title: '加载中'
})
wxService.post(`/sale/touchpoints/pointConsumptionCount/getPointConsumptionCount?activityId=${activityId}&memberId=${memberId}`).then(res => {
if (res) { if (res) {
const { result, data } = res.data const { result, data } = res.data
if (result == 0) { if (result == 0) {
...@@ -52,15 +71,16 @@ wxService.page({ ...@@ -52,15 +71,16 @@ wxService.page({
handleGo() { handleGo() {
// 兑换成功跳转 触点有礼-消费集点兑换 // 兑换成功跳转 触点有礼-消费集点兑换
// wxService.router(`/pages/coupons/coupons`) // wxService.router(`/pages/coupons/coupons`)
// /touchpoints/pointConsumptionExchange/exchange
this.getPointExchange() this.getPointExchange()
}, },
getPointExchange() { getPointExchange() {
const { activityId} = this.data
const { memberId } = wx.getStorageSync('_baseUserInfo')
wx.showLoading({ wx.showLoading({
title: '加载中' title: '加载中'
}) })
wxService.get(`/sale/touchpoints/pointConsumptionExchange/exchange?activityId=${1}&memberId=${1}`).then(res => { wxService.get(`/sale/touchpoints/pointConsumptionExchange/exchange?activityId=${activityId}&memberId=${memberId}`).then(res => {
if (res) { if (res) {
const { result, data } = res.data const { result, data } = res.data
if (result == 0) { if (result == 0) {
...@@ -90,7 +110,10 @@ wxService.page({ ...@@ -90,7 +110,10 @@ wxService.page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
this.getPointDetail() const {id} = this.options
if(id){
this.getPointDetail(id)
}
}, },
/** /**
......
...@@ -4,12 +4,12 @@ const wxService = require('../../utils/wxService') ...@@ -4,12 +4,12 @@ const wxService = require('../../utils/wxService')
const utils = require('../../utils/util') const utils = require('../../utils/util')
wxService.page({ wxService.page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
pointList: [] pointList: [],
currentPointList: [] // 合并对象
}, },
/** /**
...@@ -40,18 +40,37 @@ wxService.page({ ...@@ -40,18 +40,37 @@ wxService.page({
if(res) { if(res) {
const { result, data } = res.data const { result, data } = res.data
if (result == 0) { if (result == 0) {
this.setData({
pointList: data
})
data.forEach(item=>{
this.getPointConsumptionCount(item.id)
})
}
}
})
},
getPointConsumptionCount(activityId) {
const { memberId } = wx.getStorageSync('_baseUserInfo')
// 会员集点活动统计信息
wxService.post(`/sale/touchpoints/pointConsumptionCount/getPointConsumptionCount?activityId=${activityId}&memberId=${memberId}`).then(res => {
if (res) {
const { result, data } = res.data
if (result == 0) {
wx.hideLoading() wx.hideLoading()
console.log(data) let obj1 = {...this.data.pointList,...res.data}
let currentList = []
currentList.push(obj1)
this.setData({ this.setData({
currentPointList: currentList
}) })
} }
} }
}) })
}, },
handleDetail(e) { handleDetail(e) {
const {index} = e.currentTarget.dataset const {id} = e.currentTarget.dataset
console.log('handleDetail',index) wxService.router(`/pages/pointDetail/pointDetail`).search({id})
wxService.router(`/pages/pointDetail/pointDetail`).search({index})
}, },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
......
<!--pages/pointList/pointList.wxml--> <!--pages/pointList/pointList.wxml-->
<view class="point-list border_box"> <view class="point-list border_box">
<block wx:for="{{4}}" wx:for-item="item"> <block wx:for="{{currentPointList}}" wx:key="item">
<view class="point border_box" data-index="{{item}}" bindtap="handleDetail"> <view class="point border_box" data-id="{{item[0].id}}" bindtap="handleDetail">
<status-img></status-img> <status-img img="{{item[0].listImage}}" />
<view class="progress weui-flex df-j--bt"> <view class="progress weui-flex df-j--bt">
<view class="rate">进度: <text class="rate-num">1</text>/5</view> <view class="rate">进度:
<view class="time-out">距离结束时间: <text class="time">11</text></view> <text class="rate-num">1</text>
/ {{item[0].goal}}
</view>
<view class="time-out">距离结束时间:
<text class="time">11</text>
</view>
</view> </view>
</view> </view>
</block> </block>
</view> </view>
...@@ -6,7 +6,7 @@ wxService.page({ ...@@ -6,7 +6,7 @@ wxService.page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
goodsList: [{ name: 'aa' }, { name: 'aa' }, { name: 'aa' },{ name: 'aa' }, { name: 'aa' }, { name: 'aa' },{ name: 'aa' }, { name: 'aa' }, { name: 'aa' },{ name: 'aa' }, { name: 'aa' }, { name: 'aa' }], goodsList: [{ name: 'aa' }, { name: 'aa' }, { name: 'aa' }, { name: 'aa' }, { name: 'aa' }, { name: 'aa' }, { name: 'aa' }, { name: 'aa' }, { name: 'aa' }, { name: 'aa' }, { name: 'aa' }, { name: 'aa' }],
isNoMore: true isNoMore: true
}, },
...@@ -23,12 +23,31 @@ wxService.page({ ...@@ -23,12 +23,31 @@ wxService.page({
onReady: function () { onReady: function () {
}, },
// 活动下商品列表 id pageNo pageSize
findActivityProductList() {
wx.showLoading({
title: '加载中'
})
wxService.get(`/sale/touchpoints/pointConsumptionActivity/findActivityProductList?id=${}&pageNo=${}&pageSize=${}`).then(res => {
if (res) {
const { result, data } = res.data
if (result == 0) {
wx.hideLoading()
console.log(data)
this.setData({
})
}
}
})
},
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
const {id} = this.options
if(id){
this.findActivityProductList(id)
}
}, },
/** /**
......
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