| // logs.unshift(Date.now()) | // logs.unshift(Date.now()) | ||||
| // wx.setStorageSync('logs', logs) | // wx.setStorageSync('logs', logs) | ||||
| var openid = wx.getStorageSync('openid') || ""; | var openid = wx.getStorageSync('openid') || ""; | ||||
| console.log(this.globalData.present_id) | |||||
| // 登录 | // 登录 | ||||
| if (!openid){ | if (!openid){ | ||||
| wx.login({ | wx.login({ | ||||
| }, | }, | ||||
| getUserType: function () {//获取用户注册状态 | getUserType: function () {//获取用户注册状态 | ||||
| console.log(this.globalData.openId) | console.log(this.globalData.openId) | ||||
| this.wxRequest(this.globalData.httpUrl + 'getinfo',{},e=>{ | |||||
| this.wxRequest(this.globalData.httpUrl + 'getinfo', {},e=>{ | |||||
| console.log(e) | console.log(e) | ||||
| if(e.code==201){//未注册跳到注册页面 | if(e.code==201){//未注册跳到注册页面 | ||||
| wx.reLaunch({ | wx.reLaunch({ | ||||
| url: '/pages/register/register' | url: '/pages/register/register' | ||||
| }) | }) | ||||
| } else if (e.code == 202){//已注册 | |||||
| } else if (e.code == 202) {//已注册 | |||||
| this.globalData.userInfo = e.data; | this.globalData.userInfo = e.data; | ||||
| console.log(this.globalData.userInfo) | |||||
| if (this.globalData.present_id){ | if (this.globalData.present_id){ | ||||
| } else { | } else { | ||||
| }, | }, | ||||
| globalData: { | globalData: { | ||||
| openidSuccessFuc: null,//方法回调 | openidSuccessFuc: null,//方法回调 | ||||
| userInfoSuccessFuc: null,//方法回调 | |||||
| userInfo: null, | userInfo: null, | ||||
| present_id:"",//判断用户是通过领取优惠券进来的还是直接进的 | present_id:"",//判断用户是通过领取优惠券进来的还是直接进的 | ||||
| number:"",//赠送优惠券的数量 | number:"",//赠送优惠券的数量 |
| ticketStateArr:[],//优惠券使用状态 | ticketStateArr:[],//优惠券使用状态 | ||||
| codePicUrl:"",//二维码图片地址 | codePicUrl:"",//二维码图片地址 | ||||
| yesCode: false,//二维码图片隐藏 | yesCode: false,//二维码图片隐藏 | ||||
| id:"" | |||||
| }, | }, | ||||
| /** | /** | ||||
| */ | */ | ||||
| onLoad: function (options) { | onLoad: function (options) { | ||||
| console.log(options.id) | console.log(options.id) | ||||
| this.data.id = options.id; | |||||
| if (app.globalData.openId) { | if (app.globalData.openId) { | ||||
| this.getTicketUser(options.id, 1) | |||||
| this.getCodeFn(options.id) | |||||
| this.getTicketUser() | |||||
| this.getCodeFn() | |||||
| } else { | } else { | ||||
| app.globalData.openidSuccessFuc = this.getTicketUser; | app.globalData.openidSuccessFuc = this.getTicketUser; | ||||
| app.globalData.openidSuccessFuc = this.getCodeFn; | app.globalData.openidSuccessFuc = this.getCodeFn; | ||||
| } | } | ||||
| }, | }, | ||||
| getTicketUser: function (id,from) {//获取优惠券信息 | |||||
| app.wxRequest(app.globalData.httpUrl + 'couponsell/detail', { coupon_sell_id: id, from: from}, e => { | |||||
| getTicketUser: function () {//获取优惠券信息 | |||||
| app.wxRequest(app.globalData.httpUrl + 'couponsell/detail', { coupon_sell_id: this.data.id, from: 1}, e => { | |||||
| console.log(e) | console.log(e) | ||||
| if (e.code == 200) { | if (e.code == 200) { | ||||
| this.setData({ | this.setData({ | ||||
| } | } | ||||
| }, this) | }, this) | ||||
| }, | }, | ||||
| getCodeFn:function(id){//获取二维码 | |||||
| app.wxRequest(app.globalData.httpUrl + 'couponbuy/getqrcode', { coupon_sell_id: id}, e => { | |||||
| getCodeFn:function(){//获取二维码 | |||||
| app.wxRequest(app.globalData.httpUrl + 'couponbuy/getqrcode', { coupon_sell_id: this.data.id}, e => { | |||||
| console.log(e) | console.log(e) | ||||
| if (e.code == 200) { | if (e.code == 200) { | ||||
| this.setData({ | this.setData({ |
| ticketUser: [],//优惠券信息 | ticketUser: [],//优惠券信息 | ||||
| orderUser:[],//下单信息 | orderUser:[],//下单信息 | ||||
| sign_num:"",//确认支付参数 | sign_num:"",//确认支付参数 | ||||
| id:"" | |||||
| }, | }, | ||||
| /** | /** | ||||
| */ | */ | ||||
| onLoad: function (options) { | onLoad: function (options) { | ||||
| console.log(options) | console.log(options) | ||||
| this.data.id = options.index; | |||||
| if (app.globalData.openId) { | if (app.globalData.openId) { | ||||
| this.getTicketUser(options.index, 1) | |||||
| this.getTicketUser() | |||||
| } else { | } else { | ||||
| app.globalData.openidSuccessFuc = this.getTicketUser; | app.globalData.openidSuccessFuc = this.getTicketUser; | ||||
| } | } | ||||
| }, | }, | ||||
| getTicketUser:function(index,from){//获取优惠券信息 | |||||
| app.wxRequest(app.globalData.httpUrl + 'couponsell/detail', { coupon_sell_id: index, from: from}, e => { | |||||
| getTicketUser:function(){//获取优惠券信息 | |||||
| app.wxRequest(app.globalData.httpUrl + 'couponsell/detail', { coupon_sell_id: this.data.id, from: 1}, e => { | |||||
| console.log(e) | console.log(e) | ||||
| if (e.code == 200) { | if (e.code == 200) { | ||||
| this.setData({ | this.setData({ |
| */ | */ | ||||
| onLoad: function (options) { | onLoad: function (options) { | ||||
| console.log(options.id) | console.log(options.id) | ||||
| this.data.id = options.id | |||||
| this.data.sellId = options.id; | |||||
| if (app.globalData.openId) { | if (app.globalData.openId) { | ||||
| this.getTicketUser(options.id, 1) | |||||
| this.getTicketUser() | |||||
| } else { | } else { | ||||
| app.globalData.openidSuccessFuc = this.getTicketUser; | app.globalData.openidSuccessFuc = this.getTicketUser; | ||||
| } | } | ||||
| this.data.sellId = options.id; | |||||
| }, | }, | ||||
| getTicketUser: function (id, from) {//获取优惠券信息 | |||||
| app.wxRequest(app.globalData.httpUrl + 'couponsell/detail', { coupon_sell_id: id, from: from }, e => { | |||||
| getTicketUser: function () {//获取优惠券信息 | |||||
| app.wxRequest(app.globalData.httpUrl + 'couponsell/detail', { coupon_sell_id: this.data.sellId, from: 2 }, e => { | |||||
| console.log(e) | console.log(e) | ||||
| if (e.code == 200) { | if (e.code == 200) { | ||||
| this.setData({ | this.setData({ |
| }else{ | }else{ | ||||
| app.globalData.openidSuccessFuc = this.getDataList; | app.globalData.openidSuccessFuc = this.getDataList; | ||||
| } | } | ||||
| }, | |||||
| }, | |||||
| getDataList:function(){ | getDataList:function(){ | ||||
| app.wxRequest(app.globalData.httpUrl + 'couponsell/list', {}, e => { | app.wxRequest(app.globalData.httpUrl + 'couponsell/list', {}, e => { | ||||
| // console.log(e) | // console.log(e) |
| } | } | ||||
| .ruleMask{ | .ruleMask{ | ||||
| width: 576rpx; | width: 576rpx; | ||||
| height: 950rpx; | |||||
| height: 947rpx; | |||||
| } | } | ||||
| .hiddenIcon{ | .hiddenIcon{ | ||||
| width: 110rpx; | width: 110rpx; |
| }) | }) | ||||
| if (app.globalData.openId) { | if (app.globalData.openId) { | ||||
| this.getTicketUser(options.shareId, options.number); | |||||
| this.getTicketUser(); | |||||
| } else { | } else { | ||||
| app.globalData.openidSuccessFuc = this.getTicketUser; | app.globalData.openidSuccessFuc = this.getTicketUser; | ||||
| } | } | ||||
| }, | }, | ||||
| getTicketUser: function (id,number) {//获取赠送优惠券信息 | |||||
| app.wxRequest(app.globalData.httpUrl + 'couponbuy/presentvisit', { present_id: id, present_num: number }, e => { | |||||
| getTicketUser: function () {//获取赠送优惠券信息 | |||||
| app.wxRequest(app.globalData.httpUrl + 'couponbuy/presentvisit', { present_id: app.globalData.present_id, present_num: app.globalData.number }, e => { | |||||
| console.log(e) | console.log(e) | ||||
| if (e.code == 201) { | if (e.code == 201) { | ||||
| var partPhone = e.data.user_phone.slice(0, 3) + "****" + e.data.user_phone.slice(7) | var partPhone = e.data.user_phone.slice(0, 3) + "****" + e.data.user_phone.slice(7) |