| * 用户点击右上角分享 | * 用户点击右上角分享 | ||||
| */ | */ | ||||
| onShareAppMessage: function () { | onShareAppMessage: function () { | ||||
| return { | |||||
| title: "老门框爆肚会员", | |||||
| path: "/pages/register/register", | |||||
| success: res => { | |||||
| console.log(res, "转发成功") | |||||
| }, | |||||
| } | |||||
| } | } | ||||
| }) | }) |
| * 用户点击右上角分享 | * 用户点击右上角分享 | ||||
| */ | */ | ||||
| onShareAppMessage: function () { | onShareAppMessage: function () { | ||||
| return { | |||||
| title: "老门框爆肚会员", | |||||
| path: "/pages/register/register", | |||||
| success: res => { | |||||
| console.log(res, "转发成功") | |||||
| }, | |||||
| } | |||||
| }, | }, | ||||
| addFn:function(){ | addFn:function(){ | ||||
| // if (this.data.num<5){ | // if (this.data.num<5){ | ||||
| } | } | ||||
| }, | }, | ||||
| buySuccess:function(){//购买下单 | buySuccess:function(){//购买下单 | ||||
| if (!this.data.buyNumber) { | |||||
| wx.showToast({ | |||||
| title: '请先输入购买优惠券的数量', | |||||
| icon: "none", | |||||
| duration: 2000 | |||||
| }) | |||||
| return; | |||||
| } else if (this.data.buyNumber == 0) { | |||||
| wx.showToast({ | |||||
| title: '购买优惠券的数量最小为1', | |||||
| icon: "none", | |||||
| duration: 2000 | |||||
| }) | |||||
| return; | |||||
| } | |||||
| if (this.data.yesClick){ | if (this.data.yesClick){ | ||||
| return; | return; | ||||
| } | } | ||||
| this.data.yesClick = true; | |||||
| app.wxRequest(app.globalData.httpUrl + 'order/set', { coupon_sell_id: this.data.ticketUser.coupon_sell_id, buy_num: this.data.buyNumber}, e => { | app.wxRequest(app.globalData.httpUrl + 'order/set', { coupon_sell_id: this.data.ticketUser.coupon_sell_id, buy_num: this.data.buyNumber}, e => { | ||||
| this.data.yesClick = true; | |||||
| console.log(e) | console.log(e) | ||||
| if (e.code == 200) { | if (e.code == 200) { | ||||
| this.setData({ | this.setData({ |
| }, this) | }, this) | ||||
| }, | }, | ||||
| shareBtn:function(){ | shareBtn:function(){ | ||||
| console.log(this.data.buyNumber) | |||||
| if (!this.data.buyNumber){ | |||||
| wx.showToast({ | |||||
| title: '请先输入赠送好友优惠券的数量', | |||||
| icon:"none", | |||||
| duration:2000 | |||||
| }) | |||||
| return; | |||||
| } else if (this.data.buyNumber==0){ | |||||
| wx.showToast({ | |||||
| title: '赠送好友优惠券的数量最小为1', | |||||
| icon: "none", | |||||
| duration: 2000 | |||||
| }) | |||||
| return; | |||||
| } | |||||
| if (!this.data.yesShare) { | if (!this.data.yesShare) { | ||||
| this.data.yesShare = true; | this.data.yesShare = true; | ||||
| this.getShareId(); | this.getShareId(); | ||||
| yesShare:false, | yesShare:false, | ||||
| }) | }) | ||||
| var shareUrl = "";//分享指定路径 | var shareUrl = "";//分享指定路径 | ||||
| var titleWord = "";//title | |||||
| var shareImg = "";//分享图 | |||||
| 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 | ||||
| titleWord = "赠送给好友" | |||||
| shareImg = this.data.ticketUser.coupon_img_small; | |||||
| }else{ | |||||
| shareUrl = "/pages/register/register"; | |||||
| titleWord = "老门框爆肚会员" | |||||
| shareImg = ""; | |||||
| } | } | ||||
| return{ | return{ | ||||
| title:"赠送给好友", | |||||
| imageUrl: this.data.ticketUser.coupon_img_small, | |||||
| title: titleWord, | |||||
| imageUrl: shareImg, | |||||
| path: shareUrl, | path: shareUrl, | ||||
| success: res=> { | success: res=> { | ||||
| console.log(res, "转发成功") | console.log(res, "转发成功") | ||||
| getInputVal: function (e) { | getInputVal: function (e) { | ||||
| if (e.detail.value <= this.data.surplusNum){ | if (e.detail.value <= this.data.surplusNum){ | ||||
| console.log(this.data.buyNumber) | console.log(this.data.buyNumber) | ||||
| // if (e.detail.value < 1) { | |||||
| // if (e.detail.value == 0) { | |||||
| // wx.showToast({ | // wx.showToast({ | ||||
| // title: "赠送量最小为1", | |||||
| // duration: 1000 | |||||
| // title: "赠送数量最小为1", | |||||
| // icon:"none", | |||||
| // duration: 2000 | |||||
| // }) | // }) | ||||
| // this.setData({ | // this.setData({ | ||||
| // buyNumber: 1, | // buyNumber: 1, |
| this.setData({ | this.setData({ | ||||
| showMask: false | showMask: false | ||||
| }) | }) | ||||
| } | |||||
| }, | |||||
| /** | |||||
| * 用户点击右上角分享 | |||||
| */ | |||||
| onShareAppMessage: function () { | |||||
| return { | |||||
| title: "老门框爆肚会员", | |||||
| path: "/pages/register/register", | |||||
| success: res => { | |||||
| console.log(res, "转发成功") | |||||
| }, | |||||
| } | |||||
| }, | |||||
| }) | }) |
| app.globalData.openidSuccessFuc = this.myTicket; | app.globalData.openidSuccessFuc = this.myTicket; | ||||
| app.globalData.openidSuccessFuc = this.historyTicket; | app.globalData.openidSuccessFuc = this.historyTicket; | ||||
| } | } | ||||
| console.log(app.globalData.userInfo) | |||||
| if (app.globalData.userInfo.item_state == 2) { | |||||
| var userInfo = wx.getStorageSync('userInfo'); | |||||
| var phone = wx.getStorageSync('user_phone'); | |||||
| console.log(userInfo) | |||||
| if (userInfo) { | |||||
| var userArr = []; | var userArr = []; | ||||
| var phone=""; | |||||
| userArr.push(app.globalData.userInfo.headimgurl); | |||||
| userArr.push(app.globalData.userInfo.nickname); | |||||
| userArr.push(userInfo.avatarUrl); | |||||
| userArr.push(userInfo.nickName); | |||||
| phone = app.globalData.userInfo.user_phone | phone = app.globalData.userInfo.user_phone | ||||
| console.log(phone) | console.log(phone) | ||||
| this.setData({ | this.setData({ | ||||
| * 用户点击右上角分享 | * 用户点击右上角分享 | ||||
| */ | */ | ||||
| onShareAppMessage: function () { | onShareAppMessage: function () { | ||||
| return { | |||||
| title: "老门框爆肚会员", | |||||
| path: "/pages/register/register", | |||||
| success: res => { | |||||
| console.log(res, "转发成功") | |||||
| }, | |||||
| } | |||||
| }, | }, | ||||
| lookMyTicket:function(){ | lookMyTicket:function(){ | ||||
| this.setData({ | this.setData({ | ||||
| }, | }, | ||||
| getUser:function(e){//点击登陆获取用户信息 | getUser:function(e){//点击登陆获取用户信息 | ||||
| console.log(e) | console.log(e) | ||||
| wx.setStorageSync('userInfo', e.detail.userInfo); | |||||
| var phone = wx.getStorageSync('user_phone'); | |||||
| var userArr = []; | var userArr = []; | ||||
| var phone = ""; | |||||
| userArr.push(e.detail.userInfo.avatarUrl); | userArr.push(e.detail.userInfo.avatarUrl); | ||||
| userArr.push(e.detail.userInfo.nickName); | userArr.push(e.detail.userInfo.nickName); | ||||
| phone = app.globalData.user_phone | |||||
| // phone = app.globalData.user_phone | |||||
| console.log(phone) | console.log(phone) | ||||
| this.data.userChuan = e.detail.userInfo; | this.data.userChuan = e.detail.userInfo; | ||||
| this.setData({ | this.setData({ |
| ticketNum: options.number | ticketNum: options.number | ||||
| }) | }) | ||||
| var state = wx.getStorageSync('state'); | var state = wx.getStorageSync('state'); | ||||
| if (state == 1) {//已注册 | if (state == 1) {//已注册 | ||||
| if (app.globalData.openId) { | if (app.globalData.openId) { | ||||
| showAll:true | showAll:true | ||||
| }) | }) | ||||
| } else if (state == 0) {//未注册 | } else if (state == 0) {//未注册 | ||||
| wx.switchTab({ | |||||
| wx.navigateTo({ | |||||
| url: '/pages/register/register' | url: '/pages/register/register' | ||||
| }) | }) | ||||
| } else if (state == -1) { | } else if (state == -1) { | ||||
| showAll: true | showAll: true | ||||
| }) | }) | ||||
| } else { | } else { | ||||
| wx.switchTab({ | |||||
| wx.navigateTo({ | |||||
| url: '/pages/register/register' | url: '/pages/register/register' | ||||
| }) | }) | ||||
| } | } | ||||
| * 用户点击右上角分享 | * 用户点击右上角分享 | ||||
| */ | */ | ||||
| onShareAppMessage: function () { | onShareAppMessage: function () { | ||||
| return { | |||||
| title: "老门框爆肚会员", | |||||
| path: "/pages/register/register", | |||||
| success: res => { | |||||
| console.log(res, "转发成功") | |||||
| }, | |||||
| } | |||||
| }, | }, | ||||
| // "p1583474312b94" | // "p1583474312b94" | ||||
| getTicketFn: function () {//点击领取优惠券 | getTicketFn: function () {//点击领取优惠券 | ||||
| var id = this.data.presentId; | var id = this.data.presentId; | ||||
| 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 | |||||
| }) | |||||
| setTimeout(() => { | |||||
| wx.switchTab({ | |||||
| url: '/pages/index/index' | |||||
| }) | |||||
| }, 500) | |||||
| } else { | |||||
| wx.showToast({ | |||||
| title: e.message, | |||||
| duration: 500 | |||||
| }) | |||||
| } | |||||
| }, this, "POST") | |||||
| if (this.data.moreClick){ | |||||
| return; | |||||
| } | } | ||||
| this.data.moreClick = true; | |||||
| 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' | |||||
| }) | |||||
| }, 500) | |||||
| } else { | |||||
| this.data.moreClick = false; | |||||
| wx.showToast({ | |||||
| title: e.message, | |||||
| duration: 500 | |||||
| }) | |||||
| } | |||||
| }, this, "POST") | |||||
| }, | }, | ||||
| backIndex:function(){//优惠券已被领取,点击确定返回首页 | backIndex:function(){//优惠券已被领取,点击确定返回首页 | ||||
| wx.switchTab({ | wx.switchTab({ |
| * 用户点击右上角分享 | * 用户点击右上角分享 | ||||
| */ | */ | ||||
| onShareAppMessage: function () { | onShareAppMessage: function () { | ||||
| return { | |||||
| title: "老门框爆肚会员", | |||||
| path: "/pages/register/register", | |||||
| success: res => { | |||||
| console.log(res, "转发成功") | |||||
| }, | |||||
| } | |||||
| }, | }, | ||||
| yesCodeFn:function(){//验证码接口 | yesCodeFn:function(){//验证码接口 | ||||
| this.data.yesRegister = true; | this.data.yesRegister = true; | ||||
| if (e.code == 200) { | if (e.code == 200) { | ||||
| clearInterval(time); | clearInterval(time); | ||||
| app.globalData.user_phone = e.data.user_phone | |||||
| wx.setStorageSync('user_phone', e.data.user_phone); | |||||
| wx.setStorageSync('state', 1); | |||||
| this.setData({ | this.setData({ | ||||
| minter: 60, | minter: 60, | ||||
| num: 60 | num: 60 |
| showDataArr:[],//展示的数据列表 | showDataArr:[],//展示的数据列表 | ||||
| dataArr: [],//搜索的数据列表 | dataArr: [],//搜索的数据列表 | ||||
| getDataArr:[],//每次下拉获取的数据 | getDataArr:[],//每次下拉获取的数据 | ||||
| topNum:0,//滚动条位置 | |||||
| }, | }, | ||||
| bindchange:function(e){ | bindchange:function(e){ | ||||
| wx.pageScrollTo({ | |||||
| scrollTop: 0, | |||||
| duration: 300 | |||||
| }) | |||||
| this.data.pageNum = 1; | this.data.pageNum = 1; | ||||
| this.data.dataArr = []; | this.data.dataArr = []; | ||||
| this.setData({ | this.setData({ | ||||
| inputVal:"" | |||||
| inputVal:"", | |||||
| topNum:0 | |||||
| }) | }) | ||||
| this.searchShop(); | this.searchShop(); | ||||
| }, | }, | ||||
| * 用户点击右上角分享 | * 用户点击右上角分享 | ||||
| */ | */ | ||||
| onShareAppMessage: function () { | onShareAppMessage: function () { | ||||
| return { | |||||
| title: "老门框爆肚会员", | |||||
| path: "/pages/register/register", | |||||
| success: res => { | |||||
| console.log(res, "转发成功") | |||||
| }, | |||||
| } | |||||
| }, | }, | ||||
| callPhone:function(e){//拨打电话 | callPhone:function(e){//拨打电话 | ||||
| var index = e.target.dataset.index; | var index = e.target.dataset.index; |
| </view> | </view> | ||||
| <!-- <view class="content"> --> | <!-- <view class="content"> --> | ||||
| <scroll-view scroll-y="true" style="height:{{scrollHig}}px" bindscrolltolower="lower"> | |||||
| <scroll-view scroll-y="true" style="height:{{scrollHig}}px" scroll-top='{{topNum}}' bindscrolltolower="lower"> | |||||
| <view> | <view> | ||||
| <view class="getData" wx:for="{{showDataArr}}"> | <view class="getData" wx:for="{{showDataArr}}"> | ||||
| <view class="imgView"> | <view class="imgView"> |
| font-size:26rpx; | font-size:26rpx; | ||||
| font-family:SourceHanSansCN; | font-family:SourceHanSansCN; | ||||
| color:rgba(102,102,102,1); | color:rgba(102,102,102,1); | ||||
| width: 700rpx; | |||||
| overflow: hidden; | |||||
| white-space: nowrap; | |||||
| text-overflow: ellipsis; | |||||
| } | } | ||||
| .addressIcon{ | .addressIcon{ | ||||
| width: 21rpx; | width: 21rpx; |