Commit 9eb92c07 by 谢中龙

新增积分换物功能

parent f3c16bdf
...@@ -23,7 +23,11 @@ ...@@ -23,7 +23,11 @@
"pages/subPage/subPage", "pages/subPage/subPage",
"pages/h5/h5page", "pages/h5/h5page",
"pages/pointGoodsList/pointGoodsList", "pages/pointGoodsList/pointGoodsList",
"pages/goToHome/goToHome" "pages/goToHome/goToHome",
"pages/recordList/recordList",
"pages/IntegralMallGoods/IntegralMallGoods",
"pages/IntegrateGoodsExchangeInfo/IntegrateGoodsExchangeInfo",
"pages/exchangeAddress/exchangeAddress"
] ]
} }
], ],
......
// component/dialogStockEmpty/dialogStockEmpty.js
const wxService = require('../../utils/wxService')
Component({
/**
* 组件的属性列表
*/
properties: {
show : {
type : Boolean,
default : ''
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
//关闭
onTapClose(){
this.setData({
show : false
})
},
//查看更多活动
onTapViewMore(){
this.setData({
show: false
});
wxService.nextTick(() => {
this.triggerEvent('btnClick')
})
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--component/dialogStockEmpty/dialogStockEmpty.wxml-->
<view class='dialog-stock' wx:if="{{show}}">
<view class='body'>
<image bindtap='onTapClose'
class='close'
src='https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/icon_tips_close.png' mode='aspectFit'></image>
<view class='empty'>已抢光</view>
<view>很遗憾,你来晚了~</view>
<view class='view-btn' bindtap='onTapViewMore'>查看其它活动</view>
</view>
</view>
/* component/dialogStockEmpty/dialogStockEmpty.wxss */
view{
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.dialog-stock{
position: fixed;
z-index: 10;
left: 0;
top: 0;
background: rgba(0, 0, 0, 0.5);
width: 100%;
height: 100%;
}
.dialog-stock .body{
width: 76vw;
height: 340rpx;
background: #ffffff;
position: relative;
top: 15vw;
left: 12vw;
border-radius: 10rpx;
padding: 30rpx;
display: flex;
flex-direction:column;
align-items: center;
justify-content: center;
color: #999999;
font-size: 28rpx;
}
.dialog-stock .body .empty{
font-size: 44rpx;
color: #ff3333;
font-weight: bold;
margin-bottom: 20rpx;
}
.dialog-stock .body .view-btn{
width: 260rpx;
height: 70rpx;
background: #ff3333;
color: #ffffff;
margin-top: 40rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 8rpx;
}
.dialog-stock .body .view-btn:active{
opacity: 0.7;
}
.dialog-stock .body .close{
width: 36rpx;
height: 36rpx;
position: absolute;
right: 20rpx;
top: 20rpx;
}
// component/dialogStockEmpty/dialogStockEmpty.js
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean,
default: ''
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
//关闭
onTapClose() {
this.setData({
show: false
})
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--component/dialogStockEmpty/dialogStockEmpty.wxml-->
<view class='dialog-stock' wx:if="{{show}}">
<view class='body'>
<image bindtap='onTapClose'
class='close'
src='https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/icon_tips_close.png' mode='aspectFit'></image>
<image class='tips-icon' src='https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/tips_icon.png' mode='aspectFit'></image>
<view>您已达到上限了哦</view>
</view>
</view>
/* component/dialogStockEmpty/dialogStockEmpty.wxss */
view{
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.dialog-stock{
position: fixed;
z-index: 10;
left: 0;
top: 0;
background: rgba(0, 0, 0, 0.5);
width: 100%;
height: 100%;
}
.dialog-stock .body{
width: 76vw;
height: 340rpx;
background: #ffffff;
position: relative;
top: 15vw;
left: 12vw;
border-radius: 10rpx;
padding: 30rpx;
display: flex;
flex-direction:column;
align-items: center;
justify-content: center;
color: #999999;
font-size: 28rpx;
}
.dialog-stock .body .tips-icon{
width: 120rpx;
height: 120rpx;
margin-bottom: 20rpx;
}
.dialog-stock .body .close{
width: 36rpx;
height: 36rpx;
position: absolute;
right: 20rpx;
top: 20rpx;
}
\ No newline at end of file
...@@ -75,7 +75,8 @@ wxService.page({ ...@@ -75,7 +75,8 @@ wxService.page({
}, },
// 去积分商城 // 去积分商城
handleGoIntegralMall() { handleGoIntegralMall() {
wxService.router(`/pages/IntegralMall/IntegralMall`) // wxService.router(`/pages/IntegralMall/IntegralMall`)
wxService.router(`/subPackage/page/pages/IntegralMallGoods/IntegralMallGoods`)
}, },
// 消费详情 // 消费详情
handleGoDetail(e) { handleGoDetail(e) {
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.8.2", "libVersion": "2.8.2",
"appid": "wx700028bf32a3be66", "appid": "wx700028bf32a3be66",
"projectname": "7-Eleven", "projectname": "7-11",
"debugOptions": { "debugOptions": {
"hidedInDevtools": [] "hidedInDevtools": []
}, },
......
// pages/userCenter.js
const wxService = require('../../../../utils/wxService')
wxService.page({
/**
* 页面的初始数据
*/
data: {
query: '',
integralCouponList: [], // 积分兑换优惠券列表
integralGoodsList: [], // 限量精品列表
noMore: false,
isExchange: false,
exchangeId: '',
exchangePoint: 0,
currentTab: 'coupon',
memberPoint : {
total: '--',
expirePoint : 0,
expireDate : ''
},
dialogStockEmpty : false,
dialogUserLimit : false,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.initIntegralCouponList();
this.initIntegralProductList();
},
handelTab(e) {
let curTab = e.currentTarget.dataset.tab
this.setData({
currentTab: curTab
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
// this.initIntegralProductList()
// this.initIntegralCouponList();
//获取会员积分信息
this.getMemberIntegrateInfo();
},
//积分换物记录
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;
this.data.memberPoint.expireDate = data.pointExpiredTime;
this.setData({
memberPoint: this.data.memberPoint
});
});
},
// 查询所有生效中的活动 限量精品
initIntegralProductList() {
wx.showLoading({
title: '加载中'
})
wxService.get(`/member/pointsRedemptionProductSetting/getAllValid`).then(res => {
if (res) {
const { result, data } = res.data
if (result == 0) {
let list = data ? data : [];
if(list.length == 0){
this.data.currentTab = 'coupon';
}
else{
this.data.currentTab = 'goods';
}
this.setData({
integralGoodsList: data? data : [],
currentTab: this.data.currentTab
})
}
}
}).finally(() => {
wx.hideLoading();
})
},
// 积分兑换优惠券列表
initIntegralCouponList() {
wx.showLoading({
title: '加载中'
});
wxService.get(`/coupon/pointsRedemptionCouponSetting/getAllValid`).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
})
},
// 立即兑换物品
exchangeGoods(e) {
const { id, point } = e.currentTarget.dataset;
const { memberId } = wx.getStorageSync('_baseUserInfo')
//检查是不是可以兑换
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}`)
},
// 点击跳转至会员规则页
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
{
"enablePullDownRefresh":true,
"navigationBarTitleText": "积分商城",
"usingComponents": {
"no-more": "/component/noMore/noMore",
"exchange-coupon-modal": "/component/exchange-coupon-modal/exchange-coupon-modal",
"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: {{currentTab =='goods' ? '70rpx' : '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/integral_exchange/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>
<!-- tab -->
<view class='mall-tab' wx:if="{{integralGoodsList.length > 0}}">
<view class="tab-coupon {{currentTab=='coupon' ? 'tab-active':''}}" data-tab="coupon" bindtap="handelTab">优惠券</view>
<view class="tab-coupon-goods {{currentTab=='goods' ? 'tab-active':''}}" data-tab="goods" bindtap="handelTab">限量精品</view>
</view>
<!-- 优惠券列表-->
<view wx:if="{{currentTab == 'coupon'}}">
<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='/assets/imgs/qr-code.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='/assets/imgs/empty-coupon.png' />
<view class='empty-text'>没有任何卡劵</view>
</view>
</view>
</view>
<!-- goods -->
<view wx:if="{{currentTab =='goods'}}">
<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='/assets/imgs/qr-code.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='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='/assets/imgs/empty-coupon.png' />
<view class='empty-text'>没有任何物品</view>
</view>
</view>
</view>
<!-- 悬浮兑换记录 -->
<view class='point-exchange-goods-records' wx:if="{{currentTab =='goods'}}" bindtap='onTapToExchangeRecords'>
查看兑换记录 >>
</view>
<exchange-coupon-modal exchangeId="{{exchangeId}}" exchangePoint="{{exchangePoint}}" isExchange='{{isExchange}}' />
<!--<no-more wx:if="{{noMore}}"/>-->
</view>
<!-- 库存没了 -->
<dialog-stock-empty show="{{dialogStockEmpty}}"/>
<dialog-user-limit show="{{dialogUserLimit}}"/>
/* 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-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: 70rpx;
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/integralMallDetail/integralMallDetail.js
const app = getApp()
const wxService = require('../../../../utils/wxService')
const utils = require('../../../../utils/util')
const envInfo = require('../../../../config/index').envInfo
wxService.page({
/**
* 页面的初始数据
*/
data: {
isExchange: false,
dialogUserLimit : false,
integralMallDetail: {}
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
const { id } = this.options
// this.getIntegralCouponDetail('579702812007600128')
this.getIntegralCouponDetail(id)
},
//立即兑换
exchange() {
const { memberId } = wx.getStorageSync('_baseUserInfo');
const id = this.data.integralMallDetail.id;
//检查是不是可以兑换
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,
});
}
});
},
//获取积分兑换优惠券详情
getIntegralCouponDetail(id) {
wx.showLoading({
title: '加载中'
})
wxService.get(`/member/pointsRedemptionProductSetting/get/${id}`).then(res => {
const { result, data } = res.data
if (result == 0) {
wx.hideLoading()
data.desc = JSON.parse(data.desc)
this.setData({
integralMallDetail: data
});
}
}).finally(() => {
wx.hideLoading()
})
}
})
\ No newline at end of file
{
"navigationBarTitleText": "积分换物详情",
"usingComponents": {
"dialog-user-limit": "/component/dialogUserLimit/dialogUserLimit"
}
}
\ No newline at end of file
<!--pages/integralMallDetail/integralMallDetail.wxml-->
<view class='page-integral-detail'>
<view class='coupon-wrap'>
<view class='coupon-list'>
<view class='coupon-img'>
<image wx:if="{{integralMallDetail.thumbnail}}" src='{{integralMallDetail.thumbnail}}' />
<image wx:else src='/assets/imgs/qr-code.png' />
</view>
<view class='coupon-info'>
<view class='coupon-name fs-28'>{{integralMallDetail.point}}积分</view>
<view class='coupon-desc fs-28'>{{integralMallDetail.title}}</view>
</view>
<view class='coupon-code fs-24' bindtap='exchange'>立即兑换</view>
</view>
<view class='integral-detail'>
<view class='integral-list' wx:for="{{integralMallDetail.desc}}" wx:key="{{index}}">
<text class='integral-title'>{{item.name}}</text>
<text class='integral-desc wpl'>{{item.desc}}</text>
</view>
</view>
</view>
</view>
<view class="position-bottom">
<button type='primary' class="redeem-now" bindtap='exchange'>立即兑换</button>
</view>
<dialog-user-limit show="{{dialogUserLimit}}"/>
/* subPackage/page/pages/IntegrateGoodsExchangeInfo/IntegrateGoodsExchangeInfo.wxss */
/* pages/integralMallDetail/integralMallDetail.wxss */
@import '../../../../base/base.wxss';
.coupon-wrap{
padding: 20rpx;
clear: both;
margin-bottom: 150rpx;
}
.coupon-list{
height: 209rpx;
display: flex;
background-repeat: no-repeat;
background-position: center;
background-size: 100% 100%;
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAsgAAADRCAYAAADR7UQMAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAACddJREFUeNrs3X+IpHUdwPHv3awz+sR4F7eWjuZZik9koMlKRWn7R/0jxJ1/iIqQlv4hEajQP/4RnUhEUHQQhH8onoJQRORh+UcFKRIRLbpHZj6ScudjK/5YvPPJJ2e5aZvv7AztXet5M3u3zD7zesHD3o+dhf3wzM57vvudZ7YsLy+HE9jdP67oHpcHmCz3do896/was93jD0YJwBh5qv/4tC5X/flHbz9TvLp9M33j5ze2Hf3EWTveuiQ55zfnNc6+776Lrz201udNneBBfV/32OkcYoKdijv9RcYIwJj50qn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gQwAAAIZAAAEMgAACGRgGIO3mk6SxDAAoGKmjACGF8M4TVODAIAKsoIMAAACGQAABDIAAAhkAAAQyAAAIJBh45RlGbIsC3meGwYAVIzLvMEIOp1OKIrCIACggqwgAwCAQAYAAIEMAAACGQAAhuFFejCCer0eWq1W7yMAIJBh4jUajV4gAwDVY4sFAAAIZAAAWFvcYnHQGGBoR7rHfP/PF3WPnUYCQEUcuLJ5wc53O0uNrHzjrEn75neckfxpy/Lycvzz4e6xzfkAH+jh7rF3VRyHVZF8a/e4y30JgE3oqe6xr38c45sv/OL7fznyyh3PFK9un4RB3H3h7I2DQH6se+xybsD7P5vuB/D8B3ze9v4PF/cnADZNE4aVxZ8T+trfHv3V428+t+udo+9tqeogzm9sO/rK1XvOGOxB3uvcgBPG8exJxHEUfxuzO6ysNAPAuPvMyXbgI5fdfN1trc/ddPbUmctVHcbnt3/8j/HjIJCfDCtL68CxjvTj+PCQt7u1H9YAMK7iyvH8MDf44aW7fv7Vcz69v4rDiOF/aXLOLasDefCAfsS5Ase4a4Q4Xn2fAoBxFBdGR9pBEFeSr2xecLhqA7np3Ct/cN/F1x46PpAPhpWVMpEMK+J9Yd86bj8f/GYGgPG0nse3cNW2C++v0jC+3vrsgz/95PX3DP6+dY0H9BjJh5w30Hvx6jh8DQAYq8e41TG5mcVtFTGOH/jUjbev/ve13igkRvIV3ePeYDWZyXbwFHyNeWMEYMzEhdB1b5FIk4/8ezOH8Vd2pC/dccEXrjk+jqPBZd5OZLZ/wCQ+u15v4F4U7EUGYLwcDOvcYhHd/vzPHig67Us22zcf3whkxxkfun+w33gt/xVgAJby87DGApohAAAAAElFTkSuQmCC")
}
.coupon-bg{
width: 712rpx;
height: 209rpx;
position: absolute;
top: 0;
left: 0;
z-index: -1;
}
.coupon-img {
padding: 15rpx;
box-sizing: border-box;
}
.coupon-img image{
width: 172rpx;
height: 172rpx;
}
.coupon-info{
padding: 42rpx 39rpx;
box-sizing: border-box;
}
.coupon-name{
color:#fc9210;
}
.coupon-desc{
color:#333333;
margin-top: 6rpx;
width: 360rpx;
}
.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;
}
.integral-detail{
margin-top: 90rpx;
}
.integral-list{
margin-bottom: 60rpx;
font-size: 27rpx;
}
.integral-title,.integral-desc{
display: inline-block;
}
.integral-title{
color: #999999;
vertical-align: top;
margin-right: 50rpx;
text-align: right;
width: 120rpx;
}
.integral-desc{
width: 500rpx;
color: #666666;
}
\ No newline at end of file
// subPackage/page/pages/exchangeAddress/exchangeAddress.js
const app = getApp()
const wxService = require('../../../../utils/wxService')
wxService.page({
/**
* 页面的初始数据
*/
data: {
region: [],
point : 0,
dialogStockEmpty: false,
form : {
activateId: '',
name: '',
mobile: '',
distinct: '',
address: '',
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.data.form.activateId = options.id;
this.getIntegralCouponDetail(this.data.form.activateId);
},
//获取积分换物详情
//获取积分兑换优惠券详情
getIntegralCouponDetail(id) {
wx.showLoading({
title: '加载中'
});
wxService.get(`/member/pointsRedemptionProductSetting/get/${id}`).then(res => {
const { result, data } = res.data
if (result == 0) {
wx.hideLoading();
this.setData({
point: data.point ? data.point : 0
});
}
}).finally(() => {
wx.hideLoading()
})
},
//省市区改变事件
bindRegionChange(e){
this.data.form.distinct = e.detail.value.join(',');
this.setData({
region: e.detail.value,
form: this.data.form
});
},
//选择微信地址
chooseWxAddress(){
let self = this;
wx.chooseAddress({
success(res) {
self.data.region = [res.provinceName, res.cityName, res.countyName];
self.data.form.distinct = self.data.region.join(',');
self.data.form.name = res.userName;
self.data.form.mobile = res.telNumber;
self.data.form.address = res.detailInfo;
self.setData({
region: self.data.region,
form: self.data.form
});
},
fail(err){
}
})
},
//输入框
onInput(e){
let prop = e.target.dataset.prop,
value = e.detail.value;
this.data.form[prop] = value;
this.setData({
form : this.data.form
})
},
//确认提交
onTapSubmit(){
if(!this.data.form.name){
wx.showToast({
title: '请输入收货人真实姓名',
icon : 'none'
});
return ;
}
if (!this.data.form.mobile) {
wx.showToast({
title: '请输入收货人手机号',
icon: 'none'
});
return;
}
if (!this.data.form.distinct) {
wx.showToast({
title: '请选择省市区',
icon: 'none'
});
return;
}
if (!this.data.form.address) {
wx.showToast({
title: '请输入详细地址',
icon: 'none'
});
return;
}
wx.showLoading({
title: '兑换中..',
});
wxService.post(`/member/pointsRedemptionProductSetting/exchange`,this.data.form).then(res => {
wx.hideLoading();
if(res.data.data == 0){
wx.showToast({
title: '兑换成功',
});
setTimeout(() => {
wx.navigateBack({
delta: 1
});
}, 300);
}
else if (res.data.data == 1){ // 库存不足
this.setData({
dialogStockEmpty : true,
});
}
else if (res.data.data == 2){
wx.showToast({
title: '对不起,您积分不足',
icon : 'none'
});
}
else {
wx.showToast({
title: '您已经达到上限了哦',
icon: 'none'
});
}
});
},
//btn回调
onDialogBtnCallBack(e){
let pages = getCurrentPages();
let index = pages.length - 1;
for (let i = 0; i < pages.length ; i ++){
if (pages[i].route.indexOf('IntegralMallGoods/IntegralMallGoods') > -1){
index = index - i;
break;
}
}
wx.navigateBack({
delta: index
});
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
})
\ No newline at end of file
{
"navigationBarTitleText": "填写收货地址",
"usingComponents": {
"dialog-stock-empty": "/component/dialogStockEmpty/dialogStockEmpty"
}
}
\ No newline at end of file
<!--subPackage/page/pages/exchangeAddress/exchangeAddress.wxml-->
<view class='exchange-info'>
确认使用 <label>{{point}}</label>积分兑换礼物
</view>
<view class='address'>
<view class='items'>
<text>请填写正确的收货地址,填写后无法修改</text>
<view class='choose-address' bindtap='chooseWxAddress'>获取微信地址</view>
</view>
<view class='address-form'>
<input placeholder='请输入收货人真实姓名' value='{{form.name}}' data-prop="name" bindinput='onInput' maxlength='20'></input>
</view>
<view class='address-form'>
<input placeholder='请输入收货人手机号' value='{{form.mobile}}' data-prop="mobile" bindinput='onInput' maxlength='20'></input>
</view>
<view class='address-form'>
<picker mode="region" bindchange="bindRegionChange" value="{{region}}">
<view class="picker">
{{form.distinct ? form.distinct : "请选择地区"}}
</view>
</picker>
</view>
<view class='address-form'>
<input placeholder='请输入收货人地址' value='{{form.address}}' data-prop="address" bindinput='onInput' maxlength='20'></input>
</view>
<view class='sumbit' bindtap='onTapSubmit'>确认</view>
</view>
<dialog-stock-empty show="{{dialogStockEmpty}}" bind:btnClick="onDialogBtnCallBack"/>
\ No newline at end of file
/* subPackage/page/pages/exchangeAddress/exchangeAddress.wxss */
page{
background: #ffffff;
box-sizing: border-box;
-webkit-box-sizing: border-box;
font-size: 28rpx;
}
view{
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.exchange-info{
padding: 30rpx;
display: flex;
justify-content: center;
font-size: 32rpx;
color: #333333;
}
.exchange-info label{
color: #FF3333;
}
.address{
width: 100%;
height: auto;
padding: 40rpx;
}
.address .items{
display: flex;
align-items: center;
justify-content: space-between;
font-size: 24rpx;
color: #666666;
margin-bottom: 20rpx;
}
.address .items .choose-address{
padding: 8rpx 15rpx;
font-size: 24rpx;
background: #76A1D5;
color: #ffffff;
border-radius: 8rpx;
}
.address .address-form{
width: 100%;
height: 70rpx;
margin-bottom: 30rpx;
}
.address .address-form input{
height: 100%;
border: solid 2rpx #eeeeee;
padding: 0 20rpx;
}
.address .address-form input::placeholder{
color: #999999;
}
.address .address-form .picker{
height: 70rpx;
border: solid 2rpx #eeeeee;
padding: 0 20rpx;
display: flex;
align-items: center;
color: #999999;
}
.address .sumbit{
width: 100%;
height: 80rpx;
background: #FF3333;
color: #ffffff;
font-size: 28rpx;
display: flex;
align-items: center;
justify-content: center;
margin-top: 80rpx;
border-radius: 10rpx;
}
.address .sumbit:active{
opacity: 0.7;
}
\ No newline at end of file
// subPackage/page/pages/recordList/recordList.js
const wxService = require('../../../../utils/wxService')
const utils = require('../../../../utils/util')
wxService.page({
/**
* 页面的初始数据
*/
data: {
pageNo : 1,
pageSize : 10,
totalPage : 0,
recordList: [],
hasMore : false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.showLoading({
title: '正在加载数据..',
});
this.getWxchangeRecords();
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
//获取兑换记录
getWxchangeRecords(){
const { memberId } = wx.getStorageSync('_baseUserInfo')
let pageNo = this.data.pageNo,
pageSize = this.data.pageSize;
wxService.post(`/member/pointsRedemptionProductRecord/page?pageNo=${pageNo}&pageSize=${pageSize}`,{
memberId: memberId
}).then(res => {
let list = res.data.data.content ? res.data.data.content : [];
this.data.totalPage = res.data.data.totalPages;
list.forEach(item => {
let proviceCity = item.exchangeInfo.distinct.split(',');
item.title = item.title ? item.title : '--';
item.fullAddress = [proviceCity, item.exchangeInfo.address].join('');
});
if(list.length > 0){
this.data.hasMore = true;
}
this.data.recordList = this.data.recordList.concat(list);
this.setData({
totalPage: this.data.totalPage,
recordList: this.data.recordList,
hasMore: this.data.hasMore
});
});
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
if(this.data.pageNo < this.data.totalPage){
this.data.pageNo ++ ;
this.getWxchangeRecords();
}
else {
if (this.data.recordList.length != 0){
this.setData({
hasMore : false,
})
}
}
},
})
\ No newline at end of file
{
"navigationBarTitleText": "兑换记录"
}
\ No newline at end of file
<!--subPackage/page/pages/recordList/recordList.wxml-->
<view class="record-list" wx:if="{{recordList.length > 0}}">
<block wx:for="{{recordList}}" wx:key="{{index}}" wx:for-item="item">
<view class="list-item">
<view class="list-desc">
<view class='list-desc-item'>
<view class="desc-name">{{item.title}}</view>
<view class="desc-time">{{item.createTime}}</view>
</view>
<view class="list-point">-{{item.point}}积分</view>
</view>
<view class="desc-address">{{item.fullAddress}}</view>
</view>
</block>
<!-- view -->
<view class='no-more' wx:if="{{!hasMore}}">-- 我也是有底线滴 --</view>
</view>
<view class='empty' wx:if="{{recordList.length == 0 }}">无任何兑换记录~</view>
/* subPackage/page/pages/recordList/recordList.wxss */
@import "/base/base.wxss";
page{
background: #ffffff;
}
.record-list {
/* border-top: 1px solid rgba(151, 151, 151, 1); */
padding: 0 20rpx;
box-sizing: border-box;
}
.list-item {
height: 164rpx;
border-bottom: 1px solid #eeeeee;
padding: 35rpx 20rpx 34rpx 20rpx;
box-sizing: border-box;
overflow: hidden;
}
.list-desc {
display: flex;
justify-content: space-between;
}
.list-desc-item{
}
.desc-name {
height: 30rpx;
color: rgba(51, 51, 51, 1);
font-size: 30rpx;
margin-bottom: 10rpx;
}
.no-more{
width: 100%;
height: auto;
padding: 30rpx 0;
color: #999999;
font-size: 24rpx;
display: flex;
align-items: center;
justify-content: center;
}
.desc-time,
.desc-address {
color: rgba(170, 170, 170, 1);
font-size: 22rpx;
}
.desc-address {
width: 100%;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
.desc-time {
padding: 6rpx 0 7rpx 0;
}
.list-point {
color: rgba(0, 0, 0, 1);
font-size: 24rpx;
display: flex;
align-items: center;
justify-content: flex-end;
}
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