| @@ -1,13 +1,13 @@ | |||||
| const util = require("../../../utils/util"); | const util = require("../../../utils/util"); | ||||
| const config = require("../../../config/config.js"); | const config = require("../../../config/config.js"); | ||||
| const Http = require("../../../utils/HttpBasics"); | const Http = require("../../../utils/HttpBasics"); | ||||
| let app = getApp(); | |||||
| //券详情页面 | //券详情页面 | ||||
| Page({ | Page({ | ||||
| data: { | data: { | ||||
| code: "", | code: "", | ||||
| data: { | data: { | ||||
| salePrice:null, | |||||
| salePrice: null, | |||||
| price: null, | price: null, | ||||
| usePrice: null | usePrice: null | ||||
| }, | }, | ||||
| @@ -17,14 +17,12 @@ Page({ | |||||
| //存储计时器 | //存储计时器 | ||||
| setInter: "", | setInter: "", | ||||
| staticGamedata: {}, | staticGamedata: {}, | ||||
| showIf:false, | |||||
| showIf: false, | |||||
| }, | }, | ||||
| onUnload: function() { | |||||
| onUnload:function(){ | |||||
| console.log("onUnload"); | |||||
| let that = this; | let that = this; | ||||
| clearInterval(that.data.setInter); | clearInterval(that.data.setInter); | ||||
| wx.setScreenBrightness({ | |||||
| value: that.data.sight, | |||||
| }) | |||||
| }, | }, | ||||
| gotogame: function () { | gotogame: function () { | ||||
| let that = this; | let that = this; | ||||
| @@ -50,31 +48,30 @@ Page({ | |||||
| staticGamedata: res.data | staticGamedata: res.data | ||||
| }) | }) | ||||
| }) | }) | ||||
| .catch(err => { | |||||
| wx.showToast({ | |||||
| title: err.errMsg, | |||||
| icon: 'none', | |||||
| duration: 2000, | |||||
| mask: false | |||||
| }); | |||||
| }) | |||||
| .catch(err => { | |||||
| wx.showToast({ | |||||
| title: err.errMsg, | |||||
| icon: 'none', | |||||
| duration: 2000, | |||||
| mask: false | |||||
| }); | |||||
| }) | |||||
| }, | }, | ||||
| onLoad: function(options) { | |||||
| // onShow(options) { | |||||
| // setTimeout(function () { | |||||
| // wx.setScreenBrightness({ | |||||
| // value: 0.7, | |||||
| // }) | |||||
| // }, 200) | |||||
| // }, | |||||
| onLoad: function (options) { | |||||
| let that = this; | let that = this; | ||||
| setTimeout(function() { | |||||
| wx.setScreenBrightness({ | |||||
| value: 0.7, | |||||
| }) | |||||
| }, 200), | |||||
| that.setData({ | |||||
| sight: options.sight, | |||||
| code: options.quancode, | |||||
| couponorderstatus: options.couponorderstatus | |||||
| }); | |||||
| that.setData({ | |||||
| code: options.quancode, | |||||
| couponorderstatus: options.couponorderstatus | |||||
| }); | |||||
| //获得优惠券的详情 | //获得优惠券的详情 | ||||
| that.data.setInter = setInterval(function() { | |||||
| that.data.setInter = setInterval(function () { | |||||
| if ( | if ( | ||||
| options.quancode && | options.quancode && | ||||
| that.data.couponorderstatus == 0 | that.data.couponorderstatus == 0 | ||||
| @@ -85,6 +82,7 @@ Page({ | |||||
| couponOrderId: options.quancode | couponOrderId: options.quancode | ||||
| } | } | ||||
| }).then(res => { | }).then(res => { | ||||
| console.log(res); | |||||
| that.setData({ | that.setData({ | ||||
| couponorderstatus: res.data.couponOrderStatus, | couponorderstatus: res.data.couponOrderStatus, | ||||
| data: res.data | data: res.data | ||||
| @@ -108,14 +106,14 @@ Page({ | |||||
| createDate: util.formatTime(that.data.data.createDate, "yyyy-MM-dd hh:mm:ss") | createDate: util.formatTime(that.data.data.createDate, "yyyy-MM-dd hh:mm:ss") | ||||
| }); | }); | ||||
| }) | }) | ||||
| .catch(err => { | |||||
| wx.showToast({ | |||||
| title: err.errMsg, | |||||
| icon: 'none', | |||||
| duration: 2000, | |||||
| mask: false | |||||
| }); | |||||
| }) | |||||
| .catch(err => { | |||||
| wx.showToast({ | |||||
| title: err.errMsg, | |||||
| icon: 'none', | |||||
| duration: 2000, | |||||
| mask: false | |||||
| }); | |||||
| }) | |||||
| } | } | ||||
| }, 2000); | }, 2000); | ||||
| @@ -140,16 +138,16 @@ Page({ | |||||
| util.barcode("barcode", options.quancode, 510, 100); | util.barcode("barcode", options.quancode, 510, 100); | ||||
| util.qrcode("qrcode", options.quancode, 350, 350); | util.qrcode("qrcode", options.quancode, 350, 350); | ||||
| }) | }) | ||||
| .catch(err => { | |||||
| wx.showToast({ | |||||
| title: err.errMsg, | |||||
| icon: 'none', | |||||
| duration: 2000, | |||||
| mask: false | |||||
| }); | |||||
| }) | |||||
| .catch(err => { | |||||
| wx.showToast({ | |||||
| title: err.errMsg, | |||||
| icon: 'none', | |||||
| duration: 2000, | |||||
| mask: false | |||||
| }); | |||||
| }) | |||||
| }, | }, | ||||
| phone: function() { | |||||
| phone: function () { | |||||
| let that = this; | let that = this; | ||||
| if (that.data.data.merchantLinkPhone) { | if (that.data.data.merchantLinkPhone) { | ||||
| wx.makePhoneCall({ | wx.makePhoneCall({ | ||||
| @@ -1,6 +1,7 @@ | |||||
| const util = require("../../../utils/util.js"); | const util = require("../../../utils/util.js"); | ||||
| const config = require("../../../config/config.js"); | const config = require("../../../config/config.js"); | ||||
| const Http = require("../../../utils/HttpBasics"); | const Http = require("../../../utils/HttpBasics"); | ||||
| let app = getApp(); | |||||
| Page({ | Page({ | ||||
| data: { | data: { | ||||
| tabs: [{ | tabs: [{ | ||||
| @@ -40,14 +41,12 @@ Page({ | |||||
| }) | }) | ||||
| wx.hideTabBarRedDot({ | wx.hideTabBarRedDot({ | ||||
| index:2 | index:2 | ||||
| }), | |||||
| wx.getScreenBrightness({ | |||||
| success:function(res){ | |||||
| that.setData({ | |||||
| sight:res.value | |||||
| }) | |||||
| } | |||||
| }); | |||||
| }) | |||||
| // wx.getScreenBrightness({ | |||||
| // success:function(res){ | |||||
| // app.globalData.sight = res.value; | |||||
| // } | |||||
| // }); | |||||
| }, | }, | ||||
| //点击跳转到券详情页面 | //点击跳转到券详情页面 | ||||
| gotouse: function (e) { | gotouse: function (e) { | ||||
| @@ -58,7 +57,7 @@ Page({ | |||||
| } | } | ||||
| wx.navigateTo({ | wx.navigateTo({ | ||||
| url: `/pages/couponorder/detail/index?quancode=${ | url: `/pages/couponorder/detail/index?quancode=${ | ||||
| e.currentTarget.dataset.quancode}&couponorderstatus=${mystatus}&sight=${this.data.sight}` | |||||
| e.currentTarget.dataset.quancode}&couponorderstatus=${mystatus}` | |||||
| }); | }); | ||||
| }, | }, | ||||
| getList(key, pageNum) { | getList(key, pageNum) { | ||||
| @@ -8,7 +8,7 @@ Component({ | |||||
| * 组件的属性列表 | * 组件的属性列表 | ||||
| */ | */ | ||||
| properties: { | properties: { | ||||
| loading: { | |||||
| loading: { | |||||
| type: Boolean, | type: Boolean, | ||||
| value: '' | value: '' | ||||
| }, | }, | ||||
| @@ -33,7 +33,7 @@ Component({ | |||||
| pageNum: 1, // 设置加载的第几次,默认是第一次 | pageNum: 1, // 设置加载的第几次,默认是第一次 | ||||
| pageSize: 10, //返回数据的个数 | pageSize: 10, //返回数据的个数 | ||||
| searchLoadingComplete: false, //“没有数据”的变量,默认false,隐藏 | searchLoadingComplete: false, //“没有数据”的变量,默认false,隐藏 | ||||
| allow_load: true // 是否允许继续加载标识 默认 true 允许,false 加载完成 | |||||
| allow_load: true, // 是否允许继续加载标识 默认 true 允许,false 加载完成 | |||||
| }, | }, | ||||
| /** | /** | ||||
| * 组件的方法列表 | * 组件的方法列表 | ||||
| @@ -51,7 +51,6 @@ Component({ | |||||
| detail | detail | ||||
| }) { | }) { | ||||
| let that = this; | let that = this; | ||||
| // 切换tab时重新初始化下list 和 allow_load | // 切换tab时重新初始化下list 和 allow_load | ||||
| that.setData({ | that.setData({ | ||||
| current_scroll: detail.key, | current_scroll: detail.key, | ||||
| @@ -70,11 +69,23 @@ Component({ | |||||
| this.triggerEvent("myevent", myEventDetail); | this.triggerEvent("myevent", myEventDetail); | ||||
| }, | }, | ||||
| getList(key, pageNum) { | |||||
| getList(key, pageNum, from) { | |||||
| var that = this; | var that = this; | ||||
| console.log("pageNum------>"+pageNum); | |||||
| /** | |||||
| * from==refresh | |||||
| * 表示是从下拉刷新进来的 | |||||
| */ | |||||
| app.couponListCallback = token => { | app.couponListCallback = token => { | ||||
| Http.setToken(token); | Http.setToken(token); | ||||
| // 券list获取 | // 券list获取 | ||||
| if (from == 'refresh') { | |||||
| that.setData({ | |||||
| allow_load: true, | |||||
| list: [], | |||||
| }) | |||||
| console.log(that.data.list); | |||||
| } | |||||
| if (that.data.allow_load) { | if (that.data.allow_load) { | ||||
| that.setData({ | that.setData({ | ||||
| loading: true, | loading: true, | ||||
| @@ -103,28 +114,28 @@ Component({ | |||||
| /** | /** | ||||
| * 加载完成 | * 加载完成 | ||||
| */ | */ | ||||
| if (pageNum >= res.data.pages) { | if (pageNum >= res.data.pages) { | ||||
| if(res.data.pages == 0||res.data.pages == 1){ | |||||
| if (res.data.pages == 0 || res.data.pages == 1) { | |||||
| that.setData({ | that.setData({ | ||||
| allow_load: true, | allow_load: true, | ||||
| loading: false, | loading: false, | ||||
| content: "" | content: "" | ||||
| }); | }); | ||||
| }else{ | |||||
| } | |||||
| else { | |||||
| that.setData({ | that.setData({ | ||||
| allow_load: false, | allow_load: false, | ||||
| loading: true, | loading: true, | ||||
| content: "——— 再拉裤子就掉了啦 ———" | |||||
| content: "——— 再拉裤子就掉了啦 ———", | |||||
| }); | }); | ||||
| } | |||||
| } | |||||
| } | } | ||||
| if (pageNum == 1) { | if (pageNum == 1) { | ||||
| that.setData({ | that.setData({ | ||||
| list: [], | list: [], | ||||
| }) | }) | ||||
| } | } | ||||
| var tmpArr = that.data.list; | var tmpArr = that.data.list; | ||||
| tmpArr.push.apply(tmpArr, res.data.list); | tmpArr.push.apply(tmpArr, res.data.list); | ||||
| that.setData({ | that.setData({ | ||||
| @@ -144,7 +155,7 @@ Component({ | |||||
| loading: false, | loading: false, | ||||
| }) | }) | ||||
| }, 1400); | }, 1400); | ||||
| } | |||||
| } | |||||
| else { | else { | ||||
| that.setData({ | that.setData({ | ||||
| loading: true, | loading: true, | ||||
| @@ -180,14 +191,14 @@ Component({ | |||||
| tabs: res.data.list | tabs: res.data.list | ||||
| }); | }); | ||||
| }) | }) | ||||
| .catch(err => { | |||||
| wx.showToast({ | |||||
| title: err.errMsg, | |||||
| icon: 'none', | |||||
| duration: 2000, | |||||
| mask: false | |||||
| }); | |||||
| }) | |||||
| .catch(err => { | |||||
| wx.showToast({ | |||||
| title: err.errMsg, | |||||
| icon: 'none', | |||||
| duration: 2000, | |||||
| mask: false | |||||
| }); | |||||
| }) | |||||
| }; | }; | ||||
| if (app.globalData.token && app.globalData.token != null) { | if (app.globalData.token && app.globalData.token != null) { | ||||
| app.businessListCallback(app.globalData.token); | app.businessListCallback(app.globalData.token); | ||||
| @@ -6,94 +6,94 @@ Page({ | |||||
| data: { | data: { | ||||
| market: app.globalData.market, | market: app.globalData.market, | ||||
| list: [], | list: [], | ||||
| loading:true, | |||||
| loading: true, | |||||
| swiperCurrent: 0, | swiperCurrent: 0, | ||||
| title:'', | |||||
| desc:'', | |||||
| title: null, | |||||
| desc: null, | |||||
| scrollTop: 0, | scrollTop: 0, | ||||
| showGame:false, | |||||
| gamedata:{}, | |||||
| couponId:'',//游戏返回时传回的字段 | |||||
| played:false,//从游戏页面跳回首页返回true | |||||
| showGame: false, | |||||
| gamedata: {}, | |||||
| couponId: '',//游戏返回时传回的字段 | |||||
| played: false,//从游戏页面跳回首页返回true | |||||
| havePlayEd: app.globalData.havePlayEd, | havePlayEd: app.globalData.havePlayEd, | ||||
| staticGamedata:{}, | |||||
| showIf:false, | |||||
| staticGamedata: {}, | |||||
| showIf: false, | |||||
| page: 1 // 刷新进入页面时已经加载了第一页数据,onReachBottom时 page++,从第2页开始加载 | page: 1 // 刷新进入页面时已经加载了第一页数据,onReachBottom时 page++,从第2页开始加载 | ||||
| }, | }, | ||||
| swiperChange: function(e) { | |||||
| swiperChange: function (e) { | |||||
| this.setData({ | this.setData({ | ||||
| swiperCurrent: e.detail.current | swiperCurrent: e.detail.current | ||||
| }); | }); | ||||
| }, | }, | ||||
| gotogame:function(){ | |||||
| let that = this; | |||||
| Http.post({ | |||||
| url: config.api.checkPhoneStatus, | |||||
| data: {} | |||||
| }) | |||||
| .then(res => { | |||||
| gotogame: function () { | |||||
| let that = this; | |||||
| Http.post({ | |||||
| url: config.api.checkPhoneStatus, | |||||
| data: {} | |||||
| }) | |||||
| .then(res => { | |||||
| var data = { | |||||
| couponChannelId: "" + that.data.couponChannelId, | |||||
| couponId: "" + that.data.couponId | |||||
| }; | |||||
| if (that.data.couponChannelId == null) { | |||||
| var data = { | var data = { | ||||
| couponChannelId: "" + that.data.couponChannelId, | |||||
| couponId: "" + that.data.couponId | couponId: "" + that.data.couponId | ||||
| }; | }; | ||||
| if (that.data.couponChannelId == null) { | |||||
| var data = { | |||||
| couponId: "" + that.data.couponId | |||||
| }; | |||||
| } | |||||
| wx.navigateTo({ | |||||
| url: '/pages/game/index?url=' + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId, | |||||
| }) | |||||
| }) | |||||
| .catch(err => { | |||||
| if (err.code == 11005) { | |||||
| // 用户手机未授权 | |||||
| /** | |||||
| * 将值传到用户手机号授权的页面 | |||||
| * | |||||
| */ | |||||
| wx.redirectTo({ | |||||
| url: "/pages/getphoneInfo/index?path=index&url=" + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId, | |||||
| }); | |||||
| } else if (err.code == 11006) { | |||||
| // 用户手机已加密 | |||||
| wx.redirectTo({ | |||||
| url: "/pages/phoneinput/phoneinput?path=index&url=" + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId, | |||||
| }); | |||||
| } else { | |||||
| wx.showToast({ | |||||
| title: err.errMsg, | |||||
| icon: 'none', | |||||
| duration: 2000, | |||||
| mask: false | |||||
| }); | |||||
| } | |||||
| } | |||||
| wx.navigateTo({ | |||||
| url: '/pages/game/index?url=' + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId, | |||||
| }) | }) | ||||
| }) | |||||
| .catch(err => { | |||||
| if (err.code == 11005) { | |||||
| // 用户手机未授权 | |||||
| /** | |||||
| * 将值传到用户手机号授权的页面 | |||||
| * | |||||
| */ | |||||
| wx.redirectTo({ | |||||
| url: "/pages/getphoneInfo/index?path=index&url=" + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId, | |||||
| }); | |||||
| } else if (err.code == 11006) { | |||||
| // 用户手机已加密 | |||||
| wx.redirectTo({ | |||||
| url: "/pages/phoneinput/phoneinput?path=index&url=" + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId, | |||||
| }); | |||||
| } else { | |||||
| wx.showToast({ | |||||
| title: err.errMsg, | |||||
| icon: 'none', | |||||
| duration: 2000, | |||||
| mask: false | |||||
| }); | |||||
| } | |||||
| }) | |||||
| }, | }, | ||||
| /** | /** | ||||
| * 生命周期函数--监听页面初次渲染完成 | * 生命周期函数--监听页面初次渲染完成 | ||||
| */ | */ | ||||
| onLoad: function(options) { | |||||
| if(options.played=="true"){ | |||||
| onLoad: function (options) { | |||||
| if (options.played == "true") { | |||||
| this.setData({ | this.setData({ | ||||
| played:true | |||||
| played: true | |||||
| }) | }) | ||||
| } | } | ||||
| var that = this; | var that = this; | ||||
| if (decodeURIComponent(options.scene)=="undefined"){ | |||||
| if (decodeURIComponent(options.scene) == "undefined") { | |||||
| that.setData({ | that.setData({ | ||||
| scene: 0 | scene: 0 | ||||
| }); | }); | ||||
| }else{ | |||||
| } else { | |||||
| that.setData({ | that.setData({ | ||||
| scene: decodeURIComponent(options.scene) | scene: decodeURIComponent(options.scene) | ||||
| }); | }); | ||||
| } | } | ||||
| app.getLocation(); | app.getLocation(); | ||||
| if (options.couponChannelId && options.couponId){ | |||||
| if (options.couponChannelId && options.couponId) { | |||||
| that.userLogin(options.couponChannelId, options.couponId); | that.userLogin(options.couponChannelId, options.couponId); | ||||
| }else{ | |||||
| } else { | |||||
| that.userLogin() | that.userLogin() | ||||
| } | } | ||||
| Http.get({ | Http.get({ | ||||
| @@ -102,67 +102,57 @@ Page({ | |||||
| appId: config.weapp.AppId, | appId: config.weapp.AppId, | ||||
| } | } | ||||
| }) | }) | ||||
| .then(res=>{ | |||||
| let weapNote = JSON.parse(res.data.weapNote); | |||||
| that.setData({ | |||||
| desc: weapNote.firstpage.desc, | |||||
| title: weapNote.firstpage.title | |||||
| }) | |||||
| }) | |||||
| .catch(err => { | |||||
| console.log(err); | |||||
| if (err.errMsg == '请求超时,请检查您的网络设置!') { | |||||
| .then(res => { | |||||
| let weapNote = JSON.parse(res.data.weapNote); | |||||
| that.setData({ | that.setData({ | ||||
| loading: false, | |||||
| loadingtext: "请求超时,请检查您的网络设置!" | |||||
| desc: weapNote.firstpage.desc, | |||||
| title: weapNote.firstpage.title | |||||
| }) | }) | ||||
| } | |||||
| wx.showToast({ | |||||
| title: err.errMsg, | |||||
| icon: 'none', | |||||
| duration: 2000, | |||||
| mask: false | |||||
| }) | |||||
| .catch(err => { | |||||
| console.log(err); | |||||
| if (err.errMsg == '请求超时,请检查您的网络设置!') { | |||||
| that.setData({ | |||||
| loading: false, | |||||
| loadingtext: "请求超时,请检查您的网络设置!" | |||||
| }) | |||||
| } | |||||
| wx.showToast({ | |||||
| title: err.errMsg, | |||||
| icon: 'none', | |||||
| duration: 2000, | |||||
| mask: false | |||||
| }); | |||||
| }); | }); | ||||
| }); | |||||
| }, | }, | ||||
| onShow:function(){ | |||||
| onShow: function () { | |||||
| this.setData({ | this.setData({ | ||||
| havePlayEd: app.globalData.havePlayEd ? app.globalData.havePlayEd:false | |||||
| havePlayEd: app.globalData.havePlayEd ? app.globalData.havePlayEd : false | |||||
| }) | }) | ||||
| let num = wx.getStorageSync('couponNum'); | let num = wx.getStorageSync('couponNum'); | ||||
| if (num =='couponNum'){ | |||||
| if (num == 'couponNum') { | |||||
| wx.showTabBarRedDot({ | wx.showTabBarRedDot({ | ||||
| index: 2 | index: 2 | ||||
| }) | }) | ||||
| }; | }; | ||||
| }, | }, | ||||
| /** | /** | ||||
| * 下拉刷新 | |||||
| * | |||||
| * @param {code,page} | |||||
| * 子组件向父组件传值 | |||||
| */ | */ | ||||
| onPullDownRefresh: function(e) { | |||||
| let that = this; | |||||
| that.userLogin(); | |||||
| if (that.data.code == 0 || that.data.code == undefined) { | |||||
| that.selectComponent("#lists").getList(0, 1); | |||||
| wx.stopPullDownRefresh(); | |||||
| } else { | |||||
| that.selectComponent("#lists").getList(that.data.code, 1); | |||||
| wx.stopPullDownRefresh(); | |||||
| }; | |||||
| }, | |||||
| onGetCode: function(e) { | |||||
| //子组件传递给父组件的值 | |||||
| onGetCode: function (e) { | |||||
| this.setData({ | this.setData({ | ||||
| code: e.detail.val, | code: e.detail.val, | ||||
| page: e.detail.pageNum | |||||
| page: e.detail.pageNum, | |||||
| }); | }); | ||||
| console.log(e.detail.val) | |||||
| console.log(e.detail.pageNum) | |||||
| }, | }, | ||||
| /** | /** | ||||
| * 用户登录 | * 用户登录 | ||||
| */ | */ | ||||
| userLogin: function (couponChannelId,couponId) { | |||||
| userLogin: function (couponChannelId, couponId) { | |||||
| var that = this; | var that = this; | ||||
| // 登录 | // 登录 | ||||
| wx.login({ | wx.login({ | ||||
| @@ -195,13 +185,12 @@ Page({ | |||||
| }; | }; | ||||
| } | } | ||||
| Http.post({ | Http.post({ | ||||
| url: config.api.login, | |||||
| data: usrdata | |||||
| }) | |||||
| url: config.api.login, | |||||
| data: usrdata | |||||
| }) | |||||
| .then(res => { | .then(res => { | ||||
| app.globalData.token = res.data.token; | app.globalData.token = res.data.token; | ||||
| if (res.data.token){ | if (res.data.token){ | ||||
| that.getGameOne(res.data.token) | that.getGameOne(res.data.token) | ||||
| that.getStaticGame(res.data.token) | that.getStaticGame(res.data.token) | ||||
| } | } | ||||
| @@ -226,7 +215,7 @@ Page({ | |||||
| } | } | ||||
| }); | }); | ||||
| }, | }, | ||||
| checkuerstatus(couponChannelId, couponId){ | |||||
| checkuerstatus(couponChannelId, couponId) { | |||||
| Http.post({ | Http.post({ | ||||
| url: config.api.checkUserStatus, | url: config.api.checkUserStatus, | ||||
| data: {} | data: {} | ||||
| @@ -249,16 +238,16 @@ Page({ | |||||
| wx.redirectTo({ | wx.redirectTo({ | ||||
| url: '/pages/getuserinfo/index' | url: '/pages/getuserinfo/index' | ||||
| }); | }); | ||||
| } | |||||
| } | |||||
| } | } | ||||
| }); | }); | ||||
| }, | }, | ||||
| getStaticGame(token){ | |||||
| getStaticGame(token) { | |||||
| let _this = this; | let _this = this; | ||||
| Http.get({ | Http.get({ | ||||
| url: config.api.getGame, | url: config.api.getGame, | ||||
| data: { | data: { | ||||
| triggleAction:2, | |||||
| triggleAction: 2, | |||||
| token: token | token: token | ||||
| } | } | ||||
| }).then(res => { | }).then(res => { | ||||
| @@ -275,8 +264,8 @@ Page({ | |||||
| console.log(err) | console.log(err) | ||||
| }) | }) | ||||
| }, | }, | ||||
| getGameOne:function(token){ | |||||
| let _this=this; | |||||
| getGameOne: function (token) { | |||||
| let _this = this; | |||||
| Http.get({ | Http.get({ | ||||
| url: config.api.getGame, | url: config.api.getGame, | ||||
| data:{ | data:{ | ||||
| @@ -284,13 +273,13 @@ Page({ | |||||
| token: token | token: token | ||||
| } | } | ||||
| }).then(res => { | }).then(res => { | ||||
| if (res.data.id){ | |||||
| if (res.data.id) { | |||||
| _this.setData({ | _this.setData({ | ||||
| showGame: true | showGame: true | ||||
| }) | }) | ||||
| } | } | ||||
| _this.setData({ | _this.setData({ | ||||
| gamedata:res.data | |||||
| gamedata: res.data | |||||
| }) | }) | ||||
| }) | }) | ||||
| .catch(err => { | .catch(err => { | ||||
| @@ -300,7 +289,7 @@ Page({ | |||||
| /** | /** | ||||
| * banner | * banner | ||||
| */ | */ | ||||
| getBannerlist: function() { | |||||
| getBannerlist: function () { | |||||
| let that = this; | let that = this; | ||||
| Http.get({ | Http.get({ | ||||
| url: config.api.bannerlist, | url: config.api.bannerlist, | ||||
| @@ -318,7 +307,7 @@ Page({ | |||||
| /** | /** | ||||
| * 检查用户是否有车 | * 检查用户是否有车 | ||||
| */ | */ | ||||
| checkUserCarStatus: function() { | |||||
| checkUserCarStatus: function () { | |||||
| var that = this; | var that = this; | ||||
| Http.get({ | Http.get({ | ||||
| url: config.api.userCarCount, | url: config.api.userCarCount, | ||||
| @@ -336,7 +325,7 @@ Page({ | |||||
| /** | /** | ||||
| * car共同登录 | * car共同登录 | ||||
| */ | */ | ||||
| userCarLogin: function() { | |||||
| userCarLogin: function () { | |||||
| var that = this; | var that = this; | ||||
| if (!app.globalData.carLogin) { | if (!app.globalData.carLogin) { | ||||
| // 共同登录 | // 共同登录 | ||||
| @@ -357,7 +346,7 @@ Page({ | |||||
| /** | /** | ||||
| * 获取用户信息 | * 获取用户信息 | ||||
| */ | */ | ||||
| getUserInfo: function() { | |||||
| getUserInfo: function () { | |||||
| // 获取用户信息 | // 获取用户信息 | ||||
| wx.getSetting({ | wx.getSetting({ | ||||
| success: res => { | success: res => { | ||||
| @@ -372,13 +361,32 @@ Page({ | |||||
| } | } | ||||
| }); | }); | ||||
| }, | }, | ||||
| //下拉加载更多 | |||||
| onReachBottom: function() { | |||||
| /** | |||||
| * 刷新 | |||||
| */ | |||||
| onPullDownRefresh: function (e) { | |||||
| let that = this; | |||||
| that.userLogin(); | |||||
| that.setData({ | |||||
| page:1 | |||||
| }) | |||||
| if (that.data.code == 0 || that.data.code == undefined) { | |||||
| that.selectComponent("#lists").getList(0, 1, "refresh"); | |||||
| wx.stopPullDownRefresh(); | |||||
| } else { | |||||
| that.selectComponent("#lists").getList(that.data.code, 1, "refresh"); | |||||
| wx.stopPullDownRefresh(); | |||||
| }; | |||||
| }, | |||||
| //加载更多 | |||||
| onReachBottom: function () { | |||||
| let that = this; | let that = this; | ||||
| that.data.page++; | that.data.page++; | ||||
| that.setData({ | that.setData({ | ||||
| page: that.data.page | page: that.data.page | ||||
| }); | }); | ||||
| console.log("加载更多页数"+that.data.page); | |||||
| console.log("加载更多key"+that.data.code); | |||||
| //父组件获得子组件的方法 | //父组件获得子组件的方法 | ||||
| //如果code == 0 | //如果code == 0 | ||||
| if (that.data.code == 0 || that.data.code == undefined) { | if (that.data.code == 0 || that.data.code == undefined) { | ||||
| @@ -388,11 +396,11 @@ Page({ | |||||
| } | } | ||||
| }, | }, | ||||
| // 用户点击右上角分享 | // 用户点击右上角分享 | ||||
| onShareAppMessage: function() { | |||||
| onShareAppMessage: function () { | |||||
| return { | return { | ||||
| title: this.data.title, | title: this.data.title, | ||||
| desc: this.data.desc, | desc: this.data.desc, | ||||
| success: function(res) { | |||||
| success: function (res) { | |||||
| wx.showToast({ | wx.showToast({ | ||||
| title: "分享成功", | title: "分享成功", | ||||
| duration: 1000, | duration: 1000, | ||||
| @@ -34,7 +34,7 @@ Page({ | |||||
| e.currentTarget.dataset.subtitle | e.currentTarget.dataset.subtitle | ||||
| }&remark=${e.currentTarget.dataset.remark}&couponorderstatus=${ | }&remark=${e.currentTarget.dataset.remark}&couponorderstatus=${ | ||||
| e.currentTarget.dataset.couponorderstatus | e.currentTarget.dataset.couponorderstatus | ||||
| }&sight=${that.data.sight}` | |||||
| }` | |||||
| }); | }); | ||||
| } else { | } else { | ||||
| wx.navigateTo({ | wx.navigateTo({ | ||||
| @@ -44,7 +44,7 @@ Page({ | |||||
| e.currentTarget.dataset.subtitle | e.currentTarget.dataset.subtitle | ||||
| }&remark=${e.currentTarget.dataset.remark}&couponorderstatus=${ | }&remark=${e.currentTarget.dataset.remark}&couponorderstatus=${ | ||||
| that.data.mystatus | that.data.mystatus | ||||
| }&sight=${that.data.sight}` | |||||
| }` | |||||
| }); | }); | ||||
| } | } | ||||
| }, | }, | ||||
| @@ -212,13 +212,12 @@ Page({ | |||||
| */ | */ | ||||
| onShow: function () { | onShow: function () { | ||||
| let that = this; | let that = this; | ||||
| wx.getScreenBrightness({ | |||||
| success: function (res) { | |||||
| that.setData({ | |||||
| sight: res.value | |||||
| }) | |||||
| } | |||||
| }); | |||||
| // wx.getScreenBrightness({ | |||||
| // success: function (res) { | |||||
| // app.globalData.sight=res.value; | |||||
| // console.log(app.globalData.sight); | |||||
| // } | |||||
| // }); | |||||
| }, | }, | ||||
| /** | /** | ||||
| @@ -160,5 +160,5 @@ Page({ | |||||
| page: that.data.page | page: that.data.page | ||||
| }); | }); | ||||
| that.getList(that.data.current_scroll, that.data.page); | that.getList(that.data.current_scroll, that.data.page); | ||||
| } | |||||
| }, | |||||
| }); | }); | ||||
| @@ -1,23 +1,18 @@ | |||||
| let util = require("../../utils/util"); | let util = require("../../utils/util"); | ||||
| let Http = require("../../utils/HttpBasics"); | let Http = require("../../utils/HttpBasics"); | ||||
| let config = require("../../config/config.js"); | let config = require("../../config/config.js"); | ||||
| let app = getApp(); | |||||
| Page({ | Page({ | ||||
| data: { | data: { | ||||
| code: "", | code: "", | ||||
| //存储计时器 | //存储计时器 | ||||
| setInter: "" | setInter: "" | ||||
| }, | }, | ||||
| onLoad: function(options) { | |||||
| onLoad: function (options) { | |||||
| let that = this; | let that = this; | ||||
| setTimeout(function () { | |||||
| wx.setScreenBrightness({ | |||||
| value: 0.7, | |||||
| }) | |||||
| }, 200), | |||||
| util.barcode("barcode", options.quancode, 500, 100); | util.barcode("barcode", options.quancode, 500, 100); | ||||
| util.qrcode("qrcode", options.quancode, 350, 350); | util.qrcode("qrcode", options.quancode, 350, 350); | ||||
| that.setData({ | that.setData({ | ||||
| sight: options.sight, | |||||
| code: options.quancode, | code: options.quancode, | ||||
| title: options.title, | title: options.title, | ||||
| subtitle: options.subtitle, | subtitle: options.subtitle, | ||||
| @@ -27,7 +22,7 @@ Page({ | |||||
| /** | /** | ||||
| * 如果没有核销 | * 如果没有核销 | ||||
| */ | */ | ||||
| that.data.setInter = setInterval(function() { | |||||
| that.data.setInter = setInterval(function () { | |||||
| if (that.data.couponorderstatus == 0) { | if (that.data.couponorderstatus == 0) { | ||||
| Http.get({ | Http.get({ | ||||
| url: config.api.getStatus, | url: config.api.getStatus, | ||||
| @@ -35,6 +30,7 @@ Page({ | |||||
| couponOrderId: options.quancode | couponOrderId: options.quancode | ||||
| } | } | ||||
| }).then(res => { | }).then(res => { | ||||
| console.log(res); | |||||
| that.setData({ | that.setData({ | ||||
| couponorderstatus: res.data.CouponOrderStatus | couponorderstatus: res.data.CouponOrderStatus | ||||
| }); | }); | ||||
| @@ -48,17 +44,16 @@ Page({ | |||||
| prevPage.setData({ | prevPage.setData({ | ||||
| mystatus: res.data.CouponOrderStatus | mystatus: res.data.CouponOrderStatus | ||||
| }); | }); | ||||
| } | } | ||||
| }) | }) | ||||
| .catch(err => { | |||||
| wx.showToast({ | |||||
| title: err.errMsg, | |||||
| icon: 'none', | |||||
| duration: 2000, | |||||
| mask: false | |||||
| }); | |||||
| }) | |||||
| .catch(err => { | |||||
| wx.showToast({ | |||||
| title: err.errMsg, | |||||
| icon: 'none', | |||||
| duration: 2000, | |||||
| mask: false | |||||
| }); | |||||
| }) | |||||
| } | } | ||||
| }, 2000); | }, 2000); | ||||
| @@ -77,14 +72,14 @@ Page({ | |||||
| couponorderstatus: res.data.CouponOrderStatus | couponorderstatus: res.data.CouponOrderStatus | ||||
| }); | }); | ||||
| }) | }) | ||||
| .catch(err => { | |||||
| wx.showToast({ | |||||
| title: err.errMsg, | |||||
| icon: 'none', | |||||
| duration: 2000, | |||||
| mask: false | |||||
| }); | |||||
| }) | |||||
| .catch(err => { | |||||
| wx.showToast({ | |||||
| title: err.errMsg, | |||||
| icon: 'none', | |||||
| duration: 2000, | |||||
| mask: false | |||||
| }); | |||||
| }) | |||||
| } | } | ||||
| /** | /** | ||||
| * couponorderstatus | * couponorderstatus | ||||
| @@ -92,11 +87,22 @@ Page({ | |||||
| * 1 已经核销成功 | * 1 已经核销成功 | ||||
| */ | */ | ||||
| }, | }, | ||||
| onUnload: function() { | |||||
| // onShow(options) { | |||||
| // console.log("屏幕的亮度") | |||||
| // setTimeout(function () { | |||||
| // wx.setScreenBrightness({ | |||||
| // value: 1, | |||||
| // }) | |||||
| // }, 200) | |||||
| // }, | |||||
| onUnload: function () { | |||||
| let that = this; | let that = this; | ||||
| clearInterval(that.data.setInter); | clearInterval(that.data.setInter); | ||||
| wx.setScreenBrightness({ | |||||
| value: that.data.sight, | |||||
| }) | |||||
| } | |||||
| }, | |||||
| // onHide:function(){ | |||||
| // console.log(app.globalData.sight) | |||||
| // wx.setScreenBrightness({ | |||||
| // value: app.globalData.sight, | |||||
| // }) | |||||
| // } | |||||
| }); | }); | ||||
| @@ -165,9 +165,11 @@ | |||||
| .nocoupon button { | .nocoupon button { | ||||
| background: #00c0ff; | background: #00c0ff; | ||||
| color: #fff; | color: #fff; | ||||
| font-style: 30rpx; | |||||
| font-size: 36rpx; | |||||
| width: 100%; | width: 100%; | ||||
| border-radius: 60rpx; | border-radius: 60rpx; | ||||
| height: 88rpx; | |||||
| line-height: 88rpx; | |||||
| } | } | ||||
| .loading { | .loading { | ||||