diff --git a/app.js b/app.js index 4cae355..feaffec 100644 --- a/app.js +++ b/app.js @@ -40,33 +40,36 @@ App({ onShow: function(options) { //自助积分 需要openId 且必须写在onshow里面 let _this = this - if (businessSwitch) { - wx.login({ - success: (res) => { - if (wx.getStorageSync('openId')) { - myPluginInterface.getLocation(wx.getStorageSync('openId')).then(res => {}) - } else { - if (res.code) { - let usrdata = { - appId: config.weapp.AppId, - code: res.code, - } - Http.post({ - url: config.api.login, - data: usrdata - }).then(res => { - if (_this.data.businessSwitch) { - myPluginInterface.getLocation(res.data.openId).then(res => { - console.log(res, "我是地理位置") - }) - } - }) - } - } - - } - }) + if (businessSwitch && wx.getStorageSync('openId')){ + myPluginInterface.getLocation(wx.getStorageSync('openId')).then(res => { console.log("商圈位置授权onS") }) } + // if (businessSwitch) { + // wx.login({ + // success: (res) => { + // if (wx.getStorageSync('openId')) { + // myPluginInterface.getLocation(wx.getStorageSync('openId')).then(res => {}) + // } else { + // if (res.code) { + // let usrdata = { + // appId: config.weapp.AppId, + // code: res.code, + // } + // Http.post({ + // url: config.api.login, + // data: usrdata + // }).then(res => { + // if (_this.data.businessSwitch) { + // myPluginInterface.getLocation(res.data.openId).then(res => { + // console.log(res, "我是地理位置") + // }) + // } + // }) + // } + // } + + // } + // }) + // } }, @@ -78,7 +81,7 @@ App({ let that = this; // 登录 wx.login({ - success: ({ + success: ({ code }) => { let usrdata = { @@ -99,8 +102,12 @@ App({ if (res.data.mall){ that.globalData.marketName = res.data.mall.name ? res.data.mall.name : "" } - wx.setStorageSync('openId', res.data.openId) + if (businessSwitch && res.data.openId) { + myPluginInterface.getLocation(res.data.openId).then(res => { console.log("商圈位置授权onL") }).catch(err=>{ + console.log(err,"商圈位置授权onL err") + }) + } that.globalData.mouldType = res.data.mouldType ? res.data.mouldType:0 if (res.data.subMalls) { const squareList = JSON.parse(res.data.subMalls) diff --git a/components/commodityMould/commodityMould.wxml b/components/commodityMould/commodityMould.wxml index 4baa51c..0195757 100644 --- a/components/commodityMould/commodityMould.wxml +++ b/components/commodityMould/commodityMould.wxml @@ -30,7 +30,10 @@ - {{item.title}} + + {{item.title}} + + diff --git a/components/commodityMould/commodityMould.wxss b/components/commodityMould/commodityMould.wxss index 779e06f..d6e05a7 100644 --- a/components/commodityMould/commodityMould.wxss +++ b/components/commodityMould/commodityMould.wxss @@ -1,94 +1,106 @@ -.commBox{ +.commBox { width: 96%; margin: 27rpx auto; background-color: #fff; border-radius: 20rpx; overflow: hidden; } -.titleBox{ + +.titleBox { width: 100%; overflow: hidden; height: 140rpx; background-image: url("https://formall.oss-accelerate.aliyuncs.com/cimg/v20211214/home_icon_d9qt.png"); background-size: 100% 100%; background-repeat: no-repeat; - } -.titleImg{ + +.titleImg { width: 180rpx; height: 40rpx; float: left; margin: 20rpx; display: block; } -.specialTitle{ + +.specialTitle { float: left; margin: 10rpx 20rpx; font-size: 38rpx; font-family: YouSheBiaoTiHei; font-weight: 600; - color: #37332D; + color: #37332d; } -.more{ + +.more { float: right; font-size: 24rpx; font-family: OPPOSans; font-weight: 500; color: #866741; margin: 16rpx 20rpx; - } -.rup{ + +.rup { width: 13rpx; height: 20rpx; - margin: 2rpx 0 0 6rpx + margin: 2rpx 0 0 6rpx; } -.contBox{ + +.contBox { overflow: hidden; /* width: 96%; */ margin: -50rpx auto 0 auto; } -.topImg{ + +.topImg { width: 100%; height: 140rpx; border-radius: 16rpx; margin-bottom: 40rpx; /* background-color: chartreuse; */ } -.topImg image{ + +.topImg image { border-radius: 16rpx; width: 100%; height: 100%; } -.itemBox{ + +.itemBox { overflow: hidden; display: -webkit-box; overflow-x: scroll; -webkit-overflow-scrolling: touch; margin: 20rpx auto; - width: 96% + width: 96%; } + .itemBox::-webkit-scrollbar { - display: none; + display: none; } -.item{ + +.item { width: 240rpx; /* background-color: antiquewhite; */ margin-right: 20rpx; } -.itemImg{ + +.itemImg { position: relative; width: 240rpx; height: 240rpx; - border-radius: 16rpx ; + border-radius: 16rpx; /* background-color: aquamarine; */ } -.itemImg image{ + +.itemImg image { width: 100%; height: 100%; border-radius: 16rpx; } -.sellout{ + +.sellout { position: absolute; top: 0; left: 0; @@ -98,66 +110,86 @@ border-radius: 20rpx; } -.selloutImg{ +.selloutImg { width: 195rpx !important; height: 154rpx !important; margin: 18% auto; - display: block + display: block; +} + +.titleNameBox { + /* font-size: 18px; */ + height: 80rpx; + line-height: 40rpx; + display: flex; + align-items: center; + justify-content: center; } -.titleName{ - width:100%; +.titleName { + width: 100%; font-size: 28rpx; font-family: OPPOSans; font-weight: 500; - color: #333333; + color: #333; + margin-top: 10rpx; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; - white-space: nowrap; - margin-top: 10rpx } -.priceBox{ + +.priceBox { overflow: hidden; margin: 10rpx 0; } -.f{ + +.f { float: left; } -.r{ - float:right; + +.r { + float: right; } -.sellingBox{ - overflow: hidden + +.sellingBox { + overflow: hidden; } -.fuhao{ - color: #DF2D2D; + +.fuhao { + color: #df2d2d; font-size: 24rpx; float: left; font-family: OPPOSans; /* font-weight: bold; */ - margin-top: 10rpx + margin-top: 10rpx; } -.int{ + +.int { float: left; font-size: 36rpx; font-family: OPPOSans; font-weight: bold; - color: #DF2D2D; + color: #df2d2d; } -.originalBox{ - overflow: hidden + +.originalBox { + overflow: hidden; } -.origina{ + +.origina { text-align: right; font-size: 24rpx; font-family: OPPOSans; font-weight: 400; text-decoration: line-through; - color: #999999; + color: #999; margin-top: 10rpx; margin-right: 10rpx; } -.countBox{ + +.countBox { width: 100%; height: 46rpx; background-image: url("https://formall.oss-accelerate.aliyuncs.com/cimg/v20211214/home_icon_bq.png"); @@ -167,57 +199,60 @@ line-height: 46rpx; overflow: hidden; } -.countText{ + +.countText { font-size: 22rpx; font-family: OPPOSans; font-weight: 400; - color: #999999; - background: linear-gradient(180deg, #DCB07D 0%, #F5E0BF 100%); + color: #999; + background: linear-gradient(180deg, #dcb07d 0%, #f5e0bf 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-left: 8rpx; } -.countDate{ + +.countDate { font-size: 24rpx; font-family: OPPOSans; font-weight: bold; - color: #4C3820; + color: #4c3820; margin-right: 8rpx; } -.moreItem{ - background: #F7F7F7; + +.moreItem { + background: #f7f7f7; border-radius: 8px; } -.noDataImg{ + +.noDataImg { width: 160rpx; height: 160rpx; margin: 25% auto 5% auto; - } -.noDataImg image{ + +.noDataImg image { width: 100%; - height: 100% + height: 100%; } -.noDataText{ + +.noDataText { text-align: center; font-size: 22rpx; font-family: OPPOSans; font-weight: 500; - color: #999999; - + color: #999; } - -.product{ +.product { width: 96%; height: 140rpx; margin: 30rpx auto 10rpx; border-radius: 16rpx; overflow: hidden; } -.product image{ +.product image { height: 100%; display: block; width: 100%; -} \ No newline at end of file +} diff --git a/components/gameentry/gentry.js b/components/gameentry/gentry.js index b55d916..78a5c58 100644 --- a/components/gameentry/gentry.js +++ b/components/gameentry/gentry.js @@ -1,6 +1,7 @@ // pages/index/sw/index.js const Http = require("../../utils/HttpBasics"); var config = require("../../config/config.js"); +let app = getApp(); Component({ properties: { gamedata: { @@ -17,41 +18,62 @@ Component({ gotogame: function (e) { let that=this; Http.get({ - url: config.api.checkPhoneStatus, - data: {} - }) - .then(res => { - var data = { - couponChannelId: "" + that.data.couponChannelId, - couponId: "" + that.data.couponId - }; - if (that.data.couponChannelId == null) { + url: config.api.checkUserStatus, + data: { + token: app.globalData.token + } + }).then(res1 => { + Http.get({ + url: config.api.checkPhoneStatus, + data: {} + }).then(res => { var data = { + couponChannelId: "" + that.data.couponChannelId, couponId: "" + that.data.couponId }; - } - wx.navigateTo({ - url: '/pages/game/index?url=' + e.target.dataset.data.url + "&id=" + e.target.dataset.data.id + "&gameId=" + e.target.dataset.data.gameId, - }) - }) - .catch(err => { - if (err.code == 11005) { - // 用户手机未授权 - /** - * 将值传到用户手机号授权的页面 - * - */ + if (that.data.couponChannelId == null) { + var data = { + couponId: "" + that.data.couponId + }; + } wx.redirectTo({ - url: "/pages/getphoneInfo/index?path=index&url=" + e.target.dataset.data.url + "&id=" + e.target.dataset.data.id + "&gameId=" + e.target.dataset.data.gameId - }); - } else if (err.code == 11006){ - // 用户手机已加密 + url: '/pages/game/index?url=' + e.target.dataset.data.url + "&id=" + e.target.dataset.data.id + "&gameId=" + e.target.dataset.data.gameId, + }) + }).catch(err => { + if (err.code == 11005) { + // 用户手机未授权 + /** + * 将值传到用户手机号授权的页面 + * + */ + app.globalData.skipUrl = '/pages/game/index?url=' + e.target.dataset.data.url + "&id=" + e.target.dataset.data.id + "&gameId=" + e.target.dataset.data.gameId, + app.globalData.skip = 'redirectTo' + wx.redirectTo({ + url: "/pages/getphoneInfo/index?path=index&url=" + e.target.dataset.data.url + "&id=" + e.target.dataset.data.id + "&gameId=" + e.target.dataset.data.gameId, + }); + } else if (err.code == 11006) { + // 用户手机已加密 + wx.redirectTo({ + url: "/pages/phoneinput/phoneinput?path=index&url=" + e.target.dataset.data.url + "&id=" + e.target.dataset.data.id + "&gameId=" + e.target.dataset.data.gameId, + }); + } else { + wx.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + } + }) + }).catch(err => { + if (err.code == 11004) { //未授权微信 + app.globalData.type = 'gm' wx.redirectTo({ - url: "/pages/phoneinput/phoneinput?path=index&url=" + e.target.dataset.data.url + "&id=" + e.target.dataset.data.id + "&gameId=" + e.target.dataset.data.gameId + url: "/pages/getuserinfo/index?path=index&url=" + e.target.dataset.data.url + "&id=" + e.target.dataset.data.id + "&gameId=" + e.target.dataset.data.gameId, }); - }else { + } else { wx.showToast({ - title: err.errMsg, + title: err.message, icon: 'none', duration: 2000, mask: false diff --git a/components/optimization/optimization.wxss b/components/optimization/optimization.wxss index a6f5119..976d6c4 100644 --- a/components/optimization/optimization.wxss +++ b/components/optimization/optimization.wxss @@ -1,5 +1,6 @@ .optimizationBox { - overflow: hidden; + /* overflow: hidden; */ + margin-top: 20rpx; } .titleImg { @@ -86,15 +87,16 @@ .contBox{ background: linear-gradient(0deg, #F5F5F5, #fff); - overflow: hidden; + height: 350rpx; } .contLsitBox{ width: 96%; - margin: 0 auto; + margin: 0 auto ; display: flex; overflow: hidden; justify-content: space-between; flex-wrap: wrap; + padding-bottom: 170rpx; } .item{ diff --git a/config/config.js b/config/config.js index 4c64dc8..bbba3cb 100755 --- a/config/config.js +++ b/config/config.js @@ -61,7 +61,7 @@ var config = { /** * 商户优惠信息 */ - listByMerchant: "/wxCouponChannel/listByMerchant", + listByMerchant: "/wxCouponChannel/listByMerchant", /** * 优惠券详情 */ @@ -89,7 +89,7 @@ var config = { /** * 频道查询 */ - couponChannelList: "/wxCouponChannel/list", + couponChannelList: "/wxCouponChannel/list", /** * 换一换change */ diff --git a/ext.json b/ext.json index 0f043d1..248639b 100644 --- a/ext.json +++ b/ext.json @@ -1,7 +1,14 @@ { "ext": { "attr": { - "mchId": "1602801645", + "car": { + "etcp": { + "etcpAppId": "wx192b7d2e8dcbefd0", + "etcpVersion": "release", + "etcpCallbackUrl": "https://admintest.malls.iformall.com/api/carCallback/etcpPaidCallback" + } + }, + "mchId": "1604439800", "imgProxy": [ { "newUrl": "https://ctest.malls.iformall.com/img", @@ -17,14 +24,12 @@ } ], "configUrl": "https://ctest.malls.iformall.com/C/api", - "etcpAppId": "wx9f3a77763caa7c89", - "etcpVersion": "release", - "etcpCallbackUrl": "https://admintest.malls.iformall.com/api/carCallback/etcpPaidCallback", + "businessSwitch": "1", "ifHaveWebSocket": "0", "ifHaveCarModular": "1" }, - "name": "富茂望京测试版", - "weappId": "wx9f3a77763caa7c89", + "name": "金泸商务", + "weappId": "wx649b3be73c1afe47", "appVersion": "C.test.5.2.0" }, "debug": false, @@ -65,12 +70,16 @@ "navigationBarBackgroundColor": "#FFFFFF" }, "plugins": { + "auto-points-plugin": { + "version": "1.3.0", + "provider": "wxfab2bf944bfc4da6" + }, "live-player-plugin": { "version": "1.2.5", "provider": "wx2b03c6e691cd7370" } }, - "extAppid": "wx9f3a77763caa7c89", + "extAppid": "wx649b3be73c1afe47", "extEnable": true, "permission": { "scope.userLocation": { diff --git a/index/index.js b/index/index.js index 8321af8..05642b9 100644 --- a/index/index.js +++ b/index/index.js @@ -2,7 +2,7 @@ const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {} let ifStoreApp = extConfig.attr.ifStoreApp; let businessSwitch = extConfig.attr.businessSwitch let mch_id = extConfig.attr.mchId -const navigationBarHeight = (getApp().statusBarHeight + 44)+"px" +const navigationBarHeight = (getApp().statusBarHeight + 44) + "px" const Http = require("../utils/HttpBasics"); const imgurl = require("../utils/imgurl"); const config = require("../config/config"); @@ -12,27 +12,28 @@ const bgColor = require("../utils/bgColor.js") let app = getApp(); Page({ data: { - aa: (app.statusBarHeight+ 34) + "rpx", - noDataFlag:false, - busineKye:0, - businePageNum:1, - businessList:[],//优选好物导航 - businessData: [],//优选好物数据 - topicObj2: null,//欢乐城首页限时抢购 - topicObj3: null,//欢乐城首页砍价 - topicObj4: null,//欢乐城首页拼团 - topicObj5: null,//欢乐城首页消费卡 - topicObj6: null,//欢乐城首页积分商城 - specialLsit:[],//欢乐城首页专题 - marketName:"",//商场名称 - mouldType:0, + aa: (app.statusBarHeight + 34) + "rpx", + noDataFlag: false, + busineKye: 0, + businePageNum: 1, + credit: 0, + businessList: [], //优选好物导航 + businessData: [], //优选好物数据 + topicObj2: null, //欢乐城首页限时抢购 + topicObj3: null, //欢乐城首页砍价 + topicObj4: null, //欢乐城首页拼团 + topicObj5: null, //欢乐城首页消费卡 + topicObj6: null, //欢乐城首页积分商城 + specialLsit: [], //欢乐城首页专题 + marketName: "", //商场名称 + mouldType: 0, navLineHeight: ((app.statusBarHeight + app.statusBarHeight) + 44) + "px", huanlechengImgurl: "https://formall.oss-accelerate.aliyuncs.com/cimg/v20211214/", mch_id: mch_id, - goUrl:"",//商圈跳转链接 - accreditFlag:1,//1是未授权微信且未授权手机号 2授权了微信 没授权手机号 3微信和手机号都授权了 + goUrl: "", //商圈跳转链接 + accreditFlag: 1, //1是未授权微信且未授权手机号 2授权了微信 没授权手机号 3微信和手机号都授权了 businessSwitch: businessSwitch, - typeLsit:{}, + typeLsit: {}, showLocationIf: true, ifStoreApp: ifStoreApp, navigationBarTitle: '首页', @@ -107,17 +108,17 @@ Page({ liveFlag: 0, //直播按钮显隐标志位 squareName: "", //当前广场 isShowSqare: false, - moduleList:[],//按钮列表 + moduleList: [], //按钮列表 }, - getBusineData(e){ + getBusineData(e) { this.setData({ - businePageNum:1, + businePageNum: 1, busineKye: e.detail, - noDataFlag:false, + noDataFlag: false, }) this.getCouponChannelList(e.detail) }, - getBusinessList(){//获取优选导航 + getBusinessList() { //获取优选导航 Http.get({ url: config.api.businessList, data: { @@ -125,31 +126,35 @@ Page({ } }).then(res => { this.setData({ - businessList: [{ id: 0, title: "全部", type: 1 }].concat(res.data) + businessList: [{ + id: 0, + title: "全部", + type: 1 + }].concat(res.data) }); - }).catch(err=>{ + }).catch(err => { wx.showModal({ title: '提示', - content: err.message ? err.message:err.data, + content: err.message ? err.message : err.data, showCancel: false }) }) }, - getCouponChannelList(key){ + getCouponChannelList(key) { if (this.data.noDataFlag) { return } wx.showLoading({ title: "加载中" }); - let param={} - if (key==0){ + let param = {} + if (key == 0) { param = { pageNum: this.data.businePageNum, pageSize: 6, targetAd: 1 } - }else{ + } else { param = { pageNum: this.data.businePageNum, pageSize: 6, @@ -158,39 +163,39 @@ Page({ } } - + Http.get({ url: config.api.couponChannelList, data: param - }).then(res=>{ - if (res.data.list.length==0){ - this.setData({ - noDataFlag:true + }).then(res => { + if (res.data.list&&res.data.list.length != 0) { + + let tempLsit = this.data.businessData + let data = res.data.list + data.map(item => { + if (item.salePriceStr && item.salePriceStr.indexOf('.') != -1) { + let str = item.salePriceStr.split('.') + item.salePriceStrQ = str[0] + item.salePriceStrH = str[1] + } + item.sale = item.inventory - item.remainInventory }) - } - - let tempLsit = this.data.businessData - let data = res.data.list - data.map(item => { - if (item.salePriceStr && item.salePriceStr.indexOf('.') != -1) { - let str = item.salePriceStr.split('.') - item.salePriceStrQ = str[0] - item.salePriceStrH = str[1] - } - item.sale = item.inventory - item.remainInventory - }) - if (this.data.businePageNum>1){ - this.setData({ - businessData: [...tempLsit, ...data] - }) + if (this.data.businePageNum > 1) { + this.setData({ + businessData: [...tempLsit, ...data] + }) + } else { + this.setData({ + businessData: data + }) + } }else{ this.setData({ - businessData: data + noDataFlag: true }) } wx.hideLoading(); - }).catch(err => { wx.hideLoading(); wx.showModal({ @@ -200,27 +205,27 @@ Page({ }) }) }, - goPage(e){ + goPage(e) { let obj = e.currentTarget.dataset.obj - console.log(obj,"obj") - if (obj.linkType==1){ - if (obj.linkUrl =="/pages/game/index"){ + console.log(obj, "obj") + if (obj.linkType == 1) { + if (obj.linkUrl == "/pages/game/index") { this.gotogame() - }else{ - + } else { + wx.navigateTo({ url: obj.linkUrl, - + }) } //小程序内部跳转 - }else if(obj.linkType==2){ + } else if (obj.linkType == 2) { //跳转到外部小程序 wx.navigateToMiniProgram({ appId: obj.outLinkAppid, path: obj.linkUrl ? obj.linkUrl : '', - fail:err=>{ + fail: err => { wx.showModal({ title: '提示', content: err, @@ -231,87 +236,87 @@ Page({ } }, //获取按钮列表 - getModule(){ + getModule() { Http.get({ url: config.api.wxCustomizeModule - }).then(res=>{ + }).then(res => { this.setData({ moduleList: res.data, }) - }).catch(err=>{ - if (err.status!=404) - wx.showModal({ - title: '提示', - content: err.message ? err.message:err.data, - showCancel: false - }) + }).catch(err => { + if (err.status != 404) + wx.showModal({ + title: '提示', + content: err.message ? err.message : err.data, + showCancel: false + }) }) }, //判断用户是否授权 - uesrInfo(){ + uesrInfo() { Http.get({ url: config.api.checkUserStatus, data: { token: app.globalData.token } }).then(res => { - Http.get({ - url: config.api.checkPhoneStatus - }).then(res=>{//全部授权 - this.setData({ - accreditFlag: 3 - }) - }).catch(err => { - if(err.code==11005){//未授权手机号 - this.setData({ - accreditFlag: 2 - }) - }else{ - wx.showToast({ - title: err.message, - icon: 'none', - duration: 2000, - mask: false - }); - } - }) - }).catch (err => { - if(err.code==11004){//未授权微信 + Http.get({ + url: config.api.checkPhoneStatus + }).then(res => { //全部授权 this.setData({ - accreditFlag:1 + accreditFlag: 3 }) - }else{ + }).catch(err => { + if (err.code == 11005) { //未授权手机号 + this.setData({ + accreditFlag: 2 + }) + } else { wx.showToast({ title: err.message, icon: 'none', duration: 2000, mask: false }); - } + } + }) + }).catch(err => { + if (err.code == 11004) { //未授权微信 + this.setData({ + accreditFlag: 1 + }) + } else { + wx.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + } }) }, //获取当前广场名 //跳转到每日签到 - goSign(){ + goSign() { wx.navigateTo({ url: '/pages/activityCalendar/activityCalendar', }) }, //活动日历 - goCalendar(){ + goCalendar() { wx.navigateTo({ url: '/pages/dateLsit/dateLsit', }) }, //跳转到其他广场列表 goSquareList() { - if (this.data.isShowSqare){ + if (this.data.isShowSqare) { wx.navigateTo({ url: '/pages/location/location', }) } - + }, goLive() { wx.navigateTo({ @@ -373,7 +378,7 @@ Page({ swiperCurrent: e.detail.current }); }, - gotogame: function() { + gotogame: function() { let that = this; if (!that.data.showIf) { wx.showToast({ @@ -383,10 +388,16 @@ Page({ }) } else { Http.get({ + url: config.api.checkUserStatus, + data: { + token: app.globalData.token + } + }).then(res1 => { + app.globalData.type = 'gm' + Http.get({ url: config.api.checkPhoneStatus, data: {} - }) - .then(res => { + }).then(res => { var data = { couponChannelId: "" + that.data.couponChannelId, couponId: "" + that.data.couponId @@ -399,14 +410,15 @@ Page({ wx.redirectTo({ url: '/pages/game/index?url=' + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId, }) - }) - .catch(err => { + }).catch(err => { if (err.code == 11005) { // 用户手机未授权 /** * 将值传到用户手机号授权的页面 * */ + app.globalData.skipUrl = '/pages/game/index?url=' + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId, + app.globalData.skip = 'redirectTo' wx.redirectTo({ url: "/pages/getphoneInfo/index?path=index&url=" + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId, }); @@ -424,6 +436,22 @@ Page({ }); } }) + }).catch(err => { + if (err.code == 11004) { //未授权微信 + app.globalData.type = 'gm' + wx.redirectTo({ + url: "/pages/getuserinfo/index?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 + }); + } + }) + } }, @@ -451,13 +479,16 @@ Page({ getType() { Http.get({ url: config.api.setType, - data:{ + data: { mouldType: app.globalData.mouldType } - }).then(res=>{ - const{code ,data}=res - if(code==200){ - app.globalData.typeLsit=data + }).then(res => { + const { + code, + data + } = res + if (code == 200) { + app.globalData.typeLsit = data this.setData({ typeLsit: data, }) @@ -497,7 +528,7 @@ Page({ //获取条形码 // util.barcode("barcode", optionss.quancode, 510, 100); // console.log(Http.headers.token, "?") - + }, /** * 获得经纬度 @@ -527,42 +558,50 @@ Page({ }, onUnload() { // wx.removeStorageSync('squareList') - + }, // 初始换底部导航栏 - setTabStyle: function () { + setTabStyle: function() { this.getTabBar().setData({ selectedColor: `${app.globalData.styleLsit.t_in_std.styleClass}`, list: [{ - "pagePath": "/index/index", - "iconPath": `${app.globalData.styleLsit.t_in.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_in_std.icon}`, - "text": "首页" - }, - { - "pagePath": "/index/searchbar", - "iconPath": `${app.globalData.styleLsit.t_md.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_md_std.icon}`, - "text": "门店" - }, - { - "pagePath": "/index/passCar", - "iconPath": `${app.globalData.styleLsit.t_tc.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_tc_std.icon}`, - "text": "停车" - }, - { - "pagePath": "/index/user", - "iconPath": `${app.globalData.styleLsit.t_uc.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_uc_std.icon}`, - "text": "我的" - } + "pagePath": "/index/index", + "iconPath": `${app.globalData.styleLsit.t_in.icon}`, + "selectedIconPath": `${app.globalData.styleLsit.t_in_std.icon}`, + "text": "首页" + }, + { + "pagePath": "/index/searchbar", + "iconPath": `${app.globalData.styleLsit.t_md.icon}`, + "selectedIconPath": `${app.globalData.styleLsit.t_md_std.icon}`, + "text": "门店" + }, + { + "pagePath": "/index/passCar", + "iconPath": `${app.globalData.styleLsit.t_tc.icon}`, + "selectedIconPath": `${app.globalData.styleLsit.t_tc_std.icon}`, + "text": "停车" + }, + { + "pagePath": "/index/user", + "iconPath": `${app.globalData.styleLsit.t_uc.icon}`, + "selectedIconPath": `${app.globalData.styleLsit.t_uc_std.icon}`, + "text": "我的" + } ], }) }, onShow: function() { - console.log(app.globalData.mouldType,"mouldType") + console.log(app.globalData.mouldType, "mouldType") + if (app.globalData.token) { + this.getmemberId(app.globalData.token); + } else { + app.tokenCallback = token => { + this.getmemberId(app.globalData.token); + } + } + this.setData({ mouldType: app.globalData.mouldType, marketName: app.globalData.marketName, @@ -575,11 +614,11 @@ Page({ goUrl: `plugin://auto-points-plugin/index?openid=${openId}&mch_id=${this.data.mch_id}` }) } - - if(JSON.stringify(app.globalData.styleLsit)!="{}"){ + + if (JSON.stringify(app.globalData.styleLsit) != "{}") { this.setTabStyle() } - + this.ifShowSqare(); if (wx.getStorageSync("squareList") && wx.getStorageSync("selectedMall")) { var temp = wx.getStorageSync("squareList").filter(item => item.tenantId == wx.getStorageSync("selectedMall"))[0].name @@ -625,12 +664,14 @@ Page({ setTimeout(function() { that.alphaClick(); }, 8000) - // 如果有广告 + // 如果有广告 setTimeout(function() { // debugger that.alphaClick1(); }, 8000) }, + + getmemberId: function(token) { let that = this; Http.get({ @@ -644,6 +685,7 @@ Page({ upgradePercent: res.data.upgradePercent, upgradeScore: res.data.upgradeScore, memberId: res.data.id, + credit: res.data.credit, }) }) .catch(err => { @@ -659,7 +701,7 @@ Page({ url: '/pages/czdetail/czdetail', }) }, - goIntegralmall(){ + goIntegralmall() { wx.navigateTo({ url: '/pages/integralmall/index', }) @@ -706,15 +748,15 @@ Page({ getWeapNote: function(couponChannelId, couponId, orderId) { var that = this; - if (app.globalData.token) { + if (app.globalData.token) { // 登录 console.log(app.globalData.token) that.getmemberId(app.globalData.token); that.getBannerlist(); - if(that.data.mouldType==0){//富茂原版 + if (that.data.mouldType == 0) { //富茂原版 that.topicShow(); that.getxsList(); - } else if (that.data.mouldType == 1){//欢乐城模板 + } else if (that.data.mouldType == 1) { //欢乐城模板 that.getShowList() that.topicShowall(2); that.topicShowall(3); @@ -724,8 +766,8 @@ Page({ that.getBusinessList(); that.getCouponChannelList(0) } - - + + that.getType() // that.uesrInfo() that.getLocation(); @@ -777,10 +819,10 @@ Page({ console.log(app.globalData.token) that.getmemberId(app.globalData.token); that.getBannerlist(); - if (that.data.mouldType == 0) {//富茂原版 + if (that.data.mouldType == 0) { //富茂原版 that.topicShow(); that.getxsList(); - } else if (that.data.mouldType == 1) {//欢乐城模板 + } else if (that.data.mouldType == 1) { //欢乐城模板 that.getShowList() that.topicShowall(2); that.topicShowall(3); @@ -976,13 +1018,13 @@ Page({ }); }, //获取欢乐城专题 - getShowList(){ + getShowList() { Http.get({ url: config.api.showList - }).then(res=>{ + }).then(res => { let tempData = res.data - tempData.map(item1=>{ - if (item1.couponList){ + tempData.map(item1 => { + if (item1.couponList) { item1.couponList.map(item2 => { if (item2.salePriceStr && item2.salePriceStr.indexOf('.') != -1) { let str = item2.salePriceStr.split('.') @@ -991,11 +1033,11 @@ Page({ } }) } - + }) this.setData({ - specialLsit:res.data?res.data:[] - + specialLsit: res.data ? res.data : [] + }) }).catch(err => { wx.showToast({ @@ -1013,17 +1055,17 @@ Page({ * topicType=5 消费卡 * topicType=6 积分商城 */ - topicShowall(topicType){ + topicShowall(topicType) { Http.get({ url: config.api.topicShow, - data:{ + data: { topicType } - }).then(res=>{ - + }).then(res => { + let data = res.data - if (data.couponList != null && data.couponList.length > 0){ + if (data.couponList != null && data.couponList.length > 0) { data.couponList.map(item => { if (item.salePriceStr && item.salePriceStr.indexOf('.') != -1) { let str = item.salePriceStr.split('.') @@ -1032,13 +1074,13 @@ Page({ } }) } - - if (topicType==2){ + + if (topicType == 2) { let tempData = data this.setData({ - topicObj2:data + topicObj2: data }) - } else if (topicType == 3){ + } else if (topicType == 3) { this.setData({ topicObj3: data }) @@ -1056,9 +1098,9 @@ Page({ }) } - }).catch(err=>{ + }).catch(err => { wx.showToast({ - title: err.message ? err.message:err.data, + title: err.message ? err.message : err.data, icon: 'none', duration: 2000, mask: false @@ -1168,7 +1210,7 @@ Page({ }, //浮层广告 getGg: function(token) { - + let that = this Http.get({ url: config.api.getGg, @@ -1208,14 +1250,14 @@ Page({ */ onPullDownRefresh: function(e) { this.setData({ - topicObj2: null,//欢乐城首页限时抢购 - topicObj3: null,//欢乐城首页砍价 - topicObj4: null,//欢乐城首页拼团 - topicObj5: null,//欢乐城首页消费卡 - topicObj6: null,//欢乐城首页积分商城 + topicObj2: null, //欢乐城首页限时抢购 + topicObj3: null, //欢乐城首页砍价 + topicObj4: null, //欢乐城首页拼团 + topicObj5: null, //欢乐城首页消费卡 + topicObj6: null, //欢乐城首页积分商城 }) let that = this; - that.getWeapNote(); + // that.getWeapNote(); that.setData({ page: 1 }) @@ -1224,7 +1266,7 @@ Page({ } else { this.getWeapNote() } - if (that.selectComponent("#lists")){ + if (that.selectComponent("#lists")) { if (that.data.code == 0 || that.data.code == undefined) { that.selectComponent("#lists").getList(0, 1, "refresh"); wx.stopPullDownRefresh(); @@ -1234,14 +1276,14 @@ Page({ }; that.selectComponent("#hot").getList(); } - + // 砍价下拉刷新 // that.selectComponent("#bargain").getList(); // that.selectComponent("#spellGroup").getList(); // that.selectComponent("#rushtobyCard").getList(); wx.stopPullDownRefresh(); //爆款专区下拉刷新 - + that.getxsList(); that.topicShow(); }, @@ -1252,11 +1294,11 @@ Page({ that.data.page++; that.setData({ page: that.data.page, - businePageNum: that.data.businePageNum+1 + businePageNum: that.data.businePageNum + 1 }); console.log("加载更多页数" + that.data.page, ); console.log("加载更多key" + that.data.code); - if (that.data.mouldType==0){//富茂源模板 + if (that.data.mouldType == 0) { //富茂源模板 //父组件获得子组件的方法 //如果code == 0 if (that.data.code == 0 || that.data.code == undefined) { @@ -1264,16 +1306,17 @@ Page({ } else { that.selectComponent("#lists").getList(that.data.code, that.data.page); } - }else if(that.data.mouldType==1){ + } else if (that.data.mouldType == 1) { this.getCouponChannelList(that.data.busineKye) } - + }, + // 用户点击右上角分享 onShareAppMessage: function() { app.globalData.previewFlag = true return { - path:"/pages/index/index", + path: "/pages/index/index", title: this.data.weappShareTitle, imageUrl: this.data.weappShareCoverImg, success: function(res) { diff --git a/index/index.wxml b/index/index.wxml index 365b0f2..cbde9c7 100644 --- a/index/index.wxml +++ b/index/index.wxml @@ -142,7 +142,7 @@ {{levelName}} - 积分:4554 + 积分:{{credit}} diff --git a/index/index.wxss b/index/index.wxss index c6e2d6a..1483d12 100644 --- a/index/index.wxss +++ b/index/index.wxss @@ -3,7 +3,11 @@ page { background: #f4f5f9; } - +.temp{ + width: 100rpx; + height: 100rpx; + background-color: darkcyan +} .xia { width: 24rpx; height: 14rpx; diff --git a/index/passCar.js b/index/passCar.js index 0fc5ff2..88c7fc8 100644 --- a/index/passCar.js +++ b/index/passCar.js @@ -1,4 +1,3 @@ - const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px' const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {} let app = getApp(); @@ -20,7 +19,7 @@ Page({ cheUrl: imgurl.che.url, jiaofei: imgurl.jiaofei.url, wentiHr: imgurl.wentiHr.url, - stopThat: imgurl.stopThat.url, + stopThat: imgurl.stopThat.url, park: null, carList: [], payList: [], @@ -41,7 +40,7 @@ Page({ canIUse: wx.canIUse("navigator"), showTicketModal: false, ticketList: [], - noCoupon:imgurl.noCoupon.url, + noCoupon: imgurl.noCoupon.url, loadingUrl: imgurl.loading.url, allow_load: true, curPageNum: 1, @@ -51,21 +50,21 @@ Page({ quanid: '', gouHr: imgurl.gouHr.url, totalTicketNum: 0, - remark:'', - generalPayPath:'', - generalExtraData:{}, + remark: '', + generalPayPath: '', + generalExtraData: {}, }, getMoreList(e) { let totalNum = this.data.ticketList.length; if (this.data.curPageNum < this.data.curTotalpageNum) { this.setData({ - curPageNum: this.data.curPageNum+1 + curPageNum: this.data.curPageNum + 1 }) - this.getTicketList(0 ,this.data.curPageNum); + this.getTicketList(0, this.data.curPageNum); } - + }, - /** + /** * 选择使用的优惠券 */ choicecoupon: function(e) { @@ -87,7 +86,7 @@ Page({ } } }) - + }, /* */ @@ -98,78 +97,77 @@ Page({ title: "加载中" }); Http.get({ - url: config.api.couponOrderCarList, - data: { - pageNum: pageNum, - pageSize: 15, - couponOrderStatus: key - } - }).then(res => { - that.setData({ - curTotalpageNum: res.data.pages, - curPageNum: res.data.pageNum, - totalTicketNum: res.data.total - }) - res.data.list.map(file => { - file.expiredTime = format.formatTime( - file.expiredTime, - "yyyy-MM-dd hh:mm:ss" - ); - }); - setTimeout(function () { - wx.hideLoading(); - }, 1200); - if (pageNum >= res.data.pages) { - that.setData({ - allow_load: false - }); - } - /** - * 先赋值后渲染页面 - * concat 不会改变原数组值 - * push 会改变原数组值,但不会一条一条插入,而是整个数组插入 - */ - if (pageNum == 1) { - that.setData({ - ticketList: res.data.list, - curPageNum: pageNum - }); - } else { + url: config.api.couponOrderCarList, + data: { + pageNum: pageNum, + pageSize: 15, + couponOrderStatus: key + } + }).then(res => { that.setData({ - ticketList: that.data.ticketList.concat(res.data.list) + curTotalpageNum: res.data.pages, + curPageNum: res.data.pageNum, + totalTicketNum: res.data.total + }) + res.data.list.map(file => { + file.expiredTime = format.formatTime( + file.expiredTime, + "yyyy-MM-dd hh:mm:ss" + ); }); - } - // that.data.ticketList = that.data.ticketList.concat(res.data.list); - - wx.hideLoading(); - }) - .catch(err => { - setTimeout(function () { + setTimeout(function() { + wx.hideLoading(); + }, 1200); + if (pageNum >= res.data.pages) { + that.setData({ + allow_load: false + }); + } + /** + * 先赋值后渲染页面 + * concat 不会改变原数组值 + * push 会改变原数组值,但不会一条一条插入,而是整个数组插入 + */ + if (pageNum == 1) { + that.setData({ + ticketList: res.data.list, + curPageNum: pageNum + }); + } else { + that.setData({ + ticketList: that.data.ticketList.concat(res.data.list) + }); + } + // that.data.ticketList = that.data.ticketList.concat(res.data.list); + wx.hideLoading(); - }, 1200); - wx.showToast({ - title: err.errMsg, - icon: 'none', - duration: 2000, - mask: false - }); - }) - } else { - } + }) + .catch(err => { + setTimeout(function() { + wx.hideLoading(); + }, 1200); + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) + } else {} }, //点击跳转到券详情页面 - gotouse: function (e) { + gotouse: function(e) { wx.navigateTo({ url: `/pages/passCar/couponDetail/couponDetail?quancode=${ e.currentTarget.dataset.quancode }`, - success: function (res) { + success: function(res) { // success }, - fail: function () { + fail: function() { // fail }, - complete: function () { + complete: function() { // complete } }); @@ -177,7 +175,7 @@ Page({ /** * 车牌轮播滑动 */ - onSlideChangeEnd: function (e) { + onSlideChangeEnd: function(e) { var that = this; /** * 获得当前的车牌号码 @@ -195,7 +193,7 @@ Page({ }, //停车费用为0 - paySuccess: function () { + paySuccess: function() { wx.showModal({ title: '支付成功', content: '请15分钟内离场', @@ -203,28 +201,28 @@ Page({ }) }, - gotomange: function () { + gotomange: function() { wx.navigateTo({ url: '/pages/managelicenseplate/managelicenseplate', }) }, - bindfail: function (res) { + bindfail: function(res) { console.log(123) console.log(res) }, - gotoCarMini: function (e) { + gotoCarMini: function(e) { console.log(478) var that = this // etcp parkVendor1 // 泊链停车 parkVendor5 - if (e.target.dataset.flag == 'parkVendor1'){ + if (e.target.dataset.flag == 'parkVendor1') { wx.navigateToMiniProgram({ appId: that.data.etcpAppId, extraData: that.data.extraData, envVersion: that.data.carMiniVersion, path: that.data.payPath }) - } else if (e.target.dataset.flag == 'parkVendor5'){ + } else if (e.target.dataset.flag == 'parkVendor5') { wx.navigateToMiniProgram({ appId: that.data.bolinkAppId, extraData: that.data.extraData, @@ -233,19 +231,19 @@ Page({ }) } }, - showquan: function () { + showquan: function() { wx.navigateTo({ url: '/pages/passCar/couponList/couponList', }) }, - gotodetail: function (e) { + gotodetail: function(e) { wx.showModal({ title: '缴费规则', content: e.target.dataset.rule, showCancel: false, }) }, - onShow: function (options) { + onShow: function(options) { if (typeof this.getTabBar === 'function' && this.getTabBar()) { this.getTabBar().setData({ @@ -297,17 +295,17 @@ Page({ addCar: null }); } - + this.getTicketList(0, 1); - - + + }, cancelMove: function() { console.log(111) return false; }, - onHide: function () { + onHide: function() { this.setData({ allow_load: true, showTicketModal: false, @@ -315,7 +313,7 @@ Page({ ticketList: [] }) }, - onLoad: function (options) { + onLoad: function(options) { var that = this; /** * 获得分享小程序的 @@ -323,11 +321,11 @@ Page({ * desc */ Http.get({ - url: config.api.getWeapNote, - data: { - appId: config.weapp.AppId, - } - }) + url: config.api.getWeapNote, + data: { + appId: config.weapp.AppId, + } + }) .then(res => { let weapNote = JSON.parse(res.data.weapNote); that.setData({ @@ -343,16 +341,16 @@ Page({ that.setData({ scene: scene }); - if (app.globalData.token) { } else { + if (app.globalData.token) {} else { // app.getLocation(); that.userLogin() } - + }, /** * 用户登录 */ - userLogin: function () { + userLogin: function() { var that = this; // 登录 wx.login({ @@ -360,7 +358,7 @@ Page({ code }) => { wx.getSystemInfo({ - success: function (res) { + success: function(res) { that.setData({ systemInfo: JSON.stringify(res) }) @@ -385,9 +383,9 @@ Page({ }; } Http.post({ - url: config.api.login, - data: usrdata - }) + url: config.api.login, + data: usrdata + }) .then(res => { app.globalData.token = res.data.token; Http.setToken(res.data.token); @@ -400,7 +398,7 @@ Page({ data: {} }); }) - .then(res => { }) + .then(res => {}) .catch(err => { if (err.code == 11004) { // 用户昵称未授权 @@ -421,33 +419,33 @@ Page({ /** * 检查用户是否有车 */ - checkUserCarStatus: 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(); - } - }) - .catch(err => { }) + url: config.api.userCarCount, + data: {} + }).then(res => { + if (res.data > 0) { + // 用户名下有车 + app.globalData.phone = res.data.phone; + app.globalData.supportCar = true; + // 共同登录 + that.userCarLogin(); + } + }) + .catch(err => {}) }, - jumpToAdd: function () { + jumpToAdd: function() { wx.navigateTo({ url: `/pages/addPark/addPark?flags=managepalte` }); }, - passc: function () { + passc: function() { wx.navigateTo({ url: '/pages/ques/ques', }) }, - goExplain: function () { + goExplain: function() { wx.navigateTo({ url: '/pages/tcExplain/tcExplain', }) @@ -457,14 +455,14 @@ Page({ /** * 券绑定车牌 */ - bindCoupon: function (quanid,quantitle) { + bindCoupon: function(quanid, quantitle) { wx.showLoading({ title: '使用中...', }) var that = this; /** * etcp - */ + */ var postCouponData = { etcpToken: app.globalData.etcpToken, carNumber: that.data.listCardNum, @@ -476,7 +474,7 @@ Page({ carNumber: that.data.listCardNum } } - if (app.globalData.parkVendor == 4){ + if (app.globalData.parkVendor == 4) { // 尚安 postCouponData = { carNumber: that.data.listCardNum, @@ -491,7 +489,7 @@ Page({ couponOrderId: quanid } } - if (app.globalData.parkVendor>=6){ + if (app.globalData.parkVendor >= 6) { console.log(123456789) postCouponData = { carNumber: that.data.listCardNum, @@ -501,30 +499,30 @@ Page({ } } Http.post({ - url: config.api.getCarCoupon, - data: postCouponData - }) + url: config.api.getCarCoupon, + data: postCouponData + }) .then(res => { wx.hideLoading() // if(res.data){ - that.getStopFee(that.data.listCardNum); - that.initUsrCarList(); - that.setData({ - quantitle: quantitle,//接口条用成功后在赋值 - }) + that.getStopFee(that.data.listCardNum); + that.initUsrCarList(); + that.setData({ + quantitle: quantitle, //接口条用成功后在赋值 + }) // }else{ - // wx.showToast({ - // title: res.message, - // icon: 'none', - // duration: 3000, - // mask: false - // }); + // wx.showToast({ + // title: res.message, + // icon: 'none', + // duration: 3000, + // mask: false + // }); // } - + }) .catch(err => { wx.hideLoading() - if (err.message!=undefined) { + if (err.message != undefined) { wx.showToast({ title: err.message, icon: 'none', @@ -532,7 +530,7 @@ Page({ mask: false }); } - + }) }, /** @@ -551,7 +549,7 @@ Page({ // } // }, - closeTicketModal: function () { + closeTicketModal: function() { this.setData({ showTicketModal: false }) @@ -559,7 +557,7 @@ Page({ /** * 停车券 弹框 */ - openTicketModal: function () { + openTicketModal: function() { this.setData({ showTicketModal: true, allow_load: true, @@ -571,24 +569,24 @@ Page({ /* if (!this.data.ticketList.length){ this.getTicketList(0, 1); } */ - + }, //获取名下停车券列表 getList() { var that = this; Http.get({ - url: config.api.couponOrderCarList + "?type=5&couponOrderStatus=0", - data: { - pageNum: 1, - pageSize: 15, - couponOrderStatus: 0 - } - }).then(res => { - that.setData({ - couponList: res.data.list - }); - }) + url: config.api.couponOrderCarList + "?type=5&couponOrderStatus=0", + data: { + pageNum: 1, + pageSize: 15, + couponOrderStatus: 0 + } + }).then(res => { + that.setData({ + couponList: res.data.list + }); + }) .catch(err => { console.log(err) }) @@ -598,61 +596,83 @@ Page({ /** * 共同登录 */ - init: function (carNumber) { + init: function(carNumber) { var that = this; app.parkInitCallback = token => { that.initPark(); that.getParkStatus(); if (!app.globalData.carLogin) { - /** - * 判断是否授权手机号 - */ Http.get({ - url: config.api.checkPhoneStatus, + url: config.api.checkUserStatus, data: {} - }) - .then(res => { - 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) { - app.globalData.etcpToken = res.data.token; + }).then(res => { + app.globalData.type = 'pc' + /** + * 判断是否授权手机号 + */ + Http.get({ + url: config.api.checkPhoneStatus, + data: {} + }) + .then(res => { + 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) { + app.globalData.etcpToken = res.data.token; + } + /** + * 获得停车费用 + */ + that.initUsrCarList("flags"); + }); + }) + .catch(err => { + if (err.code == 11005) { + // 用户手机未授权 + /** + * 将值传到用户手机号授权的页面 + * + */ + wx.redirectTo({ + url: "/pages/getphoneInfo/index" + }); + } else if (err.code == 11006) { + // 用户手机已加密 + wx.redirectTo({ + url: "/pages/phoneinput/phoneinput" + }); + } else { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); } - /** - * 获得停车费用 - */ - that.initUsrCarList("flags"); + }) + + }).catch(err => { + app.globalData.type = 'pc' + if (err.code == 11004) { + // 用户昵称未授权 + wx.redirectTo({ + url: "/pages/getuserinfo/index" }); - }) - .catch(err => { - if (err.code == 11005) { - // 用户手机未授权 - /** - * 将值传到用户手机号授权的页面 - * - */ - wx.redirectTo({ - url: "/pages/getphoneInfo/index" - }); - } else if (err.code == 11006) { - // 用户手机已加密 - wx.redirectTo({ - url: "/pages/phoneinput/phoneinput" - }); - } else { - wx.showToast({ - title: err.errMsg, - icon: 'none', - duration: 2000, - mask: false - }); - } - }) + } else { + wx.showModal({ + title: '提示', + content: err.errMsg, + showCancel: false + }) + } + }); + } }; if (app.globalData.token && app.globalData.token != null) { @@ -660,7 +680,7 @@ Page({ } }, - bindCar: function (carNum) { + bindCar: function(carNum) { var that = this; // ETCP var etcpData = { @@ -672,9 +692,9 @@ Page({ }; var postData = app.globalData.parkVendor == 1 ? etcpData : otherData; Http.post({ - url: config.api.bindCar, - data: postData - }) + url: config.api.bindCar, + data: postData + }) .then(res => { that.setData({ addCar: null @@ -684,7 +704,7 @@ Page({ title: "提示", showCancel: false, content: "绑车牌成功!", - success: function () { } + success: function() {} }); }) .catch(error => { @@ -692,24 +712,24 @@ Page({ title: "提示", showCancel: false, content: error.data.message, - success: function () { } + success: function() {} }); }); }, /** * 车场信息获取 */ - initPark: function () { + initPark: function() { var that = this; Http.get({ - url: config.api.getParkInfo, - data: {} - }) + url: config.api.getParkInfo, + data: {} + }) .then(res => { that.setData({ park: res.data }) - if (res.data){ + if (res.data) { app.globalData.parkVendor = res.data.vendorType; if (app.globalData.parkVendor == 1) { console.log("payPath: " + extConfig.attr.car.etcp.payPath) @@ -759,11 +779,11 @@ Page({ /** * 车场状态获取 */ - getParkStatus: function () { + getParkStatus: function() { var that = this; Http.get({ - url: config.api.getParkStatus, - }) + url: config.api.getParkStatus, + }) .then(res => { console.log(res) }) @@ -780,30 +800,30 @@ Page({ /** * 绑定车获取 */ - initUsrCarList: function (flag) { + initUsrCarList: function(flag) { var that = this; Http.get({ - url: config.api.getUserCarList, - data: {} - }).then(res => { - that.setData({ - carList: res.data - }); - /** - * flag ==flags - * 表示从首页onShow进来的 - */ - if (flag == "flags" && res.data.length > 0) { - var listCardNum = res.data[0].carNumber; + url: config.api.getUserCarList, + data: {} + }).then(res => { that.setData({ - listCardNum: listCardNum - }) + carList: res.data + }); /** - * 获得停车费用 + * flag ==flags + * 表示从首页onShow进来的 */ - that.getStopFee(listCardNum); - } - }) + if (flag == "flags" && res.data.length > 0) { + var listCardNum = res.data[0].carNumber; + that.setData({ + listCardNum: listCardNum + }) + /** + * 获得停车费用 + */ + that.getStopFee(listCardNum); + } + }) .catch(err => { wx.showToast({ title: err.message, @@ -817,22 +837,22 @@ Page({ /** * 获得停车费用修改 */ - getStopFee: function (carNumber) { + getStopFee: function(carNumber) { let that = this; let postData = app.globalData.parkVendor == 1 ? { etcpToken: app.globalData.etcpToken, carNumber: carNumber } : { - carNumber: carNumber - }; + carNumber: carNumber + }; Http.post({ - url: config.api.getCarStopFee, - data: postData - }) + url: config.api.getCarStopFee, + data: postData + }) .then(res => { console.log(res) - if(app.globalData.parkVendor == 1){ // ETCP + if (app.globalData.parkVendor == 1) { // ETCP var extraDataStr = { params: { token: app.globalData.etcpToken, @@ -887,7 +907,7 @@ Page({ }, timecha: res.data.duration }); - }else{ + } else { // var extraDataStr = { // params: { // token: app.globalData.etcpToken, @@ -897,7 +917,7 @@ Page({ // returnUrl: that.data.etcpCallbackUrl, // source: "FUMAO-001", // actionId: "1",//操作ID,1:小程序支付 - + // }, // } that.setData({ @@ -906,13 +926,13 @@ Page({ stopFees: res.data, timecha: Util.timecha(res.data.exitTime, res.data.entranceTime), remark: res.data.remark, - generalAppId:res.data.appId, + generalAppId: res.data.appId, generalPayPath: res.data.payPath, generalExtraData: res.data.extraData, extraDataFlag: JSON.stringify(res.data.extraData), - + }); - console.log( that.data.extraDataFlag,"123456789") + console.log(that.data.extraDataFlag, "123456789") } that.setData({ @@ -930,11 +950,11 @@ Page({ /** * 下拉刷新 */ - onPullDownRefresh: function (e) { + onPullDownRefresh: function(e) { let that = this; that.initUsrCarList("flags"); that.setData({ - current:0 + current: 0 }) wx.stopPullDownRefresh(); } diff --git a/index/user.js b/index/user.js index 9f90791..c560580 100644 --- a/index/user.js +++ b/index/user.js @@ -62,6 +62,18 @@ Page({ appVersion: "", placeholder: '' }, + suerService() { + console.log("打开客服") + wx.openCustomerServiceChat({ + extInfo: { url: 'https://work.weixin.qq.com/kfid/kfc7f4a755cbb51fa99' }, + corpId: 'wwdc116b631d3ea35f', + success(res) { }, + fail(res) { + console.log(res); + } + }) + + }, checkUserStatus() { let that = this; Http.get({ @@ -110,6 +122,7 @@ Page({ }).then(res => { this.ifPhoneInfo() }).catch(err => { + app.globalData.type = 'uc' wx.navigateTo({ url: `/pages/getuserinfo/index`, }) diff --git a/index/user.wxml b/index/user.wxml index 976d78d..0051cdd 100644 --- a/index/user.wxml +++ b/index/user.wxml @@ -136,6 +136,12 @@ > + 投诉建议 diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js index 5bc3842..f03c082 100644 --- a/pages/coupon/detail/index.js +++ b/pages/coupon/detail/index.js @@ -1190,6 +1190,7 @@ Page({ var eData = options.target.dataset.id; shareObj.path = `/pages/index/index?couponChannelId=${eData}&frommd=JC`; } + console.log(shareObj) // 返回shareObj return shareObj; }, diff --git a/pages/dateLsit/dateLsit.js b/pages/dateLsit/dateLsit.js index 2f6e8fc..6581229 100644 --- a/pages/dateLsit/dateLsit.js +++ b/pages/dateLsit/dateLsit.js @@ -7,7 +7,7 @@ let app = getApp(); Page({ /** - * 页面的初始数据 + * 页面的初始数据 */ data: { navigationBarHeight, @@ -17,7 +17,8 @@ Page({ list: [], childUrl: config.api.activityDey, startDate:'', - endDate:'' + endDate:'', + mouldType:0 }, goActivity(e){ let id = e.currentTarget.dataset.id @@ -97,6 +98,9 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function(options) { + this.setData({ + mouldType: app.globalData.mouldType, + }) this.setActivityCalendar(this.data.startDate, this.data.endDate) }, diff --git a/pages/dateLsit/dateLsit.wxml b/pages/dateLsit/dateLsit.wxml index 4c965a0..fe5819d 100644 --- a/pages/dateLsit/dateLsit.wxml +++ b/pages/dateLsit/dateLsit.wxml @@ -2,7 +2,7 @@ - + {{item.title}} 报名时间:{{item.startTime}}至{{item.endTime}} 活动时间:{{item.activityStartTime}}至{{item.activityEndTime}} diff --git a/pages/game/index.wxml b/pages/game/index.wxml index 9f2ecf2..dd06594 100644 --- a/pages/game/index.wxml +++ b/pages/game/index.wxml @@ -1 +1 @@ - \ No newline at end of file + diff --git a/pages/getphoneInfo/index.js b/pages/getphoneInfo/index.js index 9cc5609..83ed51e 100755 --- a/pages/getphoneInfo/index.js +++ b/pages/getphoneInfo/index.js @@ -12,24 +12,27 @@ Page({ signActivity: "", mineFlag: null, skipUrl: 0, - fillIndentId:"", - couponId:"", + fillIndentId: "", + couponId: "", // skip: app.globalData.skip }, onLoad: function(options) { - + var that = this; console.log(options.skipUrl, "options.skipUrl") - that.setData({ - skipUrl: options.skipUrl - }) + if (options.skipUrl) { + that.setData({ + skipUrl: options.skipUrl + }) + } + that.setData({ path: options.path }) that.setData({ paramData: options }) - if (options && options.fillIndentId && options.couponId){ + if (options && options.fillIndentId && options.couponId) { that.setData({ fillIndentId: options.fillIndentId, couponId: options.couponId @@ -41,7 +44,7 @@ Page({ }); } - if (options && options.mineFlag) { + if (options && options.mineFlag) { that.setData({ mineFlag: options.mineFlag }) @@ -74,6 +77,34 @@ Page({ }); }) }, + onShow: function() { + wx.checkSession({ + success() { + //session_key 未过期,并且在本生命周期一直有效 + }, + fail() { + // session_key 已经失效,需要重新执行登录流程 + console.log("session_key 过期") + wx.login({ + success: (res) => { + if (res.code) { + let usrdata = { + appId: config.weapp.AppId, + code: res.code, + } + Http.post({ + url: config.api.login, + data: usrdata + }).then(res => { + Http.setToken(res.data.token); + app.globalData.token = res.data.token; + }) + } + } + }) + } + }) + }, backHome: function() { wx.switchTab({ url: '/index/index', @@ -84,137 +115,135 @@ Page({ var iv = e.detail.iv; var encryptedData = e.detail.encryptedData; Http.post({ - url: config.api.getUserPhone, - data: { - encryptedData: encryptedData, - iv: iv - } - }).then(res => { - - app.globalData.phone = res.data.phone; - if (that.data.skipUrl == '1') { - console.log(app.globalData.skip,app.globalData.skipUrl,"跳转地址" ) - if (app.globalData.skip == 'redirectTo') { - wx.redirectTo({ - url: app.globalData.skipUrl, - }) - return; - } else if (app.globalData.skip == 'navigateTo') { - wx.navigateTo({ - url: app.globalData.skipUrl, - }) - return; - } else if (app.globalData.skip == 'reLaunch') { - wx.reLaunch({ - url: app.globalData.skipUrl, - }) - return; - } else if (app.globalData.skip == 'switchTab') { - wx.switchTab({ - url: app.globalData.skipUrl, - }) - return; - } - } - //线上配送 - if(that.data.path == "fi"){ - wx.redirectTo({ - url: `/pages/fillIndent/fillIndent?id=${that.data.fillIndentId}&couponId=${that.data.couponId}` - }) - } - // 来着问卷 - if (that.data.path =="wj"){ + url: config.api.getUserPhone, + data: { + encryptedData: encryptedData, + iv: iv + } + }).then(res => { + // debugger + app.globalData.phone = res.data.phone; + if (that.data.skipUrl == '1') { + console.log(app.globalData.skip, app.globalData.skipUrl, "跳转地址") + if (app.globalData.skip == 'redirectTo') { wx.redirectTo({ - url: `/pages/questionnaire/questionnaire?id=${that.data.wjId}` + url: app.globalData.skipUrl, }) return; - } - /**a - * 来自我的 - */ - if (that.data.path == 'main') { - wx.switchTab({ - url: `/index/user` + } else if (app.globalData.skip == 'navigateTo') { + wx.navigateTo({ + url: app.globalData.skipUrl, }) return; - } - /** - * 来自积分兑换 - */ - if (that.data.path == 'jifen') { - wx.redirectTo({ - url: `/pages/integralmall/payIntegcoupondetail/index?couponChannelId=${that.data.paramData.couponChannelId}&couponId=${that.data.paramData.couponId}` + } else if (app.globalData.skip == 'reLaunch') { + wx.reLaunch({ + url: app.globalData.skipUrl, }) return; - } - /** - * 来自拼团详情 - */ - if (that.data.path == 'spell') { - if (that.data.paramData.avatarUrl) { - wx.redirectTo({ - url: `/pages/joinFrDpell/index?couponId=${that.data.paramData.couponId}&orderGroupId=${that.data.paramData.orderGroupId}&couponChannelId=${that.data.paramData.couponChannelId}&orderId=${that.data.paramData.orderId}&avatarUrl=${that.data.paramData.avatarUrl}&nickName=${that.data.paramData.nickName}` - }) - } else { - wx.redirectTo({ - url: `/pages/spellGroup/mySpellGroup/index?couponId=${that.data.paramData.couponId}&couponChannelId=${that.data.paramData.couponChannelId}` - }) - } + } else if (app.globalData.skip == 'switchTab') { + wx.switchTab({ + url: app.globalData.skipUrl, + }) return; } - /** - * fromId若存在来自卡转赠 - */ - if (that.data.path == 'index' && !that.data.paramData.cuserId) { - wx.redirectTo({ - url: "/pages/game/index?url=" + that.data.paramData.url + "&id=" + that.data.paramData.id + "&gameId=" + that.data.paramData.gameId, - }) - } else if (that.data.path == 'index' && that.data.paramData.cuserId) { + } + //线上配送 + if (that.data.path == "fi") { + wx.redirectTo({ + url: `/pages/fillIndent/fillIndent?id=${that.data.fillIndentId}&couponId=${that.data.couponId}` + }) + } + // 来着问卷 + if (that.data.path == "wj") { + wx.redirectTo({ + url: `/pages/questionnaire/questionnaire?id=${that.data.wjId}` + }) + return; + } + /**a + * 来自我的 + */ + if (that.data.path == 'main') { + wx.switchTab({ + url: `/index/user` + }) + return; + } + /** + * 来自积分兑换 + */ + if (that.data.path == 'jifen') { + wx.redirectTo({ + url: `/pages/integralmall/payIntegcoupondetail/index?couponChannelId=${that.data.paramData.couponChannelId}&couponId=${that.data.paramData.couponId}` + }) + return; + } + /** + * 来自拼团详情 + */ + if (that.data.path == 'spell') { + if (that.data.paramData.avatarUrl) { wx.redirectTo({ - url: "/pages/coupon/detail/index?cuserId=" + that.data.paramData.cuserId + '&couponChannelId=' + that.data.paramData.couponChannelId + '&coverImg=' + that.data.paramData.coverImg + '&avatarUrl=' + that.data.paramData.avatarUrl + '&userName=' + that.data.paramData.userName + '&couponOrderId=' + that.data.paramData.couponOrderId + "&updateDate=" + that.data.paramData.updateDate + url: `/pages/joinFrDpell/index?couponId=${that.data.paramData.couponId}&orderGroupId=${that.data.paramData.orderGroupId}&couponChannelId=${that.data.paramData.couponChannelId}&orderId=${that.data.paramData.orderId}&avatarUrl=${that.data.paramData.avatarUrl}&nickName=${that.data.paramData.nickName}` }) - } - /** - * 活动报名 - */ - else if (that.data.signActivity) { + } else { wx.redirectTo({ - url: `/pages/radetail/joinActivity/edit?activityId=${that.data.signActivity}` + url: `/pages/spellGroup/mySpellGroup/index?couponId=${that.data.paramData.couponId}&couponChannelId=${that.data.paramData.couponChannelId}` }) - } else if (that.data.mineFlag == 'mine') { - wx.switchTab({ - url: '/index/user' - }); - } else if (that.data.mineFlag == 'index'){ - wx.switchTab({ - url: '/index/index' - }); - }else { - - wx.showToast({ - title: res.data.msg, - icon: "success", - success: function(res) { - if (that.data.couponChannelId) { - wx.redirectTo({ - url: "/pages/coupon/detail/index?couponChannelId=" + that.data.couponChannelId + "&flag=pay" - }) - } else { - wx.switchTab({ - url: '/index/passCar', - }) - } - } - }); } - }) - .catch(err => { + return; + } + /** + * fromId若存在来自卡转赠 + */ + if (that.data.path == 'index' && !that.data.paramData.cuserId) { + wx.redirectTo({ + url: "/pages/game/index?url=" + that.data.paramData.url + "&id=" + that.data.paramData.id + "&gameId=" + that.data.paramData.gameId, + }) + } else if (that.data.path == 'index' && that.data.paramData.cuserId) { + wx.redirectTo({ + url: "/pages/coupon/detail/index?cuserId=" + that.data.paramData.cuserId + '&couponChannelId=' + that.data.paramData.couponChannelId + '&coverImg=' + that.data.paramData.coverImg + '&avatarUrl=' + that.data.paramData.avatarUrl + '&userName=' + that.data.paramData.userName + '&couponOrderId=' + that.data.paramData.couponOrderId + "&updateDate=" + that.data.paramData.updateDate + }) + } + /** + * 活动报名 + */ + else if (that.data.signActivity) { + wx.redirectTo({ + url: `/pages/radetail/joinActivity/edit?activityId=${that.data.signActivity}` + }) + } else if (that.data.mineFlag == 'mine') { + wx.switchTab({ + url: '/index/user' + }); + } else if (that.data.mineFlag == 'index') { + wx.switchTab({ + url: '/index/index' + }); + } else { wx.showToast({ - title: err.message, - icon: 'none', - duration: 2000, - mask: false + title: res.data.msg, + icon: "success", + success: function(res) { + if (that.data.couponChannelId) { + wx.redirectTo({ + url: "/pages/coupon/detail/index?couponChannelId=" + that.data.couponChannelId + "&flag=pay" + }) + } else { + wx.switchTab({ + url: '/index/passCar', + }) + } + } }); - }) - } + } + }).catch(err => { + wx.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }, }); \ No newline at end of file diff --git a/pages/getuserinfo/index.js b/pages/getuserinfo/index.js index 6263ce6..84b15ed 100755 --- a/pages/getuserinfo/index.js +++ b/pages/getuserinfo/index.js @@ -15,8 +15,11 @@ Page({ fromflag: '', couponChannelIdflag: '', wjId: "", - composeOrderType:"", - fillIndentId: "", + composeOrderType: "", + fillIndentId: "", + url:null,//游戏路径 + id:null,//游戏id, + gameId: null,//游戏gameId }, //是否授权手机号 judgePhonelngo() { @@ -47,25 +50,35 @@ Page({ wx.redirectTo({ url: `/pages/getphoneInfo/index?skipUrl=1` }); - }) + }) }, onLoad: function(options) { - console.log(app.globalData.skip, app.globalData.skipUrl, "跳转地址") + + console.log(app.globalData.skip, app.globalData.skipUrl, app.globalData.type, "跳转地址") var that = this; // options.fromflag == 'coupondetail'; + + // 游戏页面 + if (options && options.url && options.id && options.gameId){ + that.setData({ + url: options.url,//游戏路径 + id: options.id,//游戏id, + gameId: options.gameId,//游戏gameId + }) + } // 来自优惠券详情页面 if (options && options.fromflag) { that.setData({ fromflag: options.fromflag }) - } - if (options && options.composeOrderType){ + } + if (options && options.composeOrderType) { that.setData({ composeOrderType: options.composeOrderType }) } //线上配送 填写订单 - if (options && options.fillIndentId && couponId && options.couponId){ + if (options && options.fillIndentId && couponId && options.couponId) { that.setData({ fillIndentId: options.fillIndentId, couponId: options.couponId @@ -152,248 +165,45 @@ Page({ }); }) }, + onShow: function() { + wx.checkSession({ + success() { + //session_key 未过期,并且在本生命周期一直有效 + }, + fail() { + console.log("session_key 过期") + // session_key 已经失效,需要重新执行登录流程 + wx.login({ + success: (res) => { + if (res.code) { + let usrdata = { + appId: config.weapp.AppId, + code: res.code, + } + Http.post({ + url: config.api.login, + data: usrdata + }).then(res => { + Http.setToken(res.data.token); + app.globalData.token = res.data.token; + }) + } + } + }) + } + }) + }, backHome: function() { wx.switchTab({ url: '/index/index', }) }, - // bindGetUserInfo: function (e) { - // let that = this; - // var iv = e.detail.iv; - // var encryptedData = e.detail.encryptedData; - // wx.getUserInfo({ - // success: function (res) { - // Http.post({ - // url: config.api.getUserInfo, - // data: { - // encryptedData: encryptedData, - // iv: iv - // } - // }).then( - // function (res) { - // if (that.data.wjId) { - // app.globalData.skipUrl = `/pages/questionnaire/questionnaire?id=${that.data.wjId}` - // app.globalData.skip = 'redirectTo' - // that.judgePhonelngo() - // return; - // } - // if (that.data.fromflag == 'poster') { - // app.globalData.skipUrl = `/pages/canvas/index?couponChannelId=${that.data.couponChannelId}` - // app.globalData.skip = 'redirectTo' - // that.judgePhonelngo() - // return; - // } - // // - // if (that.data.optionData.orderGroupId) { - // app.globalData.skipUrl = `/pages/joinFrDpell/index?couponId=${that.data.optionData.couponId}&orderGroupId=${that.data.optionData.orderGroupId}&couponChannelId=${that.data.optionData.couponChannelId}&orderId=${that.data.optionData.orderId}&avatarUrl=${that.data.optionData.avatarUrl}&nickName=${that.data.optionData.nickName}` - // app.globalData.skip = 'reLaunch' - // that.judgePhonelngo() - // return; - // } - // if (that.data.path == 'index') { - // app.globalData.skipUrl = "/pages/game/index" - // app.globalData.skip = 'reLaunch' - // that.judgePhonelngo() - // } else { - // //返回主页 - // // if (that.data.couponChannelId && !that.data.cuserId && !that.data.spellGroup||that.data.couponChannelId && !that.data.cuserId&&app.globalData.type == 'cd') { - // if (that.data.couponChannelId && !that.data.cuserId && !that.data.spellGroup && app.globalData.type == 'cd') { - // // 跳转普通券/消费卡/限时秒杀/砍价详情 - // app.globalData.skipUrl = `/pages/coupon/detail/index?couponChannelId=${that.data.couponChannelId}` - // app.globalData.skip = 'navigateTo' - // that.judgePhonelngo() - // } else if (that.data.couponChannelId && that.data.cuserId && !that.data.spellGroup && app.globalData.type != 'sd') { - // // 来自转赠 - // app.globalData.skipUrl = `/pages/coupon/detail/index?couponChannelId=${that.data.couponChannelId}&cuserId=${that.data.cuserId}&coverImg=${that.data.coverImg}&userName=${that.data.userName}&avatarUrl=${that.data.avatarUrl}&couponOrderId=${that.data.couponOrderId}&updateDate=${that.data.updateDate}` - // app.globalData.skip = 'reLaunch' - // that.judgePhonelngo() - // } else if (that.data.couponChannelId && app.globalData.type == 'sd' || that.data.couponChannelId && that.data.spellGroup) { - // // 拼团详情页 - // app.globalData.skipUrl = `/pages/spellGroup/mySpellGroup/index?couponChannelId=${that.data.couponChannelId}` - // app.globalData.skip = 'redirectTo' - // that.judgePhonelngo() - // } else if (that.data.optionData.id && app.globalData.type == 'gm') { - // // 游戏页面 - // that.getGameOne(app.globalData.token, that.data.optionData.id) - - // } else if (that.data.optionData.id && app.globalData.type == 'td') { - // app.globalData.skipUrl = `/pages/topicDetail/index?id=${that.data.optionData.id}` - // app.globalData.skip = 'redirectTo' - // that.judgePhonelngo() - // } - // // 报名活动 - // else if (that.data.optionData.id && app.globalData.type == 'ra') { - // app.globalData.skipUrl = `/pages/radetail/index?id=${that.data.optionData.id}`, - // app.globalData.skip = 'redirectTo' - // that.judgePhonelngo() - // } - // // 报名签到 - // else if (that.data.optionData.id && app.globalData.type == 'si') { - // app.globalData.skipUrl = `/pages/acSignIn/index?id=${that.data.optionData.id}`, - // app.globalData.skip = 'redirectTo' - // that.judgePhonelngo() - // } - // // 门店详情 - // else if (that.data.optionData.id && app.globalData.type == 'md') { - // app.globalData.skipUrl = `/pages/index/searchbar/detail/index?id=${that.data.optionData.id}`, - // app.globalData.skip = 'redirectTo' - // that.judgePhonelngo() - // } - // // 通过分享进入的门店详情页面 - // else if (that.data.id && that.data.frommd == 'md') { - // app.globalData.skipUrl = `/pages/index/searchbar/detail/index?id=${that.data.id}`, - // app.globalData.skip = 'redirectTo' - // that.judgePhonelngo() - // } else if (that.data.optionData.bt && that.data.optionData.id && app.globalData.type == 'bd') { - // // 宣传页详情 - // if (that.data.optionData.bt == '2') { - // // 自由图文 - // app.globalData.skipUrl = `/pages/freeBannerDetail/index?id=${that.data.optionData.id}`, - // app.globalData.skip = 'redirectTo' - // that.judgePhonelngo() - // } else { - // // 标准格式 - // app.globalData.skipUrl = `/pages/bannerdetail/index?id=${that.data.optionData.id}`, - // app.globalData.skip = 'redirectTo' - // that.judgePhonelngo() - // } - // } else if (that.data.orderId || that.data.orderId && app.globalData.type == 'bg') { - // // 参与砍价 - // app.globalData.skipUrl = `/pages/bargain/bargainDatail/bargainDatail?orderId=${that.data.orderId}`, - // app.globalData.skip = 'navigateTo' - // that.judgePhonelngo() - // } else if (app.globalData.type == 'uc') { - // // 我的 - // app.globalData.skipUrl = '/index/user', - // app.globalData.skip = 'switchTab' - // that.judgePhonelngo() - // } else if (app.globalData.type == 'in') { - // // 首页 - // app.globalData.skipUrl = '/index/index', - // app.globalData.skip = 'switchTab' - // that.judgePhonelngo() - // } else if (app.globalData.type == "qd") { - // //每日签到 - // app.globalData.skipUrl = "/pages/activityCalendar/activityCalendar" - // app.globalData.skip = 'reLaunch' - // that.judgePhonelngo() - // } - // else if (app.globalData.type == "hdrl") { - // //活动日历 - // app.globalData.skipUrl = `/pages/radetail/index?id=${app.globalData.activityId}` - // app.globalData.skip = 'redirectTo' - // that.judgePhonelngo() - // } - // // 积分 - // else if (app.globalData.type == 'jf') { - // app.globalData.skipUrl = '/pages/integralmall/index', - // app.globalData.skip = 'redirectTo' - // that.judgePhonelngo() - // } else if (app.globalData.type == 'pc') { - // // 停车 - // app.globalData.skipUrl = '/index/passCar', - // app.globalData.skip = 'switchTab' - // that.judgePhonelngo() - // } else if (app.globalData.type == 'mc') { - // // 我的券包 - // app.globalData.skipUrl = '/pages/couponorder/index/index', - // app.globalData.skip = 'redirectTo' - // that.judgePhonelngo() - // } else if (app.globalData.type == 'mo') { - // // 我的订单 - // app.globalData.skipUrl = '/pages/order/index/index?id=all', - // app.globalData.skip = 'redirectTo' - // that.judgePhonelngo() - // } else if (app.globalData.type == 'ca') { - // // 我的卡包 - // app.globalData.skipUrl = '/pages/cardorder/index/index', - // app.globalData.skip = 'redirectTo' - // that.judgePhonelngo() - // } else if (app.globalData.type == 'sc') { - // // 特享礼遇 - // app.globalData.skipUrl = '/pages/specialcourtesy/specialcourtesy', - // app.globalData.skip = 'redirectTo' - // that.judgePhonelngo() - // } else if (app.globalData.type == 'rb') { - // // 限时秒杀 - // app.globalData.skipUrl = '/pages/rushToBuy/index', - // app.globalData.skip = 'redirectTo' - // that.judgePhonelngo() - // } else if (app.globalData.type == 'bl') { - // // 砍价专场 - // app.globalData.skipUrl = '/pages/bargain/bargain', - // app.globalData.skip = 'redirectTo' - // that.judgePhonelngo() - // } else if (app.globalData.type == 'mb') { - // // 我的砍价 - // app.globalData.skipUrl = '/pages/bargain/bargain?from=myhtml', - // app.globalData.skip = 'redirectTo' - // that.judgePhonelngo() - // } else if (app.globalData.type == 'sl') { - // // 拼团专场 - // app.globalData.skipUrl = '/pages/spellGroup/spellGroup', - // app.globalData.skip = 'redirectTo' - // that.judgePhonelngo() - // } else if (app.globalData.type == 'ms') { - // // 我的拼团 - // app.globalData.skipUrl = '/pages/spellGroup/spellGroup?from=myhtml', - // app.globalData.skip = 'redirectTo' - // that.judgePhonelngo() - // } else if (app.globalData.type == 'dc') { - // // 消费卡 - // app.globalData.skipUrl = '/pages/discountCardList/discountCardList', - // app.globalData.skip = 'redirectTo' - // that.judgePhonelngo() - // } else if (app.globalData.type == 'td') { - // // 专题活动页 - // app.globalData.skipUrl = '/pages/topicDetail/index', - // app.globalData.skip = 'redirectTo' - // that.judgePhonelngo() - // } else if (app.globalData.type == 'ml') { - // // 门店 - // app.globalData.skipUrl = '/index/searchbar', - // app.globalData.skip = 'switchTab' - // that.judgePhonelngo() - // } else if (that.data.fromflag == 'coupondetail' && that.data.couponChannelIdflag) { - // app.globalData.skipUrl = `/pages/coupon/detail/index?couponChannelId=${that.data.couponChannelIdflag}`, - // app.globalData.skip = 'redirectTo' - // that.judgePhonelngo() - // } else if (that.data.fromflag == 'spellcoupondetail' && that.data.couponChannelIdflag) { - // app.globalData.skipUrl = `/pages/spellGroup/mySpellGroup/index?couponChannelId=${that.data.couponChannelIdflag}`, - // app.globalData.skip = 'redirectTo' - // that.judgePhonelngo() - // } else { - // app.globalData.skipUrl = "/index/index", - // app.globalData.skip = 'switchTab' - // that.judgePhonelngo() - // } - // } - - // }, - // function (error) { - // console.log(error) - // wx.showToast({ - // title: "请授权个人信息", - // icon: "none" - // }); - // } - - // ) - // .catch(err => { - // wx.showToast({ - // title: err.errMsg, - // icon: 'none', - // duration: 2000, - // mask: false - // }); - // }) - // } - // }) - // }, bindGetUserInfo(e) { + //session_key 未过期,并且在本生命周期一直有效 wx.getUserProfile({ + title: '温馨提示', desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 success: (res) => { let that = this; @@ -413,6 +223,12 @@ Page({ // title: "授权个人信息成功11", // icon: "none" // }); + if (app.globalData.type == 'gm' && that.data.id && that.data.gameId && that.data.url){//游戏页面 + app.globalData.skipUrl = '/pages/game/index?url=' + that.data.url + "&id=" + that.data.id + "&gameId=" + that.data.gameId, + app.globalData.skip = 'redirectTo' + that.judgePhonelngo() + return; + } if (that.data.wjId) { app.globalData.skipUrl = `/pages/questionnaire/questionnaire?id=${that.data.wjId}` app.globalData.skip = 'redirectTo' @@ -426,8 +242,8 @@ Page({ return; } // - - if (that.data.optionData!=null && that.data.optionData.orderGroupId != null && that.data.optionData.orderGroupId !="" ) { + + if (that.data.optionData != null && that.data.optionData.orderGroupId != null && that.data.optionData.orderGroupId != "") { app.globalData.skipUrl = `/pages/joinFrDpell/index?couponId=${that.data.optionData.couponId}&orderGroupId=${that.data.optionData.orderGroupId}&couponChannelId=${that.data.optionData.couponChannelId}&orderId=${that.data.optionData.orderId}&avatarUrl=${that.data.optionData.avatarUrl}&nickName=${that.data.optionData.nickName}` app.globalData.skip = 'reLaunch' that.judgePhonelngo() @@ -453,7 +269,7 @@ Page({ } else if (that.data.couponChannelId && app.globalData.type == 'sd' || that.data.couponChannelId && that.data.spellGroup) { // 拼团详情页 app.globalData.skipUrl = `/pages/spellGroup/mySpellGroup/index?couponChannelId=${that.data.couponChannelId}` - app.globalData.skip = 'redirectTo' + app.globalData.skip = 'redirectTo' that.judgePhonelngo() } else if (that.data.optionData != null && that.data.optionData.id && app.globalData.type == 'gm') { // 游戏页面 @@ -604,12 +420,12 @@ Page({ app.globalData.skipUrl = `/pages/spellGroup/mySpellGroup/index?couponChannelId=${that.data.couponChannelIdflag}`, app.globalData.skip = 'redirectTo' that.judgePhonelngo() - } else if (that.data.fromflag == 'fillIndent' && that.data.fillIndentId && that.data.couponId){ + } else if (that.data.fromflag == 'fillIndent' && that.data.fillIndentId && that.data.couponId) { //线上配送 填写订单 app.globalData.skipUrl = `/pages/fillIndent/fillIndent?id=${that.data.fillIndentId}&couponId=${that.data.couponId}`, app.globalData.skip = 'redirectTo' that.judgePhonelngo() - }else { + } else { app.globalData.skipUrl = "/index/index", app.globalData.skip = 'switchTab' that.judgePhonelngo() @@ -636,9 +452,11 @@ Page({ }) } }) - } + }, + fail: (err => { + console.log(err) + }) }) - }, getGameOne: function(token, id) { let _this = this; diff --git a/pages/index/index.js b/pages/index/index.js index f6de4b4..0728eb9 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -13,9 +13,6 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function(options) { - wx.switchTab({ - url: '/index1/index1' - }); console.log("我是中转页面") let that = this; console.log(options); @@ -79,6 +76,8 @@ Page({ options.id = this.data.newArr[2]; } else if (options.type == 'wj') { options.id = this.data.newArr[2]; + } else if (options.type == 'ts') { + options.id = this.data.newArr[2]; } } } @@ -214,6 +213,12 @@ Page({ url: `/pages/questionnaire/questionnaire?id=${options.id}`, }) } + //投诉建议 + else if (app.globalData.type == 'ts') { + wx.redirectTo({ + url: `/pages/complaint/complaint`, + }) + } // 宣传页详情 else if (options && options.bt && options.id && app.globalData.type == 'bd') { if (options.bt == '2') { diff --git a/pages/index/searchbar/detail/index.js b/pages/index/searchbar/detail/index.js index 652e622..0fc3153 100644 --- a/pages/index/searchbar/detail/index.js +++ b/pages/index/searchbar/detail/index.js @@ -6,7 +6,7 @@ const util = require("../../../../utils/util"); let app = getApp(); Page({ - /** + /** * 页面的初始数据 */ data: { diff --git a/pages/joinFrDpell/index.js b/pages/joinFrDpell/index.js index 91f0ea2..bccf5dc 100644 --- a/pages/joinFrDpell/index.js +++ b/pages/joinFrDpell/index.js @@ -11,6 +11,7 @@ Page({ * 页面的初始数据 */ data: { + mouldType: 0, navigationBarHeight, teljpgUrl: imgurl.teljpg.url, wmhome: imgurl.wmhome.url, @@ -31,12 +32,15 @@ Page({ showErr: false, showTime: true, merchantVoList: [] - }, + }, - /** + /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { + this.setData({ + mouldType: app.globalData.mouldType + }) Http.get({ url: config.api.checkUserStatus, data: { @@ -501,6 +505,7 @@ Page({ */ onShow: function() { this.setData({ + mouldType: app.globalData.mouldType, canSpell: true, canBuyIf: true, showTime: true diff --git a/pages/joinFrDpell/index.wxml b/pages/joinFrDpell/index.wxml index 03ef4a3..94d225d 100644 --- a/pages/joinFrDpell/index.wxml +++ b/pages/joinFrDpell/index.wxml @@ -1,9 +1,9 @@ - + - - + + {{data.title}} diff --git a/pages/questionnaire/questionnaire.js b/pages/questionnaire/questionnaire.js index 30e9200..f59ddf7 100644 --- a/pages/questionnaire/questionnaire.js +++ b/pages/questionnaire/questionnaire.js @@ -3,7 +3,7 @@ const Http = require("../../utils/HttpBasics"); var config = require("../../config/config.js"); const util = require("../../utils/util.js"); var app = getApp(); -const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px' +const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px' Page({ /** @@ -15,6 +15,7 @@ Page({ question: {}, userDetails: "", thenDate: "", + mouldType: 0 }, //设置选中项 setLsit(e) { @@ -193,7 +194,7 @@ Page({ this.setData({ id: options.id, - + mouldType: app.globalData.mouldType, }) this.getDetail() }, diff --git a/pages/questionnaire/questionnaire.wxml b/pages/questionnaire/questionnaire.wxml index 5fca6f1..833bb15 100644 --- a/pages/questionnaire/questionnaire.wxml +++ b/pages/questionnaire/questionnaire.wxml @@ -4,7 +4,7 @@ - + {{question.title}} {{'答题时间:'+question.startDate_Sing+'至'+question.endDate_Sing}} diff --git a/pages/questionnaire/questionnaireLsit/questionnaireLsit.js b/pages/questionnaire/questionnaireLsit/questionnaireLsit.js index 3a99871..d934454 100644 --- a/pages/questionnaire/questionnaireLsit/questionnaireLsit.js +++ b/pages/questionnaire/questionnaireLsit/questionnaireLsit.js @@ -2,7 +2,6 @@ const Http = require("../../../utils/HttpBasics"); var config = require("../../../config/config.js"); var app = getApp(); -var app = getApp(); const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px' Page({ @@ -15,6 +14,7 @@ Page({ pageNum: 1, pageSize: 4, thenDate:"", + mouldType: 0 }, goDetails(e){ let id = e.currentTarget.dataset.id @@ -58,7 +58,9 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + this.setData({ + mouldType:app.globalData.mouldType, + }) }, /** diff --git a/pages/questionnaire/questionnaireLsit/questionnaireLsit.wxml b/pages/questionnaire/questionnaireLsit/questionnaireLsit.wxml index f134069..4c855dd 100644 --- a/pages/questionnaire/questionnaireLsit/questionnaireLsit.wxml +++ b/pages/questionnaire/questionnaireLsit/questionnaireLsit.wxml @@ -3,7 +3,7 @@ 敬请期待! - + {{item.title}} {{item.topDesc}} diff --git a/pages/radetail/index.js b/pages/radetail/index.js index c29488b..325c88f 100644 --- a/pages/radetail/index.js +++ b/pages/radetail/index.js @@ -26,9 +26,13 @@ Page({ wmhome: imgurl.wmhome.url, minute: "", nodes: '', + mouldType: 0 }, onLoad(options) { let that = this; + that.setData({ + mouldType: app.globalData.mouldType, + }) wx.hideShareMenu(); if(options&&options.id){ that.setData({ diff --git a/pages/radetail/index.wxml b/pages/radetail/index.wxml index a68df39..b400fa8 100644 --- a/pages/radetail/index.wxml +++ b/pages/radetail/index.wxml @@ -8,8 +8,8 @@ -