From a0aa2e74524d21bd6847740ccc2e8b16d33d4d30 Mon Sep 17 00:00:00 2001 From: YWQ HK IX <568170040@qq.com> Date: Sat, 10 Dec 2022 18:21:00 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E7=94=A8=E9=97=A8=E5=BA=97=E6=96=B0?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F#3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/shop/shop.ttml | 109 +--------- index/index.js | 328 +++++++++++++++--------------- pages/couponorder/detail/index.js | 27 +-- 3 files changed, 177 insertions(+), 287 deletions(-) diff --git a/components/shop/shop.ttml b/components/shop/shop.ttml index 2cbfd67..5e1db06 100644 --- a/components/shop/shop.ttml +++ b/components/shop/shop.ttml @@ -15,7 +15,7 @@ - + {{item.merchantVoList.length+'家门店适用'}} @@ -25,7 +25,7 @@ - + - - - - - - - {{item.addr}} - - - - - - - - {{item.addr}} - - - - - - - - {{item.addr}} - - - - - - - - {{item.merchantVoList.length+'家门店适用,展开全部'}} - - - - \ No newline at end of file diff --git a/index/index.js b/index/index.js index 1840d7f..df9c05d 100644 --- a/index/index.js +++ b/index/index.js @@ -31,7 +31,7 @@ Page({ marketName: "", //商场名称 mouldType: null, navLineHeight: ((app.statusBarHeight + app.statusBarHeight) + 50) + "px", - navImgHeight:(((app.statusBarHeight + app.statusBarHeight) + 34)/2) + "px", + navImgHeight: (((app.statusBarHeight + app.statusBarHeight) + 34) / 2) + "px", huanlechengImgurl: "https://formall.oss-accelerate.aliyuncs.com/cimg/v20211214/", // mch_id: mch_id, goUrl: "", //商圈跳转链接 @@ -116,15 +116,15 @@ Page({ moduleList: [], //按钮列表 }, - getCongig(){//获取小程序是否开通授权手机号 + getCongig() { //获取小程序是否开通授权手机号 Http.get({ - url:config.api.getConfig, - data:{ - key:"douyinPhoneStatus" + url: config.api.getConfig, + data: { + key: "douyinPhoneStatus" } - }).then(res=>{ - app.globalData.ifCongPh = res.data?res.data:1 - }).catch(err=>{ + }).then(res => { + app.globalData.ifCongPh = res.data ? res.data : 1 + }).catch(err => { app.globalData.ifCongPh = 1 }) }, @@ -187,8 +187,8 @@ Page({ url: config.api.couponChannelList, data: param }).then(res => { - if (res.data.list&&res.data.list.length != 0) { - + if (res.data.list && res.data.list.length != 0) { + let tempLsit = this.data.businessData let data = res.data.list data.map(item => { @@ -209,7 +209,7 @@ Page({ businessData: data }) } - }else{ + } else { this.setData({ noDataFlag: true }) @@ -257,7 +257,7 @@ Page({ //获取按钮列表 getModule() { Http.get({ - url: config.api.wxCustomizeModule + url: config.api.wxCustomizeModule }).then(res => { this.setData({ moduleList: res.data, @@ -518,7 +518,7 @@ Page({ * 生命周期函数--监听页面初次渲染完成 */ onLoad: function (options) { - + let that = this; let optionss; @@ -603,10 +603,10 @@ Page({ // this.uesrInfo() this.ifShowSqare(); if (tt.getStorageSync("squareList") && tt.getStorageSync("selectedMall")) { - var temp = tt.getStorageSync("squareList").filter(item => item.tenantId == tt.getStorageSync("selectedMall"))[0].name - this.setData({ - squareName: temp - }) + // var temp = tt.getStorageSync("squareList").filter(item => item.tenantId == tt.getStorageSync("selectedMall"))[0].name + // this.setData({ + // squareName: temp + // }) } if (typeof this.getTabBar === 'function' && this.getTabBar()) { @@ -656,25 +656,25 @@ Page({ getmemberId: function (token) { let that = this; Http.get({ - url: config.api.getScore, - data: { - token: token - } - }).then(res => { - if(res.data.avatarUrl||res.data.nickName){ - app.globalData.avatarUrl = res.data.avatarUrl - app.globalData.nickName = res.data.nickName - } - that.setData({ - levelName: res.data.levelName, - upgradePercent: res.data.upgradePercent, - upgradeScore: res.data.upgradeScore, - memberId: res.data.id, - credit: res.data.credit, - userAvatarUrl: res.data.avatarUrl ? res.data.avatarUrl:'', - userName: res.data.nickName ? res.data.nickName:'', + url: config.api.getScore, + data: { + token: token + } + }).then(res => { + if (res.data.avatarUrl || res.data.nickName) { + app.globalData.avatarUrl = res.data.avatarUrl + app.globalData.nickName = res.data.nickName + } + that.setData({ + levelName: res.data.levelName, + upgradePercent: res.data.upgradePercent, + upgradeScore: res.data.upgradeScore, + memberId: res.data.id, + credit: res.data.credit, + userAvatarUrl: res.data.avatarUrl ? res.data.avatarUrl : '', + userName: res.data.nickName ? res.data.nickName : '', + }) }) - }) .catch(err => { tt.showModal({ title: '提示', @@ -738,7 +738,7 @@ Page({ if (app.globalData.token) { // 登录 console.log(app.globalData.token) - that.getCongig()//获取小程序是否开通授权手机号 + that.getCongig() //获取小程序是否开通授权手机号 that.setData({ mouldType: app.globalData.mouldType, marketName: app.globalData.marketName, @@ -780,11 +780,11 @@ Page({ app.businessListCallback(app.globalData.token); } Http.get({ - url: config.api.getWeapNote, - data: { - appId: app.globalData.appId, - } - }) + url: config.api.getWeapNote, + data: { + appId: app.globalData.appId, + } + }) .then(res => { console.log(33333333333) console.log(app.globalData.token) @@ -814,7 +814,7 @@ Page({ app.tokenCallback = token => { // 登录 console.log(app.globalData.token) - that.getCongig()//获取小程序是否开通授权手机号 + that.getCongig() //获取小程序是否开通授权手机号 that.setData({ mouldType: app.globalData.mouldType, marketName: app.globalData.marketName, @@ -852,11 +852,11 @@ Page({ } Http.get({ - url: config.api.getWeapNote, - data: { - appId: app.globalData.appId, - } - }) + url: config.api.getWeapNote, + data: { + appId: app.globalData.appId, + } + }) .then(res => { console.log(33333333333) console.log(app.globalData.token) @@ -889,26 +889,26 @@ Page({ getStaticGame(token) { let _this = this; Http.get({ - url: config.api.getGame, - data: { - triggleAction: 2, // 固定入口 - token: token - } - }).then(res => { - if (res.data.id) { - _this.setData({ - showIf: true, - newUrl: res.data.imgUrl - }) - } else { + url: config.api.getGame, + data: { + triggleAction: 2, // 固定入口 + token: token + } + }).then(res => { + if (res.data.id) { + _this.setData({ + showIf: true, + newUrl: res.data.imgUrl + }) + } else { + _this.setData({ + showIf: false + }) + } _this.setData({ - showIf: false + staticGamedata: res.data }) - } - _this.setData({ - staticGamedata: res.data }) - }) .catch(err => { _this.setData({ showIf: false @@ -919,25 +919,25 @@ Page({ getGameOne: function (token) { let _this = this; Http.get({ - url: config.api.getGame, - data: { - triggleAction: 1, // 登录触发 - token: token - } - }).then(res => { - if (res.data.id) { - _this.setData({ - showGame: true, - }) - } else { + url: config.api.getGame, + data: { + triggleAction: 1, // 登录触发 + token: token + } + }).then(res => { + if (res.data.id) { + _this.setData({ + showGame: true, + }) + } else { + _this.setData({ + showGame: false + }) + } _this.setData({ - showGame: false + gamedata: res.data }) - } - _this.setData({ - gamedata: res.data }) - }) .catch(err => { _this.setData({ showGame: false @@ -951,18 +951,18 @@ Page({ getMallInfo: function (token) { let that = this; Http.get({ - url: config.api.getMallInfo, - data: { - token: token, - } - }).then(res => { - that.setData({ - liveFlag: res.data.liveSupport, - weappShareTitle: res.data.weappShareTitle ? res.data.weappShareTitle : null, - weappShareCoverImg: res.data.weappShareCoverImg ? res.data.weappShareCoverImg : null, - }); - console.log(that.data.liveFlag, "||||") - }) + url: config.api.getMallInfo, + data: { + token: token, + } + }).then(res => { + that.setData({ + liveFlag: res.data.liveSupport, + weappShareTitle: res.data.weappShareTitle ? res.data.weappShareTitle : null, + weappShareCoverImg: res.data.weappShareCoverImg ? res.data.weappShareCoverImg : null, + }); + console.log(that.data.liveFlag, "||||") + }) .catch(err => { // 不需要错误提示 }); @@ -971,24 +971,24 @@ Page({ getxsList() { let that = this; Http.get({ - url: config.api.couponChannelList, - data: { - pageNum: 1, - pageSize: 3, - targetAd: 2 - } - }).then(res => { - if (res && res.data.total > 0) { - that.setData({ - xslist: res.data.list, - showQg: true - }); - } else { - that.setData({ - showQg: false - }) - } - }) + url: config.api.couponChannelList, + data: { + pageNum: 1, + pageSize: 3, + targetAd: 2 + } + }).then(res => { + if (res && res.data.total > 0) { + that.setData({ + xslist: res.data.list, + showQg: true + }); + } else { + that.setData({ + showQg: false + }) + } + }) .catch(err => { console.log(err) tt.showToast({ @@ -1005,19 +1005,19 @@ Page({ getBannerlist: function () { let that = this; Http.get({ - url: config.api.bannerlist, - data: { - pageNum: 1, - pageSize: 7, - plat:3 - } - }).then(res => { - that.getmemberId(app.globalData.token); - // that.checkUserCarStatus(); - that.setData({ - list: res.data.list - }); - }) + url: config.api.bannerlist, + data: { + pageNum: 1, + pageSize: 7, + plat: 3 + } + }).then(res => { + that.getmemberId(app.globalData.token); + // that.checkUserCarStatus(); + that.setData({ + list: res.data.list + }); + }) .catch(err => { that.getmemberId(app.globalData.token); // that.checkUserCarStatus(); @@ -1117,24 +1117,24 @@ Page({ topicShow: function () { let that = this; Http.get({ - url: config.api.topicShow, - data: { - token: app.globalData.token - } - }).then(res => { - if (res && res.data) { - that.setData({ - name: res.data.name, - cover: res.data.cover, - id: res.data.id, - showTopic: true - }) - } else { - that.setData({ - showTopic: false - }) - } - }) + url: config.api.topicShow, + data: { + token: app.globalData.token + } + }).then(res => { + if (res && res.data) { + that.setData({ + name: res.data.name, + cover: res.data.cover, + id: res.data.id, + showTopic: true + }) + } else { + that.setData({ + showTopic: false + }) + } + }) .catch(err => { console.log(err); }) @@ -1218,30 +1218,30 @@ Page({ let that = this Http.get({ - url: config.api.getGg, - data: { - token: token, - appId: app.globalData.appId, - openId: "" // tt.getStorageSync('openId') - } - }).then(res => { - console.log(res) - if (res.data.id) { - that.setData({ - showGg: true, - }) - console.log(that.data.showGg, 1111111111111) - } else { + url: config.api.getGg, + data: { + token: token, + appId: app.globalData.appId, + openId: "" // tt.getStorageSync('openId') + } + }).then(res => { + console.log(res) + if (res.data.id) { + that.setData({ + showGg: true, + }) + console.log(that.data.showGg, 1111111111111) + } else { + that.setData({ + showGg: false + }) + // that.getGameOne(app.globalData.token) + console.log(that.data.showGg, 222222222222222222) + } that.setData({ - showGg: false + ggdata: res.data }) - // that.getGameOne(app.globalData.token) - console.log(that.data.showGg, 222222222222222222) - } - that.setData({ - ggdata: res.data }) - }) .catch(err => { this.setData({ showGg: false @@ -1264,7 +1264,7 @@ Page({ topicObj4: null, //欢乐城首页拼团 topicObj5: null, //欢乐城首页消费卡 topicObj6: null, //欢乐城首页积分商城 - specialLsit: null,//专题 + specialLsit: null, //专题 }) // that.getWeapNote(); that.setData({ @@ -1310,7 +1310,7 @@ Page({ page: that.data.page, businePageNum: that.data.businePageNum + 1 }); - console.log("加载更多页数" + that.data.page,); + console.log("加载更多页数" + that.data.page, ); console.log("加载更多key" + that.data.code); if (that.data.mouldType == 0) { //富茂源模板 //父组件获得子组件的方法 diff --git a/pages/couponorder/detail/index.js b/pages/couponorder/detail/index.js index 91c9545..1aa173d 100644 --- a/pages/couponorder/detail/index.js +++ b/pages/couponorder/detail/index.js @@ -28,7 +28,8 @@ Page({ couponTenantId: '', templTiem: "", curHtml: "", - tenantId: '' + tenantId: '', + mallList: '' }, showId() { let this_ = this; @@ -61,7 +62,8 @@ Page({ }, - getCouponMerchant(couponChannelId) { //获取适用门店 + //获取适用门店 + getCouponMerchant(couponChannelId) { Http.get({ url: config.api.couponMerchant, data: { @@ -83,20 +85,9 @@ Page({ this.setData({ mallList: mallList }) - // if (res.data && res.data.length) { - // let merchantVoList = res.data - // let idList = [] - // merchantVoList.map(item => { - // idList.push(item.id) - // }) - // this.setData({ - // idList: idList - // }) - // this.getCouponList(idList) //获取推荐列表 - // } - // this.setData({ - // merchantVoList: res.data - // }) + console.log(this.mallList, 'mallList'); + }).catch(err => { + }) }, @@ -117,6 +108,7 @@ Page({ } }) }, + onLoad: function (options) { let that = this; console.log(options); @@ -143,11 +135,13 @@ Page({ tenantId: res.data.tenantId }) that.setRq() + that.getCouponMerchant(res.data.id) } that.setData({ couponorderstatus: res.data.couponOrderStatus, data: res.data, }); + that.setData({ expiredTime: util.formatTime(that.data.data.expiredTime, "yyyy-MM-dd hh:mm:ss"), updateDate: util.formatTime(that.data.data.updateDate, "yyyy-MM-dd hh:mm:ss"), @@ -170,6 +164,7 @@ Page({ } }).catch(err => { + console.log(err, 'err'); tt.showToast({ title: err.message ? err.message : err.data, icon: 'none',