diff --git a/app.js b/app.js index 03b6c38..aa83b93 100644 --- a/app.js +++ b/app.js @@ -1,10 +1,15 @@ let config = require("./config/config.js"); const Http = require("./utils/HttpBasics"); const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {} + +var myPluginInterface = extConfig.attr.businessSwitch?requirePlugin('auto-points-plugin'):null; +let businessSwitch = extConfig.attr.businessSwitch ? extConfig.attr.businessSwitch:false App({ data: { newArr:[],//存放分享二维进入消息信息 + businessSwitch: businessSwitch,//判断是否开启商圈自助积分 }, + onLaunch: function(options) { // wx.hideTabBar() var that = this; @@ -15,7 +20,7 @@ App({ if (options.query.scene) { that.globalData.newArr = decodeURIComponent(options.query.scene).split(":"); } - that.globalData.sceneAddress = options.scene; + that.globalData.sceneAddress = options.scene /** * 小程序版本更新 */ @@ -29,11 +34,34 @@ App({ that.statusBarHeight = res.statusBarHeight } }) + }, - + onShow:function(options){ - console.log("onshow被调用了!") - + //自助积分 需要openId 且必须写在onshow里面 + let _this = this + wx.login({ + success:(res)=>{ + console.log('我是onshow') + 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, "我是地理位置") + }) + } + }) + } + } + }) + }, statusBarHeight: 0, /** @@ -62,7 +90,8 @@ App({ data: usrdata }) .then(res => { - wx.setStorageSync('openId',res.data.openId) + wx.setStorageSync('0',res.data.openId) + if (res.data.subMalls){ const squareList = JSON.parse(res.data.subMalls) wx.setStorageSync("squareList", squareList) diff --git a/ext.json b/ext.json index 5a139c3..0b255d7 100644 --- a/ext.json +++ b/ext.json @@ -2,33 +2,44 @@ "ext": { "attr": { "car": { + "tjd": { + "payPath": "", + "tjdAppId": "wx6945d1bda68d7993" + }, "etcp": { - "etcpAppId": "wx192b7d2e8dcbefd0", - "etcpVersion": "release", - "etcpCallbackUrl": "https://admintest.malls.iformall.com/api/carCallback/etcpPaidCallback" - } + "payPath": "pages/pay/order-pay-open/main", + "etcpAppId": "wxc07f9d67923d676d", + "etcpCallbackUrl": "https://admin.malls.iformall.com/api/carCallback/etcpPaidCallback" + }, + "bolink": { + "payPath": "pages/park/park", + "bolinkAppId": "wxbd08b4baa10fcc1d" + }, + "version": "release" }, + "mchId": "1604439800", "imgProxy": [ { - "newUrl": "https://ctest.malls.iformall.com/img", + "newUrl": "https://c.malls.iformall.com/img", "orgUrl": "https://iformall-net.formall.oss-accelerate.aliyuncs.com" }, { - "newUrl": "https://ctest.malls.iformall.com/img1", + "newUrl": "https://c.malls.iformall.com/img1", "orgUrl": "https://formall.oss-accelerate.aliyuncs.com" }, { - "newUrl": "https://ctest.malls.iformall.com/img2", + "newUrl": "https://c.malls.iformall.com/img2", "orgUrl": "https://wx.qlogo.cn" } ], - "configUrl": "https://ctest.malls.iformall.com/C/api", + "configUrl": "https://c.malls.iformall.com/C/api", + "ifStoreApp": "0", "ifHaveWebSocket": "0", - "ifHaveCarModular": "1" + "ifHaveCarModular": "0" }, - "name": "金泸商务", - "weappId": "wx649b3be73c1afe47", - "appVersion": "C.test.5.2.0" + "name": "富茂链客生产版", + "weappId": "wx6a2524a8286d687f", + "appVersion": "C.5.1.1" }, "debug": false, "tabBar": { @@ -58,8 +69,7 @@ "selectedIconPath": "assets/images/user-a.png" } ], - "color": "#abb1be", - "selectedColor": "#b2743d" + "custom": true }, "window": { "backgroundTextStyle": "dark", @@ -73,7 +83,7 @@ "provider": "wx2b03c6e691cd7370" } }, - "extAppid": "wx649b3be73c1afe47", + "extAppid": "wx6a2524a8286d687f", "extEnable": true, "permission": { "scope.userLocation": { diff --git a/index/index.js b/index/index.js index 672d7a4..d246903 100644 --- a/index/index.js +++ b/index/index.js @@ -1,5 +1,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 Http = require("../utils/HttpBasics"); const imgurl = require("../utils/imgurl"); @@ -10,6 +12,10 @@ const bgColor = require("../utils/bgColor.js") let app = getApp(); Page({ data: { + mch_id: mch_id, + goUrl:"",//商圈跳转链接 + accreditFlag:1,//1是未授权微信且未授权手机号 2授权了微信 没授权手机号 3微信和手机号都授权了 + businessSwitch: businessSwitch, typeLsit:{}, showLocationIf: true, ifStoreApp: ifStoreApp, @@ -87,6 +93,50 @@ Page({ isShowSqare: false, }, + //判断用户是否授权 + 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.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + } + }) + }).catch (err => { + if(err.code==11004){//未授权微信 + this.setData({ + accreditFlag:1 + }) + }else{ + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + } + }) + }, + //获取当前广场名 //跳转到每日签到 goSign(){ @@ -265,11 +315,6 @@ Page({ let optionss; let openId = wx.getStorageSync('openId') - if (openId) { - that.setData({ - openId: openId - }) - } if (wx.getStorageSync('options')) { optionss = JSON.parse(wx.getStorageSync('options')); } @@ -289,6 +334,7 @@ Page({ //获取条形码 // util.barcode("barcode", optionss.quancode, 510, 100); // console.log(Http.headers.token, "?") + }, /** * 获得经纬度 @@ -352,6 +398,13 @@ Page({ }, onShow: function() { + if (businessSwitch) { + let openId = wx.getStorageSync("0") + this.setData({ + goUrl: `plugin://auto-points-plugin/index?openid=${openId}&mch_id=${this.data.mch_id}` + }) + } + this.uesrInfo() if(JSON.stringify(app.globalData.styleLsit)!="{}"){ this.setTabStyle() } diff --git a/index/index.wxml b/index/index.wxml index 8d7aa09..f1b8cab 100644 --- a/index/index.wxml +++ b/index/index.wxml @@ -149,4 +149,18 @@ 您今日签到成功,获得{{fistLogin}}成长值 - \ No newline at end of file + + + + + + + + + + + + + + + diff --git a/index/index.wxss b/index/index.wxss index b68e8d8..5bb2447 100644 --- a/index/index.wxss +++ b/index/index.wxss @@ -590,3 +590,11 @@ i-tabs i-tabs-scroll{ background: #F4F5F9!important; } +.integralBox{ + width: 110rpx; + height: 110rpx; + bottom: 500rpx; + right: 20rpx; + position: fixed; + z-index: 1000000 +} \ No newline at end of file diff --git a/index/passCar.js b/index/passCar.js index 4d638e7..99b2998 100644 --- a/index/passCar.js +++ b/index/passCar.js @@ -69,23 +69,25 @@ Page({ * 选择使用的优惠券 */ choicecoupon: function(e) { - /* wx.navigateBack(); - var pages = getCurrentPages(); - var prevPage = pages[pages.length - 2] //上一个页面 */ var that = this; - var quantitle = e.currentTarget.dataset.title; - var quanid = e.currentTarget.dataset.id; - this.setData({ - quantitle: quantitle, - quanid: quanid, - showTicketModal: false, - }); - - that.bindCoupon(that.data.quanid); - /* wx.setStorage({ - key: 'chosed', - data: 'chosed', - }) */ + wx.showModal({ + title: '确定是否使用停车券', + content: '使用后无法撤销', + success(res) { + if (res.confirm) { + var quantitle = e.currentTarget.dataset.title; + var quanid = e.currentTarget.dataset.id; + that.setData({ + quanid: quanid, + showTicketModal: false, + }); + that.bindCoupon(that.data.quanid, quantitle); + } else if (res.cancel) { + console.log('用户点击取消') + } + } + }) + }, /* */ @@ -453,7 +455,7 @@ Page({ /** * 券绑定车牌 */ - bindCoupon: function (quanid) { + bindCoupon: function (quanid,quantitle) { var that = this; /** * etcp @@ -498,10 +500,24 @@ Page({ data: postCouponData }) .then(res => { - that.getStopFee(that.data.listCardNum); - that.initUsrCarList(); + // if(res.data){ + that.getStopFee(that.data.listCardNum); + that.initUsrCarList(); + that.setData({ + quantitle: quantitle,//接口条用成功后在赋值 + }) + // }else{ + // wx.showToast({ + // title: res.message, + // icon: 'none', + // duration: 3000, + // mask: false + // }); + // } + }) .catch(err => { + if (err.message!=undefined) { wx.showToast({ title: err.message, diff --git a/index/user.js b/index/user.js index fbac954..43d0f25 100644 --- a/index/user.js +++ b/index/user.js @@ -1,6 +1,8 @@ var app = getApp(); const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px' const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {} +let businessSwitch = extConfig.attr.businessSwitch +let mch_id = extConfig.attr.mchId let ifStoreApp = extConfig.attr.ifStoreApp; const Http = require("../utils/HttpBasics"); const imgurl = require("../utils/imgurl"); @@ -11,6 +13,10 @@ Page({ * 页面的初始数据 */ data: { + + mch_id: mch_id, + businessSwitch:businessSwitch, + goUrl: "", templateId: [], aboutShow: false, navigationBarHeight, @@ -40,6 +46,7 @@ Page({ mineFlag: "", flag: 'hidden', score: '0', + credit:'0', userId:"", memberName:"", memberLogo:"", @@ -150,7 +157,6 @@ Page({ }, //获取房间列表 getRoomList() { - debugger Http.get({ url: config.api.getRoomList, data: { @@ -216,6 +222,14 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function() { + + if (businessSwitch){ + let openId = wx.getStorageSync("0") + this.setData({ + goUrl: `plugin://auto-points-plugin/index?openid=${openId}&mch_id=${this.data.mch_id}` + }) + } + console.log(this.data.goUrl) let that = this; that.userAuthorization() if (typeof that.getTabBar === 'function' && @@ -297,6 +311,7 @@ Page({ } that.setData({ score: res.data.score, + credit: res.data.credit, curPhone: curPhone, levelName: res.data.levelName, userId: res.data.userId diff --git a/index/user.wxml b/index/user.wxml index b7d907e..5d3ef03 100644 --- a/index/user.wxml +++ b/index/user.wxml @@ -53,6 +53,7 @@ 更多成长值 + 我的积分:{{credit}} @@ -135,6 +136,12 @@ > + + + 自助积分 + > + + 关于我们 diff --git a/index/user.wxss b/index/user.wxss index 494b1ec..1cfbca2 100644 --- a/index/user.wxss +++ b/index/user.wxss @@ -54,7 +54,7 @@ page{ font-family: PingFangSC-Medium; height: 42rpx; margin-top: 66rpx; - letter-spacing: 0.64rpx; + line-height: 44rpx; font-size: 32rpx; color: #FFFFFF; @@ -72,7 +72,7 @@ page{ .user_phone{ font-family: PingFangSC-Medium; height: 42rpx; - letter-spacing: 0.64rpx; + line-height: 44rpx; font-size: 32rpx; color: #FFFFFF; @@ -102,6 +102,9 @@ page{ } .memberBox{ float: left; + margin-left: 20rpx; + margin-top: 10rpx; + margin-bottom: 10rpx; } .memberCode{ font-size: 24rpx; @@ -109,17 +112,12 @@ page{ font-weight: 400; color: #888; line-height: 34rpx; - margin: 20rpx 0 0 20rpx; } .user-phone { font-family: PingFangSC-Regular; - letter-spacing: 0.64rpx; line-height: 44rpx; font-size: 36rpx; color: #000; - padding: 0 20rpx 20rpx; - text-align: center; - } .user-avatar { @@ -470,10 +468,16 @@ page{ text-align: center; font-size: 28rpx; } -.membercode { +/* .membercode { margin-top: 20rpx; +} */ +.integral{ + font-size:24rpx; + font-family:PingFangSC-Regular; + font-weight:400; + color:rgba(166,166,166,1); + line-height:34rpx } - .top{ width: 100%; height: 234rpx; diff --git a/pages/couponorder/index/index.js b/pages/couponorder/index/index.js index b1cb859..4fd07b7 100644 --- a/pages/couponorder/index/index.js +++ b/pages/couponorder/index/index.js @@ -109,11 +109,21 @@ Page({ list: [] }) } - var tmpArr = that.data.list; - Object.assign(tmpArr, res.data.list); - that.setData({ - list: tmpArr - }) + var tmpArr =[]; + tmpArr = that.data.list + // Object.assign(tmpArr, res.data.list); + if(pageNum==1){ + console.log(res.data.list) + that.setData({ + list: res.data.list + }) + }else{ + tmpArr = [...tmpArr,...res.data.list] + that.setData({ + list: tmpArr + }) + } + }) .catch(err => { wx.showModal({ diff --git a/pages/getuserinfo/index.js b/pages/getuserinfo/index.js index 2e36dad..d173259 100755 --- a/pages/getuserinfo/index.js +++ b/pages/getuserinfo/index.js @@ -14,7 +14,7 @@ Page({ optionData: null, fromflag: '', couponChannelIdflag: '', - wjId:"", + wjId: "", }, //是否授权手机号 judgePhonelngo() { @@ -23,15 +23,15 @@ Page({ data: {} }).then(res => { var tempSkip = app.globalData.skip - if (tempSkip =='redirectTo'){ + if (tempSkip == 'redirectTo') { wx.redirectTo({ url: app.globalData.skipUrl, }) - } else if (tempSkip == 'navigateTo'){ + } else if (tempSkip == 'navigateTo') { wx.navigateTo({ url: app.globalData.skipUrl, }) - } else if (tempSkip == 'reLaunch'){ + } else if (tempSkip == 'reLaunch') { wx.reLaunch({ url: app.globalData.skipUrl, }) @@ -40,7 +40,7 @@ Page({ url: app.globalData.skipUrl, }) } - + }).catch(err => { wx.redirectTo({ url: `/pages/getphoneInfo/index?skipUrl=1` @@ -64,7 +64,7 @@ Page({ }) } //调查问卷 - if (options && !options.wjId || options.wjId){ + if (options && !options.wjId || options.wjId) { this.setData({ wjId: options.wjId }) @@ -144,238 +144,477 @@ Page({ 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) + // 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 == '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) { + wx.getUserProfile({ + desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 + success: (res) => { + let that = this; + var iv = res.iv; + var encryptedData = res.encryptedData; + wx.getUserInfo({ + success: function(res) { + Http.post({ + url: config.api.getUserInfo, + data: { + encryptedData: encryptedData, + iv: iv } - // 门店详情 - else if (that.data.optionData.id && app.globalData.type == 'md') { - app.globalData.skipUrl = `/pages/index/searchbar/detail/index?id=${that.data.optionData.id}`, + }).then( + function(res) { + if (that.data.wjId) { + app.globalData.skipUrl = `/pages/questionnaire/questionnaire?id=${that.data.wjId}` 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}`, + that.judgePhonelngo() + return; + } + if (that.data.fromflag == 'poster') { + app.globalData.skipUrl = `/pages/canvas/index?couponChannelId=${that.data.couponChannelId}` 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() + 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 { - // 标准格式 - app.globalData.skipUrl = `/pages/bannerdetail/index?id=${that.data.optionData.id}`, + //返回主页 + // 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() + 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() + } } - } 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" - }); - } + }, + function(error) { + console.log(error) + wx.showToast({ + title: "请授权个人信息", + icon: "none" + }); + } - ) - .catch(err => { - wx.showToast({ - title: err.errMsg, - icon: 'none', - duration: 2000, - mask: false - }); - }) + ) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) + } + }) } }) + }, getGameOne: function(token, id) { let _this = this; diff --git a/pages/getuserinfo/index.wxml b/pages/getuserinfo/index.wxml index cd9cea1..15b68b3 100755 --- a/pages/getuserinfo/index.wxml +++ b/pages/getuserinfo/index.wxml @@ -8,7 +8,8 @@ 授权后,可以更好的体验我们哦~ - + + 微信用户登录 diff --git a/pages/index/index.js b/pages/index/index.js index 9d9dc7a..ea49476 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -12,6 +12,7 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function(options) { + console.log("我是中转页面") let that = this; console.log(options); wx.showToast({ diff --git a/pages/integralmall/integraHistory/index.wxss b/pages/integralmall/integraHistory/index.wxss index bcd3a11..75d1722 100644 --- a/pages/integralmall/integraHistory/index.wxss +++ b/pages/integralmall/integraHistory/index.wxss @@ -58,7 +58,7 @@ .content { position: relative; padding: 0 35rpx; - height: 145rpx; + height: 155rpx; border-bottom: 1px solid #eaeaea; } @@ -80,7 +80,7 @@ .content>view:nth-of-type(2n+1) { float: left; width: 60%; - height: 145rpx; + height: 150rpx; overflow: hidden; } diff --git a/pages/spellDetail/index.wxml b/pages/spellDetail/index.wxml index 98dcb8c..f5adee8 100644 --- a/pages/spellDetail/index.wxml +++ b/pages/spellDetail/index.wxml @@ -32,7 +32,7 @@ - + @@ -89,7 +89,7 @@ - + diff --git a/pages/spellGroup/mySpellGroup/index.js b/pages/spellGroup/mySpellGroup/index.js index c8df335..2c2c5ce 100644 --- a/pages/spellGroup/mySpellGroup/index.js +++ b/pages/spellGroup/mySpellGroup/index.js @@ -53,7 +53,7 @@ Page({ /** * 生命周期函数--监听页面加载 */ - onLoad: function(options) { + onLoad: function (options) { Http.get({ url: config.api.checkUserStatus, data: { @@ -96,7 +96,7 @@ Page({ url: `/pages/canvas/index?couponChannelId=${this.data.data.id}` }) }, */ - showPoster: function() { + showPoster: function () { console.log(this.data.data) let that = this; Http.get({ @@ -125,7 +125,7 @@ Page({ /** * 显示分享弹框 */ - showshare: function() { + showshare: function () { this.setData({ isshowposter: true, }) @@ -133,12 +133,12 @@ Page({ /** * 隐藏分享弹框 */ - hidemodal: function() { + hidemodal: function () { this.setData({ isshowposter: false, }) }, - gotoIndex: function() { + gotoIndex: function () { wx.switchTab({ url: '/index/index', }) @@ -146,7 +146,7 @@ Page({ /** * 拨打电话 */ - phone: function(e) { + phone: function (e) { let that = this; wx.makePhoneCall({ phoneNumber: e.target.dataset.merchantlinkphone @@ -168,11 +168,11 @@ Page({ getQuestions(type) { let that = this; Http.get({ - url: config.api.getQuestion, - data: { - couponType: JSON.stringify(that.data.data.type) - } - }) + url: config.api.getQuestion, + data: { + couponType: JSON.stringify(that.data.data.type) + } + }) .then(res => { wx.hideLoading(); if (res.data == undefined) { @@ -206,7 +206,7 @@ Page({ /** * 点击提交问题单选 */ - formSubmit: function(e) { + formSubmit: function (e) { console.log(e); let that = this; /** @@ -224,12 +224,12 @@ Page({ console.log(answserIs) console.log(e.currentTarget.dataset.questionid) Http.post({ - url: config.api.answerQuestion, - data: { - answer: answserIs, - questionId: e.currentTarget.dataset.questionid - } - }) + url: config.api.answerQuestion, + data: { + answer: answserIs, + questionId: e.currentTarget.dataset.questionid + } + }) .then(res => { that.closeQuestion(); }) @@ -245,21 +245,21 @@ Page({ /** * 多选 */ - checkboxChange: function(e) { + checkboxChange: function (e) { console.log(e) this.setData({ anwserId: e.detail.value }) }, - closeQuestion: function() { + closeQuestion: function () { let that = this; that.setData({ display: "none", zIndex: 11, opacity: 0 }) - setTimeout(function() { + setTimeout(function () { that.orderFunc(); }, 500) }, @@ -312,7 +312,7 @@ Page({ }) } if (that.data.showTime) { - setTimeout(function() { + setTimeout(function () { total_micro_second -= 1000; that.countdown(); }, 1000) @@ -349,7 +349,7 @@ Page({ title: '提示', content: "您有未支付拼团订单,请先进行支付", confirmText: "去支付", - success: function(res) { + success: function (res) { if (res.confirm) { wx.navigateTo({ url: `/pages/spellGroup/paySpellGroup/index?orderId=${that.data.disOrderNumber}&couponChannelId=${that.data.couponChannelId}&couponId=${couponId}&orderGroupId={that.data.orderGroupId}`, @@ -363,7 +363,7 @@ Page({ title: '提示', content: '您有未支付订单,请先进行支付', confirmText: "去支付", - success: function(res) { + success: function (res) { if (res.confirm) { wx.navigateTo({ url: `/pages/order/detail/index?orderId=${that.data.disOrderNumber}`, @@ -476,13 +476,13 @@ Page({ let that = this; // 支付成功 Http.post({ - url: config.api.toOrderGroup, - data: { - id: orderGroupId, - orderId, - couponId: _this.data.data.couponId - } - }) + url: config.api.toOrderGroup, + data: { + id: orderGroupId, + orderId, + couponId: _this.data.data.couponId + } + }) .then(res => { wx.navigateTo({ url: `/pages/spellDetail/index?orderId=${orderId}&couponId=${_this.data.data.couponId}&orderGroupId=${res.data.orderGroupId}&couponChannelId=${_this.data.couponChannelId}` @@ -492,6 +492,7 @@ Page({ console.log(err); }) }, + /** * 支付订单更新 */ @@ -500,14 +501,14 @@ Page({ let that = this; // 支付成功 Http.post({ - url: config.api.payOrderUpdate, - data: { - payOrderId: payOrderId, - orderId: orderId, - status: status, - reason: reason - } - }) + url: config.api.payOrderUpdate, + data: { + payOrderId: payOrderId, + orderId: orderId, + status: status, + reason: reason + } + }) .then(res => { wx.hideLoading() if (orderGroupId !== 0) { @@ -520,7 +521,7 @@ Page({ }) .catch(err => { if (err.code != 12002) { - setTimeout(function() { + setTimeout(function () { _this.payOrderUpdate(orderId, payOrderId, status, reason, _this, orderGroupId); }, 2000) } @@ -552,193 +553,189 @@ Page({ } Http.get({ - url: config.api.checkUserStatus, - data: { - token: app.globalData.token + url: config.api.checkUserStatus, + data: { + token: app.globalData.token + } + }).then(res => { + Http.get({ + url: config.api.checkPhoneStatus, + data: {} + }).then(res => { + /** + * orderSave 下单 + */ + return Http.post({ + url: config.api.orderSave, + data: data + }); + }).catch(err => { + console.log(err); + that.setData({ + showbutton: false, + showbutton1: false, + canSpell: true, + canBuyIf: true + }) + if (err.code == 2011) { + wx.showToast({ + title: "商户信息没找到", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 2013) { + wx.showToast({ + title: "商户信息禁用", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3000) { + wx.showToast({ + title: "库存不足", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3001) { + wx.showToast({ + title: "您已超过限购", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3002) { + wx.showToast({ + title: "订单失败", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3003) { + wx.showToast({ + title: "订单不存在", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3004) { + wx.showToast({ + title: "订单不存在", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 4003) { + wx.showToast({ + title: "卡券已作废", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3012) { + // wx.showToast({ + // title: err.message, + // icon: "none" + // }) + that.getUnPaidOrder(that.data.data.couponId); + } else if (err.code == 11005) { + /** + * 将值传到用户手机号授权的页面 + * + */ + wx.redirectTo({ + url: `/pages/getphoneInfo/index?path=spell&couponChannelId=${that.data.couponChannelId}&couponId=${that.data.data.couponId}` + }); + } else if (err.code == 11006) { + // 用户手机已加密 + wx.redirectTo({ + url: `/pages/phoneinput/phoneinput?path=spell&couponChannelId=${that.data.couponChannelId}&couponId=${that.data.data.couponId}` + }); + } else { + wx.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); } }).then(res => { - Http.get({ - url: config.api.checkPhoneStatus, - data: {} - }) - .then(res => { - /** - * orderSave 下单 - */ - return Http.post({ - url: config.api.orderSave, - data: data + console.log(res) + if (typeof (res) != "undefined") { + let orderId = "" + res.data.id; + that.setData({ + orderId: orderId, + canSpell: false, + canBuyIf: true + }); + // 支付金额不为0 + /** + * 支付订单创建 + */ + Http.post({ + url: config.api.payOrderCreate, + data: { + orderId: orderId + } + }).then(res => { + var payOrderId = "" + res.data.payOrderId; + wx.hideLoading(); + wx.requestPayment({ + timeStamp: res.data.timeStamp, + nonceStr: res.data.nonceStr, + package: res.data.package, + signType: (res.data.signType) ? res.data.signType : "MD5", + paySign: res.data.paySign, + success: res => { + that.setData({ + canSpell: false + }) + wx.showLoading({ + title: '订单正在处理中...', + }) + // setTimeout(function() { + // wx.hideLoading() + // }, 5000) + that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', that, orderGroupId); + if (res.errMsg == "requestPayment:ok") { + setTimeout(function () { + wx.hideLoading(); + }, 2000); + } + }, + fail: res => { + /** + * 支付失败,需要更新订单的状态 + */ + that.payOrderUpdate(that.data.orderId, payOrderId, 2, '', that, orderGroupId); + that.setData({ + showbutton: false, + canSpell: true, + canBuyIf: true + }) + return; + }, + complete: res => { } }); + /// End payment -------- }) - .catch(err => { - console.log(err); - that.setData({ - showbutton: false, - showbutton1: false, - canSpell: true, - canBuyIf: true - }) - if (err.code == 2011) { - wx.showToast({ - title: "商户信息没找到", - image: './../../../assets/images/fail.png', - duration: 2000, - mask: false - }); - } else if (err.code == 2013) { - wx.showToast({ - title: "商户信息禁用", - image: './../../../assets/images/fail.png', - duration: 2000, - mask: false - }); - } else if (err.code == 3000) { - wx.showToast({ - title: "库存不足", - image: './../../../assets/images/fail.png', - duration: 2000, - mask: false - }); - } else if (err.code == 3001) { - wx.showToast({ - title: "您已超过限购", - image: './../../../assets/images/fail.png', - duration: 2000, - mask: false - }); - } else if (err.code == 3002) { - wx.showToast({ - title: "订单失败", - image: './../../../assets/images/fail.png', - duration: 2000, - mask: false - }); - } else if (err.code == 3003) { - wx.showToast({ - title: "订单不存在", - image: './../../../assets/images/fail.png', - duration: 2000, - mask: false - }); - } else if (err.code == 3004) { - wx.showToast({ - title: "订单不存在", - image: './../../../assets/images/fail.png', - duration: 2000, - mask: false - }); - } else if (err.code == 4003) { - wx.showToast({ - title: "卡券已作废", - image: './../../../assets/images/fail.png', - duration: 2000, - mask: false - }); - } else if (err.code == 3012) { - // wx.showToast({ - // title: err.message, - // icon: "none" - // }) - that.getUnPaidOrder(that.data.data.couponId); - } else if (err.code == 11005) { - /** - * 将值传到用户手机号授权的页面 - * - */ - wx.redirectTo({ - url: `/pages/getphoneInfo/index?path=spell&couponChannelId=${that.data.couponChannelId}&couponId=${that.data.data.couponId}` - }); - } else if (err.code == 11006) { - // 用户手机已加密 - wx.redirectTo({ - url: `/pages/phoneinput/phoneinput?path=spell&couponChannelId=${that.data.couponChannelId}&couponId=${that.data.data.couponId}` - }); - } else { + .catch(err => { + that.setData({ + canSpell: true, + canBuyIf: true + }) wx.showToast({ title: err.message, icon: 'none', duration: 2000, mask: false }); - } - }) - .then(res => { - console.log(res) - if (typeof(res) != "undefined") { - let orderId = "" + res.data.id; - that.setData({ - orderId: orderId, - canSpell: false, - canBuyIf: true - }); - // 支付金额不为0 - /** - * 支付订单创建 - */ - Http.post({ - url: config.api.payOrderCreate, - data: { - orderId: orderId - } - }) - .then(res => { - var payOrderId = "" + res.data.payOrderId; - wx.hideLoading(); - wx.requestPayment({ - timeStamp: res.data.timeStamp, - nonceStr: res.data.nonceStr, - package: res.data.package, - signType: (res.data.signType) ? res.data.signType : "MD5", - paySign: res.data.paySign, - success: res => { - that.setData({ - canSpell: false - }) - wx.showLoading({ - title: '订单正在处理中...', - }) - setTimeout(function() { - wx.hideLoading() - }, 5000) - that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', that, orderGroupId); - if (res.errMsg == "requestPayment:ok") { - setTimeout(function() { - wx.hideLoading(); - }, 2000); - } - }, - fail: res => { - /** - * 支付失败,需要更新订单的状态 - */ - that.payOrderUpdate(that.data.orderId, payOrderId, 2, '', that, orderGroupId); - that.setData({ - showbutton: false, - canSpell: true, - canBuyIf: true - }) - return; - }, - complete: res => {} - }); - /// End payment -------- - }) - .catch(err => { - that.setData({ - canSpell: true, - canBuyIf: true - }) - wx.showToast({ - title: err.message, - icon: 'none', - duration: 2000, - mask: false - }); - }) - } + }) + } - }) }) + }) .catch(err => { console.log(err) if (err.code == 11004) { @@ -758,7 +755,7 @@ Page({ /** * 生命周期函数--监听页面显示 */ - onShow: function() { + onShow: function () { this.setData({ canSpell: true, canBuyIf: true, @@ -772,7 +769,7 @@ Page({ /** * 生命周期函数--监听页面隐藏 */ - onHide: function() { + onHide: function () { this.setData({ showTime: false }) @@ -781,7 +778,7 @@ Page({ /** * 生命周期函数--监听页面卸载 */ - onUnload: function() { + onUnload: function () { this.setData({ showTime: false }) @@ -790,7 +787,7 @@ Page({ /** * 页面相关事件处理函数--监听用户下拉动作 */ - onPullDownRefresh: function(e) { + onPullDownRefresh: function (e) { let that = this; console.log(this.data.couponId, 222) that.getDetail(that.data.couponChannelId); @@ -798,18 +795,18 @@ Page({ that.getOneSpell(that.data.couponId) } }, - onShareAppMessage: function(options) { + onShareAppMessage: function (options) { app.globalData.previewFlag = true console.log(options) 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`, - success: function(res) { - if (res.errMsg == 'shareAppMessage:ok') {} + success: function (res) { + if (res.errMsg == 'shareAppMessage:ok') { } }, - fail: function(error) { - if (res.errMsg == 'shareAppMessage:fail cancel') {} else if (res.errMsg == 'shareAppMessage:fail') {} + fail: function (error) { + if (res.errMsg == 'shareAppMessage:fail cancel') { } else if (res.errMsg == 'shareAppMessage:fail') { } } }; // 来自页面内的按钮的转发 diff --git a/project.config.json b/project.config.json index 6336fc1..fde5a61 100644 --- a/project.config.json +++ b/project.config.json @@ -32,7 +32,7 @@ }, "compileType": "miniprogram", "libVersion": "2.14.4", - "appid": "wxfa336cad86ed598d", + "appid": "wx453ae0d37f3550d0", "projectname": "oldC", "isGameTourist": false, "simulatorType": "wechat",