Commit e0787249 by 谢中龙

积分换物优化

parent e1a90987
// 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
......@@ -18,7 +18,9 @@ wxService.page({
total: '--',
expirePoint : 0,
expireDate : ''
}
},
dialogStockEmpty : false,
dialogUserLimit : false,
},
/**
......@@ -133,9 +135,15 @@ wxService.page({
wx.showLoading({
title: '检查兑换资格中..',
});
wxService.post(`/member/pointsRedemptionProductRecord/checkByMemberIdAndSettingId?memberId=${memberId}&settingId=${id}`).
then(res => {
if (res) {
if(res.data.data == -1){
this.setData({
dialogUserLimit : true
})
}
else{
wx.navigateTo({
url: '/subPackage/page/pages/exchangeAddress/exchangeAddress?id=' + id,
});
......
......@@ -4,6 +4,8 @@
"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",
"go-home": "/component/goHome/goHome"
}
}
\ No newline at end of file
......@@ -117,4 +117,10 @@
<!--goHome-->
<go-home/>
</view>
<!-- 库存没了 -->
<dialog-stock-empty show="{{dialogStockEmpty}}"/>
<dialog-user-limit show="{{dialogUserLimit}}"/>
......@@ -11,6 +11,7 @@ wxService.page({
*/
data: {
isExchange: false,
dialogUserLimit : false,
integralMallDetail: {}
},
......@@ -33,8 +34,12 @@ wxService.page({
});
wxService.post(`/member/pointsRedemptionProductRecord/checkByMemberIdAndSettingId?memberId=${memberId}&settingId=${id}`).
then(res => {
console.log(res)
if(res){
if (res.data.data == -1) {
this.setData({
dialogUserLimit: true
})
}
else {
wx.navigateTo({
url: '/subPackage/page/pages/exchangeAddress/exchangeAddress?id=' + id,
});
......
{
"navigationBarTitleText": "积分换物详情",
"usingComponents": {
"go-home": "/component/goHome/goHome"
"go-home": "/component/goHome/goHome",
"dialog-user-limit": "/component/dialogUserLimit/dialogUserLimit"
}
}
\ No newline at end of file
......@@ -26,4 +26,4 @@
</view>
<!--goHome-->
<go-home/>
<dialog-user-limit show="{{dialogUserLimit}}"/>
......@@ -10,6 +10,7 @@ wxService.page({
data: {
region: [],
point : 0,
dialogStockEmpty: false,
form : {
activateId: '',
name: '',
......@@ -123,7 +124,7 @@ wxService.page({
wxService.post(`/member/pointsRedemptionProductSetting/exchange`,this.data.form).then(res => {
wx.hideLoading();
if (res.data.result == 0){
if(res.data.data == 0){
wx.showToast({
title: '兑换成功',
});
......@@ -132,8 +133,40 @@ wxService.page({
wx.navigateBack({
delta: 1
});
},300);
}, 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
});
},
......
{
"navigationBarTitleText": "填写收货地址",
"usingComponents": {}
"usingComponents": {
"dialog-stock-empty": "/component/dialogStockEmpty/dialogStockEmpty"
}
}
\ No newline at end of file
......@@ -28,3 +28,5 @@
<view class='sumbit' bindtap='onTapSubmit'>确认</view>
</view>
<dialog-stock-empty show="{{dialogStockEmpty}}" bind:btnClick="onDialogBtnCallBack"/>
\ 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