| //app.js | //app.js | ||||
| App({ | App({ | ||||
| onLaunch: function (options) { | onLaunch: function (options) { | ||||
| console.log(options); | |||||
| this.globalData.sceneSource = options.scene; | this.globalData.sceneSource = options.scene; | ||||
| if (options.referrerInfo && options.referrerInfo.extraData && options.referrerInfo.extraData.source) { | if (options.referrerInfo && options.referrerInfo.extraData && options.referrerInfo.extraData.source) { | ||||
| this.globalData.sceneSource = options.referrerInfo.extraData.source; | this.globalData.sceneSource = options.referrerInfo.extraData.source; | ||||
| isFirstLucky: true,//是否为第一次进入幸运星抓手 | isFirstLucky: true,//是否为第一次进入幸运星抓手 | ||||
| indexData:{},//首页数据 | indexData:{},//首页数据 | ||||
| myCenterData:null,//个人中心数据 | myCenterData:null,//个人中心数据 | ||||
| userInfoData:null, | |||||
| userInfoData:{ | |||||
| "avatarUrl":"", | |||||
| "nickName":"" | |||||
| }, | |||||
| certificationState:0,//1车主,2合伙人,3同事 | certificationState:0,//1车主,2合伙人,3同事 | ||||
| mobileData:null, | mobileData:null, | ||||
| userPhoneType:null, | userPhoneType:null, | ||||
| myCenter:false, | myCenter:false, | ||||
| guessPrize:false, | guessPrize:false, | ||||
| everyday:false | everyday:false | ||||
| }, | |||||
| getSecondGuessInfo:{//第二轮价格竞猜信息 | |||||
| secondData:null, | |||||
| firstData:null | |||||
| } | } | ||||
| }, | }, | ||||
| // 获取openId | // 获取openId |
| data: { | data: { | ||||
| imgUrl: app.globalData.urlStatic,//图片路径 | imgUrl: app.globalData.urlStatic,//图片路径 | ||||
| yuyueShow:false, | yuyueShow:false, | ||||
| userType:1, | |||||
| }, | }, | ||||
| /** | /** | ||||
| app.addPageEnter("7C8AAA38F8D85EFC48C2995FB6EBAC19"); | app.addPageEnter("7C8AAA38F8D85EFC48C2995FB6EBAC19"); | ||||
| app.globalData.addPageEnterState.guessPrize = true; | app.globalData.addPageEnterState.guessPrize = true; | ||||
| } | } | ||||
| this.getSecondGuessInfo(); | |||||
| }, | }, | ||||
| /** | /** | ||||
| * 生命周期函数--监听页面初次渲染完成 | * 生命周期函数--监听页面初次渲染完成 | ||||
| * 生命周期函数--监听页面显示 | * 生命周期函数--监听页面显示 | ||||
| */ | */ | ||||
| onShow: function () { | onShow: function () { | ||||
| if(app.globalData.getSecondGuessInfo.firstData){ | |||||
| this.data.userType = 1; | |||||
| } | |||||
| }, | }, | ||||
| /** | /** | ||||
| }) | }) | ||||
| }, | }, | ||||
| enterGuessPrize:function(){//开始竞猜 | enterGuessPrize:function(){//开始竞猜 | ||||
| wx.navigateTo({ | |||||
| url: '/pages/guessPrize/guessPrize' | |||||
| }) | |||||
| if(this.data.userType == 1){ | |||||
| wx.navigateTo({ | |||||
| url: '/pages/guessSecondPrize/guessSecondPrize' | |||||
| }) | |||||
| }else if(this.data.userType == 2){ | |||||
| wx.navigateTo({ | |||||
| url: '/pages/guessSecond/guessSecond?type=1' | |||||
| }) | |||||
| }else{ | |||||
| wx.navigateTo({ | |||||
| url: '/pages/guessSecond/guessSecond?type=2' | |||||
| }) | |||||
| } | |||||
| }, | |||||
| getSecondGuessInfo:function(){ | |||||
| app.wxRequest(app.globalData.urlRoot + "guessPrice/getSecondGuessInfo", {}, res => { | |||||
| if (res.code == 200) { | |||||
| app.globalData.getSecondGuessInfo = res.data; | |||||
| if(res.data.secondData || !res.data.firstData){ | |||||
| this.data.userType = 1; | |||||
| }else if(res.data.firstData.lucky_result==-1){ | |||||
| this.data.userType = 2; | |||||
| }else{ | |||||
| this.data.userType = 3; | |||||
| } | |||||
| } | |||||
| }, this); | |||||
| } | } | ||||
| }) | }) |
| imgUrl: app.globalData.urlStatic,//图片路径 | imgUrl: app.globalData.urlStatic,//图片路径 | ||||
| guessResult:true,//第一轮竞猜是否猜中 | guessResult:true,//第一轮竞猜是否猜中 | ||||
| drawResult:0,//1:京东卡,2:升舱卡,3:未抽中 | drawResult:0,//1:京东卡,2:升舱卡,3:未抽中 | ||||
| drawState:false,//是否抽过奖 | |||||
| guessPriceArr:[1,2,3,4,5,6], | guessPriceArr:[1,2,3,4,5,6], | ||||
| ruleShow:false,//是否显示竞猜规则 | ruleShow:false,//是否显示竞猜规则 | ||||
| isUserAddress:false,//用户是否有地址 | |||||
| httpState:false,//是否正在进行http请求 | |||||
| }, | }, | ||||
| /** | /** | ||||
| */ | */ | ||||
| onLoad: function (options) { | onLoad: function (options) { | ||||
| app.globalData.nowPage = 3; | app.globalData.nowPage = 3; | ||||
| if (app.globalData.openid) { | |||||
| this.loadFun(); | |||||
| } else { | |||||
| app.globalData.openidSuccessFuc = this.loadFun; | |||||
| var getSecondGuessInfo = app.globalData.getSecondGuessInfo; | |||||
| this.data.guessPriceArr = getSecondGuessInfo.firstData.guess_price.toString().split(""); | |||||
| for(let i=0;i<this.data.guessPriceArr.length;i++){ | |||||
| this.data.guessPriceArr[i] = parseInt(this.data.guessPriceArr[i]); | |||||
| } | |||||
| this.setData({ | |||||
| guessPriceArr:this.data.guessPriceArr | |||||
| }) | |||||
| if(options.type==1){ | |||||
| this.setData({ | |||||
| guessResult:false | |||||
| }) | |||||
| }else if(options.type==2){ | |||||
| this.setData({ | |||||
| guessResult:true | |||||
| }) | |||||
| } | |||||
| if(this.data.guessResult && app.globalData.getSecondGuessInfo.firstData.lucky_result!=0){ | |||||
| this.setData({ | |||||
| drawState:true | |||||
| }) | |||||
| } | } | ||||
| }, | }, | ||||
| loadFun:function(){ | loadFun:function(){ | ||||
| this.getAddress(); | |||||
| }, | }, | ||||
| /** | /** | ||||
| * 生命周期函数--监听页面显示 | * 生命周期函数--监听页面显示 | ||||
| */ | */ | ||||
| onShow: function () { | onShow: function () { | ||||
| if (app.globalData.openid) { | |||||
| this.loadFun(); | |||||
| } else { | |||||
| app.globalData.openidSuccessFuc = this.loadFun; | |||||
| } | |||||
| }, | }, | ||||
| /** | /** | ||||
| }) | }) | ||||
| }, | }, | ||||
| startDraw:function(){//抽奖 | startDraw:function(){//抽奖 | ||||
| this.setData({ | |||||
| drawResult:1 | |||||
| }) | |||||
| if(this.data.httpState){ | |||||
| return; | |||||
| } | |||||
| this.data.httpState = true; | |||||
| app.wxRequest(app.globalData.urlRoot+"guessPrice/getFirstGuessLucky",{},res =>{ | |||||
| this.data.httpState = false; | |||||
| if(res.code==200){ | |||||
| app.globalData.getSecondGuessInfo.firstData.lucky_result = 1; | |||||
| res.data.lucky_result = 1; | |||||
| if(res.data.lucky_result==1){ | |||||
| this.setData({ | |||||
| drawResult:2 | |||||
| }) | |||||
| }else if(res.data.lucky_result==2){ | |||||
| this.setData({ | |||||
| drawResult:1 | |||||
| }) | |||||
| }else if(res.data.lucky_result==-2){ | |||||
| app.globalData.getSecondGuessInfo.firstData.lucky_result = -2; | |||||
| this.setData({ | |||||
| drawResult:3 | |||||
| }) | |||||
| } | |||||
| }else{ | |||||
| wx.showToast({ | |||||
| title: res.msg, | |||||
| icon:'none' | |||||
| }) | |||||
| } | |||||
| },this); | |||||
| }, | }, | ||||
| prizeWindowControl:function(){//关闭抽奖弹窗 | prizeWindowControl:function(){//关闭抽奖弹窗 | ||||
| this.setData({ | this.setData({ | ||||
| }) | }) | ||||
| }, | }, | ||||
| enterPerfectMsg:function(){//马上领取 | enterPerfectMsg:function(){//马上领取 | ||||
| if(this.data.isUserAddress){ | |||||
| this.enterGuess(); | |||||
| }else{ | |||||
| wx.navigateTo({ | |||||
| url: '/pages/perfectMsg/perfectMsg', | |||||
| }) | |||||
| } | |||||
| }, | |||||
| getAddress: function () {//获取地址 | |||||
| app.wxRequest(app.globalData.urlRoot + "address/getAddressV2", {}, res => { | |||||
| if (res.code == 200) { | |||||
| if (res.data) { | |||||
| this.data.isUserAddress = true; | |||||
| } | |||||
| } | |||||
| }, this); | |||||
| }, | |||||
| lookConfigure: function () { | |||||
| wx.navigateTo({ | wx.navigateTo({ | ||||
| url: '/pages/perfectMsg/perfectMsg', | |||||
| url: '/pages/configure/configure', | |||||
| }) | }) | ||||
| } | } | ||||
| }) | }) |
| <image class="pageBg" src="{{imgUrl+'/versions/20.png?v=002'}}"></image> | <image class="pageBg" src="{{imgUrl+'/versions/20.png?v=002'}}"></image> | ||||
| <view class="topGroup"> | <view class="topGroup"> | ||||
| <image class="newImages5-2" src="{{imgUrl+'/newImages5/2.png'}}"></image> | <image class="newImages5-2" src="{{imgUrl+'/newImages5/2.png'}}"></image> | ||||
| <image class="newImages5-1" src="{{imgUrl+'/newImages5/1.png'}}"></image> | |||||
| <image class="newImages5-1" bindtap="lookConfigure" src="{{imgUrl+'/newImages5/1.png'}}"></image> | |||||
| </view> | </view> | ||||
| <image class="newImages5-3" src="{{imgUrl+'/newImages5/'+(guessResult?'38':'37')+'.png'}}"></image> | |||||
| <image class="newImages5-3" src="{{imgUrl+'/newImages5/'+(guessResult?drawState?'36':'38':'37')+'.png'}}"></image> | |||||
| <image class="newImages5-4" src="{{imgUrl+'/newImages5/4.png'}}"></image> | <image class="newImages5-4" src="{{imgUrl+'/newImages5/4.png'}}"></image> | ||||
| <view class="selectFream"> | <view class="selectFream"> | ||||
| <image class="versions-19" src="{{imgUrl+'/versions/19.png'}}"></image> | <image class="versions-19" src="{{imgUrl+'/versions/19.png'}}"></image> | ||||
| </view> | </view> | ||||
| <view class="slideMask"></view> | <view class="slideMask"></view> | ||||
| </view> | </view> | ||||
| <image class="newImages5-5" wx:if="{{!guessResult}}" bindtap="enterGuess" src="{{imgUrl+'/newImages5/5.png'}}"></image> | |||||
| <image class="newImages5-5" wx:if="{{guessResult}}" bindtap="startDraw" src="{{imgUrl+'/newImages5/7.png'}}"></image> | |||||
| <image class="newImages5-5" wx:if="{{!guessResult || drawState}}" bindtap="enterGuess" src="{{imgUrl+'/newImages5/5.png'}}"></image> | |||||
| <image class="newImages5-5" wx:if="{{guessResult && !drawState}}" bindtap="startDraw" src="{{imgUrl+'/newImages5/7.png'}}"></image> | |||||
| <image class="drawBtn" bindtap="ruleControl" src="{{imgUrl+'/versions/7.png'}}"></image> | <image class="drawBtn" bindtap="ruleControl" src="{{imgUrl+'/versions/7.png'}}"></image> | ||||
| <image class="yuyue" bindtap="enterLucky" src="{{imgUrl+'/versions/1.png'}}"></image> | <image class="yuyue" bindtap="enterLucky" src="{{imgUrl+'/versions/1.png'}}"></image> | ||||
| <view class="ruleFrame" wx:if="{{ruleShow}}"> | <view class="ruleFrame" wx:if="{{ruleShow}}"> | ||||
| <image class="prizeTip" src="{{imgUrl+'/newImages5/9.png'}}"></image> | <image class="prizeTip" src="{{imgUrl+'/newImages5/9.png'}}"></image> | ||||
| <image class="prizeBtn" bindtap="enterPerfectMsg" src="{{imgUrl+'/newImages5/10.png'}}"></image> | <image class="prizeBtn" bindtap="enterPerfectMsg" src="{{imgUrl+'/newImages5/10.png'}}"></image> | ||||
| </view> | </view> | ||||
| <image class="prizeWindowClose" bindtap="prizeWindowControl" src="{{imgUrl+'/newImages5/12.png'}}"></image> | |||||
| <image class="prizeWindowClose" bindtap="enterPerfectMsg" src="{{imgUrl+'/newImages5/12.png'}}"></image> | |||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| <view class="ruleFrame ruleFrame2" wx:if="{{drawResult==3}}"> | <view class="ruleFrame ruleFrame2" wx:if="{{drawResult==3}}"> |
| stringValue:"",//输入的竞猜价格 | stringValue:"",//输入的竞猜价格 | ||||
| focusState:false,//输入框聚焦状态 | focusState:false,//输入框聚焦状态 | ||||
| tipImgShow:true,//是否显示输入框提示 | tipImgShow:true,//是否显示输入框提示 | ||||
| isGuess:true,//是否竞猜过价格 | |||||
| isGuess:false,//是否竞猜过价格 | |||||
| guessPrice:"", | |||||
| guessPriceArr:[1,2,3,4,5,6], | guessPriceArr:[1,2,3,4,5,6], | ||||
| slideDay:['0','0'],//距离上市时间 | slideDay:['0','0'],//距离上市时间 | ||||
| randomNum:44,//随机数 | randomNum:44,//随机数 | ||||
| cartogramShow:false,//是否显示统计图 | cartogramShow:false,//是否显示统计图 | ||||
| getSecondGuessInfo:null, | |||||
| httpState:false,//是否正在进行http请求 | |||||
| }, | }, | ||||
| /** | /** | ||||
| } else { | } else { | ||||
| app.globalData.openidSuccessFuc = this.loadFun; | app.globalData.openidSuccessFuc = this.loadFun; | ||||
| } | } | ||||
| this.setData({ | |||||
| getSecondGuessInfo:app.globalData.getSecondGuessInfo | |||||
| }) | |||||
| var getSecondGuessInfo = app.globalData.getSecondGuessInfo; | |||||
| if(getSecondGuessInfo.secondData){ | |||||
| this.data.guessPriceArr = getSecondGuessInfo.secondData.guess_price.toString().split(""); | |||||
| for(let i=0;i<this.data.guessPriceArr.length;i++){ | |||||
| this.data.guessPriceArr[i] = parseInt(this.data.guessPriceArr[i]); | |||||
| } | |||||
| this.setData({ | |||||
| isGuess:true, | |||||
| guessPriceArr:this.data.guessPriceArr | |||||
| }) | |||||
| } | |||||
| }, | }, | ||||
| loadFun:function(){ | loadFun:function(){ | ||||
| console.log(this.data.guessPriceArr); | console.log(this.data.guessPriceArr); | ||||
| this.tipWindowControl2(); | this.tipWindowControl2(); | ||||
| } | } | ||||
| // this.submitFirstGuessInfo(); | |||||
| }, | }, | ||||
| tipWindowControl:function(){ | tipWindowControl:function(){ | ||||
| this.setData({ | this.setData({ | ||||
| randomNum:randomNum, | randomNum:randomNum, | ||||
| cartogramShow:!this.data.cartogramShow | cartogramShow:!this.data.cartogramShow | ||||
| }) | }) | ||||
| }, | |||||
| submitFirstGuessInfo:function(){//提交竞猜价格 | |||||
| if(this.data.httpState){ | |||||
| return; | |||||
| } | |||||
| this.data.httpState = true; | |||||
| app.wxRequest(app.globalData.urlRoot + "guessPrice/submitSecondGuessInfo", {guess_price:this.data.guessPrice,statistics_scene:app.globalData.sceneSource}, res => { | |||||
| this.data.httpState = false; | |||||
| if (res.code == 200) { | |||||
| app.globalData.getSecondGuessInfo.secondData = {}; | |||||
| app.globalData.getSecondGuessInfo.secondData.guess_price = this.data.guessPrice; | |||||
| app.globalData.getSecondGuessInfo.secondData.firstData = null; | |||||
| this.setData({ | |||||
| isGuess:true | |||||
| }) | |||||
| this.tipWindowControl2(); | |||||
| this.shareWindowControl(); | |||||
| }else{ | |||||
| wx.showToast({ | |||||
| title: res.msg, | |||||
| icon:"none" | |||||
| }) | |||||
| } | |||||
| }, this,"POST"); | |||||
| }, | |||||
| shareWindowControl:function(){//邀请好友弹窗显示控制 | |||||
| this.setData({ | |||||
| shareShow:!this.data.shareShow | |||||
| }) | |||||
| } | } | ||||
| }) | }) |
| <image class="tipWindowClose" bindtap="cartogramControl" src="{{imgUrl+'/newImages4/27.png'}}"></image> | <image class="tipWindowClose" bindtap="cartogramControl" src="{{imgUrl+'/newImages4/27.png'}}"></image> | ||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| <view class="shareWindow" wx:if="{{shareShow}}"> | |||||
| <view class="shareWindowGroup"> | |||||
| <image class="versions-23" src="{{imgUrl+'/versions/23.png?v=002'}}"></image> | |||||
| <image class="versions-22" src="{{imgUrl+'/versions/22.png'}}"></image> | |||||
| <button open-type="share" style="min-height:0;width: 462rpx;" class="shareBtn2"></button> | |||||
| <image class="versions-24" bindtap="shareWindowControl" src="{{imgUrl+'/versions/24.png'}}"></image> | |||||
| </view> | |||||
| </view> | </view> | ||||
| <tabBar></tabBar> | |||||
| </view> | |||||
| <tabBar></tabBar> |
| margin: 0; | margin: 0; | ||||
| padding: 0; | padding: 0; | ||||
| opacity: 0; | opacity: 0; | ||||
| }.shareWindow{ | |||||
| position: fixed; | |||||
| top:0; | |||||
| left: 0; | |||||
| width: 100%; | |||||
| height: calc(100vh - 120rpx); | |||||
| display: flex; | |||||
| align-items: center; | |||||
| justify-content: center; | |||||
| background-color: rgba(000, 000, 000, 0.5); | |||||
| } | |||||
| .shareWindowGroup{ | |||||
| position: relative; | |||||
| width: 591rpx; | |||||
| height: 611rpx; | |||||
| } | |||||
| .versions-23{ | |||||
| width: 100%; | |||||
| height: 100%; | |||||
| } | |||||
| .versions-22{ | |||||
| position: absolute; | |||||
| left: 50%; | |||||
| transform: translateX(-50%); | |||||
| bottom: 60rpx; | |||||
| width: 462rpx; | |||||
| height: 54rpx; | |||||
| } | |||||
| .shareBtn2{ | |||||
| position: absolute; | |||||
| left: 50%; | |||||
| transform: translateX(-50%); | |||||
| bottom: 60rpx; | |||||
| height: 54rpx; | |||||
| margin: 0; | |||||
| padding: 0; | |||||
| opacity: 0; | |||||
| } | |||||
| .versions-24{ | |||||
| position: absolute; | |||||
| top: -42rpx; | |||||
| right: -42rpx; | |||||
| width: 42rpx; | |||||
| height: 42rpx; | |||||
| } | } |
| <view class="contentFrame"> | <view class="contentFrame"> | ||||
| <view class="newImages2-76"> | <view class="newImages2-76"> | ||||
| <!-- <image style="width:750rpx;height:10368rpx;" src="{{imgUrl+'/newImages4/16.png'}}"></image> --> | <!-- <image style="width:750rpx;height:10368rpx;" src="{{imgUrl+'/newImages4/16.png'}}"></image> --> | ||||
| <image style="width:750rpx;height:1600rpx;" src="{{imgUrl+'/newImages4/indeximages/new_01.png?v=002'}}"></image> | |||||
| <image style="width:750rpx;height:1600rpx;" src="{{imgUrl+'/newImages4/indeximages/new_02.png'}}"></image> | |||||
| <image style="width:750rpx;height:1600rpx;" src="{{imgUrl+'/newImages4/indeximages/new_03.png'}}"></image> | |||||
| <image style="width:750rpx;height:1600rpx;" src="{{imgUrl+'/newImages4/indeximages/new_04.png'}}"></image> | |||||
| <image style="width:750rpx;height:1600rpx;" src="{{imgUrl+'/newImages4/indeximages/new_05.png'}}"></image> | |||||
| <image style="width:750rpx;height:1600rpx;" src="{{imgUrl+'/newImages4/indeximages/new_06.png'}}"></image> | |||||
| <image style="width:750rpx;height:768rpx;" src="{{imgUrl+'/newImages4/indeximages/new_07.png'}}"></image> | |||||
| <image style="width:750rpx;height:1600rpx;" src="{{imgUrl+'/newImages5/images/newImg_01.png?v=002'}}"></image> | |||||
| <image style="width:750rpx;height:1600rpx;" src="{{imgUrl+'/newImages5/images/newImg_02.png'}}"></image> | |||||
| <image style="width:750rpx;height:1600rpx;" src="{{imgUrl+'/newImages5/images/newImg_03.png'}}"></image> | |||||
| <image style="width:750rpx;height:1600rpx;" src="{{imgUrl+'/newImages5/images/newImg_04.png'}}"></image> | |||||
| <image style="width:750rpx;height:1600rpx;" src="{{imgUrl+'/newImages5/images/newImg_05.png'}}"></image> | |||||
| <image style="width:750rpx;height:1600rpx;" src="{{imgUrl+'/newImages5/images/newImg_06.png'}}"></image> | |||||
| <image style="width:750rpx;height:768rpx;" src="{{imgUrl+'/newImages5/images/newImg_07.png'}}"></image> | |||||
| </view> | </view> | ||||
| <view class="videoGroup" bindtap="playVideo"> | <view class="videoGroup" bindtap="playVideo"> | ||||
| <image class="newImages2-108" animation="{{playBtnDeg}}" src="{{imgUrl+'/newImages3/32.png'}}"></image> | <image class="newImages2-108" animation="{{playBtnDeg}}" src="{{imgUrl+'/newImages3/32.png'}}"></image> |
| <image class="gameRuleClose" wx:if="{{ruleCloseShow}}" bindtap="closeRule" src="{{imgUrl+'/star/closebtn.png'}}"></image> | <image class="gameRuleClose" wx:if="{{ruleCloseShow}}" bindtap="closeRule" src="{{imgUrl+'/star/closebtn.png'}}"></image> | ||||
| <view class="gameRuleGroup"> | <view class="gameRuleGroup"> | ||||
| <view style="width: 452rpx;height: 1661rpx;"> | <view style="width: 452rpx;height: 1661rpx;"> | ||||
| <image class="newImages48" style="width: 100%;height: 100%;" src="{{imgUrl+'/newImages3/30.png'}}"></image> | |||||
| <image class="newImages48" style="width: 100%;height: 100%;" src="{{imgUrl+'/newImages5/51.png'}}"></image> | |||||
| </view> | </view> | ||||
| <view class="gameStrat" bindtap="closeRule"> | <view class="gameStrat" bindtap="closeRule"> | ||||
| <image style="width:100%;height:100%;" src="{{imgUrl+'/btns/gameStart.png'}}"></image> | <image style="width:100%;height:100%;" src="{{imgUrl+'/btns/gameStart.png'}}"></image> |
| verificationCode:"获取验证码", | verificationCode:"获取验证码", | ||||
| sendCode:true, | sendCode:true, | ||||
| mobile2:"", | mobile2:"", | ||||
| phoneInputShow: false, | |||||
| isUserAddress:true,//用户是否有地址 | |||||
| submitData:{ | submitData:{ | ||||
| realName:"",//姓名 | realName:"",//姓名 | ||||
| mobile:"",//手机号 | mobile:"",//手机号 | ||||
| nowProvince: "",//选中的省市文字 | nowProvince: "",//选中的省市文字 | ||||
| storeArr: [],//专营店数据 | storeArr: [],//专营店数据 | ||||
| storeValue: 0,//选中的专营店下标 | storeValue: 0,//选中的专营店下标 | ||||
| httpState:false,//是否正在进行http请求 | |||||
| windowTipShow:false,//是否显示完善信息后的弹窗 | |||||
| }, | }, | ||||
| /** | /** | ||||
| if (app.globalData.userMobile) { | if (app.globalData.userMobile) { | ||||
| this.data.submitData.mobile = app.globalData.userMobile; | this.data.submitData.mobile = app.globalData.userMobile; | ||||
| this.setData({ | this.setData({ | ||||
| phoneInputShow: true, | |||||
| submitData: this.data.submitData | submitData: this.data.submitData | ||||
| }) | }) | ||||
| } | } | ||||
| }) | }) | ||||
| }, | }, | ||||
| chooseType:function(e){//选中的手机号类型 | chooseType:function(e){//选中的手机号类型 | ||||
| this.setData({ | |||||
| selectType:e.currentTarget.dataset.type | |||||
| }) | |||||
| if(e){ | |||||
| this.setData({ | |||||
| selectType:e.currentTarget.dataset.type | |||||
| }) | |||||
| }else{ | |||||
| this.setData({ | |||||
| selectType:1 | |||||
| }) | |||||
| } | |||||
| }, | }, | ||||
| getAddressDetail: function (e) {//获取详细地址 | getAddressDetail: function (e) {//获取详细地址 | ||||
| this.data.submitData.addressDetail = e.detail.value; | this.data.submitData.addressDetail = e.detail.value; | ||||
| this.setData({ | |||||
| submitData:this.data.submitData | |||||
| }) | |||||
| }, | }, | ||||
| getRealName:function(e){//获取用户输入的姓名 | getRealName:function(e){//获取用户输入的姓名 | ||||
| this.data.submitData.realName = e.detail.value; | this.data.submitData.realName = e.detail.value; | ||||
| this.setData({ | |||||
| submitData:this.data.submitData | |||||
| }) | |||||
| }, | }, | ||||
| getMobile:function(e){//获取用户输入的电话 | getMobile:function(e){//获取用户输入的电话 | ||||
| this.data.mobile2 = e.detail.value; | |||||
| this.setData({ | |||||
| mobile2:e.detail.value | |||||
| }) | |||||
| }, | }, | ||||
| getCaptcha: function (e) {//获取用户输入的验证码 | getCaptcha: function (e) {//获取用户输入的验证码 | ||||
| this.data.submitData.captcha = e.detail.value; | this.data.submitData.captcha = e.detail.value; | ||||
| this.setData({ | |||||
| submitData:this.data.submitData | |||||
| }) | |||||
| }, | }, | ||||
| getCode: function (e) {//获取验证码 | getCode: function (e) {//获取验证码 | ||||
| if (!app.mobileVerify(this.data.mobile2)) { | if (!app.mobileVerify(this.data.mobile2)) { | ||||
| } | } | ||||
| }, 1000); | }, 1000); | ||||
| }, | }, | ||||
| getUserPhone: function (e) {//获取用户手机号 | |||||
| if (e.detail.errMsg == 'getPhoneNumber:ok') { | |||||
| app.getMobile(e.detail.encryptedData, e.detail.iv, res => { | |||||
| if (res.code == 200) { | |||||
| this.setData({ | |||||
| phoneInputShow: true | |||||
| }) | |||||
| this.chooseType(); | |||||
| if (res.data && res.data.decodeData) { | |||||
| this.data.submitData.mobile = res.data.decodeData.phoneNumber; | |||||
| this.setData({ | |||||
| submitData: this.data.submitData | |||||
| }) | |||||
| } | |||||
| } else { | |||||
| wx.showToast({ | |||||
| title: res.msg, | |||||
| icon: "none" | |||||
| }) | |||||
| } | |||||
| }, this); | |||||
| } | |||||
| }, | |||||
| getAddress: function () {//获取地址 | getAddress: function () {//获取地址 | ||||
| app.wxRequest(app.globalData.urlRoot + "address/getAddressV2", {}, res => { | app.wxRequest(app.globalData.urlRoot + "address/getAddressV2", {}, res => { | ||||
| console.log(res); | console.log(res); | ||||
| this.data.submitData.city = res.data.city; | this.data.submitData.city = res.data.city; | ||||
| this.data.submitData.addressDetail = res.data.addressDetail; | this.data.submitData.addressDetail = res.data.addressDetail; | ||||
| this.setData({ | this.setData({ | ||||
| submitData: this.data.submitData | |||||
| submitData: this.data.submitData, | |||||
| mobile2:res.data.mobile | |||||
| }) | }) | ||||
| if(!res.data.agentDetail){ | if(!res.data.agentDetail){ | ||||
| this.getUserLocation();//获取用户当前位置 | this.getUserLocation();//获取用户当前位置 | ||||
| } | } | ||||
| }else{ | |||||
| this.getUserLocation();//获取用户当前位置 | |||||
| this.setData({ | |||||
| isUserAddress:false | |||||
| }) | |||||
| } | } | ||||
| } else { | } else { | ||||
| wx.showToast({ | wx.showToast({ | ||||
| city.push(res.data.list[res.data.nearData.provinceIndex].children[j].city) | city.push(res.data.list[res.data.nearData.provinceIndex].children[j].city) | ||||
| } | } | ||||
| //将数据赋值给变量 | //将数据赋值给变量 | ||||
| var storeArr = res.data.list[res.data.nearData.provinceIndex].children[res.data.nearData.cityIndex].children; | |||||
| var storeValue = res.data.nearData.agentIndex; | |||||
| this.data.submitData.agentDetail = storeArr[storeValue].agent_detail; | |||||
| this.data.submitData.agent_code = storeArr[storeValue].agent_code; | |||||
| this.data.submitData.province = province[res.data.nearData.provinceIndex]; | |||||
| this.data.submitData.city = city[res.data.nearData.cityIndex]; | |||||
| this.setData({ | this.setData({ | ||||
| provinceDataAll: res.data.list, | provinceDataAll: res.data.list, | ||||
| provinceDataArr: [province, city], | provinceDataArr: [province, city], | ||||
| provinceDataValue: [res.data.nearData.provinceIndex, res.data.nearData.cityIndex], | provinceDataValue: [res.data.nearData.provinceIndex, res.data.nearData.cityIndex], | ||||
| nowProvince: province[res.data.nearData.provinceIndex] + " " + city[res.data.nearData.cityIndex], | nowProvince: province[res.data.nearData.provinceIndex] + " " + city[res.data.nearData.cityIndex], | ||||
| storeArr: res.data.list[res.data.nearData.provinceIndex].children[res.data.nearData.cityIndex].children, | |||||
| storeValue: res.data.nearData.agentIndex | |||||
| storeArr: storeArr, | |||||
| storeValue: storeValue | |||||
| }) | }) | ||||
| } else { | } else { | ||||
| wx.showToast({ | wx.showToast({ | ||||
| this.setData({ | this.setData({ | ||||
| storeValue: e.detail.value | storeValue: e.detail.value | ||||
| }) | }) | ||||
| }, | |||||
| submitUserMsg:function(){//数据提交 | |||||
| if (!this.data.submitData.realName) { | |||||
| wx.showToast({ | |||||
| title: '请输入姓名', | |||||
| icon: "none" | |||||
| }) | |||||
| return; | |||||
| } | |||||
| if (!this.data.mobile2 && this.data.selectType==2) { | |||||
| wx.showToast({ | |||||
| title: '请输入电话', | |||||
| icon: "none" | |||||
| }) | |||||
| return; | |||||
| } | |||||
| if (this.data.selectType == 2) { | |||||
| if (!this.data.submitData.captcha) { | |||||
| wx.showToast({ | |||||
| title: '请输入验证码', | |||||
| icon: "none" | |||||
| }) | |||||
| return; | |||||
| } | |||||
| } | |||||
| if(this.data.httpState){ | |||||
| return; | |||||
| } | |||||
| this.data.httpState = true; | |||||
| this.data.submitData.province = this.data.provinceDataArr[0][this.data.provinceDataValue[0]]; | |||||
| this.data.submitData.city = this.data.provinceDataArr[1][this.data.provinceDataValue[1]]; | |||||
| this.data.submitData.agent_code = this.data.storeArr[this.data.storeValue].agent_code; | |||||
| this.data.submitData.agentDetail = this.data.storeArr[this.data.storeValue].agent_detail; | |||||
| this.data.submitData.scene = app.globalData.sceneSource; | |||||
| if(this.data.isUserAddress){ | |||||
| this.updateAddress(); | |||||
| }else{ | |||||
| this.addAddress(); | |||||
| } | |||||
| }, | |||||
| addAddress: function () {//添加地址 | |||||
| var mobile = this.data.submitData.mobile; | |||||
| if(this.data.selectType==2){ | |||||
| this.data.submitData.mobile = this.data.mobile2; | |||||
| } | |||||
| app.wxRequest(app.globalData.urlRoot + "address/addAddressV2", this.data.submitData, res => { | |||||
| this.data.httpState = false; | |||||
| if (res.code == 200) { | |||||
| this.windowTipControl(); | |||||
| }else{ | |||||
| this.data.submitData.mobile = mobile; | |||||
| wx.showToast({ | |||||
| title: res.msg, | |||||
| }) | |||||
| } | |||||
| }, this, "POST") | |||||
| }, | |||||
| updateAddress: function () {//更新地址 | |||||
| var mobile = this.data.submitData.mobile; | |||||
| if(this.data.selectType==2){ | |||||
| this.data.submitData.mobile = this.data.mobile2; | |||||
| } | |||||
| app.wxRequest(app.globalData.urlRoot + "address/updateAddressV2", this.data.submitData, res => { | |||||
| this.data.httpState = false; | |||||
| if (res.code == 200) { | |||||
| this.windowTipControl(); | |||||
| }else{ | |||||
| this.data.submitData.mobile = mobile; | |||||
| wx.showToast({ | |||||
| title: res.msg, | |||||
| }) | |||||
| } | |||||
| }, this, "POST"); | |||||
| }, | |||||
| windowTipControl:function(){ | |||||
| this.setData({ | |||||
| windowTipShow:!this.data.windowTipShow | |||||
| }) | |||||
| }, | |||||
| enterGuess:function(){//去竞猜 | |||||
| wx.redirectTo({ | |||||
| url: '/pages/guessSecondPrize/guessSecondPrize', | |||||
| }) | |||||
| } | } | ||||
| }) | }) |
| <image class="pageBg" src="{{imgUrl+'/versions/20.png?v=002'}}"></image> | <image class="pageBg" src="{{imgUrl+'/versions/20.png?v=002'}}"></image> | ||||
| <view class="pageTitle">完善个人信息</view> | <view class="pageTitle">完善个人信息</view> | ||||
| <view class="selectGroup"> | <view class="selectGroup"> | ||||
| <view class="selectType {{selectType==1?'selectType2':''}}" bindtap="chooseType" data-type="1" style="margin-bottom:20rpx;">使用微信绑定手机号</view> | |||||
| <view style="position: relative;"> | |||||
| <view class="selectType {{selectType==1?'selectType2':''}}" bindtap="chooseType" data-type="1" style="margin-bottom:20rpx;">使用微信绑定手机号</view> | |||||
| <view class="getPhoneFrame" wx:if="{{!phoneInputShow}}"> | |||||
| <button class="getPhoneBtn" style="width: 100%;height: 100%;margin: 0;padding: 0;min-height: 0;" open-type="getPhoneNumber" bindgetphonenumber="getUserPhone"></button> | |||||
| </view> | |||||
| </view> | |||||
| <view class="selectType {{selectType==2?'selectType2':''}}" bindtap="chooseType" data-type="2">使用手机号码</view> | <view class="selectType {{selectType==2?'selectType2':''}}" bindtap="chooseType" data-type="2">使用手机号码</view> | ||||
| </view> | </view> | ||||
| <view class="userMsgFrame"> | <view class="userMsgFrame"> | ||||
| <view class="userMsgTitle">电话</view> | <view class="userMsgTitle">电话</view> | ||||
| <input class="userMsgInput" type="number" maxlength="11" bindinput="getMobile" value="{{mobile2}}" placeholder="请输入您的联系电话" placeholder-style="color:#99999A;"></input> | <input class="userMsgInput" type="number" maxlength="11" bindinput="getMobile" value="{{mobile2}}" placeholder="请输入您的联系电话" placeholder-style="color:#99999A;"></input> | ||||
| </view> | </view> | ||||
| <view class="userMsgGroup" style="justify-content: flex-end;"> | |||||
| <view class="userMsgGroup" wx:if="{{selectType==2}}" style="justify-content: flex-end;"> | |||||
| <view class="userMsgGroup2"> | <view class="userMsgGroup2"> | ||||
| <input class="userMsgInput" style="width:350rpx;" bindinput="getCaptcha" placeholder="请输入验证码" placeholder-style="color:#99999A;"></input> | <input class="userMsgInput" style="width:350rpx;" bindinput="getCaptcha" placeholder="请输入验证码" placeholder-style="color:#99999A;"></input> | ||||
| <view class="getCode" bindtap="getCode">{{verificationCode}}</view> | <view class="getCode" bindtap="getCode">{{verificationCode}}</view> | ||||
| <view class="userMsgDetailGroup"> | <view class="userMsgDetailGroup"> | ||||
| <view class="userMsgDetail"> | <view class="userMsgDetail"> | ||||
| <view class="detailTitle">收货地址:</view> | <view class="detailTitle">收货地址:</view> | ||||
| <textarea class="addressTextarea" maxlength="-1" style="margin-top:{{marginT}}rpx;width:490rpx;" bindinput="getAddressDetail" value=""></textarea> | |||||
| <textarea class="addressTextarea" maxlength="-1" value="{{submitData.addressDetail}}" style="margin-top:{{marginT}}rpx;width:490rpx;" bindinput="getAddressDetail"></textarea> | |||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| <image class="submitBtn" src="{{imgUrl+'/newImages5/18.png'}}"></image> | |||||
| <image class="submitBtn" bindtap="submitUserMsg" src="{{imgUrl+'/newImages5/18.png'}}"></image> | |||||
| </view> | </view> | ||||
| <image class="drawBtn" bindtap="ruleControl" src="{{imgUrl+'/versions/7.png'}}"></image> | <image class="drawBtn" bindtap="ruleControl" src="{{imgUrl+'/versions/7.png'}}"></image> | ||||
| <image class="yuyue" bindtap="enterLucky" src="{{imgUrl+'/versions/1.png'}}"></image> | <image class="yuyue" bindtap="enterLucky" src="{{imgUrl+'/versions/1.png'}}"></image> | ||||
| <image class="gameRule" src="{{imgUrl+'/newImages4/17.png'}}"></image> | <image class="gameRule" src="{{imgUrl+'/newImages4/17.png'}}"></image> | ||||
| <image class="closeRule" bindtap="ruleControl" src="{{imgUrl+'/versions/21.png'}}"></image> | <image class="closeRule" bindtap="ruleControl" src="{{imgUrl+'/versions/21.png'}}"></image> | ||||
| </view> | </view> | ||||
| <view class="ruleFrame ruleFrame2" wx:if="{{windowTipShow}}"> | |||||
| <view class="windowTipGroup"> | |||||
| <image class="windowTipImg" src="{{imgUrl+'/newImages5/49.png'}}"></image> | |||||
| <image class="windowTipBtn" bindtap="enterGuess" src="{{imgUrl+'/newImages5/48.png'}}"></image> | |||||
| <image class="windowTipClose" bindtap="enterGuess" src="{{imgUrl+'/newImages5/50.png'}}"></image> | |||||
| </view> | |||||
| </view> | |||||
| </view> | </view> | ||||
| <tabBar></tabBar> | <tabBar></tabBar> |
| font-family:PingFangSC; | font-family:PingFangSC; | ||||
| font-weight:300; | font-weight:300; | ||||
| color:white; | color:white; | ||||
| } | |||||
| .getPhoneFrame{ | |||||
| position: absolute; | |||||
| left: 0; | |||||
| top: 0; | |||||
| width:100%; | |||||
| height: 70rpx; | |||||
| z-index: 2; | |||||
| } | |||||
| .getPhoneBtn{ | |||||
| opacity: 0; | |||||
| } | |||||
| .ruleFrame2{ | |||||
| width: 100%; | |||||
| display: flex; | |||||
| align-items: center; | |||||
| justify-content: center; | |||||
| background-color: rgba(0,0,0,0.5); | |||||
| z-index: 9; | |||||
| } | |||||
| .windowTipGroup{ | |||||
| position: relative; | |||||
| width: 501rpx; | |||||
| height: 550rpx; | |||||
| } | |||||
| .windowTipImg{ | |||||
| width: 100%; | |||||
| height: 100%; | |||||
| } | |||||
| .windowTipBtn{ | |||||
| position: absolute; | |||||
| left: 50%; | |||||
| transform: translateX(-50%); | |||||
| bottom: 66rpx; | |||||
| width: 389rpx; | |||||
| height: 60rpx; | |||||
| } | |||||
| .windowTipClose{ | |||||
| position: absolute; | |||||
| width: 42rpx; | |||||
| height: 42rpx; | |||||
| top: -32rpx; | |||||
| right: -32rpx; | |||||
| } | } |