Commit d6dfcc01 by 谢中龙

新增积分活动分组

parent 7d54be44
......@@ -32,7 +32,10 @@
"pages/valueCardInfo/valueCardInfo",
"pages/myValueCard/myValueCard",
"pages/myValueCardInfo/myValueCardInfo",
"pages/valueCardRecords/valueCardRecords"
"pages/valueCardRecords/valueCardRecords",
"pages/pointActicityGroup/pointActivityGroup",
"pages/pointExchangeCoupon/pointExchangeCoupon",
"pages/pointExchangeGoods/pointExchangeGoods"
]
}
],
......
const PROJECT_ENV = 'prod' // 生产 prod, 开发1 dev,开发2 dev2, 测试 test, 预生产 pre
const PROJECT_ENV = 'test' // 生产 prod, 开发1 dev,开发2 dev2, 测试 test, 预生产 pre
const needMock = '' //
const brandId = 2711 ; //1002 测试 2711 生产
const brandId = 1002 ; //1002 测试 2711 生产
// appid_dev_wx wxc3b64b09b1d3dfc2
// appid_test_wx wxac09792264c49b5c
// appid_pre_711 wx358b56af62edbde1
......
......@@ -128,7 +128,9 @@ wxService.page({
// 去积分商城
handleGoIntegralMall() {
// wxService.router(`/pages/IntegralMall/IntegralMall`)
wxService.router(`/subPackage/page/pages/IntegralMallGoods/IntegralMallGoods`)
// wxService.router(`/subPackage/page/pages/IntegralMallGoods/IntegralMallGoods`)
//现在修改为跳转到积分活动分组列表
wxService.router(`/subPackage/page/pages/pointActicityGroup/pointActivityGroup`);
},
// 消费详情
handleGoDetail(e) {
......
......@@ -13,7 +13,7 @@
},
"compileType": "miniprogram",
"libVersion": "2.8.2",
"appid": "wx700028bf32a3be66",
"appid": "wxac09792264c49b5c",
"projectname": "7-11",
"debugOptions": {
"hidedInDevtools": []
......@@ -43,7 +43,7 @@
"list": []
},
"miniprogram": {
"current": -1,
"current": 29,
"list": [
{
"id": -1,
......@@ -216,6 +216,23 @@
"name": "超值卡记录",
"pathName": "subPackage/page/pages/valueCardRecords/valueCardRecords",
"query": ""
},
{
"id": -1,
"name": "活动积分分组",
"pathName": "subPackage/page/pages/pointActicityGroup/pointActivityGroup",
"query": ""
},
{
"id": -1,
"name": "积分活动积分换物详情",
"pathName": "subPackage/page/pages/pointExchangeGoods/pointExchangeGoods",
"query": ""
},
{
"id": -1,
"name": "积分活动积分兑券详情",
"pathName": "subPackage/page/pages/pointExchangeCoupon/pointExchangeCoupon"
}
]
}
......
// pages/userCenter.js
const wxService = require('../../../../utils/wxService')
wxService.page({
/**
* 页面的初始数据
*/
data: {
query: '',
memberPoint: {
total: '--',
expirePoint: 0,
expireDate: ''
},
activityList : [],
pageNo : 1,
pageSize : 10,
totalPage : 0,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.hideShareMenu();
this.refreshPointRequest();
this.getPointActivityGroupList();
},
//刷新积分请求
refreshPointRequest() {
const { memberId } = wx.getStorageSync('_baseUserInfo')
if (!memberId) {
return;
}
wxService.get('/member/memberPoint/refreshExpiredPoint?memberId=' + memberId).then(res => { })
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
//获取会员积分信息
this.getMemberIntegrateInfo();
},
//查询会员积分信息
getMemberIntegrateInfo() {
// wx.showLoading({
// title: '数据请求中..',
// });
const { memberId } = wx.getStorageSync('_baseUserInfo')
if (!memberId) {
return;
}
wxService.get(`/member/memberPoint/getMemberPointInfo?memberId=${memberId}`).then(res => {
let data = res.data.data ? res.data.data : {};
this.data.memberPoint.total = data.point ? data.point : 0;
this.data.memberPoint.expirePoint = data.pointWillExpired ? data.pointWillExpired : 0;
let expireDate = data.pointExpiredTime ? data.pointExpiredTime : '2019-12-31 23:59:59';
if (expireDate) {
let dateStr = expireDate.replace(/-/g, '/');
let da = new Date(dateStr);
let year = da.getFullYear();
let month = (da.getMonth() + 1) < 10 ? '0' + (da.getMonth() + 1) : da.getMonth() + 1;
let day = da.getDate() < 10 ? '0' + da.getDate() : da.getDate();
expireDate = `${year}${month}${day}日`
}
this.data.memberPoint.expireDate = expireDate;
this.setData({
memberPoint: this.data.memberPoint
});
});
},
// 点击跳转至会员规则页
handleGoMemberRulesRules() {
wxService.router(`/pages/memberRules/memberRules?type=2`)
},
//获取积分分组活动列表
getPointActivityGroupList(refres){
let pageNo = this.data.pageNo,
pageSize = this.data.pageSize;
wxService.post(`/merchant/groupingActivities/findPage?pageNo=${pageNo}&pageSize=${pageSize}`,{
status : 0
}).then(res => {
if(res){
let list = res.data.data.content ? res.data.data.content: [];
this.data.activityList = this.data.activityList.concat(list);
this.data.totalPage = res.data.data.totalPages;
this.setData({
activityList: this.data.activityList,
totalPage: this.data.totalPage
});
}
if(refres){
wx.stopPullDownRefresh();
wx.showToast({
title: '刷新成功',
});
}
})
},
//去详情
onTapToInfo(e){
let item = e.currentTarget.dataset.item;
if (item.type == 1){
//积分换物
wx.navigateTo({
url: '/subPackage/page/pages/pointExchangeGoods/pointExchangeGoods?id=' + item.id,
});
}
else if(item.type == 2){
//积分兑换优惠券
wx.navigateTo({
url: '/subPackage/page/pages/pointExchangeCoupon/pointExchangeCoupon?id=' + item.id,
});
}
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
this.data.pageNo = 1;
this.data.activityList = [];
this.getPointActivityGroupList(true);
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
if(this.data.pageNo < this.data.totalPage){
this.data.pageNo ++ ;
this.getPointActivityGroupList();
}
else{
if(this.data.pageNo > 1){
wx.showToast({
title: '没有更多数据啦~',
icon : 'none'
});
}
}
},
});
\ No newline at end of file
{
"navigationBarTitleText": "积分活动中心",
"enablePullDownRefresh": true,
"usingComponents": {
"empty": "/component/empty/empty"
}
}
\ No newline at end of file
<!--pages/userCenter.wxml-->
<view class='page-integral-mall'>
<!-- title -->
<view class='mall-title'>
<view class='title-num-point'>
<view class='title-img-point'>
<view class='img-point'>
<image class="point-img" src='/assets/imgs/point.png' mode="widthFix" />
</view>
<view class='text-point'>
{{memberPoint.total}}
</view>
</view>
<view class='integral-vip-rules' bindtap="handleGoMemberRulesRules">会员规则</view>
</view>
<view class='title-time-point' wx:if="{{memberPoint.expirePoint > 0}}">
{{memberPoint.expirePoint}} 积分将于 {{memberPoint.expireDate}} 清零
</view>
<view class='title-time-point' wx:if="{{memberPoint.expirePoint == 0}}">
暂无将过期积分
</view>
</view>
<!-- 活动分组列表 -->
<view class='activity-group-list box' wx:if="{{activityList.length > 0}}">
<view class='list-item'
wx:for="{{activityList}}"
wx:for-item="item"
data-item="{{item}}"
bindtap='onTapToInfo'
wx:key="*this">
<image mode='widthFix' src='{{item.msgUrl}}'></image>
</view>
</view>
<!-- 空 -->
<empty text="当前商家暂无任何积分兑换活动~" wx:else/>
<!--goHome-->
<go-home/>
<floatNav bind:getAuth="_getUserInfo" bind:updatePage="updatePage"/>
</view>
<!-- 库存没了 -->
<go-guid />
/* pages/userCenter.wxss */
@import "/base/base.wxss";
page {
/* background-color: rgba(0, 0, 0, 0.05); */
background: #ffffff;
}
.page-integral-mall {
border-top: 1px solid rgba(151, 151, 151, 0.1);
}
.box{
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.empty-wrap {
width: 300rpx;
margin: 190rpx auto 0;
text-align: center;
}
.empty-img {
width: 197rpx;
height: 176rpx;
margin-bottom: 48rpx;
}
.empty-text {
color: #cccccc;
font-size: 28rpx;
}
.text-align-left{
text-align: left !important;
}
.point-img {
width: 28rpx;
height: 36rpx;
}
.title-img-point {
display: flex;
align-items: center;
}
.point-exchange-goods-records{
font-size: 28rpx;
color: #ffffff;
display: flex;
justify-content: center;
align-items: center;
height: 80rpx;
position: fixed;
left: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.65);
z-index: 2;
width: 100%;
}
.point-exchange-goods-records:active{
opacity: 0.7;
}
.text-point {
color: rgba(51, 51, 51, 1);
font-size: 42rpx;
margin-left: 10rpx;
}
.mall-title {
height: 150rpx;
padding-left: 50rpx;
padding-right: 42rpx;
box-sizing: border-box;
background-color: rgba(255, 255, 255, 1);
box-shadow: 0px 0px 8px 5px rgba(0, 0, 0, 0.05),
0px 0px 3px 0px rgba(0, 0, 0, 0.03);
}
.title-num-point {
padding-top: 30rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.integral-vip-rules {
width: 133rpx;
height: 42rpx;
line-height: 42rpx;
border-radius: 34rpx;
font-size: 23rpx;
text-align: center;
border: 1px solid rgba(204, 204, 204, 1);
}
.title-time-point {
color: rgba(102, 102, 102, 1);
font-size: 20rpx;
text-align: left;
padding-top: 3rpx;
margin-top: 15rpx;
}
/* 活动分组 */
.activity-group-list{
width: 100%;
height: auto;
padding: 10rpx 30rpx;
margin-top: 20rpx;
}
.activity-group-list .list-item{
width: 100%;
height: auto;
margin-bottom: 20rpx;
}
.activity-group-list .list-item:active{
opacity: 0.7;
}
.activity-group-list .list-item image{
width: 100%;
display: block;
border-radius: 10rpx;
}
\ No newline at end of file
// pages/userCenter.js
const wxService = require('../../../../utils/wxService')
wxService.page({
/**
* 页面的初始数据
*/
data: {
query: '',
integralCouponList: [], // 积分兑换优惠券列表
noMore: false,
isExchange: false,
exchangeId: '',
exchangePoint: 0,
memberPoint: {
total: '--',
expirePoint: 0,
expireDate: ''
},
activityId : '',
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.data.activityId = options.id;
wx.hideShareMenu();
this.refreshPointRequest();
this.getActivityGroupInfo();
},
//刷新积分请求
refreshPointRequest() {
const { memberId } = wx.getStorageSync('_baseUserInfo')
if (!memberId) {
return;
}
wxService.get('/member/memberPoint/refreshExpiredPoint?memberId=' + memberId).then(res => { })
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
//获取会员积分信息
this.getMemberIntegrateInfo();
},
//查询会员积分信息
getMemberIntegrateInfo() {
// wx.showLoading({
// title: '数据请求中..',
// });
const { memberId } = wx.getStorageSync('_baseUserInfo')
if (!memberId) {
return;
}
wxService.get(`/member/memberPoint/getMemberPointInfo?memberId=${memberId}`).then(res => {
let data = res.data.data ? res.data.data : {};
this.data.memberPoint.total = data.point ? data.point : 0;
this.data.memberPoint.expirePoint = data.pointWillExpired ? data.pointWillExpired : 0;
let expireDate = data.pointExpiredTime ? data.pointExpiredTime : '2019-12-31 23:59:59';
if (expireDate) {
let dateStr = expireDate.replace(/-/g, '/');
let da = new Date(dateStr);
let year = da.getFullYear();
let month = (da.getMonth() + 1) < 10 ? '0' + (da.getMonth() + 1) : da.getMonth() + 1;
let day = da.getDate() < 10 ? '0' + da.getDate() : da.getDate();
expireDate = `${year}${month}${day}日`
}
this.data.memberPoint.expireDate = expireDate;
this.setData({
memberPoint: this.data.memberPoint
});
});
},
//查询指定积分换物活动兑换数量
findExchangeNumByIds(integralGoodsList) {
//获取ids
let ids = integralGoodsList.map(g => {
return g.id;
});
wxService.post(`/member/pointsRedemptionProductSetting/getExchangeCount`, ids).then(res => {
if (res) {
let data = res.data.data ? res.data.data : null;
if (data) {
for (let k in data) {
let id = k, value = data[k];
for (let i = 0; i < integralGoodsList.length; i++) {
if (integralGoodsList[i].id == id) {
integralGoodsList[i].canExchange = integralGoodsList[i].stock > value;
}
}
}
}
}
this.setData({
integralGoodsList: integralGoodsList,
});
});
},
//获取积分活动分组详情
getActivityGroupInfo(){
wxService.get(`/merchant/groupingActivities/findById?id=${this.data.activityId}`).then(res => {
if(res){
let data = res.data.data ? res.data.data : null;
if(data){
let ids = data.sons.map(item => {
return item.activateId;
});
this.initIntegralCouponList(ids);
}
}
})
},
// 积分兑换优惠券列表
initIntegralCouponList(ids) {
wx.showLoading({
title: '加载中'
});
wxService.post(`/coupon/pointsRedemptionCouponSetting/findByIds`,ids).then(res => {
if (res) {
const { result, data } = res.data
if (result == 0) {
wx.hideLoading()
this.setData({
integralCouponList: data.reverse()
});
}
}
}).finally(() => {
wx.hideLoading();
})
},
//立即兑换优惠券
exchange(e) {
const { id, point } = e.currentTarget.dataset
this.setData({
isExchange: true,
exchangeId: id,
exchangePoint: point
})
},
// 点击跳转至会员规则页
handleGoMemberRulesRules() {
wxService.router(`/pages/memberRules/memberRules?type=2`)
},
goCouponDetail(e) {
const { id } = e.currentTarget.dataset
wxService.router(`/pages/integralMallDetail/integralMallDetail?id=${id}`)
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () { },
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
})
\ No newline at end of file
{
"navigationBarTitleText": "积分兑换优惠券",
"enablePullDownRefresh": true,
"usingComponents": {
"no-more": "/component/noMore/noMore",
"exchange-coupon-modal": "/component/exchange-coupon-modal/exchange-coupon-modal"
}
}
\ No newline at end of file
<!--pages/userCenter.wxml-->
<view class='page-integral-mall' style="padding-bottom: {{currentTab =='goods' ? '80rpx' : '40rpx'}}">
<!-- title -->
<view class='mall-title'>
<view class='title-num-point'>
<view class='title-img-point'>
<view class='img-point'>
<image class="point-img" src='/assets/imgs/point.png' mode="widthFix" />
</view>
<view class='text-point'>
{{memberPoint.total}}
</view>
</view>
<view class='integral-vip-rules' wx:if="{{integralCouponList.length}}" bindtap="handleGoMemberRulesRules">会员规则</view>
</view>
<view class='title-time-point' wx:if="{{memberPoint.expirePoint > 0}}">
{{memberPoint.expirePoint}} 积分将于 {{memberPoint.expireDate}} 清零
</view>
<view class='title-time-point' wx:if="{{memberPoint.expirePoint == 0}}">
暂无将过期积分
</view>
</view>
<!-- 优惠券列表-->
<view>
<view class='coupon-wrap' wx:if="{{integralCouponList.length}}">
<view
class='coupon-list'
wx:for="{{integralCouponList}}"
wx:for-item="item"
wx:for-index="k"
wx:key="{{k}}"
data-id="{{item.id}}"
bindtap="goCouponDetail"
>
<view class="coupon-item">
<view class='coupon-img-title'>
<view class='coupon-img'>
<image wx:if="{{item.thumbnail}}" src='{{item.thumbnail}}' />
<image wx:else src='https://img3.bigaka.com/prd/3001/202003/20200309/30018086c13a-4579-47ed-a16e-c74cb8010c1d.png' />
</view>
<view class='coupon-info'>
<view class='coupon-name fs-28'>{{item.title}}</view>
<view class='coupon-desc text-align-left fs-24'>查看详情</view>
</view>
</view>
<view class='coupon-btn'>
<view class='coupon-btn-click'
data-id="{{item.id}}"
data-point="{{item.point}}"
catchtap='exchange'>立即兑换</view>
<view class='coupon-btn-num'>{{item.point}}积分</view>
</view>
</view>
</view>
</view>
<view class='empty-wrap' wx:if="{{!integralCouponList.length}}">
<view class='empty-info'>
<image class='empty-img'
src='https://img3.bigaka.com/prd/3001/202003/20200309/30012bce7628-f373-4fa7-a6a4-ada9c1c721d6.png' />
<view class='empty-text'>没有任何卡劵</view>
</view>
</view>
</view>
<exchange-coupon-modal exchangeId="{{exchangeId}}" exchangePoint="{{exchangePoint}}" isExchange='{{isExchange}}' />
<!--<no-more wx:if="{{noMore}}"/>-->
<!--goHome-->
<go-home/>
<floatNav bind:getAuth="_getUserInfo" bind:updatePage="updatePage"/>
</view>
<go-guid />
/* pages/userCenter.wxss */
@import "/base/base.wxss";
page {
/* background-color: rgba(0, 0, 0, 0.05); */
background: #ffffff;
}
.page-integral-mall {
border-top: 1px solid rgba(151, 151, 151, 0.1);
}
.empty-wrap {
width: 300rpx;
margin: 190rpx auto 0;
text-align: center;
}
.empty-img {
width: 197rpx;
height: 176rpx;
margin-bottom: 48rpx;
}
.empty-text {
color: #cccccc;
font-size: 28rpx;
}
/* 卡劵列表 */
.coupon-wrap {
padding: 20rpx;
clear: both;
}
.coupon-list {
margin-bottom: 10rpx;
border-bottom: solid 1px #eeeeee;
}
.coupon-img-title {
display: flex;
align-items: center;
}
.coupon-item {
display: flex;
align-items: center;
height: 144rpx;
background-color: #fff;
justify-content: space-between;
}
.coupon-btn {
margin-right: 30rpx;
}
.coupon-btn-click {
width: 153.8rpx;
height: 48rpx;
border-radius: 33rpx;
background-color: rgba(5, 195, 91, 1);
box-shadow: 0rpx 3rpx 10rpx 0rpx rgba(5, 195, 91, 0.3);
line-height: 48rpx;
color: rgba(255, 255, 255, 1);
font-size: 24rpx;
text-align: center;
}
.coupon-btn-click.disabled{
background-color: #dddddd !important;
box-shadow: none;
}
.coupon-btn-num {
width: 153.8rpx;
height: 22rpx;
color: rgba(250, 100, 0, 1);
font-size: 22rpx;
text-align: center;
margin-top: 10rpx;
}
.coupon-img {
box-sizing: border-box;
margin-left: 30rpx;
}
.coupon-img image {
width: 80rpx;
height: 80rpx;
}
.coupon-info {
padding: 42rpx 39rpx;
box-sizing: border-box;
}
.coupon-name {
color: #333;
}
.coupon-time {
color: #fc921e;
margin-bottom: 18rpx;
font-size: 26rpx;
}
.coupon-desc {
/* color: #999;
margin-top: 11rpx;
width: 360rpx;
font-size: 24rpx; */
color: rgba(118, 161, 213, 1);
font-size: 22rpx;
text-align: right;
margin-top: 18rpx;
}
.text-align-left{
text-align: left !important;
}
.coupon-code {
color: #ffffff;
word-wrap: break-word;
font-weight: bold;
margin: 0 10rpx;
padding: 35rpx 20rpx;
box-sizing: content-box;
width: 40rpx;
line-height: 35rpx;
}
.invalid-coupon {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 3;
border-radius: 7rpx;
}
.invalid-img {
position: absolute;
width: 147rpx;
height: 147rpx;
right: 81rpx;
top: 31rpx;
z-index: 4;
}
.point-img {
width: 28rpx;
height: 36rpx;
}
.title-img-point {
display: flex;
align-items: center;
}
.point-exchange-goods-records{
font-size: 28rpx;
color: #ffffff;
display: flex;
justify-content: center;
align-items: center;
height: 80rpx;
position: fixed;
left: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.65);
z-index: 2;
width: 100%;
}
.point-exchange-goods-records:active{
opacity: 0.7;
}
.text-point {
color: rgba(51, 51, 51, 1);
font-size: 42rpx;
margin-left: 10rpx;
}
.mall-title {
height: 150rpx;
padding-left: 50rpx;
padding-right: 42rpx;
box-sizing: border-box;
background-color: rgba(255, 255, 255, 1);
box-shadow: 0px 0px 8px 5px rgba(0, 0, 0, 0.05),
0px 0px 3px 0px rgba(0, 0, 0, 0.03);
}
.title-num-point {
padding-top: 30rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.integral-vip-rules {
width: 133rpx;
height: 42rpx;
line-height: 42rpx;
border-radius: 34rpx;
font-size: 23rpx;
text-align: center;
border: 1px solid rgba(204, 204, 204, 1);
}
.title-time-point {
color: rgba(102, 102, 102, 1);
font-size: 20rpx;
text-align: left;
padding-top: 3rpx;
margin-top: 15rpx;
}
.mall-tab {
height: 80rpx;
display: flex;
align-items: center;
background-color: #fff;
padding: 5rpx 0;
box-sizing: border-box;
margin-top: 10rpx;
border-bottom: solid 1px #eeeeee;
}
.tab-coupon, .tab-goods,.tab-coupon-goods {
flex: 1;
text-align: center;
color: rgba(102, 102, 102, 1);
font-size: 26rpx;
}
.tab-coupon {
border-right: 1rpx solid rgba(102, 102, 102, 1);
}
.tab-active {
color: rgba(5, 195, 91, 1);
}
\ No newline at end of file
// pages/userCenter.js
const wxService = require('../../../../utils/wxService')
wxService.page({
/**
* 页面的初始数据
*/
data: {
query: '',
integralGoodsList: [], // 限量精品列表
noMore: false,
isExchange: false,
exchangeId: '',
exchangePoint: 0,
memberPoint: {
total: '--',
expirePoint: 0,
expireDate: ''
},
dialogStockEmpty: false,
dialogUserLimit: false,
activityId: '',
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.data.activityId = options.id;
wx.hideShareMenu();
this.refreshPointRequest();
this.getActivityGroupInfo();
},
//刷新积分请求
refreshPointRequest() {
const { memberId } = wx.getStorageSync('_baseUserInfo')
if (!memberId) {
return;
}
wxService.get('/member/memberPoint/refreshExpiredPoint?memberId=' + memberId).then(res => { })
},
//获取积分活动分组详情
getActivityGroupInfo() {
wxService.get(`/merchant/groupingActivities/findById?id=${this.data.activityId}`).then(res => {
if (res) {
let data = res.data.data ? res.data.data : null;
if (data) {
let ids = data.sons.map(item => {
return item.activateId;
});
this.initIntegralProductList(ids);
}
}
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
//获取会员积分信息
this.getMemberIntegrateInfo();
if (wx.getStorageSync('needReloadExchangeList')) {
wx.removeStorageSync('needReloadExchangeList');
this.getActivityGroupInfo();
}
},
//积分换物记录
onTapToExchangeRecords() {
wx.navigateTo({
url: '/subPackage/page/pages/recordList/recordList',
});
},
//查询会员积分信息
getMemberIntegrateInfo() {
// wx.showLoading({
// title: '数据请求中..',
// });
const { memberId } = wx.getStorageSync('_baseUserInfo')
if (!memberId) {
return;
}
wxService.get(`/member/memberPoint/getMemberPointInfo?memberId=${memberId}`).then(res => {
let data = res.data.data ? res.data.data : {};
this.data.memberPoint.total = data.point ? data.point : 0;
this.data.memberPoint.expirePoint = data.pointWillExpired ? data.pointWillExpired : 0;
let expireDate = data.pointExpiredTime ? data.pointExpiredTime : '2019-12-31 23:59:59';
if (expireDate) {
let dateStr = expireDate.replace(/-/g, '/');
let da = new Date(dateStr);
let year = da.getFullYear();
let month = (da.getMonth() + 1) < 10 ? '0' + (da.getMonth() + 1) : da.getMonth() + 1;
let day = da.getDate() < 10 ? '0' + da.getDate() : da.getDate();
expireDate = `${year}${month}${day}日`
}
this.data.memberPoint.expireDate = expireDate;
this.setData({
memberPoint: this.data.memberPoint
});
});
},
// 查询所有生效中的活动 限量精品
initIntegralProductList(ids) {
wx.showLoading({
title: '加载中'
})
wxService.post(`/member/pointsRedemptionProductSetting/findByIds`,ids).then(res => {
if (res) {
const { result, data } = res.data
if (result == 0) {
let list = data ? data : [];
let integralGoodsList = list;
this.findExchangeNumByIds(integralGoodsList);
}
}
}).finally(() => {
wx.hideLoading();
})
},
//查询指定积分换物活动兑换数量
findExchangeNumByIds(integralGoodsList) {
//获取ids
let ids = integralGoodsList.map(g => {
return g.id;
});
wxService.post(`/member/pointsRedemptionProductSetting/getExchangeCount`, ids).then(res => {
if (res) {
let data = res.data.data ? res.data.data : null;
if (data) {
for (let k in data) {
let id = k, value = data[k];
for (let i = 0; i < integralGoodsList.length; i++) {
if (integralGoodsList[i].id == id) {
integralGoodsList[i].canExchange = integralGoodsList[i].stock > value;
}
}
}
}
}
this.setData({
integralGoodsList: integralGoodsList,
});
});
},
// 立即兑换物品
exchangeGoods(e) {
const { id, point, canexchange } = e.currentTarget.dataset;
const { memberId } = wx.getStorageSync('_baseUserInfo');
if (!canexchange) {
this.setData({
dialogStockEmpty: true
});
return;
}
//检查是不是可以兑换
wx.showLoading({
title: '检查兑换资格中..',
});
wxService.post(`/member/pointsRedemptionProductRecord/checkByMemberIdAndSettingId?memberId=${memberId}&settingId=${id}`).
then(res => {
if (res.data.data == -1) {
this.setData({
dialogUserLimit: true
})
}
else {
wx.navigateTo({
url: '/subPackage/page/pages/exchangeAddress/exchangeAddress?id=' + id,
});
}
});
},
//跳转积分换物详情
// subPackage/page/pages/IntegrateGoodsExchangeInfo/IntegrateGoodsExchangeInfo
goIntegrateGoodsExchangeDetail(e) {
const { id } = e.currentTarget.dataset
wxService.router(`/subPackage/page/pages/IntegrateGoodsExchangeInfo/IntegrateGoodsExchangeInfo?id=${id}`)
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () { },
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
})
\ No newline at end of file
{
"navigationBarTitleText": "积分换物",
"enablePullDownRefresh": true,
"usingComponents": {
"no-more": "/component/noMore/noMore",
"dialog-stock-empty": "/component/dialogStockEmpty/dialogStockEmpty",
"dialog-user-limit": "/component/dialogUserLimit/dialogUserLimit"
}
}
\ No newline at end of file
<!--pages/userCenter.wxml-->
<view class='page-integral-mall' style="padding-bottom: 80rpx;">
<!-- title -->
<view class='mall-title'>
<view class='title-num-point'>
<view class='title-img-point'>
<view class='img-point'>
<image class="point-img" src='/assets/imgs/point.png' mode="widthFix" />
</view>
<view class='text-point'>
{{memberPoint.total}}
</view>
</view>
</view>
<view class='title-time-point' wx:if="{{memberPoint.expirePoint > 0}}">
{{memberPoint.expirePoint}} 积分将于 {{memberPoint.expireDate}} 清零
</view>
<view class='title-time-point' wx:if="{{memberPoint.expirePoint == 0}}">
暂无将过期积分
</view>
</view>
<!-- goods -->
<view>
<view class='coupon-wrap' wx:if="{{integralGoodsList.length}}">
<view
class='coupon-list'
wx:for="{{integralGoodsList}}"
wx:for-item="item"
wx:for-index="k"
wx:key="{{k}}"
data-id="{{item.id}}"
bindtap="goIntegrateGoodsExchangeDetail"
>
<view class="coupon-item">
<view class='coupon-img-title'>
<view class='coupon-img'>
<image wx:if="{{item.thumbnail}}" src='{{item.thumbnail}}' />
<image wx:else src='https://img3.bigaka.com/prd/3001/202003/20200309/30018086c13a-4579-47ed-a16e-c74cb8010c1d.png' />
</view>
<view class='coupon-info'>
<view class='coupon-name fs-28'>{{item.title}}</view>
<view class='coupon-desc text-align-left fs-24'>查看详情</view>
</view>
</view>
<view class='coupon-btn'>
<view class='coupon-btn-click'
data-id="{{item.id}}"
data-point="{{item.point}}"
data-canexchange="{{item.canExchange}}"
catchtap='exchangeGoods'>立即兑换</view>
<view class='coupon-btn-num'>{{item.point}}积分</view>
</view>
</view>
</view>
</view>
<view class='empty-wrap' wx:if="{{!integralGoodsList.length}}">
<view class='empty-info'>
<image class='empty-img'
src='https://img3.bigaka.com/prd/3001/202003/20200309/30012bce7628-f373-4fa7-a6a4-ada9c1c721d6.png' />
<view class='empty-text'>没有任何物品</view>
</view>
</view>
</view>
<!-- 悬浮兑换记录 -->
<view class='point-exchange-goods-records' bindtap='onTapToExchangeRecords'>
查看兑换记录 >>
</view>
<!--goHome-->
<go-home/>
<floatNav bind:getAuth="_getUserInfo" bind:updatePage="updatePage"/>
</view>
<!-- 库存没了 -->
<dialog-stock-empty show="{{dialogStockEmpty}}"/>
<dialog-user-limit show="{{dialogUserLimit}}"/>
<go-guid />
/* pages/userCenter.wxss */
@import "/base/base.wxss";
page {
/* background-color: rgba(0, 0, 0, 0.05); */
background: #ffffff;
}
.page-integral-mall {
border-top: 1px solid rgba(151, 151, 151, 0.1);
}
.empty-wrap {
width: 300rpx;
margin: 190rpx auto 0;
text-align: center;
}
.empty-img {
width: 197rpx;
height: 176rpx;
margin-bottom: 48rpx;
}
.empty-text {
color: #cccccc;
font-size: 28rpx;
}
/* 卡劵列表 */
.coupon-wrap {
padding: 20rpx;
clear: both;
}
.coupon-list {
margin-bottom: 10rpx;
border-bottom: solid 1px #eeeeee;
}
.coupon-img-title {
display: flex;
align-items: center;
}
.coupon-item {
display: flex;
align-items: center;
height: 144rpx;
background-color: #fff;
justify-content: space-between;
}
.coupon-btn {
margin-right: 30rpx;
}
.coupon-btn-click {
width: 153.8rpx;
height: 48rpx;
border-radius: 33rpx;
background-color: rgba(5, 195, 91, 1);
box-shadow: 0rpx 3rpx 10rpx 0rpx rgba(5, 195, 91, 0.3);
line-height: 48rpx;
color: rgba(255, 255, 255, 1);
font-size: 24rpx;
text-align: center;
}
.coupon-btn-click.disabled{
background-color: #dddddd !important;
box-shadow: none;
}
.coupon-btn-num {
width: 153.8rpx;
height: 22rpx;
color: rgba(250, 100, 0, 1);
font-size: 22rpx;
text-align: center;
margin-top: 10rpx;
}
.coupon-img {
box-sizing: border-box;
margin-left: 30rpx;
}
.coupon-img image {
width: 80rpx;
height: 80rpx;
}
.coupon-info {
padding: 42rpx 39rpx;
box-sizing: border-box;
}
.coupon-name {
color: #333;
}
.coupon-time {
color: #fc921e;
margin-bottom: 18rpx;
font-size: 26rpx;
}
.coupon-desc {
/* color: #999;
margin-top: 11rpx;
width: 360rpx;
font-size: 24rpx; */
color: rgba(118, 161, 213, 1);
font-size: 22rpx;
text-align: right;
margin-top: 18rpx;
}
.text-align-left{
text-align: left !important;
}
.coupon-code {
color: #ffffff;
word-wrap: break-word;
font-weight: bold;
margin: 0 10rpx;
padding: 35rpx 20rpx;
box-sizing: content-box;
width: 40rpx;
line-height: 35rpx;
}
.invalid-coupon {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 3;
border-radius: 7rpx;
}
.invalid-img {
position: absolute;
width: 147rpx;
height: 147rpx;
right: 81rpx;
top: 31rpx;
z-index: 4;
}
.point-img {
width: 28rpx;
height: 36rpx;
}
.title-img-point {
display: flex;
align-items: center;
}
.point-exchange-goods-records{
font-size: 28rpx;
color: #ffffff;
display: flex;
justify-content: center;
align-items: center;
height: 80rpx;
position: fixed;
left: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.65);
z-index: 2;
width: 100%;
}
.point-exchange-goods-records:active{
opacity: 0.7;
}
.text-point {
color: rgba(51, 51, 51, 1);
font-size: 42rpx;
margin-left: 10rpx;
}
.mall-title {
height: 150rpx;
padding-left: 50rpx;
padding-right: 42rpx;
box-sizing: border-box;
background-color: rgba(255, 255, 255, 1);
box-shadow: 0px 0px 8px 5px rgba(0, 0, 0, 0.05),
0px 0px 3px 0px rgba(0, 0, 0, 0.03);
}
.title-num-point {
padding-top: 30rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.integral-vip-rules {
width: 133rpx;
height: 42rpx;
line-height: 42rpx;
border-radius: 34rpx;
font-size: 23rpx;
text-align: center;
border: 1px solid rgba(204, 204, 204, 1);
}
.title-time-point {
color: rgba(102, 102, 102, 1);
font-size: 20rpx;
text-align: left;
padding-top: 3rpx;
margin-top: 15rpx;
}
.mall-tab {
height: 80rpx;
display: flex;
align-items: center;
background-color: #fff;
padding: 5rpx 0;
box-sizing: border-box;
margin-top: 10rpx;
border-bottom: solid 1px #eeeeee;
}
.tab-coupon, .tab-goods,.tab-coupon-goods {
flex: 1;
text-align: center;
color: rgba(102, 102, 102, 1);
font-size: 26rpx;
}
.tab-coupon {
border-right: 1rpx solid rgba(102, 102, 102, 1);
}
.tab-active {
color: rgba(5, 195, 91, 1);
}
\ No newline at end of file
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