From 54c228cbc9497303386ceb898e4adc1889f24b4f Mon Sep 17 00:00:00 2001 From: GL <954534408@qq.com> Date: Wed, 24 Mar 2021 10:20:43 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=903=E6=9C=88=E7=89=88=E6=9C=AC=E8=BF=AD?= =?UTF-8?q?=E4=BB=A3=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 19 ++++ custom-tab-bar/index.js | 22 ++++- custom-tab-bar/index.wxss | 6 +- ext.json | 39 +++----- index/index.js | 106 +++++++++++++++++++- index/user.js | 134 +++++++++++++++++++++++++- pages/canvas/index.js | 2 +- pages/coupon/detail/index.js | 78 ++++++++++++++- pages/coupon/detail/index.json | 3 +- pages/coupon/detail/index.wxml | 4 + pages/coupon/detail/index.wxss | 33 +++++-- pages/getphoneInfo/index.js | 4 + pages/getuserinfo/index.js | 1 + pages/index/searchbar/detail/index.js | 2 +- project.config.json | 2 +- 15 files changed, 409 insertions(+), 46 deletions(-) diff --git a/app.js b/app.js index 69bbeda..b8cdb5e 100644 --- a/app.js +++ b/app.js @@ -5,6 +5,23 @@ App({ data: { newArr:[],//存放分享二维进入消息信息 }, + // 这里这么写,是要在其他界面监听,而不是在app.js中监听,而且这个监听方法,需要一个回调方法。 + watch: function (method) { + var obj = this.globalData; + Object.defineProperty(obj, "ifShowTab", { + configurable: true, + enumerable: true, + set: function (value) { + this._ifShowTab = value; + console.log('是否会被执行2') + method(value); + }, + get: function () { + // 可以在这里打印一些东西,然后在其他界面调用getApp().globalData.name的时候,这里就会执行。 + return this._ifShowTab + } + }) + }, onLaunch: function(options) { var that = this; if (that.globalData.previewFlag) {//解决微信图片预览重复进入app.js onshow @@ -164,6 +181,8 @@ App({ }) }, globalData: { + styleLsit:{}, + ifShowTab: true, previewFlag:false,//解决图片预览调用noshow activityId:'',//活动id方便授权数据回传 typeLsit: [],//初始哈样式 diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js index 2558085..d2a8d4e 100644 --- a/custom-tab-bar/index.js +++ b/custom-tab-bar/index.js @@ -94,16 +94,20 @@ Component({ // console.log(this.data.home_a_img) const data = e.currentTarget.dataset; + this.setData({ + selected: data.index + }) + console.log(data.index) const url = data.path; if (data.index == 0 || data.index == 3) { + console.log("ifShowTab = false") + app.globalData.ifShowTab = false this.getTemplateId() } + wx.switchTab({ url }); - this.setData({ - selected: data.index - }) }, /** * 获取全局样式 @@ -118,6 +122,7 @@ Component({ data } = res if (code == 200) { + app.globalData.styleLsit = data this.setData({ list: [{ "pagePath": "/index/index", @@ -209,6 +214,7 @@ Component({ wx.requestSubscribeMessage({ tmplIds: tmplIds, success(res) { + console.log("我重复订阅") let _statue = null tmplIds.map((item, index) => { //判读用户是否点击了确定 if (res[item] == "accept") { @@ -219,15 +225,25 @@ Component({ Http.post({ url: config.api.wxMsg }).then(res => { + app.globalData.ifShowTab = true + wx.setStorageSync({ + key: 'ifShowTab', + data: true, + }) console.log(res) }) return } + app.globalData.ifShowTab = true + // for (let i = 0; i < tmplIds.length;i++){ // if (res.tmplIds[i] == 'accept'){ // console.log("发送") // } // } + }, + complete(){ + app.globalData.ifShowTab = true } }) }, diff --git a/custom-tab-bar/index.wxss b/custom-tab-bar/index.wxss index f3f66cc..210656d 100644 --- a/custom-tab-bar/index.wxss +++ b/custom-tab-bar/index.wxss @@ -4,7 +4,7 @@ left: 0; right: 0; height: 70rpx; - /* padding: 10rpx; */ + padding: 10rpx; background: white; display: flex; padding-bottom: env(safe-area-inset-bottom); @@ -30,8 +30,8 @@ } .tab-bar-item cover-image { - width: 44rpx; - height: 44rpx; + width: 46rpx; + height: 46rpx; } .tab-bar-item cover-view { diff --git a/ext.json b/ext.json index fa5db67..5a139c3 100644 --- a/ext.json +++ b/ext.json @@ -2,43 +2,33 @@ "ext": { "attr": { "car": { - "tjd": { - "payPath": "", - "tjdAppId": "wx6945d1bda68d7993" - }, "etcp": { - "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" + "etcpAppId": "wx192b7d2e8dcbefd0", + "etcpVersion": "release", + "etcpCallbackUrl": "https://admintest.malls.iformall.com/api/carCallback/etcpPaidCallback" + } }, "imgProxy": [ { - "newUrl": "https://c.malls.iformall.com/img", + "newUrl": "https://ctest.malls.iformall.com/img", "orgUrl": "https://iformall-net.formall.oss-accelerate.aliyuncs.com" }, { - "newUrl": "https://c.malls.iformall.com/img1", + "newUrl": "https://ctest.malls.iformall.com/img1", "orgUrl": "https://formall.oss-accelerate.aliyuncs.com" }, { - "newUrl": "https://c.malls.iformall.com/img2", + "newUrl": "https://ctest.malls.iformall.com/img2", "orgUrl": "https://wx.qlogo.cn" } ], - "configUrl": "https://c.malls.iformall.com/C/api", - "ifStoreApp": "0", + "configUrl": "https://ctest.malls.iformall.com/C/api", "ifHaveWebSocket": "0", - "ifHaveCarModular": "0" + "ifHaveCarModular": "1" }, - "name": "富茂链客生产版", - "weappId": "wx6a2524a8286d687f", - "appVersion": "C.5.1.1" + "name": "金泸商务", + "weappId": "wx649b3be73c1afe47", + "appVersion": "C.test.5.2.0" }, "debug": false, "tabBar": { @@ -68,7 +58,8 @@ "selectedIconPath": "assets/images/user-a.png" } ], - "custom": true + "color": "#abb1be", + "selectedColor": "#b2743d" }, "window": { "backgroundTextStyle": "dark", @@ -82,7 +73,7 @@ "provider": "wx2b03c6e691cd7370" } }, - "extAppid": "wx6a2524a8286d687f", + "extAppid": "wx649b3be73c1afe47", "extEnable": true, "permission": { "scope.userLocation": { diff --git a/index/index.js b/index/index.js index e89fd7e..e01f952 100644 --- a/index/index.js +++ b/index/index.js @@ -259,6 +259,7 @@ Page({ * 生命周期函数--监听页面初次渲染完成 */ onLoad: function(options) { + console.log("我只执行一次") this.getType() this.getLocation(); let that = this; @@ -319,7 +320,110 @@ Page({ onUnload() { // wx.removeStorageSync('squareList') }, + watchBack: function (ifShowTab) { //监听ifShowTab变化 + if (ifShowTab){ + this.getTabBar().setData({ + 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": "我的" + } + ], + }) + }else{ + console.log("我隐藏了") + this.getTabBar().setData({ + list:[] + }) + } + + }, onShow: function() { + if (app.globalData.ifShowTab){ + this.getTabBar().setData({ + 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": "我的" + } + ], + }) + } else { + console.log("我隐藏") + this.getTabBar().setData({ + list: [] + }) + } + if (wx.getStorageSync("tabFlag") && wx.getStorageSync("tabFlag")==1){//处理授权取消后回到首页底部导航栏显示 + this.getTabBar().setData({ + 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": "我的" + } + ], + }) + wx.removeStorageSync("tabFlag") + } + console.log("我每次都执行" ,app.globalData.ifShowTab) + app.watch(this.watchBack) this.ifShowSqare(); if (wx.getStorageSync("squareList")) { var temp = wx.getStorageSync("squareList").filter(item => item.tenantId == wx.getStorageSync("selectedMall"))[0].name @@ -330,7 +434,7 @@ Page({ if (typeof this.getTabBar === 'function' && this.getTabBar()) { this.getTabBar().setData({ - selected: 0 + selected: 0, }) } let that = this; diff --git a/index/user.js b/index/user.js index bcb9269..23cd835 100644 --- a/index/user.js +++ b/index/user.js @@ -75,7 +75,7 @@ Page({ * 将值传到用户手机号授权的页面 * */ - wx.redirectTo({ + wx.navigateTo({ url: `/pages/getphoneInfo/index?path=main` }); }, @@ -128,7 +128,67 @@ Page({ gotoedit: function() { this.checkUserStatus(); }, + watchBack: function (ifShowTab) { //监听ifShowTab变化 + console.log("ifShowTab",ifShowTab) + if (ifShowTab) { + console.log("ifShowTab", ifShowTab) + this.getTabBar().setData({ + 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": "我的" + } + ], + }) + } else { + console.log("我隐藏") + this.getTabBar().setData({ + list: [] + }) + } + }, onLoad() { + if (typeof this.getTabBar === 'function' && + this.getTabBar()) { + if (ifStoreApp == 1) { + this.getTabBar().setData({ + selected: 1 + }) + } else if (ifStoreApp == 2) { + this.getTabBar().setData({ + selected: 2 + }) + } else { + this.getTabBar().setData({ + selected: 3, + list: [] + }) + } + + } + + + + this.getLocation(); this.updateScene(); // this.getRoomId(); @@ -203,6 +263,42 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function() { + console.log(app.globalData.ifShowTab,"////") + if (app.globalData.ifShowTab){ + this.getTabBar().setData({ + 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": "我的" + } + ], + }) + } else { + console.log("我隐藏") + this.getTabBar().setData({ + list: [] + }) + } + app.watch(this.watchBack) let that = this; that.userAuthorization() if (typeof that.getTabBar === 'function' && @@ -217,10 +313,40 @@ Page({ }) } else { that.getTabBar().setData({ - selected: 3 + selected: 3, + }) } - + } + if (wx.getStorageSync("tabFlag") && wx.getStorageSync("tabFlag") == 1) {//处理授权取消后回到首页底部导航栏显示 + this.getTabBar().setData({ + 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": "我的" + } + ], + }) + wx.removeStorageSync("tabFlag") } that.setData({ appVersion: extConfig.appVersion, @@ -286,7 +412,7 @@ Page({ score: res.data.score, curPhone: curPhone, levelName: res.data.levelName, - userId: res.data.id + userId: res.data.userId }) if (res.data.nickName) { that.setData({ diff --git a/pages/canvas/index.js b/pages/canvas/index.js index 916a730..552b867 100644 --- a/pages/canvas/index.js +++ b/pages/canvas/index.js @@ -348,7 +348,7 @@ Page({ pageNum: 1, pageSize: 15 }; - Http.get({ + Http.post({ url: config.api.listByMerchant, data: data }) diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js index e343b21..203de5b 100644 --- a/pages/coupon/detail/index.js +++ b/pages/coupon/detail/index.js @@ -25,6 +25,7 @@ Page({ swiperCurrent: 0, detailPicture: [], coverPicture: [], + couponList:[], data: { title: null }, @@ -88,7 +89,8 @@ Page({ //图文混排 curHtml: '', contentType: 0, - + page:1,//查询商户优惠券page + idList:[], }, /** * 显示分享弹框 @@ -97,6 +99,58 @@ Page({ this.setData({ isshowposter: true, }) + }, + getCouponList: function(id) { + let that = this; + let data; + data = { + status: 0, + merchantIds: id, + pageNum: that.data.page, + pageSize: 4, + } + Http.post({ + url: config.api.listByMerchant, + data: data + }).then(res => { + if (res.data.page.list<=0){ + return + } + let dataLsit = [] + dataLsit = that.data.couponList + dataLsit.push(...res.data.page.list) + dataLsit.map((item,index)=>{ + if (item.id == that.data.couponChannelId){ + dataLsit.splice(index,1) + } + }) + if (that.data.page>1){ + let tmpeLsit = dataLsit + tmpeLsit.push(...res.data.page.list) + that.setData({ + couponList: tmpeLsit, + }) + }else{ + that.setData({ + couponList: dataLsit, + }) + } + + + // if (res.data && res.data.qrCode){ + // that.setData({ + // qrCode: res.data.qrCode, + // }) + // } + }) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) }, /** * 隐藏分享弹框 @@ -450,6 +504,7 @@ Page({ }) if (options && options.couponChannelId) { that.getDetail(options.couponChannelId, 'notendclock'); + } /** * 转赠判断 @@ -498,6 +553,18 @@ Page({ }; Http.get(parmer) .then(res => { + + if (res.data.merchantVoList && res.data.merchantVoList.length){ + let merchantVoList = res.data.merchantVoList + let idList = [] + merchantVoList.map(item=>{ + idList.push(item.id) + }) + that.setData({ + idList: idList + }) + that.getCouponList(idList) + } //aaa if (res.data.contentType != undefined && res.data.contentType == 1) { //获取图文展示详情html @@ -1070,5 +1137,14 @@ Page({ onPullDownRefresh: function() { this.getDetail(this.data.couponChannelId); wx.stopPullDownRefresh() + }, + onReachBottom:function(){ + this.setData({ + page:this.data.page+1 + }) + + if (this.data.idList.length>0){ + this.getCouponList(this.data.idList) + } } }); \ No newline at end of file diff --git a/pages/coupon/detail/index.json b/pages/coupon/detail/index.json index ef321ac..20677fc 100644 --- a/pages/coupon/detail/index.json +++ b/pages/coupon/detail/index.json @@ -2,7 +2,8 @@ "usingComponents": { "c-shareposter": "../../../../components/shareposter/index", "navbar": "../../../../components/navbar/navbar", - "store": "../../../../components/store/index" + "store": "../../../../components/store/index", + "c-coupons": "../../../components/coupons/index" }, "navigationBarTitleText": "", "backgroundColor":"#f4f4f4", diff --git a/pages/coupon/detail/index.wxml b/pages/coupon/detail/index.wxml index 62f909c..58387bd 100644 --- a/pages/coupon/detail/index.wxml +++ b/pages/coupon/detail/index.wxml @@ -129,6 +129,10 @@ + 其他活动 + + + diff --git a/pages/coupon/detail/index.wxss b/pages/coupon/detail/index.wxss index 4f8b25f..c684b61 100644 --- a/pages/coupon/detail/index.wxss +++ b/pages/coupon/detail/index.wxss @@ -16,6 +16,20 @@ button::after { background: #f4f5f9; } +.couponsL c-coupons { + width: 335rpx; + height: 354rpx; + margin-bottom: 22rpx; +} + +.couponsL c-coupons:nth-of-type(2n+1) { + float: left; +} + +.couponsL c-coupons:nth-of-type(2n) { + float: right; +} + .banner { position: relative; width: 750rpx; @@ -59,16 +73,17 @@ button::after { .pickFinal_Box { overflow: hidden; } -.earnestTime{ + +.earnestTime { font-size: 28rpx; color: #a6a6a6; - } -.finalTime{ + +.finalTime { font-size: 28rpx; color: #a6a6a6; - } + .original { float: left; width: 100rpx; @@ -111,6 +126,11 @@ button::after { margin-left: 14rpx; } +.couponsL { + width: 92%; + margin: 20rpx auto; +} + .coupons_info { width: 92%; padding: 0 4%; @@ -340,9 +360,10 @@ button::after { line-height: 94rpx; border-radius: 61rpx; } -#noBuy{ + +#noBuy { position: relative; - background-color:rgba(0, 0, 0, 0.2); + background-color: rgba(0, 0, 0, 0.2); height: 94rpx; width: 560rpx; margin: 0 auto 30rpx; diff --git a/pages/getphoneInfo/index.js b/pages/getphoneInfo/index.js index f493f66..4766202 100755 --- a/pages/getphoneInfo/index.js +++ b/pages/getphoneInfo/index.js @@ -67,11 +67,13 @@ Page({ }) }, backHome: function() { + wx.setStorageSync("tabFlag", 1) wx.switchTab({ url: '/index/index', }) }, getPhoneNumber: function(e) { + wx.setStorageSync("tabFlag", 1) var that = this; var iv = e.detail.iv; var encryptedData = e.detail.encryptedData; @@ -82,6 +84,7 @@ Page({ iv: iv } }).then(res => { + app.globalData.phone = res.data.phone; if (that.data.skipUrl == '1') { console.log(app.globalData.skip,app.globalData.skipUrl,"跳转地址" ) @@ -164,6 +167,7 @@ Page({ url: '/index/user' }); } else { + wx.showToast({ title: res.data.msg, icon: "success", diff --git a/pages/getuserinfo/index.js b/pages/getuserinfo/index.js index 27219af..90e577c 100755 --- a/pages/getuserinfo/index.js +++ b/pages/getuserinfo/index.js @@ -136,6 +136,7 @@ Page({ }) }, backHome: function() { + wx.setStorageSync("tabFlag", 1) wx.switchTab({ url: '/index/index', }) diff --git a/pages/index/searchbar/detail/index.js b/pages/index/searchbar/detail/index.js index 116aa7e..ae0e578 100644 --- a/pages/index/searchbar/detail/index.js +++ b/pages/index/searchbar/detail/index.js @@ -194,7 +194,7 @@ Page({ pageNum: that.data.page, pageSize: 15, } - Http.get({ + Http.post({ url: config.api.listByMerchant, data: data }).then(res => { diff --git a/project.config.json b/project.config.json index 51bfedb..5ef8ae6 100644 --- a/project.config.json +++ b/project.config.json @@ -32,7 +32,7 @@ }, "compileType": "miniprogram", "libVersion": "2.9.5", - "appid": "wx453ae0d37f3550d0", + "appid": "wxfa336cad86ed598d", "projectname": "oldC", "isGameTourist": false, "simulatorType": "wechat",