|
|
|
@ -41,6 +41,11 @@ Page({ |
|
|
|
this.data.path += '?' + options.key + '=' + options.value |
|
|
|
} |
|
|
|
} |
|
|
|
var citystring = storage.get('ztb-now-city') |
|
|
|
if(!util.isEmpty(citystring)){ |
|
|
|
app.nowCity = JSON.parse(citystring) |
|
|
|
this.data.cityName = app.nowCity.cityName |
|
|
|
} |
|
|
|
var min = new Date() |
|
|
|
min.setHours(0, 0, 0) |
|
|
|
var maxDate = util.formatDate(min, 'Y-M-D') |
|
|
|
@ -51,7 +56,7 @@ Page({ |
|
|
|
this.data.inited = true |
|
|
|
wx.showLoading({ title: '加载中', mask: true }) |
|
|
|
const fheght = (app.globalData.safeFragmentHeight + app.globalData.statusBarHeight) - 100 |
|
|
|
this.setData({ fragment: fheght, safeBottom: app.globalData.safeBottom, maxDate, minDate, calendar }) |
|
|
|
this.setData({ fragment: fheght, safeBottom: app.globalData.safeBottom, maxDate, minDate, calendar, cityName: this.data.cityName }) |
|
|
|
var authorization = app.globalData.token || storage.get('Authorization') |
|
|
|
if (authorization) { |
|
|
|
app.globalData.token = authorization |
|
|
|
@ -137,36 +142,24 @@ Page({ |
|
|
|
this.wuxDialog.open({ |
|
|
|
resetOnClose: true, |
|
|
|
title: '温馨提示', |
|
|
|
content: '小程序没有定位权限,无法进行送餐服务,请前往设置微信小程序的定位权限。', |
|
|
|
content: '小程序没有定位权限,无法提供准确的纸厂报价和相关信息服务,请前往设置微信小程序的定位权限。', |
|
|
|
buttons: [{ |
|
|
|
text: '前往设置', |
|
|
|
type: 'primary', |
|
|
|
onTap(e) { |
|
|
|
wx.openSetting({ |
|
|
|
success(result){ |
|
|
|
if(result && (result.authSetting["scope.userLocation"] !== undefined && result.authSetting["scope.userLocation"] ===true)){ |
|
|
|
if(result && (result.authSetting["scope.userLocation"] !== undefined && result.authSetting["scope.userLocation"] === true)){ |
|
|
|
// 成功设置
|
|
|
|
that.locationing() |
|
|
|
} else { |
|
|
|
that.detectSettings() |
|
|
|
// that.detectSettings()
|
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}] |
|
|
|
}) |
|
|
|
Dialog.alert({ title: '温馨提示', message: '小程序没有定位权限,无法进行送餐服务,请前往设置微信小程序的定位权限。', confirmButtonText: '前往设置' }).then(() => { |
|
|
|
wx.openSetting({ |
|
|
|
success(result){ |
|
|
|
if(result && (result.authSetting["scope.userLocation"] !== undefined && result.authSetting["scope.userLocation"] ===true)){ |
|
|
|
// 成功设置
|
|
|
|
that.locationing() |
|
|
|
} else { |
|
|
|
that.detectSettings() |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
toIndex: function () { |
|
|
|
this.fetchRegionList() |
|
|
|
@ -219,7 +212,7 @@ Page({ |
|
|
|
this.onResume() |
|
|
|
} |
|
|
|
// 如果定位完成,但是还是没有获取城市信息,那么就要进行城市选择
|
|
|
|
if(this.located && util.isEmpty(this.data.cityName)){ |
|
|
|
if(this.located && util.isEmpty(app.nowCity)){ |
|
|
|
wx.navigateTo({url: `/pages/home/city-select/index?type=1` }) |
|
|
|
} |
|
|
|
if(app.globalData.userInfo && !app.globalData.userInfo.identityTag){ |
|
|
|
@ -290,16 +283,16 @@ Page({ |
|
|
|
if(!util.isEmpty(e.currentTarget.dataset.index)){ |
|
|
|
var item = this.data.cityList[e.currentTarget.dataset.index] |
|
|
|
var flag = false |
|
|
|
for (let index = 0; index < this.data.cityList.length; index++) { |
|
|
|
if(this.data.cityList[index].cityId == item.cityId){ |
|
|
|
flag = true |
|
|
|
break |
|
|
|
for (let index = 0; index < this.data.cityList.length; index++) { |
|
|
|
if(this.data.cityList[index].cityId == item.cityId){ |
|
|
|
flag = true |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
if(!flag){ |
|
|
|
hotList.push(item) |
|
|
|
storage.put('ztb-hot-list', JSON.stringify(hotList)) |
|
|
|
} |
|
|
|
} |
|
|
|
if(!flag){ |
|
|
|
hotList.push(item) |
|
|
|
storage.put('ztb-hot-list', JSON.stringify(hotList)) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
onUnload: function(){ |
|
|
|
|