| @@ -3,6 +3,7 @@ const Http = require("./utils/HttpBasics"); | |||
| App({ | |||
| data: {}, | |||
| onLaunch: function(options) { | |||
| console.log("onUnload ") | |||
| var that = this; | |||
| that.globalData.sceneAddress = options.scene; | |||
| }, | |||
| @@ -1,6 +1,7 @@ | |||
| { | |||
| "pages": [ | |||
| "pages/index/index", | |||
| "pages/login/index", | |||
| "pages/bargain/bargainDatail/bargainDatail", | |||
| "pages/bargain/bargain", | |||
| "pages/cardorder/index/index", | |||
| @@ -22,7 +23,6 @@ | |||
| "pages/order/detail/index", | |||
| "pages/order/index/index", | |||
| "pages/success/index", | |||
| "pages/login/index", | |||
| "pages/park/park", | |||
| "pages/ques/ques", | |||
| "pages/passCar/passCar", | |||
| @@ -36,6 +36,7 @@ | |||
| "pages/payrule/payrule", | |||
| "pages/grade/grade", | |||
| "pages/game/index", | |||
| "pages/login/gameentry/gentry", | |||
| "pages/index/gameentry/gentry", | |||
| "pages/specialcourtesy/specialcourtesy", | |||
| "pages/discountCardList/discountCardList", | |||
| @@ -61,7 +62,7 @@ | |||
| "selectedColor": "#00C0FF", | |||
| "list": [ | |||
| { | |||
| "pagePath": "pages/index/index", | |||
| "pagePath": "pages/login/index", | |||
| "iconPath": "assets/images/home-n.png", | |||
| "selectedIconPath": "assets/images/home-y.png", | |||
| "text": "首页" | |||
| @@ -83,7 +84,7 @@ | |||
| "window": { | |||
| "backgroundTextStyle": "red", | |||
| "navigationBarBackgroundColor": "#02C0FF", | |||
| "navigationBarTitleText": "WeChat", | |||
| "navigationBarTitleText": "", | |||
| "navigationBarTextStyle": "white" | |||
| }, | |||
| "networkTimeout": { | |||
| @@ -3,8 +3,8 @@ var appId = extConfig.appId; | |||
| var config = { | |||
| // url: "https://ciformall.youlane.cn/C/api", | |||
| // url:"https://c.malls.iformall.com/C/api", | |||
| // url:'https://ctest.malls.iformall.com/C/api', | |||
| url:'http://10.100.33.69:7000/C/api', | |||
| url:'https://ctest.malls.iformall.com/C/api', | |||
| // url:'http://10.100.33.70:7000/C/api', | |||
| // url: 'http://202.165.179.86:4000/C/api', | |||
| api: { | |||
| /** | |||
| @@ -219,7 +219,7 @@ var config = { | |||
| }, | |||
| weapp: { | |||
| AppId: "wxea71200db93d756b" | |||
| AppId: "wx649b3be73c1afe47" | |||
| }, | |||
| ErrorCode: { | |||
| @@ -41,7 +41,7 @@ | |||
| <image class="icon" src="./../../assets/images/bargainfail.png" lazy-load="true"/> | |||
| </view> | |||
| <view wx:if="{{item.orderStatus == 2}}"> | |||
| <view wx:if="{{item.orderStatus == 2 || item.orderStatus == 9}}"> | |||
| <image class="icon" style="margin-top:60rpx;" src="./../../assets/images/bargaincancel.png" lazy-load="true"/> | |||
| </view> | |||
| </view> | |||
| @@ -51,6 +51,11 @@ Page({ | |||
| showButton:false | |||
| }) | |||
| }, | |||
| goback:function(){ | |||
| wx.reLaunch({ | |||
| url: '/pages/index/index', | |||
| }) | |||
| }, | |||
| /** | |||
| * 更多砍价商品 | |||
| */ | |||
| @@ -58,11 +58,12 @@ | |||
| </view> | |||
| <view wx:if="{{data.orderStatus != 7&&discountStatus==1&&todayDate<=data.pressEndDate&&data.orderStatus!=1}}" class="btns clearfix" hover-class="none" hover-stop-propagation="false"> | |||
| <button class='goback' bindtap='goback'><image src='./../../../assets/images/home.png' mode="widthFix"></image></button> | |||
| <button class="fl" bindtap='orderFunc' disabled='{{showButton}}' data-orderId="{{data.id}}" data-price="{{data.price/100}}"> | |||
| <text>{{data.price/100}}元</text> | |||
| <text>立即购买</text> | |||
| </button> | |||
| <button class='share user-motto fr' data-orderId='{{data.id}}' id="shareBtn" open-type="share" hover-class="other-button-hover">邀请好友继续砍价</button> | |||
| <button class='share user-motto fr' data-orderId='{{data.id}}' id="shareBtn" open-type="share" hover-class="other-button-hover">邀请好友砍价</button> | |||
| </view> | |||
| <view style='display:{{display}}' wx:if="{{data.orderStatus == 7&&discountStatus == 1}}" class="btns01 clearfix" hover-class="none" hover-stop-propagation="false"> | |||
| <button bindtap='orderFunc' data-orderId="{{data.id}}" data-salePrice="{{data.salePrice/100}}" hover-class="other-button-hover">{{data.salePrice/100}}元 底价购买</button> | |||
| @@ -224,9 +224,31 @@ | |||
| text-align: center; | |||
| } | |||
| .btns .fl{ | |||
| width: 250rpx; | |||
| color: #fff; | |||
| background:rgba(255,169,2,1); | |||
| box-shadow:0px 8px 8px 1px rgba(255,169,2,0.32); | |||
| margin-left: 22rpx; | |||
| } | |||
| .goback{ | |||
| position: relative; | |||
| float: left; | |||
| width:122rpx!important; | |||
| height:95rpx; | |||
| background:rgba(255,255,255,1); | |||
| line-height: 95rpx; | |||
| border:1rpx solid rgba(227,227,227,1); | |||
| box-shadow:0px 8px 8px 1px rgba(189,189,189,0.32); | |||
| border-radius:48rpx; | |||
| } | |||
| .goback image{ | |||
| position: absolute; | |||
| width: 60rpx; | |||
| left: 0; | |||
| right: 0; | |||
| top: 0; | |||
| bottom: 0; | |||
| margin: auto; | |||
| } | |||
| .btns .fl text{ | |||
| display: block; | |||
| @@ -240,6 +262,7 @@ | |||
| font-size: 30rpx; | |||
| color: #fff; | |||
| line-height: 95rpx; | |||
| width: 271rpx; | |||
| background:linear-gradient(90deg,rgba(236,59,45,1) 0%,rgba(248,98,52,1) 100%); | |||
| box-shadow:0px 8px 8px 1px rgba(246,93,51,0.32); | |||
| } | |||
| @@ -285,7 +308,6 @@ | |||
| padding: 30rpx 0; | |||
| } | |||
| .btns01 button{ | |||
| color: #fff; | |||
| color:rgba(254,254,254,1); | |||
| width:650rpx; | |||
| height:85rpx; | |||
| @@ -317,7 +339,7 @@ | |||
| text-align: center; | |||
| border: none; | |||
| } | |||
| .status button::after{ border: none; } | |||
| button::after{ border: none; } | |||
| .status button:nth-of-type(1){ | |||
| background:linear-gradient(90deg,rgba(236,59,45,1) 0%,rgba(248,98,52,1) 100%); | |||
| border:1px solid rgba(236,59,45,1); | |||
| @@ -56,4 +56,11 @@ Page({ | |||
| onReachBottom: function () { | |||
| }, | |||
| /** | |||
| * 用户点击右上角分享 | |||
| */ | |||
| onShareAppMessage: function () { | |||
| } | |||
| }) | |||
| @@ -1 +1,3 @@ | |||
| {} | |||
| { | |||
| "usingComponents": {} | |||
| } | |||
| @@ -1,163 +1,28 @@ | |||
| const Http = require("../../utils/HttpBasics"); | |||
| const imgurl = require("../../utils/imgurl"); | |||
| const config = require("../../config/config"); | |||
| const QR = require("../../utils/memberqrcode.js"); | |||
| let app = getApp(); | |||
| Page({ | |||
| /** | |||
| * 页面的初始数据 | |||
| */ | |||
| data: { | |||
| newUrl: imgurl.new.url, | |||
| icon001: imgurl.icon001.url, | |||
| icon002: imgurl.icon002.url, | |||
| icon003: imgurl.icon003.url, | |||
| icon004: imgurl.icon004.url, | |||
| market: app.globalData.market, | |||
| list: [], | |||
| loading: true, | |||
| swiperCurrent: 0, | |||
| title: null, | |||
| desc: null, | |||
| scrollTop: 0, | |||
| showGame: false, | |||
| gamedata: {}, | |||
| couponId: '',//游戏返回时传回的字段 | |||
| played: false,//从游戏页面跳回首页返回true | |||
| havePlayEd: app.globalData.havePlayEd, | |||
| staticGamedata: {}, | |||
| showIf: false, | |||
| page: 1 // 刷新进入页面时已经加载了第一页数据,onReachBottom时 page++,从第2页开始加载 | |||
| }, | |||
| gotodiscountCardList:function(){ | |||
| wx.navigateTo({ | |||
| url: '/pages/discountCardList/discountCardList' | |||
| }) | |||
| }, | |||
| gotoRushBuy:function(){ | |||
| wx.navigateTo({ | |||
| url: '/pages/rushToBuy/index', | |||
| }) | |||
| }, | |||
| qrcode: function (e) { | |||
| var that = this; | |||
| that.setData({ | |||
| showQrcode: true | |||
| }) | |||
| /** | |||
| * 生命周期函数--监听页面加载 | |||
| */ | |||
| onLoad: function(options) { | |||
| let that = this; | |||
| wx.showToast({ | |||
| title: '生成中...', | |||
| icon: 'loading', | |||
| title: '加载中', | |||
| icon: "loading", | |||
| duration: 2000 | |||
| }); | |||
| console.log(e) | |||
| var st = setTimeout(function () { | |||
| wx.hideToast() | |||
| var size = that.setCanvasSize(); | |||
| var url = JSON.stringify({ | |||
| END: "C", | |||
| TYPE: "memberCode", | |||
| ID: that.data.memberId, | |||
| }); | |||
| that.createQrCode(url, "mycanvas2", size.w, size.h); | |||
| that.setData({ | |||
| maskHidden: true | |||
| }); | |||
| clearTimeout(st); | |||
| }, 1000) | |||
| }, | |||
| hideQrcode: function () { | |||
| let that = this; | |||
| that.setData({ | |||
| showQrcode: false | |||
| }) | |||
| }, | |||
| //适配不同屏幕大小的canvas | |||
| setCanvasSize: function () { | |||
| var size = {}; | |||
| try { | |||
| var res = wx.getSystemInfoSync(); | |||
| var scale = 750 / 500; | |||
| //不同屏幕下canvas的适配比例;设计稿是750宽 | |||
| var width = res.windowWidth / scale; | |||
| var height = width; | |||
| //canvas画布为正方形 | |||
| size.w = width; | |||
| size.h = height; | |||
| } catch (e) { | |||
| // Do something when catch error | |||
| console.log("获取设备信息失败" + e); | |||
| } | |||
| return size; | |||
| }, | |||
| createQrCode: function (url, canvasId, cavW, cavH) { | |||
| //调用插件中的draw方法,绘制二维码图片 | |||
| QR.api.draw(url, canvasId, cavW, cavH); | |||
| }, | |||
| swiperChange: function (e) { | |||
| this.setData({ | |||
| swiperCurrent: e.detail.current | |||
| }); | |||
| }, | |||
| 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 = { | |||
| 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.message, | |||
| icon: 'none', | |||
| duration: 2000, | |||
| mask: false | |||
| }); | |||
| } | |||
| }) | |||
| }, | |||
| mySpecial:function(){ | |||
| console.log("special"); | |||
| wx.navigateTo({ | |||
| url: '/pages/specialcourtesy/specialcourtesy', | |||
| }) | |||
| }, | |||
| /** | |||
| * 生命周期函数--监听页面初次渲染完成 | |||
| */ | |||
| onLoad: function (options) { | |||
| wx.setStorageSync('imgurl', imgurl) | |||
| if (options.played == "true") { | |||
| this.setData({ | |||
| played: true | |||
| }) | |||
| } | |||
| var that = this; | |||
| console.log(options); | |||
| console.log("----------------------------------options---------------------------------------") | |||
| wx.setStorageSync('options', JSON.stringify(options)) | |||
| wx.setStorageSync('imgurl', imgurl) | |||
| if (decodeURIComponent(options.scene) == "undefined") { | |||
| that.setData({ | |||
| scene: 0 | |||
| @@ -168,91 +33,16 @@ Page({ | |||
| }); | |||
| } | |||
| app.getLocation(); | |||
| if (options.couponChannelId && options.couponId||options.orderId) { | |||
| that.userLogin(options.couponChannelId, options.couponId,options.orderId); | |||
| if (options.couponChannelId && options.couponId || options.orderId) { | |||
| that.userLogin(options.couponChannelId, options.couponId, options.orderId); | |||
| } else { | |||
| that.userLogin() | |||
| } | |||
| Http.get({ | |||
| url: config.api.getWeapNote, | |||
| data: { | |||
| 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 => { | |||
| wx.showModal({ | |||
| title: "提示", | |||
| content:err.errMsg, | |||
| showCancel:false | |||
| }); | |||
| }); | |||
| }, | |||
| onShow: function () { | |||
| this.setData({ | |||
| havePlayEd: app.globalData.havePlayEd ? app.globalData.havePlayEd : false | |||
| }) | |||
| let num = wx.getStorageSync('couponNum'); | |||
| if (num == 'couponNum') { | |||
| wx.showTabBarRedDot({ | |||
| index: 2 | |||
| }) | |||
| }; | |||
| }, | |||
| // 会员码获取 | |||
| getmemberId: function (token){ | |||
| let that = this; | |||
| Http.get({ | |||
| url: config.api.getScore, | |||
| data: { | |||
| token: token | |||
| } | |||
| }).then(res => { | |||
| console.log(res) | |||
| that.setData({ | |||
| levelName: res.data.levelName | |||
| }) | |||
| if (res.data.nickName) { | |||
| that.setData({ | |||
| ismember: true, | |||
| memberId: res.data.id | |||
| }) | |||
| var size = this.setCanvasSize(); | |||
| var initUrl = JSON.stringify({ flagid: res.data.id }); | |||
| that.createQrCode(initUrl, "mycanvas1", size.w, size.h); | |||
| } | |||
| }) | |||
| .catch(err => { | |||
| wx.showModal({ | |||
| title: '提示', | |||
| content: err.message, | |||
| showCancel: false | |||
| }) | |||
| }) | |||
| }, | |||
| /** | |||
| * | |||
| * @param {code,page} | |||
| * 子组件向父组件传值 | |||
| */ | |||
| onGetCode: function (e) { | |||
| this.setData({ | |||
| code: e.detail.val, | |||
| page: e.detail.pageNum, | |||
| }); | |||
| console.log(e.detail.val) | |||
| console.log(e.detail.pageNum) | |||
| }, | |||
| /** | |||
| * 用户登录 | |||
| */ | |||
| userLogin: function (couponChannelId, couponId,orderId) { | |||
| userLogin: function(couponChannelId, couponId, orderId) { | |||
| var that = this; | |||
| // 登录 | |||
| wx.login({ | |||
| @@ -260,7 +50,7 @@ Page({ | |||
| code | |||
| }) => { | |||
| wx.getSystemInfo({ | |||
| success: function (res) { | |||
| success: function(res) { | |||
| that.setData({ | |||
| systemInfo: JSON.stringify(res) | |||
| }) | |||
| @@ -285,246 +75,80 @@ Page({ | |||
| }; | |||
| } | |||
| Http.post({ | |||
| url: config.api.login, | |||
| data: usrdata | |||
| }) | |||
| url: config.api.login, | |||
| data: usrdata | |||
| }) | |||
| .then(res => { | |||
| that.setData({ | |||
| showPages: true | |||
| }) | |||
| app.globalData.token = res.data.token; | |||
| if (res.data.token){ | |||
| that.getGameOne(res.data.token) | |||
| that.getStaticGame(res.data.token) | |||
| that.getmemberId(res.data.token); | |||
| } | |||
| Http.setToken(res.data.token); | |||
| that.checkUserCarStatus(); | |||
| that.getUserInfo(); | |||
| that.getBannerlist(); | |||
| if (app.couponChannelListCallback) { | |||
| app.couponChannelListCallback(app.globalData.token); | |||
| if(orderId){ | |||
| wx.redirectTo({ | |||
| url: '/pages/bargain/bargainDatail/bargainDatail?orderId='+orderId, | |||
| }) | |||
| }else{ | |||
| wx.switchTab({ | |||
| url: '/pages/login/index', | |||
| }) | |||
| } | |||
| if (app.couponListCallback) { | |||
| app.couponListCallback(app.globalData.token); | |||
| } | |||
| if (app.businessListCallback) { | |||
| app.businessListCallback(app.globalData.token); | |||
| } | |||
| that.checkuerstatus(couponChannelId, couponId,orderId); | |||
| }) | |||
| .catch(err => { | |||
| wx.showToast({ | |||
| title: err.message, | |||
| icon:"none" | |||
| icon: "none" | |||
| }) | |||
| }); | |||
| } | |||
| }); | |||
| }, | |||
| checkuerstatus(couponChannelId, couponId,orderId) { | |||
| Http.post({ | |||
| url: config.api.checkUserStatus, | |||
| data: {} | |||
| }) | |||
| .then(res => { | |||
| if (couponChannelId && couponId) { | |||
| wx.navigateTo({ | |||
| url: `/pages/coupon/detail/index?couponChannelId=${couponChannelId}&couponId=${couponId}`, | |||
| }) | |||
| }else if(orderId){ | |||
| wx.navigateTo({ | |||
| url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${orderId}&from='${"discount"}`, | |||
| }) | |||
| } | |||
| }) | |||
| .catch(err => { | |||
| if (err.code == 11004) { | |||
| // 用户昵称未授权 | |||
| if (couponChannelId && couponId) { | |||
| wx.redirectTo({ | |||
| url: `/pages/getuserinfo/index?couponChannelId=${couponChannelId}&couponId=${couponId}` | |||
| }); | |||
| } else if (orderId) { | |||
| wx.redirectTo({ | |||
| url: `/pages/getuserinfo/index?orderId=${orderId}&from='${"discount"}` | |||
| }); | |||
| } else { | |||
| wx.redirectTo({ | |||
| url: '/pages/getuserinfo/index' | |||
| }); | |||
| } | |||
| } | |||
| }); | |||
| }, | |||
| getStaticGame(token) { | |||
| let _this = this; | |||
| Http.get({ | |||
| url: config.api.getGame, | |||
| data: { | |||
| triggleAction: 2, | |||
| token: token | |||
| } | |||
| }).then(res => { | |||
| if (res.data.id) { | |||
| _this.setData({ | |||
| showIf:true | |||
| }) | |||
| } | |||
| _this.setData({ | |||
| staticGamedata: res.data | |||
| }) | |||
| }) | |||
| .catch(err => { | |||
| console.log(err) | |||
| }) | |||
| }, | |||
| getGameOne: function (token) { | |||
| let _this = this; | |||
| Http.get({ | |||
| url: config.api.getGame, | |||
| data:{ | |||
| triggleAction: 1, | |||
| token: token | |||
| } | |||
| }).then(res => { | |||
| if (res.data.id) { | |||
| _this.setData({ | |||
| showGame: true | |||
| }) | |||
| } | |||
| _this.setData({ | |||
| gamedata: res.data | |||
| }) | |||
| }) | |||
| .catch(err => { | |||
| console.log(err) | |||
| }) | |||
| }, | |||
| /** | |||
| * banner | |||
| * 生命周期函数--监听页面初次渲染完成 | |||
| */ | |||
| getBannerlist: function () { | |||
| let that = this; | |||
| Http.get({ | |||
| url: config.api.bannerlist, | |||
| data: { | |||
| pageNum: 1, | |||
| pageSize: 7 | |||
| } | |||
| }).then(res => { | |||
| that.setData({ | |||
| list: res.data.list | |||
| }); | |||
| }); | |||
| onReady: function() { | |||
| }, | |||
| /** | |||
| * 检查用户是否有车 | |||
| * 生命周期函数--监听页面显示 | |||
| */ | |||
| checkUserCarStatus: function () { | |||
| var that = this; | |||
| Http.get({ | |||
| url: config.api.userCarCount, | |||
| data: {} | |||
| }).then(res => { | |||
| if (res.data > 0) { | |||
| // 用户名下有车 | |||
| app.globalData.phone = res.data.phone; | |||
| app.globalData.supportCar = true; | |||
| // 共同登录 | |||
| that.userCarLogin(); | |||
| } | |||
| }); | |||
| onShow: function() { | |||
| }, | |||
| /** | |||
| * car共同登录 | |||
| * 生命周期函数--监听页面隐藏 | |||
| */ | |||
| userCarLogin: function () { | |||
| var that = this; | |||
| if (!app.globalData.carLogin) { | |||
| // 共同登录 | |||
| Http.post({ | |||
| url: config.api.carInit, | |||
| data: { | |||
| phone: app.globalData.phone | |||
| } | |||
| }).then(res => { | |||
| app.globalData.carLogin = true; | |||
| app.globalData.parkVendor = res.data.vendor; | |||
| if (res.data.token != "undefined") { | |||
| app.globalData.etcpToken = res.data.token; | |||
| } | |||
| }); | |||
| } | |||
| onHide: function() { | |||
| }, | |||
| /** | |||
| * 获取用户信息 | |||
| * 生命周期函数--监听页面卸载 | |||
| */ | |||
| getUserInfo: function () { | |||
| // 获取用户信息 | |||
| wx.getSetting({ | |||
| success: res => { | |||
| if (res.authSetting["scope.userInfo"]) { | |||
| // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框 | |||
| wx.getUserInfo({ | |||
| success: res => { | |||
| // 可以将 res 发送给后台解码出 unionId | |||
| } | |||
| }); | |||
| } | |||
| } | |||
| }); | |||
| }, | |||
| gotoBargain:function(){ | |||
| wx.navigateTo({ | |||
| url: '/pages/bargain/bargain' | |||
| }) | |||
| onUnload: 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(); | |||
| }; | |||
| * 页面相关事件处理函数--监听用户下拉动作 | |||
| */ | |||
| onPullDownRefresh: function() { | |||
| }, | |||
| //加载更多 | |||
| onReachBottom: function () { | |||
| let that = this; | |||
| that.data.page++; | |||
| that.setData({ | |||
| page: that.data.page | |||
| }); | |||
| console.log("加载更多页数"+that.data.page); | |||
| console.log("加载更多key"+that.data.code); | |||
| //父组件获得子组件的方法 | |||
| //如果code == 0 | |||
| if (that.data.code == 0 || that.data.code == undefined) { | |||
| that.selectComponent("#lists").getList(0, that.data.page); | |||
| } else { | |||
| that.selectComponent("#lists").getList(that.data.code, that.data.page); | |||
| } | |||
| /** | |||
| * 页面上拉触底事件的处理函数 | |||
| */ | |||
| onReachBottom: function() { | |||
| }, | |||
| // 用户点击右上角分享 | |||
| onShareAppMessage: function () { | |||
| return { | |||
| title: this.data.title, | |||
| desc: this.data.desc, | |||
| success: function (res) { | |||
| wx.showToast({ | |||
| title: "分享成功", | |||
| duration: 1000, | |||
| icon: "success" | |||
| }); | |||
| } | |||
| }; | |||
| /** | |||
| * 用户点击右上角分享 | |||
| */ | |||
| onShareAppMessage: function() { | |||
| } | |||
| }); | |||
| }) | |||
| @@ -1,11 +1,4 @@ | |||
| { | |||
| "usingComponents": { | |||
| "c-banner": "../../components/banner/index", | |||
| "discount-card": "../../components/discountCard/index", | |||
| "c-rushToBuy": "./rushToBuy/index", | |||
| "c-coupons": "./coupons/index", | |||
| "g-entry": "../../components/gameentry/gentry" | |||
| }, | |||
| "navigationBarTitleText": "首页", | |||
| "enablePullDownRefresh": true | |||
| } | |||
| "usingComponents": {}, | |||
| "navigationBarBackgroundColor": "#fff" | |||
| } | |||
| @@ -1,38 +1 @@ | |||
| <view class="container"> | |||
| <c-banner wx:key="unique" list="{{list}}" /> | |||
| <!-- 折扣卡 --> | |||
| <view class='section'> | |||
| <view bindtap='gotoRushBuy'> | |||
| <image src='{{icon001}}'></image> | |||
| <text>限时抢购</text> | |||
| </view> | |||
| <view bindtap='gotodiscountCardList'> | |||
| <image src='{{icon002}}'></image> | |||
| <text>消费卡</text> | |||
| </view> | |||
| <view bindtap='gotoBargain'> | |||
| <image src='{{icon004}}'></image> | |||
| <text>砍价专场</text> | |||
| </view> | |||
| <view bindtap='qrcode'> | |||
| <image src='{{icon003}}'></image> | |||
| <text>会员权益</text> | |||
| </view> | |||
| </view> | |||
| <!-- 小游戏暂时注释 --> | |||
| <view class='game' bindtap="gotogame" wx-if="{{showIf}}"> | |||
| <view class='game-entry'> | |||
| <image src="{{newUrl}}" class='gameimg' mode='widthFix'></image> | |||
| </view> | |||
| </view> | |||
| <c-coupons id="lists" bind:myevent="onGetCode" loadingtext="{{loadingtext}}" loading="{{loading}}" /> | |||
| <g-entry id="listss" wx:if="{{showGame&&!played&&!havePlayEd}}" gamedata="{{gamedata}}" bind:myevent="" /> | |||
| </view> | |||
| <view class='showQrcode' bindtap='hideQrcode' wx:if="{{showQrcode}}"> | |||
| <view class="canvas-box"> | |||
| <text class='memberIds' wx:if="{{levelName!='无'}}">{{levelName}}</text> | |||
| <canvas hidden="{{canvasHidden}}" style="width:500rpx;height:460rpx;background:0 0 0 .6;margin:-10rpx auto;overflow:hidden" canvas-id="mycanvas2" /> | |||
| <button class='button' bindtap='mySpecial'>特享礼遇</button> | |||
| </view> | |||
| </view> | |||
| @@ -1,124 +1,6 @@ | |||
| .index-position { | |||
| background: rgba(0, 0, 0, 0.5); | |||
| height: 88rpx; | |||
| position: absolute; | |||
| top: 0; | |||
| Page{ | |||
| height: 100%; | |||
| width: 100%; | |||
| font-family: PingFangSC-Semibold; | |||
| font-size: 30rpx; | |||
| color: #fff; | |||
| letter-spacing: 0.75rpx; | |||
| z-index: 9; | |||
| line-height: 88rpx; | |||
| overflow: hidden; | |||
| } | |||
| page { | |||
| width: 100%; | |||
| height: auto !important; | |||
| overflow-x: hidden; | |||
| } | |||
| .txt { | |||
| margin-left: 20rpx; | |||
| } | |||
| .game-entry { | |||
| width: 690rpx; | |||
| height: 140rpx; | |||
| margin: 57rpx auto 0; | |||
| } | |||
| .gameimg { | |||
| display: block; | |||
| width: 100%; | |||
| height: 140rpx; | |||
| } | |||
| .section { | |||
| padding: 0 20rpx; | |||
| display: flex; | |||
| justify-content: space-around; | |||
| text-align: center; | |||
| margin-top: 40rpx; | |||
| } | |||
| .section >view image { | |||
| display: block; | |||
| margin: 0 auto; | |||
| } | |||
| .section >view image { | |||
| width: 80rpx; | |||
| height: 80rpx; | |||
| margin-bottom: 14rpx; | |||
| } | |||
| .section text { | |||
| height: 23rpx; | |||
| font-size: 24rpx; | |||
| color: rgba(51, 51, 51, 1); | |||
| display: block; | |||
| margin-top: 0rpx; | |||
| } | |||
| .showQrcode { | |||
| position: fixed; | |||
| top: 0; | |||
| left: 0; | |||
| right: 0; | |||
| bottom: 0; | |||
| z-index: 1000; | |||
| background: rgba(0, 0, 0, 0.6); | |||
| } | |||
| .qrcode image { | |||
| width: 70rpx; | |||
| margin-right: 20rpx; | |||
| } | |||
| .showQrcode { | |||
| position: fixed; | |||
| top: 0; | |||
| left: 0; | |||
| right: 0; | |||
| bottom: 0; | |||
| z-index: 1000; | |||
| background: rgba(0, 0, 0, 0.6); | |||
| } | |||
| .canvas-box { | |||
| position: fixed; | |||
| width: 500rpx; | |||
| overflow: hidden; | |||
| left: 0; | |||
| top: 200rpx; | |||
| right: 0; | |||
| margin: auto; | |||
| background: #fff; | |||
| border-radius: 16rpx; | |||
| z-index:100; | |||
| padding-bottom: 30rpx; | |||
| } | |||
| .showQrcode text { | |||
| display: block; | |||
| text-align: center; | |||
| font-size: 28rpx; | |||
| } | |||
| .button { | |||
| width: 414rpx; | |||
| text-align: center; | |||
| margin: 0 auto; | |||
| height: 80rpx; | |||
| line-height: 80rpx; | |||
| background: rgba(255, 255, 255, 1); | |||
| border-radius: 10rpx; | |||
| font-size: 32rpx; | |||
| color: rgba(2, 192, 255, 1); | |||
| overflow: hidden; | |||
| margin-top: 38rpx; | |||
| } | |||
| .memberIds{ | |||
| padding-top: 30rpx; | |||
| font-size: 30rpx; | |||
| background:#fff; | |||
| opacity: 0; | |||
| } | |||
| @@ -0,0 +1,59 @@ | |||
| // pages/index/gameentry/gentry.js | |||
| Page({ | |||
| /** | |||
| * 页面的初始数据 | |||
| */ | |||
| data: { | |||
| }, | |||
| /** | |||
| * 生命周期函数--监听页面加载 | |||
| */ | |||
| onLoad: function (options) { | |||
| }, | |||
| /** | |||
| * 生命周期函数--监听页面初次渲染完成 | |||
| */ | |||
| onReady: function () { | |||
| }, | |||
| /** | |||
| * 生命周期函数--监听页面显示 | |||
| */ | |||
| onShow: function () { | |||
| }, | |||
| /** | |||
| * 生命周期函数--监听页面隐藏 | |||
| */ | |||
| onHide: function () { | |||
| }, | |||
| /** | |||
| * 生命周期函数--监听页面卸载 | |||
| */ | |||
| onUnload: function () { | |||
| }, | |||
| /** | |||
| * 页面相关事件处理函数--监听用户下拉动作 | |||
| */ | |||
| onPullDownRefresh: function () { | |||
| }, | |||
| /** | |||
| * 页面上拉触底事件的处理函数 | |||
| */ | |||
| onReachBottom: function () { | |||
| }, | |||
| }) | |||
| @@ -0,0 +1 @@ | |||
| {} | |||
| @@ -0,0 +1,2 @@ | |||
| <!--pages/index/gameentry/gentry.wxml--> | |||
| <text>pages/index/gameentry/gentry.wxml</text> | |||
| @@ -0,0 +1 @@ | |||
| /* pages/index/gameentry/gentry.wxss */ | |||
| @@ -1,30 +1,476 @@ | |||
| var config = require("../../config/config.js"); | |||
| const Http = require("../../utils/HttpBasics"); | |||
| const imgurl = require("../../utils/imgurl"); | |||
| const config = require("../../config/config"); | |||
| const QR = require("../../utils/memberqrcode.js"); | |||
| let app = getApp(); | |||
| Page({ | |||
| data: {}, | |||
| getPhoneNumber: function(e) { | |||
| wx.navigateBack({ | |||
| delta: 1 | |||
| data: { | |||
| newUrl: imgurl.new.url, | |||
| icon001: imgurl.icon001.url, | |||
| icon002: imgurl.icon002.url, | |||
| icon003: imgurl.icon003.url, | |||
| icon004: imgurl.icon004.url, | |||
| market: app.globalData.market, | |||
| list: [], | |||
| loading: true, | |||
| swiperCurrent: 0, | |||
| title: null, | |||
| desc: null, | |||
| scrollTop: 0, | |||
| showGame: false, | |||
| gamedata: {}, | |||
| couponId: '', //游戏返回时传回的字段 | |||
| played: false, //从游戏页面跳回首页返回true | |||
| havePlayEd: app.globalData.havePlayEd, | |||
| staticGamedata: {}, | |||
| showIf: false, | |||
| showPages: false, | |||
| page: 1 // 刷新进入页面时已经加载了第一页数据,onReachBottom时 page++,从第2页开始加载 | |||
| }, | |||
| gotodiscountCardList: function() { | |||
| wx.navigateTo({ | |||
| url: '/pages/discountCardList/discountCardList' | |||
| }) | |||
| }, | |||
| gotoRushBuy: function() { | |||
| wx.navigateTo({ | |||
| url: '/pages/rushToBuy/index', | |||
| }) | |||
| }, | |||
| qrcode: function(e) { | |||
| var that = this; | |||
| that.setData({ | |||
| showQrcode: true | |||
| }) | |||
| wx.showToast({ | |||
| title: '生成中...', | |||
| icon: 'loading', | |||
| duration: 2000 | |||
| }); | |||
| console.log(e) | |||
| var st = setTimeout(function() { | |||
| wx.hideToast() | |||
| var size = that.setCanvasSize(); | |||
| var url = JSON.stringify({ | |||
| END: "C", | |||
| TYPE: "memberCode", | |||
| ID: that.data.memberId, | |||
| }); | |||
| that.createQrCode(url, "mycanvas2", size.w, size.h); | |||
| that.setData({ | |||
| maskHidden: true | |||
| }); | |||
| clearTimeout(st); | |||
| }, 1000) | |||
| }, | |||
| hideQrcode: function() { | |||
| let that = this; | |||
| that.setData({ | |||
| showQrcode: false | |||
| }) | |||
| }, | |||
| //适配不同屏幕大小的canvas | |||
| setCanvasSize: function() { | |||
| var size = {}; | |||
| try { | |||
| var res = wx.getSystemInfoSync(); | |||
| var scale = 750 / 500; | |||
| //不同屏幕下canvas的适配比例;设计稿是750宽 | |||
| var width = res.windowWidth / scale; | |||
| var height = width; | |||
| //canvas画布为正方形 | |||
| size.w = width; | |||
| size.h = height; | |||
| } catch (e) { | |||
| // Do something when catch error | |||
| console.log("获取设备信息失败" + e); | |||
| } | |||
| return size; | |||
| }, | |||
| createQrCode: function(url, canvasId, cavW, cavH) { | |||
| //调用插件中的draw方法,绘制二维码图片 | |||
| QR.api.draw(url, canvasId, cavW, cavH); | |||
| }, | |||
| swiperChange: function(e) { | |||
| this.setData({ | |||
| swiperCurrent: e.detail.current | |||
| }); | |||
| }, | |||
| onLoad() { | |||
| 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 = { | |||
| 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.message, | |||
| icon: 'none', | |||
| duration: 2000, | |||
| mask: false | |||
| }); | |||
| } | |||
| }) | |||
| }, | |||
| mySpecial: function() { | |||
| console.log("special"); | |||
| wx.navigateTo({ | |||
| url: '/pages/specialcourtesy/specialcourtesy', | |||
| }) | |||
| }, | |||
| /** | |||
| * 生命周期函数--监听页面初次渲染完成 | |||
| */ | |||
| onLoad: function(options) { | |||
| let that = this; | |||
| let optionss = JSON.parse(wx.getStorageSync('options')); | |||
| console.log(optionss); | |||
| console.log("-------------------------------------------optionssss------------------------------------") | |||
| if (options.played == "true") { | |||
| that.setData({ | |||
| played: true | |||
| }) | |||
| } | |||
| if (optionss.couponChannelId && optionss.couponId || optionss.orderId) { | |||
| that.userLogin(optionss.couponChannelId, optionss.couponId, optionss.orderId); | |||
| } else { | |||
| that.userLogin() | |||
| } | |||
| }, | |||
| onShow: function() { | |||
| this.setData({ | |||
| havePlayEd: app.globalData.havePlayEd ? app.globalData.havePlayEd : false | |||
| }) | |||
| let num = wx.getStorageSync('couponNum'); | |||
| if (num == 'couponNum') { | |||
| wx.showTabBarRedDot({ | |||
| index: 2 | |||
| }) | |||
| }; | |||
| }, | |||
| // 会员码获取 | |||
| getmemberId: function(token) { | |||
| let that = this; | |||
| Http.get({ | |||
| url: config.api.marketicon, | |||
| data: { | |||
| appId: config.weapp.AppId | |||
| } | |||
| }).then(res=>{ | |||
| url: config.api.getScore, | |||
| data: { | |||
| token: token | |||
| } | |||
| }).then(res => { | |||
| console.log(res) | |||
| that.setData({ | |||
| mallImgUrl: res.data.mallImgUrl | |||
| levelName: res.data.levelName | |||
| }) | |||
| if (res.data.nickName) { | |||
| that.setData({ | |||
| ismember: true, | |||
| memberId: res.data.id | |||
| }) | |||
| var size = this.setCanvasSize(); | |||
| var initUrl = JSON.stringify({ | |||
| flagid: res.data.id | |||
| }); | |||
| that.createQrCode(initUrl, "mycanvas1", size.w, size.h); | |||
| } | |||
| }) | |||
| .catch(err => { | |||
| wx.showModal({ | |||
| title: '提示', | |||
| content: err.message, | |||
| showCancel: false | |||
| }) | |||
| }) | |||
| }, | |||
| /** | |||
| * | |||
| * @param {code,page} | |||
| * 子组件向父组件传值 | |||
| */ | |||
| onGetCode: function(e) { | |||
| this.setData({ | |||
| code: e.detail.val, | |||
| page: e.detail.pageNum, | |||
| }); | |||
| console.log(e.detail.val) | |||
| console.log(e.detail.pageNum) | |||
| }, | |||
| /** | |||
| * 用户登录 | |||
| */ | |||
| userLogin: function(couponChannelId, couponId, orderId) { | |||
| var that = this; | |||
| // 登录 | |||
| that.getGameOne(app.globalData.token) | |||
| that.getStaticGame(app.globalData.token) | |||
| that.getmemberId(app.globalData.token); | |||
| that.checkUserCarStatus(); | |||
| that.getUserInfo(); | |||
| that.getBannerlist(); | |||
| if (app.couponChannelListCallback) { | |||
| app.couponChannelListCallback(app.globalData.token); | |||
| } | |||
| if (app.couponListCallback) { | |||
| app.couponListCallback(app.globalData.token); | |||
| } | |||
| if (app.businessListCallback) { | |||
| app.businessListCallback(app.globalData.token); | |||
| } | |||
| that.checkuerstatus(couponChannelId, couponId, orderId); | |||
| Http.get({ | |||
| url: config.api.getWeapNote, | |||
| data: { | |||
| 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 => { | |||
| wx.showModal({ | |||
| title: "提示", | |||
| content: err.errMsg, | |||
| showCancel: false | |||
| }); | |||
| }).catch(err => { | |||
| wx.showToast({ | |||
| title: err.errMsg, | |||
| icon: 'none', | |||
| duration: 2000, | |||
| mask: false | |||
| }); | |||
| }, | |||
| checkuerstatus(couponChannelId, couponId, orderId) { | |||
| Http.post({ | |||
| url: config.api.checkUserStatus, | |||
| data: {} | |||
| }) | |||
| .then(res => { | |||
| if (couponChannelId && couponId) { | |||
| wx.navigateTo({ | |||
| url: `/pages/coupon/detail/index?couponChannelId=${couponChannelId}&couponId=${couponId}`, | |||
| }) | |||
| } else if (orderId) { | |||
| wx.navigateTo({ | |||
| url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${orderId}&from='${"discount"}`, | |||
| }) | |||
| } | |||
| }) | |||
| .catch(err => { | |||
| if (err.code == 11004) { | |||
| // 用户昵称未授权 | |||
| if (couponChannelId && couponId) { | |||
| wx.redirectTo({ | |||
| url: `/pages/getuserinfo/index?couponChannelId=${couponChannelId}&couponId=${couponId}` | |||
| }); | |||
| } else if (orderId) { | |||
| wx.redirectTo({ | |||
| url: `/pages/getuserinfo/index?orderId=${orderId}&from='${"discount"}` | |||
| }); | |||
| } else { | |||
| wx.redirectTo({ | |||
| url: '/pages/getuserinfo/index' | |||
| }); | |||
| } | |||
| } | |||
| }); | |||
| }, | |||
| getStaticGame(token) { | |||
| let _this = this; | |||
| Http.get({ | |||
| url: config.api.getGame, | |||
| data: { | |||
| triggleAction: 2, | |||
| token: token | |||
| } | |||
| }).then(res => { | |||
| if (res.data.id) { | |||
| _this.setData({ | |||
| showIf: true | |||
| }) | |||
| } | |||
| _this.setData({ | |||
| staticGamedata: res.data | |||
| }) | |||
| }) | |||
| .catch(err => { | |||
| console.log(err) | |||
| }) | |||
| }, | |||
| getGameOne: function(token) { | |||
| let _this = this; | |||
| Http.get({ | |||
| url: config.api.getGame, | |||
| data: { | |||
| triggleAction: 1, | |||
| token: token | |||
| } | |||
| }).then(res => { | |||
| if (res.data.id) { | |||
| _this.setData({ | |||
| showGame: true | |||
| }) | |||
| } | |||
| _this.setData({ | |||
| gamedata: res.data | |||
| }) | |||
| }) | |||
| .catch(err => { | |||
| console.log(err) | |||
| }) | |||
| }, | |||
| /** | |||
| * banner | |||
| */ | |||
| getBannerlist: function() { | |||
| let that = this; | |||
| Http.get({ | |||
| url: config.api.bannerlist, | |||
| data: { | |||
| pageNum: 1, | |||
| pageSize: 7 | |||
| } | |||
| }).then(res => { | |||
| that.setData({ | |||
| list: res.data.list | |||
| }); | |||
| }); | |||
| }, | |||
| /** | |||
| * 检查用户是否有车 | |||
| */ | |||
| checkUserCarStatus: function() { | |||
| var that = this; | |||
| Http.get({ | |||
| url: config.api.userCarCount, | |||
| data: {} | |||
| }).then(res => { | |||
| if (res.data > 0) { | |||
| // 用户名下有车 | |||
| app.globalData.phone = res.data.phone; | |||
| app.globalData.supportCar = true; | |||
| // 共同登录 | |||
| that.userCarLogin(); | |||
| } | |||
| }); | |||
| }, | |||
| /** | |||
| * car共同登录 | |||
| */ | |||
| userCarLogin: function() { | |||
| var that = this; | |||
| if (!app.globalData.carLogin) { | |||
| // 共同登录 | |||
| Http.post({ | |||
| url: config.api.carInit, | |||
| data: { | |||
| phone: app.globalData.phone | |||
| } | |||
| }).then(res => { | |||
| app.globalData.carLogin = true; | |||
| app.globalData.parkVendor = res.data.vendor; | |||
| if (res.data.token != "undefined") { | |||
| app.globalData.etcpToken = res.data.token; | |||
| } | |||
| }); | |||
| } | |||
| }, | |||
| /** | |||
| * 获取用户信息 | |||
| */ | |||
| getUserInfo: function() { | |||
| // 获取用户信息 | |||
| wx.getSetting({ | |||
| success: res => { | |||
| if (res.authSetting["scope.userInfo"]) { | |||
| // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框 | |||
| wx.getUserInfo({ | |||
| success: res => { | |||
| // 可以将 res 发送给后台解码出 unionId | |||
| } | |||
| }); | |||
| } | |||
| } | |||
| }); | |||
| }, | |||
| gotoBargain: function() { | |||
| wx.navigateTo({ | |||
| url: '/pages/bargain/bargain' | |||
| }) | |||
| }, | |||
| /** | |||
| * 刷新 | |||
| */ | |||
| 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; | |||
| that.data.page++; | |||
| that.setData({ | |||
| page: that.data.page | |||
| }); | |||
| console.log("加载更多页数" + that.data.page); | |||
| console.log("加载更多key" + that.data.code); | |||
| //父组件获得子组件的方法 | |||
| //如果code == 0 | |||
| if (that.data.code == 0 || that.data.code == undefined) { | |||
| that.selectComponent("#lists").getList(0, that.data.page); | |||
| } else { | |||
| that.selectComponent("#lists").getList(that.data.code, that.data.page); | |||
| } | |||
| }, | |||
| // 用户点击右上角分享 | |||
| onShareAppMessage: function() { | |||
| return { | |||
| title: this.data.title, | |||
| desc: this.data.desc, | |||
| success: function(res) { | |||
| wx.showToast({ | |||
| title: "分享成功", | |||
| duration: 1000, | |||
| icon: "success" | |||
| }); | |||
| } | |||
| }; | |||
| } | |||
| }); | |||
| }); | |||
| @@ -1,6 +1,11 @@ | |||
| { | |||
| "usingComponents": { | |||
| "i-button": "../../dist/button/index" | |||
| }, | |||
| "navigationBarTitleText": "登录" | |||
| } | |||
| "usingComponents": { | |||
| "c-banner": "../../components/banner/index", | |||
| "discount-card": "../../components/discountCard/index", | |||
| "c-rushToBuy": "./rushToBuy/index", | |||
| "c-coupons": "./coupons/index", | |||
| "g-entry": "../../components/gameentry/gentry" | |||
| }, | |||
| "navigationBarTitleText": "首页", | |||
| "enablePullDownRefresh": true | |||
| } | |||
| @@ -1,9 +1,38 @@ | |||
| <view class="login-body"> | |||
| <view class="login-logo"> | |||
| <image src="{{mallImgUrl}}"></image> | |||
| <view class="container"> | |||
| <c-banner wx:key="unique" list="{{list}}" /> | |||
| <!-- 折扣卡 --> | |||
| <view class='section'> | |||
| <view bindtap='gotoRushBuy'> | |||
| <image src='{{icon001}}'></image> | |||
| <text>限时抢购</text> | |||
| </view> | |||
| <view bindtap='gotodiscountCardList'> | |||
| <image src='{{icon002}}'></image> | |||
| <text>消费卡</text> | |||
| </view> | |||
| <view bindtap='gotoBargain'> | |||
| <image src='{{icon004}}'></image> | |||
| <text>砍价专场</text> | |||
| </view> | |||
| <view bindtap='qrcode'> | |||
| <image src='{{icon003}}'></image> | |||
| <text>会员权益</text> | |||
| </view> | |||
| </view> | |||
| <view class="login-btn"> | |||
| <!-- <i-button i-class="login-btn-login" bind:click="getPhoneNumber">微信登陆</i-button> --> | |||
| <button open-type="getPhoneNumber" class="login-btn-login" bindgetphonenumber="getPhoneNumber">微信登陆</button> | |||
| <!-- 小游戏暂时注释 --> | |||
| <view class='game' bindtap="gotogame" wx-if="{{showIf}}"> | |||
| <view class='game-entry'> | |||
| <image src="{{newUrl}}" class='gameimg' mode='widthFix'></image> | |||
| </view> | |||
| </view> | |||
| </view> | |||
| <c-coupons id="lists" bind:myevent="onGetCode" loadingtext="{{loadingtext}}" loading="{{loading}}" /> | |||
| <g-entry id="listss" wx:if="{{showGame&&!played&&!havePlayEd}}" gamedata="{{gamedata}}" bind:myevent="" /> | |||
| </view> | |||
| <view class='showQrcode' bindtap='hideQrcode' wx:if="{{showQrcode}}"> | |||
| <view class="canvas-box"> | |||
| <text class='memberIds' wx:if="{{levelName!='无'}}">{{levelName}}</text> | |||
| <canvas hidden="{{canvasHidden}}" style="width:500rpx;height:460rpx;background:0 0 0 .6;margin:-10rpx auto;overflow:hidden" canvas-id="mycanvas2" /> | |||
| <button class='button' bindtap='mySpecial'>特享礼遇</button> | |||
| </view> | |||
| </view> | |||
| @@ -1,36 +1,124 @@ | |||
| .login-body { | |||
| padding-top: 200rpx; | |||
| display: flex; | |||
| flex-direction: column; | |||
| align-items: center; | |||
| justify-content: center; | |||
| .index-position { | |||
| background: rgba(0, 0, 0, 0.5); | |||
| height: 88rpx; | |||
| position: absolute; | |||
| top: 0; | |||
| width: 100%; | |||
| font-family: PingFangSC-Semibold; | |||
| font-size: 30rpx; | |||
| color: #fff; | |||
| letter-spacing: 0.75rpx; | |||
| z-index: 9; | |||
| line-height: 88rpx; | |||
| overflow: hidden; | |||
| } | |||
| .login-logo { | |||
| width: 283rpx; | |||
| height: 326rpx; | |||
| page { | |||
| width: 100%; | |||
| height: auto !important; | |||
| overflow-x: hidden; | |||
| } | |||
| .login-logo>image { | |||
| width: 100%; | |||
| height: 100%; | |||
| border-radius: 16rpx; | |||
| .txt { | |||
| margin-left: 20rpx; | |||
| } | |||
| .login-btn { | |||
| padding-top: 120rpx; | |||
| width: 504rpx; | |||
| .game-entry { | |||
| width: 690rpx; | |||
| height: 140rpx; | |||
| margin: 57rpx auto 0; | |||
| } | |||
| .login-btn .login-btn-login { | |||
| background: #00C0FF !important; | |||
| border-radius: 10rpx !important; | |||
| height: 88rpx !important; | |||
| margin: 0 !important; | |||
| padding: 0 !important; | |||
| font-family: PingFangSC-Semibold !important; | |||
| font-size: 36rpx !important; | |||
| color: #FFFFFF !important; | |||
| letter-spacing: 0.75rpx !important; | |||
| text-align: center; | |||
| .gameimg { | |||
| display: block; | |||
| width: 100%; | |||
| height: 140rpx; | |||
| } | |||
| .section { | |||
| padding: 0 20rpx; | |||
| display: flex; | |||
| justify-content: space-around; | |||
| text-align: center; | |||
| margin-top: 40rpx; | |||
| } | |||
| .section >view image { | |||
| display: block; | |||
| margin: 0 auto; | |||
| } | |||
| .section >view image { | |||
| width: 80rpx; | |||
| height: 80rpx; | |||
| margin-bottom: 14rpx; | |||
| } | |||
| .section text { | |||
| height: 23rpx; | |||
| font-size: 24rpx; | |||
| color: rgba(51, 51, 51, 1); | |||
| display: block; | |||
| margin-top: 0rpx; | |||
| } | |||
| .showQrcode { | |||
| position: fixed; | |||
| top: 0; | |||
| left: 0; | |||
| right: 0; | |||
| bottom: 0; | |||
| z-index: 1000; | |||
| background: rgba(0, 0, 0, 0.6); | |||
| } | |||
| .qrcode image { | |||
| width: 70rpx; | |||
| margin-right: 20rpx; | |||
| } | |||
| .showQrcode { | |||
| position: fixed; | |||
| top: 0; | |||
| left: 0; | |||
| right: 0; | |||
| bottom: 0; | |||
| z-index: 1000; | |||
| background: rgba(0, 0, 0, 0.6); | |||
| } | |||
| .canvas-box { | |||
| position: fixed; | |||
| width: 500rpx; | |||
| overflow: hidden; | |||
| left: 0; | |||
| top: 200rpx; | |||
| right: 0; | |||
| margin: auto; | |||
| background: #fff; | |||
| border-radius: 16rpx; | |||
| z-index:100; | |||
| padding-bottom: 30rpx; | |||
| } | |||
| .showQrcode text { | |||
| display: block; | |||
| text-align: center; | |||
| font-size: 28rpx; | |||
| } | |||
| .button { | |||
| width: 414rpx; | |||
| text-align: center; | |||
| margin: 0 auto; | |||
| height: 80rpx; | |||
| line-height: 80rpx; | |||
| background: rgba(255, 255, 255, 1); | |||
| border-radius: 10rpx; | |||
| font-size: 32rpx; | |||
| color: rgba(2, 192, 255, 1); | |||
| overflow: hidden; | |||
| margin-top: 38rpx; | |||
| } | |||
| .memberIds{ | |||
| padding-top: 30rpx; | |||
| font-size: 30rpx; | |||
| } | |||
| @@ -35,7 +35,7 @@ | |||
| 只有支付完成的时 | |||
| 才显示兑换码 | |||
| --> | |||
| <view wx:if="{{order.orderStatus==1&&order.type!=100}}" data-couponOrderStatus="{{order.couponOrderStatus}}" data-title="{{order.title}}" data-subtitle="{{order.subTitle}}" data-remark="{{order.remark}}" data-quancode="{{order.couponOrderId}}" bindtap="powerDrawer"> | |||
| <view wx:if="{{order.orderStatus==1&&order.type!=100&&order.type!=5}}" data-couponOrderStatus="{{order.couponOrderStatus}}" data-title="{{order.title}}" data-subtitle="{{order.subTitle}}" data-remark="{{order.remark}}" data-quancode="{{order.couponOrderId}}" bindtap="powerDrawer"> | |||
| <view style="width:86%;clear: both;"> | |||
| <text>兑换码</text> | |||
| <text class="fr">{{order.couponOrderId}}</text> | |||
| @@ -76,7 +76,7 @@ | |||
| <view class="margin"></view> | |||
| <!-- <button bindtap="navigateTo" class="user-out-btn">退出登陆</button> --> | |||
| <view bindlongtap='showVersion' class='version'> | |||
| <view wx:if="{{flag=='show'}}">版本号:3.3.3</view> | |||
| <view wx:if="{{flag=='show'}}">版本号:3.3.4</view> | |||
| <view wx:if="{{flag=='hidden'}}"></view> | |||
| </view> | |||
| </view> | |||
| @@ -4,7 +4,7 @@ | |||
| "ignore": [] | |||
| }, | |||
| "setting": { | |||
| "urlCheck": false, | |||
| "urlCheck": true, | |||
| "es6": true, | |||
| "postcss": true, | |||
| "minified": true, | |||
| @@ -13,7 +13,7 @@ | |||
| }, | |||
| "compileType": "miniprogram", | |||
| "libVersion": "2.0.9", | |||
| "appid": "wxea71200db93d756b", | |||
| "appid": "wx649b3be73c1afe47", | |||
| "projectname": "C", | |||
| "isGameTourist": false, | |||
| "condition": { | |||
| @@ -34,9 +34,6 @@ class HttpBasics { | |||
| get({ url, data, headers }) { | |||
| headers = { ...this.headers, ...headers }; | |||
| url = `${this.address}${url}`; | |||
| // wx.showLoading({ | |||
| // title: 'loading...', | |||
| // }) | |||
| return new Promise((resolve, reject) => { | |||
| wx.request({ | |||
| url: url, | |||
| @@ -44,19 +41,15 @@ class HttpBasics { | |||
| data: data, | |||
| method: "Get", | |||
| success: res => { | |||
| // wx.hideLoading(); | |||
| this.responseMap(res, resolve, reject); | |||
| }, | |||
| fail: err => { | |||
| console.log(err) | |||
| if (err.errMsg == 'request:fail timeout') { | |||
| err.errMsg = '请求超时,请检查您的网络设置!' | |||
| } else if (err.errMsg == 'request:fail '){ | |||
| err.errMsg = '未检查到您的网络,请检查您的网络设置!' | |||
| } else if (err.code == 1052){ | |||
| wx.switchTab({ | |||
| url: '/pages/index/index', | |||
| }) | |||
| } | |||
| } | |||
| reject(err); | |||
| } | |||
| }); | |||
| @@ -69,9 +62,6 @@ class HttpBasics { | |||
| post({ url, data, headers }) { | |||
| headers = { ...this.headers, ...headers }; | |||
| url = `${this.address}${url}`; | |||
| // wx.showLoading({ | |||
| // title: 'loading...', | |||
| // }) | |||
| return new Promise((resolve, reject) => { | |||
| wx.request({ | |||
| url: url, | |||
| @@ -83,16 +73,12 @@ class HttpBasics { | |||
| this.responseMap(res, resolve, reject); | |||
| }, | |||
| fail: err => { | |||
| // wx.hideLoading(); | |||
| console.log(err) | |||
| if (err.errMsg == 'request:fail timeout') { | |||
| err.errMsg = '请求超时,请检查您的网络设置!' | |||
| } else if (err.errMsg == 'request:fail ') { | |||
| err.errMsg = '未检查到您的网络,请检查您的网络设置!' | |||
| } else if (err.code == 1052) { | |||
| wx.switchTab({ | |||
| url: '/pages/index/index', | |||
| }) | |||
| } | |||
| } | |||
| reject(err); | |||
| }, | |||
| complete: res => {} | |||
| @@ -100,7 +86,7 @@ class HttpBasics { | |||
| }); | |||
| } | |||
| /** | |||
| * 过滤 请求信息 | |||
| * 过滤 请求信息 | |||
| * @param {*} res | |||
| * @param {*} resolve | |||
| * @param {*} reject | |||
| @@ -111,11 +97,14 @@ class HttpBasics { | |||
| // 服务器code 200 成功 | |||
| if (res.data.code == 200) { | |||
| resolve(res.data); | |||
| } else if (res.data.code == 1052) { | |||
| wx.reLaunch({ | |||
| url: '/pages/index/index' | |||
| }) | |||
| } else { | |||
| reject(res.data); | |||
| } | |||
| } | |||
| else { | |||
| } else { | |||
| console.log("请求出错:", res); | |||
| reject(res.data); | |||
| } | |||