Browse Source

增加积分兑换

release
ZhaoTongYao 4 years ago
parent
commit
ac839246a7
  1. 3
      epdc-resident-mp-yushan/app.json
  2. 2
      epdc-resident-mp-yushan/pages/toRegister/toRegister.js
  3. 3
      epdc-resident-mp-yushan/subpages/communityNews/pages/detail/detail.js
  4. BIN
      epdc-resident-mp-yushan/subpages/integralCentre/images/code.png
  5. 79
      epdc-resident-mp-yushan/subpages/integralCentre/pages/exchangeIndex/exchangeIndex.js
  6. 9
      epdc-resident-mp-yushan/subpages/integralCentre/pages/exchangeIndex/exchangeIndex.json
  7. 33
      epdc-resident-mp-yushan/subpages/integralCentre/pages/exchangeIndex/exchangeIndex.wxml
  8. 113
      epdc-resident-mp-yushan/subpages/integralCentre/pages/exchangeIndex/exchangeIndex.wxss
  9. 6
      epdc-resident-mp-yushan/subpages/integralCentre/pages/index/index.js
  10. 7
      epdc-resident-mp-yushan/subpages/integralCentre/pages/index/index.wxml
  11. 21
      epdc-resident-mp-yushan/subpages/integralCentre/pages/index/index.wxss
  12. 28
      epdc-resident-mp-yushan/utils/integralCentre.js

3
epdc-resident-mp-yushan/app.json

@ -109,7 +109,8 @@
"pages": [ "pages": [
"pages/index/index", "pages/index/index",
"pages/record/record", "pages/record/record",
"pages/noticeDetail/noticeDetail" "pages/noticeDetail/noticeDetail",
"pages/exchangeIndex/exchangeIndex"
] ]
}, },
{ {

2
epdc-resident-mp-yushan/pages/toRegister/toRegister.js

@ -21,7 +21,7 @@ Page({
} }
}) })
let that = this let that = this
const versionNum = '1.2.27' const versionNum = '1.2.29'
api.getScanSwitch(versionNum).then(function (res) { api.getScanSwitch(versionNum).then(function (res) {
console.log(res.data) console.log(res.data)
let state = res.data ? res.data.scanFlag : '1' let state = res.data ? res.data.scanFlag : '1'

3
epdc-resident-mp-yushan/subpages/communityNews/pages/detail/detail.js

@ -16,6 +16,9 @@ Page({
this.getResidentConfig() this.getResidentConfig()
} }
}, },
onUnload () {
clearInterval(this.data.timer)
},
// 加积分 // 加积分
browsePoints () { browsePoints () {
let that = this let that = this

BIN
epdc-resident-mp-yushan/subpages/integralCentre/images/code.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

79
epdc-resident-mp-yushan/subpages/integralCentre/pages/exchangeIndex/exchangeIndex.js

@ -0,0 +1,79 @@
import {
getCode,
getPointsLogs
} from "../../../../utils/integralCentre"
Page({
data: {
codeUrl: '',
behaviorCode: 'points_exchange', //积分动作编码
pageIndex: 1,
pageSize: 10,
pointList: [],
loadMoreVisible: false, //false
loadMoreType: "none",
showLoading: true,
nodata: false,
_timer: null,
},
onLoad: function () {
this.getCode()
this.getPointsLogs()
if (this.data._timer) {
clearInterval()
}
let _timer = null
_timer = setInterval(() => {
console.log('刷新')
this.getCode()
}, 1000 * 180)
},
getCode() {
this.setData({
showLoading: true
})
getCode().then(res => {
this.setData({
codeUrl: res.data.codeUrl,
showLoading: false
})
}).catch(err => {})
},
getNewCode() {
this.getCode()
},
// 获取居民兑换记录接口
getPointsLogs() {
let para = {
pageIndex: this.data.pageIndex,
pageSize: this.data.pageSize,
behaviorCode: this.data.behaviorCode,
}
getPointsLogs(para).then((res) => {
this.setData({
loadMoreVisible: true,
loadMoreType: res.data.length === this.data.pageSize ? 'loading' : 'none',
pointList: this.data.pointList.concat(res.data)
})
if (this.data.pointList.length == 0) {
this.setData({
loadMoreVisible: false,
nodata: true
})
}
}).catch(() => {
this.setData({
nodata: true
})
})
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
console.log('下拉了')
if (this.data.loadMoreType === 'loading') {
this.data.pageIndex += 1,
this.getPointsLogs()
}
},
})

9
epdc-resident-mp-yushan/subpages/integralCentre/pages/exchangeIndex/exchangeIndex.json

@ -0,0 +1,9 @@
{
"usingComponents": {
"load-more": "../../../../components/loadMore/loadMore",
"no-data": "../../../../components/nodata/nodata"
},
"navigationBarTitleText": "积分中心",
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#DD5245"
}

33
epdc-resident-mp-yushan/subpages/integralCentre/pages/exchangeIndex/exchangeIndex.wxml

@ -0,0 +1,33 @@
<view class="exchange-index">
<view class="exchange-header">
<view class="background"></view>
<view class="exchange-code">
<view class="code-text">
<image src="../../images/code.png" class="code" />
<text>兑换码</text>
</view>
<image src="{{codeUrl}}" class="code-img" bind:tap="getNewCode" wx:if="{{!showLoading}}" />
<view class="code-img" wx:if="{{showLoading}}">
<image src="../../../../images/loading.gif" class='loading' />
</view>
<view class="code-footer" bind:tap="getNewCode">请点击兑换码刷新</view>
</view>
</view>
<view class="exchange-time">
<view class="time-title">
<text class="" style="margin-left:90rpx">兑换时间</text>
<text class="" style="margin-left:220rpx">说明</text>
<text class="" style="margin-left:160rpx">积分</text>
</view>
<view class="time-item-box">
<view class="time-item" wx:for="{{pointList}}">
<text class="time-item-time">{{item.operationTime}}</text>
<text class="time-item-remark">{{item.remark?item.remark:'暂无核销记录说明'}}</text>
<!-- <text class="time-item-num">-1000</text> -->
<text class="time-item-num">{{item.operationType==='1'? '+':'-'}}{{item.points}}</text>
</view>
</view>
</view>
<no-data isShow="{{nodata}}" wx:if="{{nodata}}"></no-data>
<load-more loadMoreVisible="{{loadMoreVisible}}" loadMoreType="{{loadMoreType}}" load-more-child='load-more-exchange'></load-more>
</view>

113
epdc-resident-mp-yushan/subpages/integralCentre/pages/exchangeIndex/exchangeIndex.wxss

@ -0,0 +1,113 @@
page {
/* background: #f7f7f7; */
}
.exchange-index {
width: 100%;
box-sizing: border-box;
}
.exchange-header {
height: 680rpx;
/* border: 1rpx solid red; */
}
.exchange-header .background {
box-sizing: border-box;
width: 100%;
height: 80rpx;
background: #DD5245;
}
.exchange-header .exchange-code {
box-sizing: border-box;
width: 660rpx;
height: 630rpx;
margin: 0 auto;
position: absolute;
top: 2%;
left: 50%;
transform: translate(-50%, 0%);
background: #FFFFFF;
border-radius: 20rpx;
padding: 40rpx 30rpx;
box-shadow: 0px 0px 20rpx #eee;
}
.exchange-code .code-text {
color: 32rpx;
font-weight: bold;
}
.exchange-code .code-text text {
vertical-align: middle;
}
.exchange-code .code-text .code {
width: 32rpx;
height: 32rpx;
vertical-align: middle;
margin-right: 10rpx;
}
.exchange-code .code-img {
width: 400rpx;
height: 400rpx;
margin-left: 110rpx;
margin-top: 50rpx;
}
.loading {
width: 60rpx;
height: 60rpx;
margin-top: 170rpx;
margin-left: 150rpx;
}
.exchange-code .code-footer {
margin-left: 200rpx;
font-size: 28rpx;
color: #999;
}
.exchange-time .time-title {
box-sizing: border-box;
width: 100%;
font-weight: bold;
font-size: 30rpx;
color: #151515;
}
.time-item-box {
padding: 0 20rpx;
}
.exchange-time .time-item-box .time-item {
box-sizing: border-box;
width: 100%;
display: flex;
justify-content: space-around;
font-size: 30rpx;
margin-top: 50rpx;
}
.exchange-time .time-item-box .time-item .time-item-time {
width: 45%;
color: #151515;
}
.exchange-time .time-item-box .time-item .time-item-remark {
width: 40%;
color: #151515;
}
.exchange-time .time-item-box .time-item .time-item-num {
width: 15%;
color: #D60000;
text-align: center;
}
/* 覆盖组件样式 */
.load-more-exchange {
background: #fff !important;
}

6
epdc-resident-mp-yushan/subpages/integralCentre/pages/index/index.js

@ -228,6 +228,12 @@ Page({
url: `/subpages/integralCentre/pages/noticeDetail/noticeDetail?modulecode=notice_points_rule&residentValue=${this.data.noticePointsRule}` url: `/subpages/integralCentre/pages/noticeDetail/noticeDetail?modulecode=notice_points_rule&residentValue=${this.data.noticePointsRule}`
}) })
}, },
toExchangeIndex () {
wx.navigateTo({
url: `/subpages/integralCentre/pages/exchangeIndex/exchangeIndex`
})
},
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */

7
epdc-resident-mp-yushan/subpages/integralCentre/pages/index/index.wxml

@ -1,5 +1,6 @@
<view class="home"> <view class="home">
<view class='title'> <view class='title'>
<view class="exchange-enter" bindtap="toExchangeIndex">兑换</view>
<text class="number">{{points}}</text> <text class="number">{{points}}</text>
<text class="name">积分</text> <text class="name">积分</text>
</view> </view>
@ -22,9 +23,9 @@
<view class="tab-more"> <view class="tab-more">
<button wx:for="{{typeList}}" wx:key="index" wx:for-index="index" data-type="{{item.type}}" id="item-{{ item.type }}" bindtap="onButtonChange" class="{{item.select ? 'tab-but-w' : 'tab-but-y'}}" form-type='submit' plain='true' hover-class="hover-btn"> <button wx:for="{{typeList}}" wx:key="index" wx:for-index="index" data-type="{{item.type}}" id="item-{{ item.type }}" bindtap="onButtonChange" class="{{item.select ? 'tab-but-w' : 'tab-but-y'}}" form-type='submit' plain='true' hover-class="hover-btn">
<view class="{{item.select ? 'tab-but-name-w' : 'tab-but-name-y'}}">{{item.name}}</view> <view class="{{item.select ? 'tab-but-name-w' : 'tab-but-name-y'}}">{{item.name}}</view>
<image wx:if="{{item.type == 0}}" class="tab-but-img-w" src="{{item.select ? wg_y : wg_n}}"></image> <image wx:if="{{item.type == 0}}" class="tab-but-img-w" src="{{!item.select ? wg_y : wg_n}}"></image>
<image wx:elif="{{item.type == 1}}" class="tab-but-img-w" src="{{item.select ? jd_y : jd_n}}"></image> <image wx:elif="{{item.type == 1}}" class="tab-but-img-w" src="{{!item.select ? jd_y : jd_n}}"></image>
<image wx:else class="tab-but-img-w" src="{{item.select ? dj_y : dj_n}}"></image> <image wx:else class="tab-but-img-w" src="{{!item.select ? dj_y : dj_n}}"></image>
</button> </button>
</view> </view>
<!-- 我当前数据 --> <!-- 我当前数据 -->

21
epdc-resident-mp-yushan/subpages/integralCentre/pages/index/index.wxss

@ -16,13 +16,24 @@ page {
align-items: center; align-items: center;
} }
.title .exchange-enter {
width: 100%;
height: 50rpx;
line-height: 50rpx;
padding: 0 30rpx;
box-sizing: border-box;
font-size: 28rpx;
text-align: right;
color: rgba(255, 255, 255, 1);
}
.title .number { .title .number {
height: 86rpx; height: 86rpx;
font-size: 86rpx; font-size: 86rpx;
line-height: 86rpx; line-height: 86rpx;
font-weight: bold; font-weight: bold;
color: rgba(255, 255, 255, 1); color: rgba(255, 255, 255, 1);
margin-top: 55rpx; margin-top: 10rpx;
} }
.title .name { .title .name {
@ -80,7 +91,7 @@ page {
/* justify-content: space-between; */ /* justify-content: space-between; */
align-items: center; align-items: center;
} }
.tab-more .tab-but-w{ .tab-more .tab-but-y{
width: 30%; width: 30%;
height: 90rpx; height: 90rpx;
background: #FFFFFF; background: #FFFFFF;
@ -91,7 +102,7 @@ page {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.tab-more .tab-but-y{ .tab-more .tab-but-w{
width: 30%; width: 30%;
height: 90rpx; height: 90rpx;
background: linear-gradient(86deg, #FECA04, #FF9E02); background: linear-gradient(86deg, #FECA04, #FF9E02);
@ -102,7 +113,7 @@ page {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.tab-but-name-w{ .tab-but-name-y{
font-size: 30rpx; font-size: 30rpx;
font-weight: 500; font-weight: 500;
color: #666666; color: #666666;
@ -112,7 +123,7 @@ page {
height: 42rpx; height: 42rpx;
margin-left: 22rpx; margin-left: 22rpx;
} }
.tab-but-name-y{ .tab-but-name-w{
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
color: #FFFFFF; color: #FFFFFF;

28
epdc-resident-mp-yushan/utils/integralCentre.js

@ -4,7 +4,9 @@ module.exports = {
userPointsRankinglist:userPointsRankinglist, userPointsRankinglist:userPointsRankinglist,
gradeRankinglist:gradeRankinglist, gradeRankinglist:gradeRankinglist,
noticelist: noticelist, noticelist: noticelist,
noticeDetail:noticeDetail noticeDetail:noticeDetail,
getCode,
getPointsLogs
} }
/***********积分**********/ /***********积分**********/
/** /**
@ -68,4 +70,28 @@ function noticelist (params) {
// 通知详情 // 通知详情
function noticeDetail (noticeId) { function noticeDetail (noticeId) {
return fly.get(`news/notice/detail/${noticeId}`) return fly.get(`news/notice/detail/${noticeId}`)
}
/**
* 获取积分核销兑换码 2022.03.07
*/
function getCode () {
return fly.get("userpointsverification/getqrcode")
}
/**
* 获取居民兑换记录接口 2022.03.07
* @param behaviorCode 积分动作编码
* @param pageIndex Number 页码
* @param pageSize Number 页容量
*/
function getPointsLogs ({
behaviorCode,
pageIndex,
pageSize
}) {
return fly.get("userpointsverification/getpointslogs", {
behaviorCode,
pageIndex,
pageSize
})
} }
Loading…
Cancel
Save