Browse Source

upload

soldDate
HolyKnightIX 1 year ago
parent
commit
b53e10d327
2 changed files with 53 additions and 18 deletions
  1. +50
    -15
      index/index.js
  2. +3
    -3
      project.config.json

+ 50
- 15
index/index.js View File

@@ -119,6 +119,8 @@ Page({
mallTenantId: tt.getStorageSync('mallTenantId') || '', mallTenantId: tt.getStorageSync('mallTenantId') || '',
index: tt.getStorageSync('mallIndex') || 0, index: tt.getStorageSync('mallIndex') || 0,
locateData: {}, locateData: {},
scanIn: false, // 扫码进入首页
scanInTenantId: ''
}, },


getCongig() { //获取小程序是否开通授权手机号 getCongig() { //获取小程序是否开通授权手机号
@@ -145,19 +147,45 @@ Page({
Http.get({ Http.get({
url: '/mall/subMall?isAll=1', url: '/mall/subMall?isAll=1',
}).then(res => { }).then(res => {

tt.setStorageSync('shopList', JSON.stringify(res.data)); tt.setStorageSync('shopList', JSON.stringify(res.data));
this.setData({
shopList: res.data,
mallTenantId: tt.getStorageSync('mallTenantId') || res.data[0].tenantId
});
if (!tt.getStorageSync('mallTenantId') && res.data.length > 1) {
tt.setStorageSync('mallTenantId', res.data[0].tenantId)
tt.setStorageSync('mallIndex', 0)
}
const locationSwitch = tt.getStorageSync('locationSwitch');
if (!locationSwitch) {
this.getLocation()

if (this.data.scanIn) {
console.log('Over Here!!!!!!!!!!!!!!');
let obj = {}
let i = 0
res.data.forEach((item, index) => {
if (item.tenantId == this.data.scanInTenantId) {
obj = item
i = index
return
}
})
console.log(obj, 'obj');
this.setData({
shopList: res.data,
mallTenantId: obj.tenantId,
index: i
});
tt.setStorageSync('mallTenantId', obj.tenantId)
tt.setStorageSync('mallIndex', i)

} else {
console.log('IIIOver Here!!!!!!!!!!!!!!');
this.setData({
shopList: res.data,
mallTenantId: tt.getStorageSync('mallTenantId') || res.data[0].tenantId
});
if (!tt.getStorageSync('mallTenantId') && res.data.length > 1) {
tt.setStorageSync('mallTenantId', res.data[0].tenantId)
tt.setStorageSync('mallIndex', 0)
}
const locationSwitch = tt.getStorageSync('locationSwitch');
if (locationSwitch) {
this.getLocation()
}
} }

}).catch(err => { }).catch(err => {
console.log(err, 'err'); console.log(err, 'err');
}) })
@@ -193,7 +221,7 @@ Page({
url: config.api.businessList, url: config.api.businessList,
data: { data: {
filter: 2, filter: 2,
mallTenantId: this.data.mallTenantId,
mallTenantId: this.data.mallTenantId || that.data.scanInTenantId || "",
} }
}).then(res => { }).then(res => {
this.setData({ this.setData({
@@ -225,7 +253,7 @@ Page({
pageNum: that.data.businePageNum, pageNum: that.data.businePageNum,
pageSize: 6, pageSize: 6,
targetAd: 101, targetAd: 101,
mallTenantId: tt.getStorageSync('mallTenantId') || ""
mallTenantId: tt.getStorageSync('mallTenantId') || that.data.scanInTenantId || ""
} }
} else { } else {
param = { param = {
@@ -233,7 +261,7 @@ Page({
pageSize: 6, pageSize: 6,
business: key, business: key,
targetAd: 101, targetAd: 101,
mallTenantId: tt.getStorageSync('mallTenantId') || ""
mallTenantId: tt.getStorageSync('mallTenantId') || that.data.scanInTenantId || ""


} }
} }
@@ -583,6 +611,13 @@ Page({
const locationSwitch = options.type || '' const locationSwitch = options.type || ''
tt.setStorageSync('locationSwitch', locationSwitch); tt.setStorageSync('locationSwitch', locationSwitch);


if (options.tenantId) {
that.setData({
scanIn: true,
scanInTenantId: options.tenantId
})
console.log(that.data.scanInTenantId, 'scanInTenantId');
}


let openId = tt.getStorageSync('openId') let openId = tt.getStorageSync('openId')
if (tt.getStorageSync('options')) { if (tt.getStorageSync('options')) {
@@ -1216,7 +1251,7 @@ Page({
pageNum: 1, pageNum: 1,
pageSize: 7, pageSize: 7,
plat: 3, plat: 3,
mallTenantId: tt.getStorageSync('mallTenantId') || ""
mallTenantId: tt.getStorageSync('mallTenantId') || that.data.scanInTenantId || ""
} }
}).then(res => { }).then(res => {
that.getmemberId(app.globalData.token); that.getmemberId(app.globalData.token);


+ 3
- 3
project.config.json View File

@@ -17,7 +17,7 @@
"projectname": "tt富茂C", "projectname": "tt富茂C",
"condition": { "condition": {
"miniprogram": { "miniprogram": {
"current": -1,
"current": 1678330099779,
"list": [ "list": [
{ {
"id": 1676969626961, "id": 1676969626961,
@@ -48,9 +48,9 @@
}, },
{ {
"id": 1678330099779, "id": 1678330099779,
"name": " index/index(noLocation)",
"name": " index/index(scanIn)",
"pathName": "index/index", "pathName": "index/index",
"query": "type=in",
"query": "type=in&tenantId=1034",
"scene": "990001", "scene": "990001",
"launchFrom": "scan", "launchFrom": "scan",
"location": "qr_code" "location": "qr_code"


Loading…
Cancel
Save