first commit
This commit is contained in:
1
衣莎项目/源码/YiShaXiYi/pages/nearbyStore/.pydio
Normal file
1
衣莎项目/源码/YiShaXiYi/pages/nearbyStore/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
8cb93d44-5edc-4b32-a8a7-1fabdd0af787
|
||||
144
衣莎项目/源码/YiShaXiYi/pages/nearbyStore/nearbyStore.js
Normal file
144
衣莎项目/源码/YiShaXiYi/pages/nearbyStore/nearbyStore.js
Normal file
@@ -0,0 +1,144 @@
|
||||
// pages/nearbyStore/nearbyStore.js
|
||||
const app = getApp();
|
||||
const regeneratorRuntime = app.loadAsync()
|
||||
const model = app.loadModel("index")
|
||||
const http = app.loadHttp()
|
||||
const util = app.loadUtils('util')
|
||||
const { StorageSync } = app.loadModel("getSetting")
|
||||
const storage = new StorageSync()
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
system: app.globalData.system, //设备相关信息
|
||||
pageTitle: "伊莎洗衣", //头部标题
|
||||
isBack: true,//显示返回
|
||||
markers: [{
|
||||
id: 1,
|
||||
latitude: 23.099994,
|
||||
longitude: 113.324520
|
||||
}],
|
||||
longitude: "",
|
||||
latitude: "",
|
||||
addList: [],// 全部门店列表
|
||||
reallyList: [],// 渲染列表
|
||||
isAdd: 3,// 控制渲染数量
|
||||
},
|
||||
/**
|
||||
* 传入经纬度和目的地名称简介打开地图
|
||||
* @param {Object} data latitude精度 longitude纬度 name目的地名称 address目的地介绍
|
||||
*/
|
||||
intoMap: function (data) {
|
||||
let item = data.currentTarget.dataset.item
|
||||
wx.openLocation({
|
||||
latitude: item.latitude,
|
||||
longitude: item.longitude,
|
||||
name: item.name,
|
||||
address: item.address,
|
||||
scale: 28,//缩放比例
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 获取当前用户经纬度
|
||||
*/
|
||||
async getAdd() {
|
||||
let data = await model.storage.getSetting("position")
|
||||
this.setData({
|
||||
longitude: data.longitude,
|
||||
latitude: data.latitude
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 获取全部门店列表
|
||||
*/
|
||||
async getStoreList() {
|
||||
let data = await model.storage.getSetting("position")
|
||||
let res = await http.http.request1({
|
||||
url: `${http.api.shoplist}`, method: "POST", data: {
|
||||
lat: data.latitude,
|
||||
lng: data.longitude
|
||||
}
|
||||
})
|
||||
let rel = res.data.data;
|
||||
this.setData({
|
||||
addList: [...rel],
|
||||
reallyList: [...rel.slice(0, 5)]
|
||||
})
|
||||
|
||||
},
|
||||
// 拨打电话
|
||||
makePhoneCall(e) {
|
||||
let tel = e.currentTarget.dataset.item.telnum
|
||||
wx.makePhoneCall({
|
||||
phoneNumber: tel
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: async function (options) {
|
||||
await model.getauth.userLocation()
|
||||
this.getAdd()
|
||||
this.getStoreList()
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
onPageScroll: function (e) {
|
||||
if (this.data.addList.length > this.data.isAdd) {
|
||||
let isAdd = this.data.isAdd
|
||||
this.setData({
|
||||
isAdd: isAdd + 2,
|
||||
reallyList: [...this.data.reallyList, ...this.data.addList.slice(isAdd, isAdd + 2)]
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
||||
4
衣莎项目/源码/YiShaXiYi/pages/nearbyStore/nearbyStore.json
Normal file
4
衣莎项目/源码/YiShaXiYi/pages/nearbyStore/nearbyStore.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"navigationBarTextStyle": "black",
|
||||
"usingComponents": {}
|
||||
}
|
||||
38
衣莎项目/源码/YiShaXiYi/pages/nearbyStore/nearbyStore.wxml
Normal file
38
衣莎项目/源码/YiShaXiYi/pages/nearbyStore/nearbyStore.wxml
Normal file
@@ -0,0 +1,38 @@
|
||||
<!-- 头部导航 -->
|
||||
<nav-bar isBack="{{isBack}}" pageTitle="{{pageTitle}}" system="{{system}}"></nav-bar>
|
||||
<!-- pages/nearbyStore/nearbyStore.wxml -->
|
||||
<view class="nearbyStore">
|
||||
<view class="map" style="top:{{system.statusHeight+system.titleHeight+'px'}}">
|
||||
<map id="map" longitude="{{ longitude }}" latitude="{{ latitude }}" scale="14" markers="{{markers}}" show-compass show-location style="width: 100%; height: 490rpx;"></map>
|
||||
</view>
|
||||
<view class="nav_title">合肥伊莎洗衣洗衣<span>{{addList.length}}</span>家门店导航</view>
|
||||
<view class="shopList pd30">
|
||||
<view class="shop_row pd30 mb20" wx:for="{{reallyList}}" wx:key="index">
|
||||
<view class="title">
|
||||
<view class="title1 fl">
|
||||
<image src="/static/img/icon/dasd1a65d1as1da6_03.png" />
|
||||
</view>
|
||||
<view class="title2 fl">{{item.name}}</view>
|
||||
<view class="title3 fr c_red">{{item.distance}}</view>
|
||||
</view>
|
||||
<view class="shop_info">
|
||||
<view class="shop_infol">
|
||||
<view class="shop_p">电话 {{item.telnum}}</view>
|
||||
<view class="shop_p">地址 {{item.address}}</view>
|
||||
</view>
|
||||
<view class="shop_infor">
|
||||
<view class="shop_img">
|
||||
<view class="shimg flex-con3" data-item="{{item}}" bind:tap="makePhoneCall">
|
||||
<image src="/static/img/icon/greger6541g61gw.png" />
|
||||
</view>
|
||||
<view class="shimg flex-con3" data-item="{{item}}" bind:tap="intoMap">
|
||||
<image src="/static/img/icon/asfasf0230.png" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- toasta提示 -->
|
||||
<i-toast id="toast" />
|
||||
104
衣莎项目/源码/YiShaXiYi/pages/nearbyStore/nearbyStore.wxss
Normal file
104
衣莎项目/源码/YiShaXiYi/pages/nearbyStore/nearbyStore.wxss
Normal file
@@ -0,0 +1,104 @@
|
||||
/* pages/nearbyStore/nearbyStore.wxss */
|
||||
|
||||
.map {
|
||||
z-index: 9999;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 490rpx;
|
||||
}
|
||||
|
||||
.nearbyStore {
|
||||
padding-top: 490rpx;
|
||||
}
|
||||
|
||||
.nav_title {
|
||||
margin: 39rpx 0;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
font-size: 30rpx;
|
||||
letter-spacing: 0px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.nav_title span {
|
||||
margin: 0 10rpx;
|
||||
font-size: 30rpx;
|
||||
letter-spacing: 0px;
|
||||
color: #1bb348;
|
||||
}
|
||||
|
||||
.shop_row {
|
||||
padding-top: 49rpx;
|
||||
padding-bottom: 20rpx;
|
||||
width: 100%;
|
||||
/* height: 228rpx; */
|
||||
background-color: #fff;
|
||||
box-shadow: 0px 0px 15rpx 0px rgba(172, 172, 172, 0.07);
|
||||
border-radius: 15rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.title1 image {
|
||||
width: 21rpx;
|
||||
height: 26rpx;
|
||||
}
|
||||
|
||||
.title2 {
|
||||
margin-left: 15rpx;
|
||||
}
|
||||
|
||||
.shop_info {
|
||||
margin-top: 32rpx;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.shop_infol {
|
||||
flex: 6;
|
||||
}
|
||||
|
||||
.shop_infol .shop_p {
|
||||
font-size: 26rpx;
|
||||
line-height: 40rpx;
|
||||
letter-spacing: 0px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.shop_infor {
|
||||
flex: 2;
|
||||
}
|
||||
|
||||
.shop_img {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.shop_img::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
margin: auto;
|
||||
width: 2rpx;
|
||||
height: 25rpx;
|
||||
background-color: #ccc;
|
||||
}
|
||||
|
||||
.shimg {
|
||||
flex: 2;
|
||||
}
|
||||
|
||||
.shimg image {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user