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