@@ -24,7 +24,7 @@ | |||
<image src="../images/circle.png"></image> | |||
<text>使用期限</text> | |||
</view> | |||
<view class="specify">{{ticketUser.coupon_deadline_desc}}</view> | |||
<view class="specify">{{ticketUser.duration}}</view> | |||
</view> | |||
<view> | |||
<view class="timeLimit"> |
@@ -14,6 +14,8 @@ Page({ | |||
yesMask:false,//提示赠送弹框 | |||
shareId:"",//获取用户标识 | |||
sellId:"",//优惠券券码 | |||
showMask:false,//弹框 | |||
yesShare:false,//防止重复点击赠送按钮 | |||
}, | |||
/** | |||
@@ -23,7 +25,7 @@ Page({ | |||
console.log(options.id) | |||
if (app.globalData.openId) { | |||
this.getTicketUser(options.id, 2) | |||
this.getTicketUser(options.id, 1) | |||
} else { | |||
app.globalData.openidSuccessFuc = this.getTicketUser; | |||
} | |||
@@ -36,12 +38,38 @@ Page({ | |||
this.setData({ | |||
ticketUser: e.data, | |||
surplusNum:e.data.num, | |||
shareId: e.data.present_id | |||
}) | |||
} | |||
}, this) | |||
}, | |||
getShareId:function(){ | |||
wx.showLoading({ | |||
title: '加载中', | |||
}) | |||
app.wxRequest(app.globalData.httpUrl + 'couponsell/presentid', { coupon_sell_id: this.data.sellId}, e => { | |||
console.log(e) | |||
if (e.code == 200) { | |||
wx.hideLoading(); | |||
this.setData({ | |||
shareId: e.present_id, | |||
showMask:true, | |||
}) | |||
} | |||
}, this) | |||
}, | |||
shareBtn:function(){ | |||
if (!this.data.yesShare) { | |||
this.data.yesShare = true; | |||
this.getShareId(); | |||
} | |||
}, | |||
hideMask:function(){ | |||
this.data.yesShare = false; | |||
this.setData({ | |||
showMask: false, | |||
}) | |||
}, | |||
/** | |||
* 生命周期函数--监听页面初次渲染完成 | |||
*/ | |||
@@ -53,7 +81,7 @@ Page({ | |||
* 生命周期函数--监听页面显示 | |||
*/ | |||
onShow: function () { | |||
}, | |||
/** | |||
@@ -88,6 +116,10 @@ Page({ | |||
* 用户点击右上角分享 | |||
*/ | |||
onShareAppMessage: function (options) { | |||
this.setData({ | |||
showMask: false, | |||
yesShare:false, | |||
}) | |||
var shareUrl = "";//分享指定路径 | |||
if (options.from === "button"){ | |||
shareUrl = '/pages/receiveTicket/receiveTicket?shareId=' + this.data.shareId + "&number=" + this.data.buyNumber |
@@ -54,7 +54,17 @@ | |||
</view> | |||
</view> | |||
<button class="shareBtn" open-type = "share"> | |||
<button class="shareBtn" bindtap="shareBtn"> | |||
<image class="giveBtn" src="../images/giveBtn.jpg"></image> | |||
</button> | |||
<view class="maskView" wx:if="{{showMask}}"> | |||
<view class="maskCont"> | |||
<view class="yesSure">是否确认赠送</view> | |||
<view class="btnView"> | |||
<view class="SureNo" catchtap="hideMask">取消</view> | |||
<button class="SureYes" open-type="share">确认</button> | |||
</view> | |||
</view> | |||
</view> | |||
</view> |
@@ -196,4 +196,52 @@ page{ | |||
.botAll{ | |||
background-color: #ffffff; | |||
border-radius: 30rpx; | |||
} | |||
.maskView{ | |||
height: 100%; | |||
width: 100%; | |||
background: rgba(0,0,0,0.3); | |||
position: fixed; | |||
top: 0; | |||
left: 0; | |||
z-index: 9; | |||
} | |||
.yesSure{ | |||
text-align: center; | |||
padding: 50rpx; | |||
border-bottom: 1rpx solid rgba(0, 0, 0, 0.1); | |||
} | |||
.maskCont{ | |||
width: 90%; | |||
background-color: #ffffff; | |||
position: absolute; | |||
top: 50%; | |||
left: 50%; | |||
transform: translate(-50%,-50%); | |||
border-radius: 30rpx; | |||
overflow: hidden; | |||
} | |||
.btnView{ | |||
display: flex; | |||
justify-content: space-between; | |||
align-items: center; | |||
} | |||
.SureYes{ | |||
border-radius: 0; | |||
width: 50%; | |||
margin: 0; | |||
background:#ffffff; | |||
border: none; | |||
border-color: transparent; | |||
} | |||
.SureYes::after{ | |||
border: none | |||
} | |||
.SureNo{ | |||
height: 95rpx; | |||
line-height: 95rpx; | |||
width: 50%; | |||
text-align: center; | |||
border-right: 1rpx solid rgba(0, 0, 0, 0.1); | |||
} |
@@ -14,7 +14,7 @@ | |||
<view class="textView"> | |||
<text class="nameText">{{dataList.coupon_name}}</text> | |||
<text class="timeText">{{dataList.coupon_condition_desc}}</text> | |||
<text class="timeText">(有效期:{{dataList.end_date}})</text> | |||
<text class="timeText">(有效期:{{dataList.duration}})</text> | |||
</view> | |||
<view class="buyView">立即购买</view> | |||
</view> |
@@ -29,7 +29,7 @@ | |||
<view class="rigWord"> | |||
<view class="name">{{item.coupon_name}}</view> | |||
<view class="time">{{item.coupon_condition_desc}}</view> | |||
<view class="time">(有效期:{{item.end_date}})</view> | |||
<view class="time">(有效期:{{item.duration}})</view> | |||
</view> | |||
</view> | |||
<view class="look"> |
@@ -127,7 +127,7 @@ | |||
margin-top: 33rpx; | |||
} | |||
.scrollY2{ | |||
height: 300rpx; | |||
height: 200rpx; | |||
margin-top: 20rpx; | |||
} | |||
.historyIcon{ |
@@ -8,9 +8,11 @@ Page({ | |||
data: { | |||
yesGet: true,//是否被领取 | |||
ticketUser:[],//优惠券信息 | |||
userPhone:"",//手机号 | |||
titleWord:"", | |||
presentId:"",//接受的id | |||
ticketNum:0, | |||
moreClick:false,//防止重复点击领取 | |||
}, | |||
/** | |||
@@ -34,42 +36,46 @@ Page({ | |||
getTicketUser: function (id,number) {//获取赠送优惠券信息 | |||
app.wxRequest(app.globalData.httpUrl + 'couponbuy/presentvisit', { present_id: id, present_num: number }, e => { | |||
console.log(e) | |||
if (e.code == 201) { | |||
this.setData({ | |||
ticketUser: e.data, | |||
yesGet: true | |||
}) | |||
} else if (e.code == 202){ | |||
this.setData({ | |||
yesGet: false, | |||
ticketUser: e.data, | |||
titleWord:"此券已被领取" | |||
}) | |||
} else if (e.code == 203){ | |||
this.setData({ | |||
yesGet: false, | |||
ticketUser: e.data, | |||
titleWord: "此券已失效" | |||
}) | |||
} else if (e.code == -201) { | |||
this.setData({ | |||
yesGet: false, | |||
ticketUser: e.data, | |||
titleWord: "没有相关赠送记录" | |||
}) | |||
} else if (e.code == 204) { | |||
this.setData({ | |||
yesGet: false, | |||
ticketUser: e.data, | |||
titleWord: "赠送优惠券不足" | |||
}) | |||
} else if (e.code == 205) { | |||
this.setData({ | |||
yesGet: false, | |||
ticketUser: e.data, | |||
titleWord: "优惠券超限" | |||
}) | |||
} | |||
if (e.code == 201) { | |||
var partPhone = e.data.user_phone.slice(0, 3) + "****" + e.data.user_phone.slice(7) | |||
this.setData({ | |||
ticketUser: e.data, | |||
yesGet: true, | |||
userPhone: partPhone | |||
}) | |||
} else if (e.code == 202) { | |||
var partPhone = e.data.user_phone.slice(0, 3) + "****" + e.data.user_phone.slice(7) | |||
this.setData({ | |||
yesGet: false, | |||
ticketUser: e.data, | |||
titleWord: e.message, | |||
userPhone: partPhone | |||
}) | |||
} else if (e.code == 203) { | |||
var partPhone = e.data.user_phone.slice(0, 3) + "****" + e.data.user_phone.slice(7) | |||
this.setData({ | |||
yesGet: false, | |||
ticketUser: e.data, | |||
titleWord: e.message, | |||
userPhone: partPhone | |||
}) | |||
} else if (e.code == 204) { | |||
var partPhone = e.data.user_phone.slice(0, 3) + "****" + e.data.user_phone.slice(7) | |||
this.setData({ | |||
yesGet: false, | |||
ticketUser: e.data, | |||
titleWord: e.message, | |||
userPhone: partPhone | |||
}) | |||
} else if (e.code == 205) { | |||
var partPhone = e.data.user_phone.slice(0, 3) + "****" + e.data.user_phone.slice(7) | |||
this.setData({ | |||
yesGet: false, | |||
ticketUser: e.data, | |||
titleWord: e.message, | |||
userPhone: partPhone | |||
}) | |||
} | |||
}, this) | |||
}, | |||
/** | |||
@@ -121,27 +127,30 @@ Page({ | |||
}, | |||
// "p1583474312b94" | |||
getTicketFn:function(){//点击领取优惠券 | |||
getTicketFn: function () {//点击领取优惠券 | |||
var id = this.data.presentId; | |||
app.wxRequest(app.globalData.httpUrl + 'couponbuy/receivepresent', { present_id: id }, e => { | |||
console.log(e) | |||
if (e.code == 200) { | |||
wx.showToast({ | |||
title: '领取成功', | |||
duration:500 | |||
}) | |||
setTimeout(()=>{ | |||
wx.switchTab({ | |||
url: '/pages/index/index' | |||
if (!this.data.moreClick) { | |||
app.wxRequest(app.globalData.httpUrl + 'couponbuy/receivepresent', { present_id: id }, e => { | |||
console.log(e) | |||
this.data.moreClick = true; | |||
if (e.code == 200) { | |||
wx.showToast({ | |||
title: '领取成功', | |||
duration: 500 | |||
}) | |||
},500) | |||
}else{ | |||
wx.showToast({ | |||
title: e.message, | |||
duration: 500 | |||
}) | |||
} | |||
}, this,"POST") | |||
setTimeout(() => { | |||
wx.switchTab({ | |||
url: '/pages/index/index' | |||
}) | |||
}, 500) | |||
} else { | |||
wx.showToast({ | |||
title: e.message, | |||
duration: 500 | |||
}) | |||
} | |||
}, this, "POST") | |||
} | |||
}, | |||
backIndex:function(){//优惠券已被领取,点击确定返回首页 | |||
wx.switchTab({ |
@@ -4,7 +4,7 @@ | |||
<view class="all" wx:if="{{yesGet}}"> | |||
<view class="content"> | |||
<view class="userName">你的好友{{ticketUser.nickname}}</view> | |||
<view class="userPhone">{{ticketUser.user_phone}}</view> | |||
<view class="userPhone">{{userPhone}}</view> | |||
<view class="giveTo">赠送给您</view> | |||
<view class="giveNum"> | |||
<text class="textNum">{{ticketNum}}</text> | |||
@@ -19,17 +19,18 @@ | |||
</view> | |||
<view class="textView"> | |||
<text class="nameText">{{ticketUser.coupon_name}}</text> | |||
<text class="timeText">{{ticketUser.coupon_memo}}</text> | |||
<text class="timeText">(有效期:{{ticketUser.end_date}})</text> | |||
<text class="timeText">{{ticketUser.coupon_condition_desc}}</text> | |||
<text class="timeText">(有效期:{{ticketUser.duration}})</text> | |||
</view> | |||
</view> | |||
<image bindtap="getTicketFn" class="getTicket" src="../images/getTicket.png"></image> | |||
</view> | |||
<view wx:if="{{!yesGet}}"> | |||
<view class="errorTitle">领取失败</view> | |||
<view class="ticketState">{{titleWord}}</view> | |||
<view class="question">如有疑问请联系</view> | |||
<view class="wx">{{ticketUser.nickname}}</view> | |||
<view class="phone">{{ticketUser.user_phone}}</view> | |||
<view class="phone">{{userPhone}}</view> | |||
<image bindtap="backIndex" class="sureTicket" src="../images/sureTicket.png"></image> | |||
</view> |
@@ -110,12 +110,19 @@ page{ | |||
margin: 180rpx auto 0 auto; | |||
} | |||
.errorTitle{ | |||
text-align: center; | |||
margin-top: 300rpx; | |||
font-size:60rpx; | |||
font-family:SourceHanSansCN; | |||
font-weight:500; | |||
color:rgba(0,0,0,1); | |||
} | |||
.ticketState{ | |||
margin-top: 380rpx; | |||
margin-top: 50rpx; | |||
margin-bottom: 203rpx; | |||
text-align: center; | |||
font-size:60rpx; | |||
font-size:30rpx; | |||
font-family:SourceHanSansCN; | |||
font-weight:500; | |||
color:rgba(0,0,0,1); |
@@ -69,10 +69,9 @@ Page({ | |||
console.log(options) | |||
if (app.globalData.openId) { | |||
this.getShopList(); | |||
this.searchShop(true); | |||
} else { | |||
app.globalData.openidSuccessFuc = this.getShopList; | |||
app.globalData.openidSuccessFuc = this.searchShop; | |||
// app.globalData.openidSuccessFuc = this.searchShop; | |||
} | |||
}, | |||
@@ -100,6 +99,8 @@ Page({ | |||
cityArr: shopCity, | |||
provinceCityArr: provinceCity, | |||
}) | |||
this.searchShop(true); | |||
// console.log(this.data.provinceArr) | |||
// console.log(this.data.cityArr) | |||
// console.log(this.data.provinceCityArr) | |||
@@ -109,6 +110,7 @@ Page({ | |||
searchShop: function (search){//搜索 | |||
if (search) { | |||
console.log(this.data.provinceCityArr) | |||
if (this.data.provinceCityArr[0][0] == "") { | |||
this.data.provinceCityArr[0][0] = "全部" | |||
} |