| @@ -41,6 +41,15 @@ App({ | |||
| data: usrdata | |||
| }) | |||
| .then(res => { | |||
| if (res.data.subMalls) { | |||
| let list = JSON.parse(res.data.subMalls) | |||
| wx.setStorageSync('tenantData', JSON.stringify(list)); | |||
| wx.setStorageSync('firstEnter', true) | |||
| wx.setStorageSync('tenantId', list.filter(e => e.tenantId == res.data.selectedMall)[0].tenantId) | |||
| } else { | |||
| wx.setStorageSync('tenantData', "[]") | |||
| wx.setStorageSync('tenantId', '') | |||
| } | |||
| wx.setStorageSync('openId',res.data.openId) | |||
| if (res.data && res.data.score) { | |||
| if (res.data.score != 0) { | |||
| @@ -1,5 +1,6 @@ | |||
| const app = getApp() | |||
| const config = require("../../config/config"); | |||
| const Http = require("../../utils/HttpBasics"); | |||
| Component({ | |||
| properties: { | |||
| @@ -30,11 +31,15 @@ Component({ | |||
| }, | |||
| data: { | |||
| array: ['A广场', 'B广场-北京西单'], | |||
| showGroupIf: JSON.parse(wx.getStorageSync('tenantData')).length>0?true:false, | |||
| tenantData: JSON.parse(wx.getStorageSync('tenantData')), | |||
| tenantId: wx.getStorageSync('tenantId'), | |||
| array: [], | |||
| index: 1, | |||
| statusBarHeight: app.statusBarHeight + 'px', | |||
| navigationBarHeight: (app.statusBarHeight + 44) + 'px' | |||
| }, | |||
| methods: { | |||
| backHome: function () { | |||
| wx.switchTab({ | |||
| @@ -46,6 +51,52 @@ Component({ | |||
| this.setData({ | |||
| index: e.detail.value | |||
| }) | |||
| let selectIndex = 0; | |||
| this.data.tenantData.map((item, index) => { | |||
| if (e.detail.value == item.tenantId) { | |||
| selectIndex = index; | |||
| wx.setStorageSync('tenantId', item.tenantId) | |||
| } | |||
| }) | |||
| let param = { | |||
| tenantId: this.data.tenantData[selectIndex].parentTenantId, | |||
| subTenantId: this.data.tenantData[e.detail.value].tenantId | |||
| } | |||
| this.checkAble = true; | |||
| wx.showLoading({ | |||
| title: '切换中...', | |||
| }) | |||
| Http.post({ | |||
| url: config.api.selectMall, | |||
| data: param | |||
| }).then(res => { | |||
| wx.setStorageSync('tenantId', this.data.tenantData[e.detail.value].tenantId) | |||
| wx.hideLoading(); | |||
| wx.showToast({ | |||
| title: '切换成功!', | |||
| icon: 'success', | |||
| duration: 2000 | |||
| }) | |||
| wx.reLaunch({ | |||
| url: '/index/index', | |||
| }) | |||
| }) | |||
| .catch(err => { | |||
| wx.showModal({ | |||
| title: '提示', | |||
| content: err.message, | |||
| showCancel: false, | |||
| success: function (res) { | |||
| // 重启首页 | |||
| if (res.confirm) { | |||
| wx.reLaunch({ | |||
| url: '/pages/index/index', | |||
| }) | |||
| } | |||
| } | |||
| }) | |||
| this.alphaClick(); | |||
| }) | |||
| }, | |||
| back: function () { | |||
| wx.navigateBack({ | |||
| @@ -54,6 +105,20 @@ Component({ | |||
| } | |||
| }, | |||
| attached: function(){ | |||
| console.log(JSON.parse(wx.getStorageSync('tenantData')), wx.getStorageSync('tenantId'),11111) | |||
| let list = []; | |||
| let tindex = 0; | |||
| this.data.tenantData.map((item,index)=>{ | |||
| list.push(item.name) | |||
| if (item.tenantId == wx.getStorageSync('tenantId')){ | |||
| tindex = index | |||
| } | |||
| }) | |||
| console.log(list,tindex,9999) | |||
| this.setData({ | |||
| array:list, | |||
| index: tindex | |||
| }) | |||
| let pages = getCurrentPages(); | |||
| if (pages.length <= 1) { | |||
| this.setData({ | |||
| @@ -10,7 +10,7 @@ | |||
| </view> | |||
| </view> | |||
| <view class='title' style="color:{{color}}!important">{{text}}</view> | |||
| <picker bindchange="bindPickerChange" wx:if="{{showLocationIf}}" class="pick-box" value="{{index}}" range="{{array}}"> | |||
| <picker bindchange="bindPickerChange" wx:if="{{showLocationIf&&showGroupIf}}" class="pick-box" value="{{index}}" range="{{array}}"> | |||
| <icon class='iconfont icon-daohangdizhiweizhi'></icon> | |||
| <view class="picker locations"> | |||
| {{array[index]}} | |||
| @@ -318,7 +318,9 @@ var config = { | |||
| //商场信息接口 | |||
| getMallInfo: "/mall/mallInfo", | |||
| // 获取楼层楼座数据 | |||
| getbuildingfloorlist:"/wxMallBuilding/getbuildingfloorlist" | |||
| getbuildingfloorlist:"/wxMallBuilding/getbuildingfloorlist", | |||
| //切换广场 | |||
| selectMall:"/user/selectMall" | |||
| }, | |||
| weapp: { | |||
| AppId: weappId | |||
| @@ -15,7 +15,7 @@ | |||
| "orgUrl": "https://wx.qlogo.cn" | |||
| } | |||
| ], | |||
| "configUrl": "https://ciformall.youlane.cn/C/api", | |||
| "configUrl": "http://10.11.153.205:7000/C/api", | |||
| "etcpAppId": "wx192b7d2e8dcbefd0", | |||
| "socketUrl": "wss://mp.youlane.cn/W/ws", | |||
| "ifStoreApp": "0", | |||
| @@ -228,6 +228,56 @@ Page({ | |||
| //获取条形码 | |||
| // util.barcode("barcode", optionss.quancode, 510, 100); | |||
| }, | |||
| //获取距离 | |||
| GetDistance(lat1, lng1, lat2, lng2) { | |||
| var radLat1 = lat1 * Math.PI / 180.0; | |||
| var radLat2 = lat2 * Math.PI / 180.0; | |||
| var a = radLat1 - radLat2; | |||
| var b = lng1 * Math.PI / 180.0 - lng2 * Math.PI / 180.0; | |||
| var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + | |||
| Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2))); | |||
| s = s * 6378.137;// EARTH_RADIUS; | |||
| s = Math.round(s * 10000) / 10000; | |||
| return s; | |||
| }, | |||
| //切换商场 | |||
| checkoutGroup(tenantId, parentTenantId){ | |||
| let param = { | |||
| tenantId: parentTenantId, | |||
| subTenantId: tenantId | |||
| } | |||
| Http.post({ | |||
| url: config.api.selectMall, | |||
| data: param | |||
| }).then(res => { | |||
| wx.setStorageSync('tenantId', tenantId) | |||
| wx.setStorageSync('firstEnter', false) | |||
| wx.hideLoading(); | |||
| // wx.showModal({ | |||
| // title: '提示', | |||
| // content: '切换成功!', | |||
| // }) | |||
| wx.reLaunch({ | |||
| url: '/index/index', | |||
| }) | |||
| }) | |||
| .catch(err => { | |||
| wx.showModal({ | |||
| title: '提示', | |||
| content: err.message, | |||
| showCancel: false, | |||
| success: function (res) { | |||
| // 重启首页 | |||
| if (res.confirm) { | |||
| wx.reLaunch({ | |||
| url: '/pages/index/index', | |||
| }) | |||
| } | |||
| } | |||
| }) | |||
| this.alphaClick(); | |||
| }) | |||
| }, | |||
| /** | |||
| * 获得经纬度 | |||
| */ | |||
| @@ -237,6 +287,30 @@ Page({ | |||
| type: "wgs84", | |||
| success: function (res) { | |||
| console.log(res, 9999) | |||
| let minNum = 0; | |||
| let minIndex = 0; | |||
| JSON.parse(wx.getStorageSync('tenantData')).map((item, index) => { | |||
| let lang = that.GetDistance(res.latitude,item.latitude,res.longitude,item.longitude) | |||
| minIndex = (index == 0 || lang < minNum) ? index : minIndex; | |||
| minNum = (index == 0 || lang < minNum) ? lang : minNum; | |||
| }) | |||
| if (JSON.parse(wx.getStorageSync('tenantData'))[minIndex].tenantId != wx.getStorageSync('tenantId') && wx.getStorageSync('firstEnter')){ | |||
| wx.showModal({ | |||
| title: '提示', | |||
| content: '系统检测到您离' + JSON.parse(wx.getStorageSync('tenantData'))[minIndex].name + '较近,要切换至' + JSON.parse(wx.getStorageSync('tenantData'))[minIndex].name+'吗?', | |||
| success: function (res) { | |||
| // 重启首页 | |||
| if (res.confirm) { | |||
| wx.showLoading({ | |||
| title: '切换中...', | |||
| }) | |||
| that.checkoutGroup(JSON.parse(wx.getStorageSync('tenantData'))[minIndex].tenantId, JSON.parse(wx.getStorageSync('tenantData'))[minIndex].parentTenantId) | |||
| }else{ | |||
| wx.setStorageSync('firstEnter', false) | |||
| } | |||
| } | |||
| }) | |||
| } | |||
| if (res && res.longitude && res.latitude) { | |||
| Http.post({ | |||
| url: config.api.updateLBS, | |||
| @@ -736,6 +810,7 @@ Page({ | |||
| onShareAppMessage: function() { | |||
| return { | |||
| title: this.data.weappShareTitle, | |||
| path: `/pages/index/index` + (wx.getStorageSync('tenantId') ? '?tenantId=' + wx.getStorageSync('tenantId') : ''), | |||
| imageUrl: this.data.weappShareCoverImg, | |||
| // desc: this.data.desc, | |||
| success: function(res) { | |||
| @@ -96,7 +96,7 @@ Page({ | |||
| let _this = this; | |||
| return { | |||
| title: _this.data.userName + '赠送您一张' + _this.data.cardDetail.title, | |||
| path: '/pages/index/index?couponChannelId=' + _this.data.cardDetail.couponChannelId + '&cuserId=' + _this.data.cardDetail.ownerId + '&couponId=' + _this.data.cardDetail.couponId + '&coverImg=' + _this.data.cardDetail.coverImg + '&userName=' + _this.data.userName + '&avatarUrl=' + _this.data.avatarUrl + '&couponOrderId=' + _this.data.cardDetail.id + '&updateDate=' + _this.data.cardDetail.updateDate, | |||
| path: '/pages/index/index?couponChannelId=' + _this.data.cardDetail.couponChannelId + '&cuserId=' + _this.data.cardDetail.ownerId + '&couponId=' + _this.data.cardDetail.couponId + '&coverImg=' + _this.data.cardDetail.coverImg + '&userName=' + _this.data.userName + '&avatarUrl=' + _this.data.avatarUrl + '&couponOrderId=' + _this.data.cardDetail.id + '&updateDate=' + _this.data.cardDetail.updateDate + (wx.getStorageSync('tenantId') ? '&tenantId=' + wx.getStorageSync('tenantId') : ''), | |||
| imageUrl: _this.data.cardDetail.coverImg, | |||
| success: function (res) { | |||
| // 转发成功 | |||
| @@ -759,7 +759,7 @@ Page({ | |||
| var that = this; | |||
| var shareObj = { | |||
| title: that.data.nickName + '邀请您帮砍' + that.data.data.title, | |||
| path: `/pages/index/index?orderId=${that.data.data.id}&from=${"discount"}`, | |||
| path: `/pages/index/index?orderId=${that.data.data.id}&from=${"discount"}` + (wx.getStorageSync('tenantId') ? '&tenantId=' + wx.getStorageSync('tenantId'):''), | |||
| success: function (res) { | |||
| if (res.errMsg == 'shareAppMessage:ok') { } | |||
| }, | |||
| @@ -770,7 +770,7 @@ Page({ | |||
| // 来自页面内的按钮的转发 | |||
| if (options.from == 'button') { | |||
| var orderId = options.target.dataset.orderid; | |||
| shareObj.path = `/pages/index/index?orderId=${orderId}&from=${"discount"}`; | |||
| shareObj.path = `/pages/index/index?orderId=${orderId}&from=${"discount"}` + (wx.getStorageSync('tenantId') ? '&tenantId=' + wx.getStorageSync('tenantId') : ''); | |||
| } | |||
| // 返回shareObj | |||
| return shareObj; | |||
| @@ -534,7 +534,7 @@ Page({ | |||
| var that = this; | |||
| var shareObj = { | |||
| title: that.data.data.title, | |||
| path: `/pages/index/index?couponChannelId=${that.data.couponChannelId}&couponId=${that.data.couponId}`, | |||
| path: `/pages/index/index?couponChannelId=${that.data.couponChannelId}&couponId=${that.data.couponId}` + (wx.getStorageSync('tenantId') ? '&tenantId=' + wx.getStorageSync('tenantId') : ''), | |||
| success: function (res) { | |||
| if (res.errMsg == 'shareAppMessage:ok') { } | |||
| }, | |||
| @@ -546,7 +546,7 @@ Page({ | |||
| if (options.from == 'button') { | |||
| var eData = options.target.dataset.id; | |||
| var couponId = options.target.dataset.couponid; | |||
| shareObj.path = `/pages/index/index?couponChannelId=${eData}&couponId=${couponId}`; | |||
| shareObj.path = `/pages/index/index?couponChannelId=${eData}&couponId=${couponId}` + (wx.getStorageSync('tenantId') ? '&tenantId=' + wx.getStorageSync('tenantId') : ''); | |||
| } | |||
| // 返回shareObj | |||
| return shareObj; | |||
| @@ -66,12 +66,5 @@ Page({ | |||
| */ | |||
| onReachBottom: function () { | |||
| }, | |||
| /** | |||
| * 用户点击右上角分享 | |||
| */ | |||
| onShareAppMessage: function () { | |||
| } | |||
| }) | |||
| @@ -958,7 +958,7 @@ Page({ | |||
| console.log(options) | |||
| var shareObj = { | |||
| title: that.data.data.title, | |||
| path: `/pages/index/index?couponChannelId=${that.data.couponChannelId}`, | |||
| path: `/pages/index/index?couponChannelId=${that.data.couponChannelId}` + (wx.getStorageSync('tenantId') ? '&tenantId=' + wx.getStorageSync('tenantId') : ''), | |||
| success: function(res) { | |||
| if (res.errMsg == 'shareAppMessage:ok') {} | |||
| }, | |||
| @@ -969,7 +969,7 @@ Page({ | |||
| // 来自页面内的按钮的转发 | |||
| if (options.from == 'button') { | |||
| var eData = options.target.dataset.id; | |||
| shareObj.path = `/pages/index/index?couponChannelId=${eData}&frommd=JC`; | |||
| shareObj.path = `/pages/index/index?couponChannelId=${eData}&frommd=JC` + (wx.getStorageSync('tenantId') ? '&tenantId=' + wx.getStorageSync('tenantId') : ''); | |||
| } | |||
| // 返回shareObj | |||
| return shareObj; | |||
| @@ -10,7 +10,7 @@ Page({ | |||
| let _this=this; | |||
| return { | |||
| title: '小游戏', | |||
| path: 'pages/index/index', | |||
| path: 'pages/index/index' + (wx.getStorageSync('tenantId') ? '&tenantId=' + wx.getStorageSync('tenantId') : ''), | |||
| success: function (res) { | |||
| // 转发成功 | |||
| }, | |||
| @@ -7,13 +7,61 @@ Page({ | |||
| /** | |||
| * 页面的初始数据 | |||
| */ | |||
| data: {}, | |||
| /** | |||
| * 生命周期函数--监听页面加载 | |||
| */ | |||
| onLoad: function(options) { | |||
| data: { | |||
| tenantData: JSON.parse(wx.getStorageSync('tenantData')) | |||
| }, | |||
| bindPickerChange(options) { | |||
| console.log('picker发送选择改变,携带值为', options.tenantId, this.data.tenantData) | |||
| let selectIndex = 0; | |||
| this.data.tenantData.map((item, index) => { | |||
| if (options.tenantId == item.tenantId) { | |||
| selectIndex = index; | |||
| wx.setStorageSync('tenantId', item.tenantId) | |||
| } | |||
| }) | |||
| console.log() | |||
| let param = { | |||
| tenantId: this.data.tenantData[selectIndex].parentTenantId, | |||
| subTenantId: this.data.tenantData[selectIndex].tenantId | |||
| } | |||
| this.checkAble = true; | |||
| wx.showLoading({ | |||
| title: '切换中...', | |||
| }) | |||
| Http.post({ | |||
| url: config.api.selectMall, | |||
| data: param | |||
| }).then(res => { | |||
| wx.setStorageSync('tenantId', this.data.tenantData[selectIndex].tenantId) | |||
| wx.hideLoading(); | |||
| wx.showToast({ | |||
| title: '切换成功!', | |||
| icon: 'success', | |||
| duration: 2000 | |||
| }) | |||
| wx.reLaunch({ | |||
| url: '/index/index', | |||
| }) | |||
| }) | |||
| .catch(err => { | |||
| wx.showModal({ | |||
| title: '提示', | |||
| content: err.message, | |||
| showCancel: false, | |||
| success: function (res) { | |||
| // 重启首页 | |||
| if (res.confirm) { | |||
| wx.reLaunch({ | |||
| url: '/pages/index/index', | |||
| }) | |||
| } | |||
| } | |||
| }) | |||
| this.alphaClick(); | |||
| }) | |||
| }, | |||
| goContinue(options){ | |||
| let that = this; | |||
| console.log(options); | |||
| wx.showToast({ | |||
| title: '加载中', | |||
| icon: "loading", | |||
| @@ -38,7 +86,7 @@ Page({ | |||
| that.setData({ | |||
| newArr: this.data.scene.split(':') | |||
| }) | |||
| //// 大屏-二维码-start | |||
| if (this.data.newArr[0] == 'JC') { | |||
| // 跳转券详情 | |||
| @@ -75,12 +123,12 @@ Page({ | |||
| } | |||
| } | |||
| } | |||
| wx.setStorageSync('options', JSON.stringify(options)) | |||
| wx.setStorageSync('imgurl', imgurl); | |||
| if (app.globalData.token) { | |||
| this.updateUserInfo(); | |||
| this.updateUserInfo(); | |||
| if (options.couponChannelId || options.orderId || options.id) { | |||
| that.userStatus(options); | |||
| } else { | |||
| @@ -99,6 +147,18 @@ Page({ | |||
| } | |||
| } | |||
| }, | |||
| /** | |||
| * 生命周期函数--监听页面加载 | |||
| */ | |||
| onLoad: function(options) { | |||
| let that = this; | |||
| console.log(options,1112222); | |||
| if (options.tenantId){ | |||
| this.bindPickerChange(options); | |||
| }else{ | |||
| this.goContinue(options); | |||
| } | |||
| }, | |||
| /** | |||
| * 检查用户的状态 | |||
| @@ -200,7 +200,7 @@ Page({ | |||
| let that = this; | |||
| let shareObj = { | |||
| title: that.data.data.merchantName, | |||
| path: `/pages/index/index?id=${that.data.id}&frommd=md`, | |||
| path: `/pages/index/index?id=${that.data.id}&frommd=md` + (wx.getStorageSync('tenantId') ? '&tenantId=' + wx.getStorageSync('tenantId') : ''), | |||
| success: function(res) { | |||
| if (res.errMsg == 'shareAppMessage:ok') {} | |||
| }, | |||
| @@ -85,12 +85,5 @@ Page({ | |||
| */ | |||
| onReachBottom: function () { | |||
| }, | |||
| /** | |||
| * 用户点击右上角分享 | |||
| */ | |||
| onShareAppMessage: function () { | |||
| } | |||
| }) | |||
| @@ -69,7 +69,7 @@ Page({ | |||
| let _this = this; | |||
| return { | |||
| title: _this.data.userName+'赠送您一张' + _this.data.order.title, | |||
| path: '/pages/index/index?couponChannelId=' + this.data.order.couponChannelId + '&cuserId=' + this.data.order.cuserId + '&couponId=' + this.data.order.productId + '&coverImg=' + this.data.order.coverImg + '&userName=' + this.data.userName + '&avatarUrl=' + this.data.avatarUrl + '&couponOrderId=' + this.data.order.couponOrderId + '&updateDate=' + this.data.order.updateDate, | |||
| path: '/pages/index/index?couponChannelId=' + this.data.order.couponChannelId + '&cuserId=' + this.data.order.cuserId + '&couponId=' + this.data.order.productId + '&coverImg=' + this.data.order.coverImg + '&userName=' + this.data.userName + '&avatarUrl=' + this.data.avatarUrl + '&couponOrderId=' + this.data.order.couponOrderId + '&updateDate=' + this.data.order.updateDate + (wx.getStorageSync('tenantId') ? '&tenantId=' + wx.getStorageSync('tenantId') : ''), | |||
| imageUrl: this.data.order.coverImg, | |||
| success: function (res) { | |||
| // 转发成功 | |||
| @@ -106,7 +106,7 @@ Page({ | |||
| // 来自页面内的按钮的转发 | |||
| if (options.from == 'button') { | |||
| var eData = options.target.dataset.id; | |||
| shareObj.path = `/pages/index/index?id=${eData}&type=ra`; | |||
| shareObj.path = `/pages/index/index?id=${eData}&type=ra` + (wx.getStorageSync('tenantId') ? '&tenantId=' + wx.getStorageSync('tenantId') : ''); | |||
| } | |||
| return shareObj; | |||
| }, | |||
| @@ -269,7 +269,7 @@ Page({ | |||
| let _this = this; | |||
| return { | |||
| title: _this.data.nickName + '超值推荐的' + _this.data.data.title, | |||
| path: `/pages/index/index?couponId=${_this.data.data.couponId}&orderGroupId=${_this.data.data.orderGroupId}&couponChannelId=${_this.data.paramData.couponChannelId}&orderId=${_this.data.data.orderId}&avatarUrl=${_this.data.avatarUrl}&nickName=${_this.data.nickName}`, | |||
| path: `/pages/index/index?couponId=${_this.data.data.couponId}&orderGroupId=${_this.data.data.orderGroupId}&couponChannelId=${_this.data.paramData.couponChannelId}&orderId=${_this.data.data.orderId}&avatarUrl=${_this.data.avatarUrl}&nickName=${_this.data.nickName}` + (wx.getStorageSync('tenantId') ? '&tenantId=' + wx.getStorageSync('tenantId') : ''), | |||
| imageUrl: _this.data.data.coverImg, | |||
| success: function (res) { | |||
| // 转发成功 | |||
| @@ -754,7 +754,7 @@ Page({ | |||
| var that = this; | |||
| var shareObj = { | |||
| title: that.data.data.title, | |||
| path: `/pages/index/index?couponChannelId=${that.data.couponChannelId}&couponId=${that.data.data.couponId}&spellGroup=spellGroup`, | |||
| path: `/pages/index/index?couponChannelId=${that.data.couponChannelId}&couponId=${that.data.data.couponId}&spellGroup=spellGroup` + (wx.getStorageSync('tenantId') ? '&tenantId=' + wx.getStorageSync('tenantId') : ''), | |||
| success: function (res) { | |||
| if (res.errMsg == 'shareAppMessage:ok') { } | |||
| }, | |||
| @@ -765,7 +765,7 @@ Page({ | |||
| // 来自页面内的按钮的转发 | |||
| if (options.from == 'button') { | |||
| var eData = options.target.dataset.id; | |||
| shareObj.path = `/pages/index/index?couponChannelId=${eData}&couponId=${that.data.data.couponId}&spellGroup=spellGroup&frommd=JC`; | |||
| shareObj.path = `/pages/index/index?couponChannelId=${eData}&couponId=${that.data.data.couponId}&spellGroup=spellGroup&frommd=JC` + (wx.getStorageSync('tenantId') ? '&tenantId=' + wx.getStorageSync('tenantId') : ''); | |||
| } | |||
| // 返回shareObj | |||
| return shareObj; | |||
| @@ -62,12 +62,5 @@ Page({ | |||
| */ | |||
| onReachBottom: function () { | |||
| }, | |||
| /** | |||
| * 用户点击右上角分享 | |||
| */ | |||
| onShareAppMessage: function () { | |||
| } | |||
| }) | |||