From 7b86d105b0576b2e6e54746765d060391b255339 Mon Sep 17 00:00:00 2001 From: XiaoXinPro 14 IAH5R <568170040@qq.com> Date: Thu, 2 Mar 2023 16:37:43 +0800 Subject: [PATCH] upload --- index/index.js | 22 +++++++++++++++++----- index/index.ttml | 4 ++-- pages/couponorder/detail/index.js | 11 +++++++++-- pages/order/detail/index.js | 3 ++- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/index/index.js b/index/index.js index 2700106..009465a 100644 --- a/index/index.js +++ b/index/index.js @@ -145,6 +145,7 @@ Page({ Http.get({ url: '/mall/subMall?isAll=1', }).then(res => { + tt.setStorageSync('shopList', JSON.stringify(res.data)); this.setData({ shopList: res.data, mallTenantId: tt.getStorageSync('mallTenantId') || res.data[0].tenantId @@ -153,6 +154,7 @@ Page({ tt.setStorageSync('mallTenantId', res.data[0].tenantId) tt.setStorageSync('mallIndex', 0) } + this.getLocation() }).catch(err => { console.log(err, 'err'); }) @@ -170,7 +172,7 @@ Page({ }); this.getBannerlist(); this.getBusinessList() - this.getCouponChannelList(0) + this.getCouponChannelList(this.data.busineKye) }, getBusineData(e) { @@ -256,12 +258,15 @@ Page({ businessData: data }) } + } else { this.setData({ - noDataFlag: true + // noDataFlag: true, + businessData: [] }) } tt.hideLoading(); + console.log(this.data.businessData, 'businessData'); }).catch(err => { tt.hideLoading(); tt.showModal({ @@ -590,12 +595,12 @@ Page({ //获取条形码 // util.barcode("barcode", optionss.quancode, 510, 100); // console.log(Http.headers.token, "?") - this.getLocation() }, /** * 获得经纬度 */ getLocation() { + console.log('getLocation'); let that = this; tt.getLocation({ type: "wgs84", @@ -618,6 +623,7 @@ Page({ city: res.city } }).then(res => { + this.getsubMallList() console.log(res, 9999) }) } @@ -632,7 +638,9 @@ Page({ const mallLocationArr = [] - that.data.shopList.forEach((item, index) => { + const shopList = JSON.parse(tt.getStorageSync('shopList')); + + shopList.forEach((item, index) => { const obj = { latitude: item.latitude, longitude: item.longitude, @@ -642,11 +650,14 @@ Page({ mallLocationArr.push(obj) }) - const tempArr = that.data.shopList + console.log(mallLocationArr, 'mallLocationArr'); + + const tempArr = shopList const bloobArr = [] mallLocationArr.forEach((item, index) => { const distanceData = that.getDistances(latitudeNow, longitudeNow, item.latitude, item.longitude) tempArr[index].distance_str = distanceData.distance_str + tempArr[index].distance = distanceData.distance bloobArr.push(distanceData.distance) }) @@ -718,6 +729,7 @@ Page({ onShow: function () { + this.mallSync() console.log(app.globalData.mouldType, "mouldType") // tt.requestSubscribeMessage({ diff --git a/index/index.ttml b/index/index.ttml index 406964d..3b84a9d 100644 --- a/index/index.ttml +++ b/index/index.ttml @@ -24,8 +24,8 @@ {{ shopList[index].name }} - + 距您{{ + shopList[index].distance_str}} diff --git a/pages/couponorder/detail/index.js b/pages/couponorder/detail/index.js index c4e46cf..cec62cc 100644 --- a/pages/couponorder/detail/index.js +++ b/pages/couponorder/detail/index.js @@ -29,7 +29,8 @@ Page({ templTiem: "", curHtml: "", tenantId: '', - mallList: '' + mallList: '', + mallTenantId: "" }, showId() { let this_ = this; @@ -65,7 +66,7 @@ Page({ //获取适用门店 getCouponMerchant(couponId) { Http.get({ - url: `/wxCoupon/couponMerchantByCouponId?couponId=${couponId}`, + url: `/wxCoupon/couponMerchantByCouponId?couponId=${couponId}&mallTenantId=${this.data.mallTenantId || ''}`, }).then(res => { const keys = Object.keys(res.data) const mallList = [] @@ -124,6 +125,12 @@ Page({ that.setRq() //动态二维码 //这个方法必须在拿到 options.quancode 后调用 } + if (options.mallTenantId) { + that.setData({ + mallTenantId: options.mallTenantId + }) + } + //初始数据不能延时收到写一边 Http.get({ url: config.api.couponOrderDetail, diff --git a/pages/order/detail/index.js b/pages/order/detail/index.js index 1de3a1c..4c913bb 100644 --- a/pages/order/detail/index.js +++ b/pages/order/detail/index.js @@ -157,7 +157,8 @@ Page({ Http.get({ url: config.api.couponMerchant, data: { - couponChannelId: couponChannelId + couponChannelId: couponChannelId, + mallTenantId: this.data.mallTenantId || '' } }).then(res => { const keys = Object.keys(res.data)