| <image src="../images/circle.png"></image> | <image src="../images/circle.png"></image> | ||||
| <text>使用期限</text> | <text>使用期限</text> | ||||
| </view> | </view> | ||||
| <view class="specify">{{ticketUser.coupon_deadline_desc}}</view> | |||||
| <view class="specify">{{ticketUser.duration}}</view> | |||||
| </view> | </view> | ||||
| <view> | <view> | ||||
| <view class="timeLimit"> | <view class="timeLimit"> |
| yesMask:false,//提示赠送弹框 | yesMask:false,//提示赠送弹框 | ||||
| shareId:"",//获取用户标识 | shareId:"",//获取用户标识 | ||||
| sellId:"",//优惠券券码 | sellId:"",//优惠券券码 | ||||
| showMask:false,//弹框 | |||||
| yesShare:false,//防止重复点击赠送按钮 | |||||
| }, | }, | ||||
| /** | /** | ||||
| console.log(options.id) | console.log(options.id) | ||||
| if (app.globalData.openId) { | if (app.globalData.openId) { | ||||
| this.getTicketUser(options.id, 2) | |||||
| this.getTicketUser(options.id, 1) | |||||
| } else { | } else { | ||||
| app.globalData.openidSuccessFuc = this.getTicketUser; | app.globalData.openidSuccessFuc = this.getTicketUser; | ||||
| } | } | ||||
| this.setData({ | this.setData({ | ||||
| ticketUser: e.data, | ticketUser: e.data, | ||||
| surplusNum:e.data.num, | surplusNum:e.data.num, | ||||
| shareId: e.data.present_id | |||||
| }) | }) | ||||
| } | } | ||||
| }, this) | }, 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, | |||||
| }) | |||||
| }, | |||||
| /** | /** | ||||
| * 生命周期函数--监听页面初次渲染完成 | * 生命周期函数--监听页面初次渲染完成 | ||||
| */ | */ | ||||
| * 生命周期函数--监听页面显示 | * 生命周期函数--监听页面显示 | ||||
| */ | */ | ||||
| onShow: function () { | onShow: function () { | ||||
| }, | }, | ||||
| /** | /** | ||||
| * 用户点击右上角分享 | * 用户点击右上角分享 | ||||
| */ | */ | ||||
| onShareAppMessage: function (options) { | onShareAppMessage: function (options) { | ||||
| this.setData({ | |||||
| showMask: false, | |||||
| yesShare:false, | |||||
| }) | |||||
| var shareUrl = "";//分享指定路径 | var shareUrl = "";//分享指定路径 | ||||
| if (options.from === "button"){ | if (options.from === "button"){ | ||||
| shareUrl = '/pages/receiveTicket/receiveTicket?shareId=' + this.data.shareId + "&number=" + this.data.buyNumber | shareUrl = '/pages/receiveTicket/receiveTicket?shareId=' + this.data.shareId + "&number=" + this.data.buyNumber |
| </view> | </view> | ||||
| </view> | </view> | ||||
| <button class="shareBtn" open-type = "share"> | |||||
| <button class="shareBtn" bindtap="shareBtn"> | |||||
| <image class="giveBtn" src="../images/giveBtn.jpg"></image> | <image class="giveBtn" src="../images/giveBtn.jpg"></image> | ||||
| </button> | </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> | </view> |
| .botAll{ | .botAll{ | ||||
| background-color: #ffffff; | background-color: #ffffff; | ||||
| border-radius: 30rpx; | 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); | |||||
| } | } |
| <view class="textView"> | <view class="textView"> | ||||
| <text class="nameText">{{dataList.coupon_name}}</text> | <text class="nameText">{{dataList.coupon_name}}</text> | ||||
| <text class="timeText">{{dataList.coupon_condition_desc}}</text> | <text class="timeText">{{dataList.coupon_condition_desc}}</text> | ||||
| <text class="timeText">(有效期:{{dataList.end_date}})</text> | |||||
| <text class="timeText">(有效期:{{dataList.duration}})</text> | |||||
| </view> | </view> | ||||
| <view class="buyView">立即购买</view> | <view class="buyView">立即购买</view> | ||||
| </view> | </view> |
| <view class="rigWord"> | <view class="rigWord"> | ||||
| <view class="name">{{item.coupon_name}}</view> | <view class="name">{{item.coupon_name}}</view> | ||||
| <view class="time">{{item.coupon_condition_desc}}</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> | </view> | ||||
| <view class="look"> | <view class="look"> |
| margin-top: 33rpx; | margin-top: 33rpx; | ||||
| } | } | ||||
| .scrollY2{ | .scrollY2{ | ||||
| height: 300rpx; | |||||
| height: 200rpx; | |||||
| margin-top: 20rpx; | margin-top: 20rpx; | ||||
| } | } | ||||
| .historyIcon{ | .historyIcon{ |
| data: { | data: { | ||||
| yesGet: true,//是否被领取 | yesGet: true,//是否被领取 | ||||
| ticketUser:[],//优惠券信息 | ticketUser:[],//优惠券信息 | ||||
| userPhone:"",//手机号 | |||||
| titleWord:"", | titleWord:"", | ||||
| presentId:"",//接受的id | presentId:"",//接受的id | ||||
| ticketNum:0, | ticketNum:0, | ||||
| moreClick:false,//防止重复点击领取 | |||||
| }, | }, | ||||
| /** | /** | ||||
| getTicketUser: function (id,number) {//获取赠送优惠券信息 | getTicketUser: function (id,number) {//获取赠送优惠券信息 | ||||
| app.wxRequest(app.globalData.httpUrl + 'couponbuy/presentvisit', { present_id: id, present_num: number }, e => { | app.wxRequest(app.globalData.httpUrl + 'couponbuy/presentvisit', { present_id: id, present_num: number }, e => { | ||||
| console.log(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) | }, this) | ||||
| }, | }, | ||||
| /** | /** | ||||
| }, | }, | ||||
| // "p1583474312b94" | // "p1583474312b94" | ||||
| getTicketFn:function(){//点击领取优惠券 | |||||
| getTicketFn: function () {//点击领取优惠券 | |||||
| var id = this.data.presentId; | 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(){//优惠券已被领取,点击确定返回首页 | backIndex:function(){//优惠券已被领取,点击确定返回首页 | ||||
| wx.switchTab({ | wx.switchTab({ |
| <view class="all" wx:if="{{yesGet}}"> | <view class="all" wx:if="{{yesGet}}"> | ||||
| <view class="content"> | <view class="content"> | ||||
| <view class="userName">你的好友{{ticketUser.nickname}}</view> | <view class="userName">你的好友{{ticketUser.nickname}}</view> | ||||
| <view class="userPhone">{{ticketUser.user_phone}}</view> | |||||
| <view class="userPhone">{{userPhone}}</view> | |||||
| <view class="giveTo">赠送给您</view> | <view class="giveTo">赠送给您</view> | ||||
| <view class="giveNum"> | <view class="giveNum"> | ||||
| <text class="textNum">{{ticketNum}}</text> | <text class="textNum">{{ticketNum}}</text> | ||||
| </view> | </view> | ||||
| <view class="textView"> | <view class="textView"> | ||||
| <text class="nameText">{{ticketUser.coupon_name}}</text> | <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> | ||||
| </view> | </view> | ||||
| <image bindtap="getTicketFn" class="getTicket" src="../images/getTicket.png"></image> | <image bindtap="getTicketFn" class="getTicket" src="../images/getTicket.png"></image> | ||||
| </view> | </view> | ||||
| <view wx:if="{{!yesGet}}"> | <view wx:if="{{!yesGet}}"> | ||||
| <view class="errorTitle">领取失败</view> | |||||
| <view class="ticketState">{{titleWord}}</view> | <view class="ticketState">{{titleWord}}</view> | ||||
| <view class="question">如有疑问请联系</view> | <view class="question">如有疑问请联系</view> | ||||
| <view class="wx">{{ticketUser.nickname}}</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> | <image bindtap="backIndex" class="sureTicket" src="../images/sureTicket.png"></image> | ||||
| </view> | </view> |
| margin: 180rpx auto 0 auto; | 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{ | .ticketState{ | ||||
| margin-top: 380rpx; | |||||
| margin-top: 50rpx; | |||||
| margin-bottom: 203rpx; | margin-bottom: 203rpx; | ||||
| text-align: center; | text-align: center; | ||||
| font-size:60rpx; | |||||
| font-size:30rpx; | |||||
| font-family:SourceHanSansCN; | font-family:SourceHanSansCN; | ||||
| font-weight:500; | font-weight:500; | ||||
| color:rgba(0,0,0,1); | color:rgba(0,0,0,1); |
| console.log(options) | console.log(options) | ||||
| if (app.globalData.openId) { | if (app.globalData.openId) { | ||||
| this.getShopList(); | this.getShopList(); | ||||
| this.searchShop(true); | |||||
| } else { | } else { | ||||
| app.globalData.openidSuccessFuc = this.getShopList; | app.globalData.openidSuccessFuc = this.getShopList; | ||||
| app.globalData.openidSuccessFuc = this.searchShop; | |||||
| // app.globalData.openidSuccessFuc = this.searchShop; | |||||
| } | } | ||||
| }, | }, | ||||
| cityArr: shopCity, | cityArr: shopCity, | ||||
| provinceCityArr: provinceCity, | provinceCityArr: provinceCity, | ||||
| }) | }) | ||||
| this.searchShop(true); | |||||
| // console.log(this.data.provinceArr) | // console.log(this.data.provinceArr) | ||||
| // console.log(this.data.cityArr) | // console.log(this.data.cityArr) | ||||
| // console.log(this.data.provinceCityArr) | // console.log(this.data.provinceCityArr) | ||||
| searchShop: function (search){//搜索 | searchShop: function (search){//搜索 | ||||
| if (search) { | if (search) { | ||||
| console.log(this.data.provinceCityArr) | |||||
| if (this.data.provinceCityArr[0][0] == "") { | if (this.data.provinceCityArr[0][0] == "") { | ||||
| this.data.provinceCityArr[0][0] = "全部" | this.data.provinceCityArr[0][0] = "全部" | ||||
| } | } |