|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135 |
- // pages/myCenter/myCenter.js
- const app = getApp()
- Page({
-
- /**
- * 页面的初始数据
- */
- data: {
- imgUrl: app.globalData.urlStatic,//图片路径
- isAddress:false,
- placing:false,
- buyState:false,
- buyStateTime:"",
- isAgreement: true,//是否同意协议
- phoneInputShow: false,//是否显示电话输入框
- siteSelect: false,//是否显示位置选择框
- isLogin:false,//登录状态
- selectNow:0,//现在的选项
- taskNow:2,//现在的任务类型
- recordNow: 2,//现在的记录类型
- taskList: [],//任务列表
- shareFriendList:[],//星探小分队列表
- couponList:[],//卡券列表
- recordList:[],//获奖记录列表
- provinceArr: [],//省
- provinceValue: 0,//选中的省下标
- storeArr: [],//店铺
- storeValue: 0,//选中的店铺下标
- verificationCode: '获取验证码',//验证码文案
- sendCode: true,
- appointment: true,
- getFriendListState:false,
- couponListState:false,
- couponListCode:"",
- tipWindow2:false,
- subscribeData: {
- realname: "",//姓名
- mobile: "",//手机号
- captcha: "",//验证码
- province: "",//省份
- agent_code: "",//经销商编码
- agentDetail: "",//经销商详细信息
- parentOpenid: app.globalData.parentOpenid,//好友openid
- },
- userData:{
- avatarUrl: null,
- nickName: null,
- userLevel: 1
- },
- descFrameShow:false,//是否显示奖品详情
- ruleShow: false,//是否显示星探等级规则
- // isRegister: false,//查询是否已注册
- parames:{
- page:1,
- count:20
- },
- parames2:{
- page:1,
- count:20
- },
- parames3:{
- page:1,
- count:20
- },
- noData:false,
- noData2:false,
- noData3:false,
- optionsData:null,
- lookDescId: null,
- agreement: false,//是否显示协议
- addressShow:false,
- mycenterTipWindow:0,
- barNums:0,
- getState:true,
- scoutRule:false,
- vipDetailShow:false,
- machineShow:false,
- upgradeShow:false,
- starMoveShow:false,
- cash1Show:false,
- cash2Show:false,
- lookPrizeDetail:false,
- lookIndex:null,
- buyStateCouponCode:"",
- starInfo:null,//星探状态
- testData:[
- {
- awardDetailPicContentHeight:0,
- awardName: "头等舱机票", //奖品名称
- awardPicurl:"https://xingb.venucia.com/award/10_1.png",//奖品小图
- couponCode: "我是卡号",//卡号
- couponSecret:"",//卡密
- dead_date:"",//有效期
- awardState: 1,
- cdate: "2020-03-23",
- awardId:1
- },
- {
- awardDetailPicContentHeight: 0,
- awardName: "小米扫地机器人", //奖品名称
- awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
- couponCode: "我是卡号",//卡号
- couponSecret:"我是卡密",//卡密
- dead_date:"我是有效期",//有效期
- awardState: 1,
- cdate: "2020-03-23",
- awardId: 2
- },
- {
- awardDetailPicContentHeight: 0,
- awardName: "索尼无线蓝牙耳机", //奖品名称
- awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
- couponCode: "我是卡号",//卡号
- couponSecret:"我是卡密",//卡密
- dead_date:"我是有效期",//有效期
- awardState: 1,
- cdate: "2020-03-23",
- awardId: 3
- },
- {
- awardDetailPicContentHeight: 0,
- awardName: "美的烤箱", //奖品名称
- awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
- couponCode: "我是卡号",//卡号
- couponSecret:"我是卡密",//卡密
- dead_date:"我是有效期",//有效期
- awardState: 1,
- cdate: "2020-03-23",
- awardId: 4
- },
- {
- awardDetailPicContentHeight: 0,
- awardName: "200元油卡", //奖品名称
- awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
- couponCode: "我是卡号",//卡号
- couponSecret:"我是卡密",//卡密
- dead_date:"我是有效期",//有效期
- awardState: 1,
- cdate: "2020-03-23",
- awardId: 5
- },
- {
- awardDetailPicContentHeight: 0,
- awardName: "100元京东E卡", //奖品名称
- awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
- couponCode: "我是卡号",//卡号
- couponSecret:"我是卡密",//卡密
- dead_date:"我是有效期",//有效期
- awardState: 1,
- cdate: "2020-03-23",
- awardId: 6,
- productId:2501
- },
- {
- awardDetailPicContentHeight: 0,
- awardName: "50元京东E卡", //奖品名称
- awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
- couponCode: "我是卡号",//卡号
- couponSecret:"",//卡密
- dead_date:"",//有效期
- awardState: 1,
- cdate: "2020-03-23",
- awardId: 7
- },
- {
- awardDetailPicContentHeight: 0,
- awardName: "网易云音乐vip月卡", //奖品名称
- awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
- couponCode: "我是卡号",//卡号
- couponSecret:"我是卡密",//卡密
- dead_date:"我是有效期",//有效期
- awardState: 1,
- cdate: "2020-03-23",
- awardId: 8
- },
- {
- awardDetailPicContentHeight: 0,
- awardName: "爱奇艺vip月卡", //奖品名称
- awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
- couponCode: "我是卡号",//卡号
- couponSecret:"我是卡密",//卡密
- dead_date:"我是有效期",//有效期
- awardState: 1,
- cdate: "2020-03-23",
- awardId: 9
- },
- {
- awardDetailPicContentHeight: 0,
- awardName: "腾讯会员vip月卡", //奖品名称
- awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
- couponCode: "我是卡号",//卡号
- couponSecret:"我是卡密",//卡密
- dead_date:"我是有效期",//有效期
- awardState: 1,
- cdate: "2020-03-23",
- awardId: 11
- },
- {
- awardDetailPicContentHeight: 0,
- awardName: "100元购车红包", //奖品名称
- awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
- couponCode: "我是卡号",//卡号
- couponSecret:"我是卡密",//卡密
- dead_date:"我是有效期",//有效期
- awardState: 1,
- cdate: "2020-03-23",
- awardId: 13
- },
- {
- awardDetailPicContentHeight: 0,
- awardName: "100元机油升级券", //奖品名称
- awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
- couponCode: "我是卡号",//卡号
- couponSecret:"我是卡密",//卡密
- dead_date:"我是有效期",//有效期
- awardState: 1,
- cdate: "2020-03-23",
- awardId: 14
- },
- {
- awardDetailPicContentHeight: 0,
- awardName: "500元现金", //奖品名称
- awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
- couponCode: "我是卡号",//卡号
- couponSecret:"我是卡密",//卡密
- dead_date:"我是有效期",//有效期
- awardState: 1,
- cdate: "2020-03-23",
- awardId: 16
- },
- {
- awardDetailPicContentHeight: 0,
- awardName: "1000元现金", //奖品名称
- awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
- couponCode: "我是卡号",//卡号
- couponSecret:"我是卡密",//卡密
- dead_date:"我是有效期",//有效期
- awardState: 1,
- cdate: "2020-03-23",
- awardId: 17
- },
- {
- awardDetailPicContentHeight: 0,
- awardName: "10元京东E卡", //奖品名称
- awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
- couponCode: "我是卡号",//卡号
- couponSecret:"我是卡密",//卡密
- dead_date:"我是有效期",//有效期
- awardState: 1,
- cdate: "2020-03-23",
- awardId: 18
- },
- ]
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- app.globalData.nowPage = 4;
- if (options.sourcePage){
- this.data.optionsData = options.sourcePage;
- }
- if (app.globalData.openid) {
- this.loadFun();
- } else {
- app.globalData.openidSuccessFuc = this.loadFun;
- }
- },
- loadFun: function () {
- if (!app.globalData.addPageEnterState.myCenter) {
- app.addPageEnter("BDAB6E93ECCD815EE83371E16EE42886");
- app.globalData.addPageEnterState.myCenter = true;
- }
- this.getUserInfo();
- this.getAddress();
- if (app.globalData.userMobile) {
- this.data.subscribeData.mobile = app.globalData.userMobile;
- this.setData({
- phoneInputShow: true,
- subscribeData: this.data.subscribeData
- })
- }
- if (app.globalData.myCenterData) {
- this.setData({
- provinceArr: app.globalData.myCenterData.provinceArr,
- storeArr: app.globalData.myCenterData.storeArr,
- provinceValue: app.globalData.myCenterData.provinceValue,
- storeValue: app.globalData.myCenterData.storeValue,
- // isRegister: app.globalData.isRegister
- })
- this.data.subscribeData.province = this.data.provinceArr[this.data.provinceValue].province;
- this.data.subscribeData.agentDetail = this.data.storeArr[this.data.storeValue].agent_detail;
- this.data.subscribeData.agent_code = this.data.storeArr[this.data.storeValue].agent_code;
- }
- // if (!app.globalData.isRegister) {
- // this.getOrderInfo();
- // }
- if (app.globalData.userInfoData) {
- if (app.globalData.userInfoData.avatarUrl){
- this.data.userData.avatarUrl = app.globalData.userInfoData.avatarUrl;
- this.data.userData.nickName = app.globalData.userInfoData.nickName;
- this.data.userData.userLevel = app.globalData.userInfoData.userLevel;
- this.setData({
- isLogin: true,
- userData: this.data.userData
- })
- }
- }
- if(!app.globalData.isStar){
- this.phonebolb();
- }else{
- app.globalData.authenticationStatus = app.globalData.isStar;
- if (!app.globalData.certificationInfo) {
- app.globalData.certificationInfo = true;
- wx.setStorageSync("certificationInfo", true);
- }
- app.globalData.certificationState = app.globalData.isStar.certificationState;
- }
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- if (app.globalData.getBuyState) {
- this.getBuyStates();
- } else {
- app.globalData.buyStateSuccessFuc = this.getBuyStates;
- }
- this.data.subscribeData.parentOpenid = app.globalData.parentOpenid;
- },
- getBuyStates: function () {
- this.setData({
- buyState: app.globalData.getBuyState.success,
- buyStateTime: app.globalData.getBuyState.cdate
- })
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
-
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
-
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
-
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- return app.sharePack();
- },
- selectChange:function(e){
- this.setData({
- selectNow: e.currentTarget.dataset.value
- })
- if (e.currentTarget.dataset.value == 1) {
- this.getFriendBuCarNum();
- } else if (e.currentTarget.dataset.value == 2) {
- this.data.parames2.page = 1;
- this.data.noData2 = false;
- this.setData({
- recordList:[]
- })
- this.getMyAwardList();
- } else if (e.currentTarget.dataset.value == 3){
- this.data.parames.page = 1;
- this.data.noData = false;
- this.setData({
- parames: this.data.parames,
- shareFriendList:[]
- })
- this.getShareList();
- }else if(e.currentTarget.dataset.value == 4){
- this.data.parames3.page = 1;
- this.data.noData3 = false;
- this.setData({
- couponList:[]
- })
- this.getMyCouponList();
- }
- },
- getMyCouponList:function(){//获取我的卡包
- this.setData({
- couponListState: true
- })
- wx.showLoading({
- title: '获取数据中'
- })
- app.wxRequest(app.globalData.urlRoot +"/bag/getMyCouponList",this.data.parames3,res=>{
- wx.hideLoading();
- if(res.code==200){
- if(res.data){
- for(let i=0;i<res.data.list.length;i++){
- this.data.couponList.push(res.data.list[i]);
- }
- this.setData({
- couponList: this.data.couponList
- })
- if (res.data.list.length<this.data.parames3.count){
- this.setData({
- noData3: true
- })
- }
- }
- }
- this.setData({
- couponListState: false
- })
- },this);
- },
- selectTask: function (e) {
- this.setData({
- taskNow: e.currentTarget.dataset.type
- })
- if (this.data.taskNow==2){
- this.getFriendBuCarNum();
- }
- },
- getFriendBuCarNum:function(){
- app.wxRequest(app.globalData.urlRoot +"/share/getFriendBuCarNum",{},res=>{
- if(res.code==200){
- this.setData({
- barNums: res.data.total
- })
- }
- },this);
- },
- selectRecord: function (e) {
- if (this.data.recordNow == e.currentTarget.dataset.type) {
- return;
- }
- this.setData({
- recordList:[],
- recordNow: e.currentTarget.dataset.type
- })
- this.data.parames2.page = 1;
- this.data.noData2 = false;
- this.getMyAwardList();
- },
- getUserLocation: function (e) {
- wx.getLocation({
- type: 'gcj02', //wgs84
- success: (res) => {
- this.getDistributorList(res.longitude, res.latitude);
- },
- fail: (res) => {
- this.getDistributorList("", "");
- },
- complete: (res) => {
- this.setData({
- siteSelect: true,
- })
- }
- })
- },
- getDistributorList: function (longitude, latitude) {//获取经销商列表
- app.wxRequest(app.globalData.urlRoot + "agent/getAgentList", { longitude: longitude, latitude: latitude }, res => {
- if (res.code == 200) {
- app.globalData.myCenterData = {};
- this.setData({
- provinceArr: res.data.list,
- storeArr: res.data.list[res.data.nearData.provinceIndex].children,
- provinceValue: res.data.nearData.provinceIndex,
- storeValue: res.data.nearData.cityIndex
- })
- this.data.subscribeData.province = this.data.provinceArr[this.data.provinceValue].province;
- this.data.subscribeData.agentDetail = this.data.storeArr[this.data.storeValue].agent_detail;
- this.data.subscribeData.agent_code = this.data.storeArr[this.data.storeValue].agent_code;
- app.globalData.myCenterData.provinceArr = res.data.list;
- app.globalData.myCenterData.storeArr = res.data.list[res.data.nearData.provinceIndex].children;
- app.globalData.myCenterData.provinceValue = res.data.nearData.provinceIndex;
- app.globalData.myCenterData.storeValue = res.data.nearData.cityIndex;
- } else {
- wx.showToast({
- title: res.msg,
- icon: "none"
- })
- }
- }, this);
- },
- provinceChane: function (e) {//选中省
- this.setData({
- provinceValue: e.detail.value,
- storeArr: this.data.provinceArr[e.detail.value].children,
- storeValue: 0
- })
- this.data.subscribeData.province = this.data.provinceArr[this.data.provinceValue].province;
- this.data.subscribeData.agentDetail = this.data.storeArr[this.data.storeValue].agent_detail;
- this.data.subscribeData.agent_code = this.data.storeArr[this.data.storeValue].agent_code;
- },
- storeChane: function (e) {//选中店铺
- this.setData({
- storeValue: e.detail.value,
- })
- this.data.subscribeData.agentDetail = this.data.storeArr[this.data.storeValue].agent_detail;
- this.data.subscribeData.agent_code = this.data.storeArr[this.data.storeValue].agent_code;
- },
- getCode: function (e) {//获取验证码
- if (!app.mobileVerify(this.data.subscribeData.mobile)) {
- if (this.data.subscribeData.mobile) {
- wx.showToast({
- title: '请输入正确的电话',
- icon: 'none'
- })
- } else {
- wx.showToast({
- title: '请输入电话',
- icon: 'none'
- })
- }
- return;
- }
- if (!this.data.sendCode) {
- return;
- }
- this.data.sendCode = false;
- app.wxRequest(app.globalData.urlRoot + "captcha/sendCaptcha", { mobile: this.data.subscribeData.mobile }, res => {
- if (res.code == 200) {
- this.countDown();
- wx.showToast({
- title: '验证码获取成功',
- icon: "none"
- })
- this.setData({
- verificationCode: 60
- })
- } else {
- this.data.sendCode = true;
- wx.showToast({
- title: res.msg,
- icon: "none"
- })
- }
- }, this)
- },
- countDown: function () {//倒计时
- setTimeout(() => {
- this.setData({
- verificationCode: this.data.verificationCode - 1
- })
- if (this.data.verificationCode > 0) {
- this.countDown();
- } else {
- this.setData({
- verificationCode: "获取验证码"
- })
- this.data.sendCode = true;
- }
- }, 1000);
- },
- getRealname: function (e) {//获取用户输入的姓名
- this.data.subscribeData.realname = e.detail.value;
- },
- getMobile: function (e) {//获取用户输入的电话
- this.data.subscribeData.mobile = e.detail.value;
- },
- getCaptcha: function (e) {//获取用户输入的验证码
- this.data.subscribeData.captcha = e.detail.value;
- },
- subscribeFun: function (e) {//预约鉴赏
- if(!this.data.subscribeData.realname){
- wx.showToast({
- title: '请输入姓名',
- icon:"none"
- })
- return;
- }
- if (!this.data.subscribeData.mobile) {
- wx.showToast({
- title: '请输入电话',
- icon: "none"
- })
- return;
- }
- if (!this.data.subscribeData.captcha) {
- wx.showToast({
- title: '请输入验证码',
- icon: "none"
- })
- return;
- }
- if (!this.data.isAgreement) {
- wx.showToast({
- title: '请同意协议',
- icon: 'none'
- })
- return;
- }
- if (!this.data.appointment) {
- return;
- }
- this.data.appointment = false;
- app.wxRequest(app.globalData.urlRoot + "userInfo/submitOrderInfo", this.data.subscribeData, res => {
- this.data.appointment = true;
- if (res.code == 200) {
- wx.showToast({
- title: '预约成功'
- })
- this.data.subscribeData.realname = "";
- this.data.subscribeData.captcha = "";
- this.setData({
- subscribeData: this.data.subscribeData,
- verificationCode: '获取验证码',
- })
- this.setData({
- siteSelect: false
- })
- // this.setData({
- // isRegister: true
- // })
- // app.globalData.isRegister = true;
- app.globalData.userMobile = this.data.subscribeData.mobile;
- } else {
- wx.showToast({
- title: res.msg,
- icon: "none"
- })
- }
- }, this, "POST")
- },
- getUserWxMsg:function(e){//通过微信获取用户信息
- if (e.detail.errMsg == "getUserInfo:ok") {
- this.data.userData.avatarUrl = e.detail.userInfo.avatarUrl;
- this.data.userData.nickName = e.detail.userInfo.nickName;
- this.setData({
- userData: this.data.userData,
- isLogin: true
- })
- app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName);
- }
- },
- getUserInfo:function(e){//获取个人信息
- app.wxRequest(app.globalData.urlRoot + 'userInfo/getUserInfo', {}, res => {
- if (res.code == 200) {
- if (res.data && res.data.avatarUrl) {
- if (!app.globalData.userInfoData.nickName) {
- this.data.userData.avatarUrl = res.data.avatarUrl;
- this.data.userData.nickName = res.data.nickName;
- this.data.userData.userLevel = res.data.userLevel;
- app.globalData.userInfoData = {};
- app.globalData.userInfoData.avatarUrl = res.data.avatarUrl;
- app.globalData.userInfoData.nickName = res.data.nickName;
- app.globalData.userInfoData.userLevel = res.data.userLevel;
- wx.setStorageSync('userInfoData', {
- avatarUrl: res.data.avatarUrl,
- nickName: res.data.nickName,
- userLevel: res.data.userLevel,
- })
- } else if (app.globalData.userInfoData.nickName){
- if (app.globalData.userInfoData.userLevel != res.data.userLevel) {
- this.data.userData.userLevel = res.data.userLevel;
- app.globalData.userInfoData.userLevel = res.data.userLevel;
- wx.setStorageSync('userInfoData', app.globalData.userInfoData);
- }
- if (app.globalData.userInfoData.avatarUrl != res.data.avatarUrl) {
- this.data.userData.avatarUrl = res.data.avatarUrl;
- app.globalData.userInfoData.avatarUrl = res.data.avatarUrl;
- wx.setStorageSync('userInfoData', app.globalData.userInfoData);
- }
- if (app.globalData.userInfoData.nickName != res.data.nickName) {
- this.data.userData.nickName = res.data.nickName;
- app.globalData.userInfoData.nickName = res.data.nickName;
- wx.setStorageSync('userInfoData', app.globalData.userInfoData);
- }
- }
- this.setData({
- userData: this.data.userData
- })
- if (app.globalData.userInfoData.nickName){
- this.setData({
- isLogin: true
- })
- }
- }
- }
- },this)
- },
- getTaskProgress: function () {//获取任务完成度 1每日任务
- app.wxRequest(app.globalData.urlRoot + "task/getTaskProgress", { taskType: this.data.taskNow},res=>{
- if(res.code==200){
- if(res.data){
- for (let i = 0; i < res.data.taskData.length; i++) {
- res.data.taskData[i]['unlockNum'] = 0;
- for (let j = 0; j < res.data.taskData[i].childIdArr.length; j++) {
- if (res.data.taskData[i].childIdArr[j]) {
- res.data.taskData[i]['unlockNum'] += 1;
- }
- }
- }
- this.setData({
- taskList: res.data.taskData
- })
- }
- }
- },this)
- },
- lookDesc:function(e){//查看奖品详情
- var index = e.currentTarget.dataset.index;
- if (this.data.lookPrizeDetail) {
- this.setData({
- lookPrizeDetail: !this.data.lookPrizeDetail
- })
- return;
- }
- if (this.data.recordList[index].awardState == 0 && !this.data.isAddress){
- this.setData({
- mycenterTipWindow:1,
- })
- } else if(this.data.recordList[index].awardState == 0 && this.data.isAddress){
- wx.showToast({
- title:"购车成功后可用",
- icon:"none"
- })
- }else {
- this.setData({
- lookIndex: (index || index == 0) ? this.data.recordList[index] : null,
- lookPrizeDetail: !this.data.lookPrizeDetail
- })
- }
- },
- lookRule: function (e) {//查看奖品详情
- this.setData({
- ruleShow: e.currentTarget.dataset.value
- })
- },
- getShareList: function () {//星探小分队
- this.setData({
- getFriendListState: true
- })
- wx.showLoading({
- title: '获取数据中'
- })
- app.wxRequest(app.globalData.urlRoot + "share/getFriendRegisterList", this.data.parames,res=>{
- wx.hideLoading();
- if(res.code==200){
- for(let i=0;i<res.data.length;i++){
- this.data.shareFriendList.push(res.data[i]);
- }
- this.setData({
- shareFriendList: this.data.shareFriendList
- })
- if (res.data.length<this.data.parames.count){
- this.setData({
- noData: true
- })
- }
- }
- this.setData({
- getFriendListState: false
- })
- },this);
- },
- getOrderInfo: function () {//查询是否已注册
- app.wxRequest(app.globalData.urlRoot + "userInfo/getOrderInfo", {}, res => {
- if (res.code == 200) {
- if (res.data) {
- this.setData({
- isRegister: true
- })
- app.globalData.isRegister = true;
- app.globalData.userMobile = res.data.mobile;
- } else {
- if (app.globalData.userMobile) {
- this.data.subscribeData.mobile = app.globalData.userMobile;
- this.setData({
- phoneInputShow: true,
- subscribeData: this.data.subscribeData
- })
- }
- }
- } else {
- console.log(res.msg)
- }
- }, this);
- },
- scrolltolower:function(){//星探小分队滚动条触底时执行
- if(!this.data.noData){
- this.data.parames.page+=1;
- this.getShareList();
- }
- },
- scrolltolower2:function(){
- if(!this.data.noData2){
- this.data.parames2.page+=1;
- this.getMyAwardList();
- }
- },
- scrolltolower3:function(){
- if(!this.data.noData3){
- this.data.parames3.page+=1;
- this.getMyCouponList();
- }
- },
- getMyAwardList: function () {//获取获奖记录
- this.setData({
- getState:true
- })
- wx.showLoading({
- title: '获取数据中'
- })
- this.data.parames2.awardSource = this.data.recordNow;
- app.wxRequest(app.globalData.urlRoot + "award/getMyAwardList", this.data.parames2, res => {
- wx.hideLoading();
- if(res.code == 200){
- // res.data[0].awardState = 0;
- // res.data = this.data.testData;
- // res.data = [{
- // awardDetailPicContentHeight: 0,
- // awardName: "500元现金", //奖品名称
- // awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
- // couponCode: "我是卡号",//卡号
- // couponSecret:"我是卡密",//卡密
- // dead_date:"我是有效期",//有效期
- // awardState: 1,
- // cdate: "2020-03-23",
- // awardId: 16
- // }]
- // if(this.data.parames2.page<3){
- // for(let i=0;i<20;i++){
- // res.data.push(res.data[0])
- // }
- // }
- for(let i=0;i<res.data.length;i++){
- this.data.recordList.push(res.data[i]);
- }
- this.setData({
- recordList: this.data.recordList
- })
- if (res.data.length<this.data.parames2.count){
- this.setData({
- noData2: true
- })
- }
- }
- this.setData({
- getState: false
- })
- },this)
- },
- getUserPhone: function (e) {//获取用户手机号
- this.setData({
- phoneInputShow: true
- })
- if (e.detail.errMsg == 'getPhoneNumber:ok') {
- app.getMobile(e.detail.encryptedData, e.detail.iv, res => {
- if (res.code == 200) {
- if (res.data && res.data.decodeData){
- this.data.subscribeData.mobile = res.data.decodeData.phoneNumber;
- this.setData({
- subscribeData: this.data.subscribeData
- })
- }
- } else {
- wx.showToast({
- title: res.msg,
- icon: "none"
- })
- }
- }, this);
- }
- },
- addressControl: function () {//跳转到地址管理
- if (app.globalData.userInfoData.nickName) {
- this.data.userData.avatarUrl = app.globalData.userInfoData.avatarUrl;
- this.data.userData.nickName = app.globalData.userInfoData.nickName;
- this.setData({
- userData: this.data.userData
- })
- }
- this.setData({
- addressShow:!this.data.addressShow,
- mycenterTipWindow:0
- })
- if (!this.data.isAddress){
- this.getAddress();
- }
- if(this.data.selectNow==2 && this.data.recordNow == 1 && !this.data.addressShow){
- this.data.parames2.page = 1;
- this.data.noData2 = false;
- this.setData({
- recordList:[]
- })
- this.getMyAwardList();
- }
- if(this.data.selectNow==4 && this.data.couponList.length && !this.data.addressShow){
- this.data.parames3.page = 1;
- this.data.noData3 = false;
- this.setData({
- couponList:[]
- })
- this.getMyCouponList();
- }
- },
- agreementState: function () {//协议
- this.setData({
- isAgreement: !this.data.isAgreement
- })
- },
- agreementControl: function () {
- this.setData({
- agreement: !this.data.agreement
- })
- },
- lookMore:function(){
- wx.navigateTo({
- url: '/pages/moreType/moreType',
- })
- },
- showSite: function () {//显示地址选择框
- if (!this.data.siteSelect) {
- if (!app.globalData.myCenterData) {
- this.getUserLocation();//获取用户当前位置
- }else{
- this.setData({
- siteSelect:true
- })
- }
- }
- },
- placingControl: function () {
- if (app.globalData.getBuyState.success != this.data.buyState) {
- this.setData({
- buyState: app.globalData.getBuyState.success,
- buyStateTime: app.globalData.getBuyState.cdate
- })
- }
- if(this.data.tipWindow2){
- this.setData({
- tipWindow2:false
- })
- }
- this.setData({
- placing: !this.data.placing
- })
- },
- scoutRuleControl:function(){
- this.setData({
- scoutRule: !this.data.scoutRule
- })
- },
- tipWindow:function(){
- this.setData({
- mycenterTipWindow:0
- })
- },
- lookAddress:function(){
- this.addressControl();
- },
- copyExchangeCode:function(){
- var text = this.data.recordList[this.data.lookDescId].couponCode || this.data.recordList[this.data.lookDescId].productCode || "";
- this.contentCopy(text);
- },
- contentCopy:function(text){//内容复制
- wx.setClipboardData({
- data: text
- })
- },
- getAddress: function () {//获取地址
- app.wxRequest(app.globalData.urlRoot + "address/getAddressV2", {}, res => {
- if (res.code == 200) {
- if (res.data) {
- this.data.isAddress = true;
- this.setData({
- mycenterTipWindow:0
- })
- }
- } else {
- wx.showToast({
- title: res.msg,
- icon: "none"
- })
- }
- }, this);
- },
- starGo:function(){//去完成
- wx.reLaunch({
- url: '/pages/star/star',
- })
- },
- enterLucky:function(){
- wx.reLaunch({
- url: '/pages/luckyStar/luckyStar',
- })
- },
- enterEvery:function(){
- wx.navigateTo({
- url: '/pages/everyday/everyday',
- })
- },
- vipDetailControl:function(e){
- var index = e.currentTarget.dataset.index;
- if (!this.data.couponList[index].addressState){
- this.setData({
- mycenterTipWindow:1,
- })
- return;
- }
- this.setData({
- couponListCode:this.data.couponList[index].couponCode?this.data.couponList[index].couponCode:""
- })
- if(this.data.couponList[index].couponId=="175978"){
- this.vipDetailHide();
- }else if(this.data.couponList[index].couponId=="171748"){
- this.machineHide();
- }else if(this.data.couponList[index].couponId=="177275"){
- this.upgradeHide();
- }else if(this.data.couponList[index].couponId=="179478"){
- this.starMoveHide();
- }else if(this.data.couponList[index].couponId=="185379"){
- this.cashHide1();
- }else if(this.data.couponList[index].couponId=="185382"){
- this.cashHide2();
- }
- },
- vipDetailHide:function(){
- this.setData({
- vipDetailShow:!this.data.vipDetailShow
- })
- },
- machineHide:function(){
- this.setData({
- machineShow:!this.data.machineShow
- })
- },
- upgradeHide:function(){
- this.setData({
- upgradeShow:!this.data.upgradeShow
- })
- },
- starMoveHide:function(){
- this.setData({
- starMoveShow:!this.data.starMoveShow
- })
- },
- cashHide1:function(){
- this.setData({
- cash1Show:!this.data.cash1Show
- })
- },
- cashHide2:function(){
- this.setData({
- cash2Show:!this.data.cash2Show
- })
- },
- cardCodeCopy:function(){
- this.contentCopy(this.data.couponListCode);
- },
- lookOrder:function(){//跳转到智趣启辰小程序的订单页面
- // if(this.data.buyState){
- console.log("小程序跳转");
- wx.navigateToMiniProgram({
- appId:'wx1d585c8c2fffe589',
- path:"/activity_module/pages/carorder_info/carorder_info",
- // appId:"wxf712bf8ad7e95b46",
- // path:"/pages/myindex/index",
- success(res) {
- // 打开成功
- },
- complete(res){
- console.log(res);
- }
- })
- // }else{
- // this.tipWindowControl();
- // }
- },
- tipWindowControl:function(){
- this.setData({
- tipWindow2:!this.data.tipWindow2
- })
- },
- enterPoster(){//荐车晋级
- if(this.data.starInfo==200 || app.globalData.isStar){
- if(app.globalData.isStar && app.globalData.isStar.agentDetail){
- wx.navigateTo({
- url: '/pages/poster/poster'
- })
- }else{
- wx.navigateTo({
- url: '/pages/supplement/supplement'
- })
- }
- }else if(this.data.starInfo==-307){
- wx.navigateTo({
- url: '/pages/mobileVerification/mobileVerification'
- })
- }else if(this.data.starInfo==-308){
- wx.navigateTo({
- url: '/pages/scout/register/register'
- })
- }
- },
- phonebolb: function (_phone) {
- app.wxRequest(app.globalData.urlRoot + "userInfo/getCertificationInfoV2", {}, res => {
- this.data.starInfo = res.code;
- if (res.code == 200) {
- app.globalData.isStar = res.data;
- wx.setStorageSync('isStar', res.data);
- app.globalData.authenticationStatus = res.data;
- if (!app.globalData.certificationInfo) {
- app.globalData.certificationInfo = true;
- wx.setStorageSync("certificationInfo", true);
- }
- app.globalData.certificationState = res.data.certificationState;
- }
- }, this);
- }
- })
|