2024-09-18 17:33:25 +08:00
|
|
|
|
<template>
|
2024-10-31 16:14:58 +08:00
|
|
|
|
<s-layout title="选择自提门店" :bgStyle="{ color: '#FFF' }">
|
|
|
|
|
<view class="storeBox" ref="container">
|
|
|
|
|
<view class="storeBox-box" v-for="(item, index) in state.storeList" :key="index" @tap="checked(item)">
|
|
|
|
|
<view class="store-img">
|
|
|
|
|
<image :src="item.logo" class="img" />
|
|
|
|
|
</view>
|
|
|
|
|
<view class="store-cent-left">
|
|
|
|
|
<view class="store-name">{{ item.name }}</view>
|
|
|
|
|
<view class="store-address line1">
|
|
|
|
|
{{ item.areaName }}{{ ', ' + item.detailAddress }}
|
|
|
|
|
</view>
|
|
|
|
|
<view class="store-address line1">
|
2024-11-04 11:13:41 +08:00
|
|
|
|
营业时间:{{item?.openingTime[0] + ":" + item?.openingTime[1]}}-{{item?.closingTime[0] + ":" + item?.closingTime[1]}}
|
2024-10-31 16:14:58 +08:00
|
|
|
|
</view>
|
2024-11-04 11:13:41 +08:00
|
|
|
|
<view class="status" v-if="item?.stat == 0">未营业</view>
|
|
|
|
|
<view class="status" v-if="item?.stat == 1">营业中</view>
|
2024-10-31 16:14:58 +08:00
|
|
|
|
</view>
|
|
|
|
|
<view class="row-right ss-flex-col ss-col-center">
|
|
|
|
|
<view>
|
|
|
|
|
<!-- #ifdef H5 -->
|
|
|
|
|
<!-- <a class="store-phone" :href="'tel:' + item.phone">
|
|
|
|
|
<view class="iconfont">
|
|
|
|
|
<view class="ss-rest-button">
|
|
|
|
|
<text class="_icon-forward" />
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</a> -->
|
|
|
|
|
<!-- #endif -->
|
|
|
|
|
<!-- #ifdef MP -->
|
|
|
|
|
<!-- <view class="store-phone" @click="call(item.phone)">
|
|
|
|
|
<view class="iconfont">
|
|
|
|
|
<view class="ss-rest-button">
|
|
|
|
|
<text class="_icon-forward" />
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view> -->
|
|
|
|
|
<!-- #endif -->
|
|
|
|
|
</view>
|
|
|
|
|
<view class="store-distance ss-flex ss-row-center">
|
|
|
|
|
<view class="addressTxt" v-if="item.distance==0 || item.distance">
|
|
|
|
|
距离{{ item.distance.toFixed(2) }}km</view>
|
|
|
|
|
<!-- <text class="addressTxt" v-else>查看地图</text> -->
|
|
|
|
|
<!-- <view class="iconfont">
|
|
|
|
|
<view class="ss-rest-button">
|
|
|
|
|
<text class="_icon-forward" />
|
|
|
|
|
</view>
|
|
|
|
|
</view> -->
|
|
|
|
|
|
|
|
|
|
<view class="tb">
|
|
|
|
|
<image @tap.stop="showMaoLocation(item)" style="margin-right:10px;"
|
|
|
|
|
src="https://zysc.fjptzykj.com:3000/shangcheng/c7362f85726ef0030b407f1c3749c710ca0caa51fee5cc8ffbb64e11226354a8.png"
|
|
|
|
|
class="img"></image>
|
2024-11-05 15:57:31 +08:00
|
|
|
|
<image @click.stop="call(item.phone)"
|
2024-10-31 16:14:58 +08:00
|
|
|
|
src="https://zysc.fjptzykj.com:3000/shangcheng/535ee6f79e04d4b6e46fcfa59ed052f214ad6ab756c340c0c040e68357f68e9a.png"
|
|
|
|
|
class="img"></image>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</s-layout>
|
2024-09-18 17:33:25 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2024-10-31 16:14:58 +08:00
|
|
|
|
import DeliveryApi from '@/sheep/api/trade/delivery';
|
|
|
|
|
import {
|
|
|
|
|
onMounted,
|
|
|
|
|
reactive
|
|
|
|
|
} from 'vue';
|
|
|
|
|
import {
|
|
|
|
|
onLoad
|
|
|
|
|
} from '@dcloudio/uni-app';
|
|
|
|
|
import sheep from '@/sheep';
|
|
|
|
|
|
|
|
|
|
const LONGITUDE = 'user_longitude';
|
|
|
|
|
const LATITUDE = 'user_latitude';
|
|
|
|
|
const state = reactive({
|
|
|
|
|
loaded: false,
|
|
|
|
|
loading: false,
|
|
|
|
|
storeList: [],
|
|
|
|
|
system_store: {},
|
|
|
|
|
locationShow: false,
|
|
|
|
|
user_latitude: 0,
|
|
|
|
|
user_longitude: 0,
|
|
|
|
|
});
|
2024-09-18 17:33:25 +08:00
|
|
|
|
|
2024-10-31 16:14:58 +08:00
|
|
|
|
const call = (phone) => {
|
|
|
|
|
uni.makePhoneCall({
|
|
|
|
|
phoneNumber: phone,
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
const selfLocation = () => {
|
|
|
|
|
// #ifdef H5
|
|
|
|
|
const jsWxSdk = sheep.$platform.useProvider('wechat').jsWxSdk;
|
|
|
|
|
if (!!jsWxSdk?.isWechat()) {
|
|
|
|
|
jsWxSdk.getLocation((res) => {
|
|
|
|
|
state.user_latitude = res.latitude;
|
|
|
|
|
state.user_longitude = res.longitude;
|
|
|
|
|
uni.setStorageSync(LATITUDE, res.latitude);
|
|
|
|
|
uni.setStorageSync(LONGITUDE, res.longitude);
|
|
|
|
|
getList();
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
// #endif
|
|
|
|
|
uni.getLocation({
|
|
|
|
|
type: 'gcj02',
|
|
|
|
|
success: (res) => {
|
|
|
|
|
console.log(res.latitude, "--------经纬度-----");
|
|
|
|
|
try {
|
|
|
|
|
state.user_latitude = res.latitude;
|
|
|
|
|
state.user_longitude = res.longitude;
|
|
|
|
|
uni.setStorageSync(LATITUDE, res.latitude);
|
|
|
|
|
uni.setStorageSync(LONGITUDE, res.longitude);
|
|
|
|
|
} catch {}
|
2024-09-18 17:33:25 +08:00
|
|
|
|
|
2024-10-31 16:14:58 +08:00
|
|
|
|
getList();
|
|
|
|
|
},
|
|
|
|
|
complete: () => {
|
|
|
|
|
getList();
|
|
|
|
|
},
|
|
|
|
|
fail(error) {
|
|
|
|
|
console.log(error, "错误")
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
console.log("有执行")
|
|
|
|
|
// #ifdef H5
|
|
|
|
|
}
|
|
|
|
|
// #endif
|
|
|
|
|
};
|
|
|
|
|
const showMaoLocation = (e) => {
|
|
|
|
|
// #ifdef H5
|
|
|
|
|
const jsWxSdk = sheep.$platform.useProvider('wechat').jsWxSdk;
|
|
|
|
|
if (jsWxSdk.isWechat()) {
|
|
|
|
|
jsWxSdk.openLocation({
|
|
|
|
|
latitude: Number(e.latitude),
|
|
|
|
|
longitude: Number(e.longitude),
|
|
|
|
|
name: e.name,
|
|
|
|
|
address: `${e.areaName}-${e.detailAddress}`
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
// #endif
|
|
|
|
|
uni.openLocation({
|
|
|
|
|
latitude: Number(e.latitude),
|
|
|
|
|
longitude: Number(e.longitude),
|
|
|
|
|
name: e.name,
|
|
|
|
|
address: `${e.areaName}-${e.detailAddress}`,
|
|
|
|
|
success: function() {
|
|
|
|
|
console.log('success');
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
// #ifdef H5
|
|
|
|
|
}
|
|
|
|
|
// #endif
|
|
|
|
|
};
|
2024-09-18 17:33:25 +08:00
|
|
|
|
|
2024-10-31 16:14:58 +08:00
|
|
|
|
/**
|
|
|
|
|
* 选中门店
|
|
|
|
|
*/
|
|
|
|
|
const checked = (addressInfo) => {
|
|
|
|
|
uni.$emit('SELECT_PICK_UP_INFO', {
|
|
|
|
|
addressInfo,
|
|
|
|
|
});
|
|
|
|
|
sheep.$router.back();
|
|
|
|
|
};
|
2024-09-18 17:33:25 +08:00
|
|
|
|
|
2024-10-31 16:14:58 +08:00
|
|
|
|
/**
|
|
|
|
|
* 获取门店列表数据
|
|
|
|
|
*/
|
|
|
|
|
const getList = async () => {
|
|
|
|
|
if (state.loading || state.loaded) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
state.loading = true;
|
|
|
|
|
console.log(state.user_latitude, state.user_longitude, "------user_longitude-------")
|
|
|
|
|
const data2 = {
|
|
|
|
|
latitude: state.user_latitude,
|
|
|
|
|
longitude: state.user_longitude,
|
|
|
|
|
};
|
|
|
|
|
const {
|
|
|
|
|
data,
|
|
|
|
|
code
|
|
|
|
|
} = await DeliveryApi.getDeliveryPickUpStoreList(data2);
|
|
|
|
|
if (code !== 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
state.loading = false;
|
|
|
|
|
state.storeList = data;
|
|
|
|
|
};
|
2024-09-18 17:33:25 +08:00
|
|
|
|
|
2024-10-31 16:14:58 +08:00
|
|
|
|
onMounted(() => {
|
|
|
|
|
if (state.user_latitude && state.user_longitude) {
|
|
|
|
|
getList();
|
|
|
|
|
} else {
|
|
|
|
|
selfLocation();
|
|
|
|
|
getList();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
onLoad(() => {
|
|
|
|
|
try {
|
|
|
|
|
state.user_latitude = uni.getStorageSync(LATITUDE);
|
|
|
|
|
state.user_longitude = uni.getStorageSync(LONGITUDE);
|
|
|
|
|
console.log(state.user_latitude, state.user_longitude, "user_longitude");
|
|
|
|
|
} catch (e) {
|
|
|
|
|
// error
|
|
|
|
|
}
|
|
|
|
|
});
|
2024-09-18 17:33:25 +08:00
|
|
|
|
</script>
|
|
|
|
|
<style lang="scss" scoped>
|
2024-10-31 16:14:58 +08:00
|
|
|
|
.status {
|
|
|
|
|
background: rgba(214, 81, 42);
|
2024-11-04 11:13:41 +08:00
|
|
|
|
width: 40px;
|
2024-10-31 16:14:58 +08:00
|
|
|
|
text-align: center;
|
|
|
|
|
color: white;
|
|
|
|
|
border-radius: 3px;
|
2024-11-04 11:13:41 +08:00
|
|
|
|
margin-top: 5px;
|
|
|
|
|
font-size: 20rpx;
|
|
|
|
|
display:flex;
|
|
|
|
|
align-items:center;
|
|
|
|
|
justify-content:center;
|
2024-10-31 16:14:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.line1 {
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
white-space: nowrap
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.geoPage {
|
|
|
|
|
position: fixed;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
top: 0;
|
|
|
|
|
z-index: 10000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.storeBox {
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.storeBox-box {
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
// width: 100%;
|
|
|
|
|
height: auto;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
padding: 23rpx;
|
|
|
|
|
justify-content: space-around;
|
|
|
|
|
border-bottom: 1px solid #eee;
|
|
|
|
|
margin: 10px 10px;
|
|
|
|
|
boeder-radius: 10px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.store-cent {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
width: 80%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.store-cent-left {
|
|
|
|
|
// width: 177px;
|
|
|
|
|
flex: 1;
|
2024-11-04 11:13:41 +08:00
|
|
|
|
max-width: 156px;
|
2024-10-31 16:14:58 +08:00
|
|
|
|
position: relative;
|
|
|
|
|
padding-right: 10px;
|
2024-09-18 17:33:25 +08:00
|
|
|
|
|
2024-10-31 16:14:58 +08:00
|
|
|
|
&::after {
|
|
|
|
|
position: absolute;
|
|
|
|
|
content: '';
|
2024-11-04 11:13:41 +08:00
|
|
|
|
width: 1px;
|
2024-10-31 16:14:58 +08:00
|
|
|
|
height: 100%;
|
|
|
|
|
background: rgba(223, 223, 223);
|
|
|
|
|
right: 0;
|
|
|
|
|
top: 0;
|
|
|
|
|
}
|
2024-09-18 17:33:25 +08:00
|
|
|
|
|
2024-10-31 16:14:58 +08:00
|
|
|
|
}
|
2024-09-18 17:33:25 +08:00
|
|
|
|
|
2024-10-31 16:14:58 +08:00
|
|
|
|
.store-img {
|
|
|
|
|
// flex: 1;
|
2024-11-04 11:13:41 +08:00
|
|
|
|
width: 60px;
|
|
|
|
|
height: 60px;
|
2024-10-31 16:14:58 +08:00
|
|
|
|
border-radius: 6rpx;
|
|
|
|
|
margin-right: 22rpx;
|
|
|
|
|
}
|
2024-09-18 17:33:25 +08:00
|
|
|
|
|
2024-10-31 16:14:58 +08:00
|
|
|
|
.store-img .img {
|
2024-11-04 11:13:41 +08:00
|
|
|
|
width: 60px;
|
|
|
|
|
height: 60px;
|
|
|
|
|
border-radius: 31px;
|
2024-10-31 16:14:58 +08:00
|
|
|
|
}
|
2024-09-18 17:33:25 +08:00
|
|
|
|
|
2024-10-31 16:14:58 +08:00
|
|
|
|
.store-name {
|
|
|
|
|
color: #282828;
|
2024-11-04 11:13:41 +08:00
|
|
|
|
font-size: 26rpx;
|
|
|
|
|
margin-bottom: 5px;
|
2024-10-31 16:14:58 +08:00
|
|
|
|
font-weight: 800;
|
|
|
|
|
}
|
2024-09-18 17:33:25 +08:00
|
|
|
|
|
2024-10-31 16:14:58 +08:00
|
|
|
|
.store-address {
|
|
|
|
|
color: #666666;
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
}
|
2024-09-18 17:33:25 +08:00
|
|
|
|
|
2024-10-31 16:14:58 +08:00
|
|
|
|
.store-phone {
|
|
|
|
|
width: 50rpx;
|
|
|
|
|
height: 50rpx;
|
|
|
|
|
color: #fff;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
display: block;
|
|
|
|
|
text-align: center;
|
|
|
|
|
line-height: 48rpx;
|
|
|
|
|
background-color: #e83323;
|
|
|
|
|
margin-bottom: 22rpx;
|
|
|
|
|
text-decoration: none;
|
|
|
|
|
}
|
2024-09-18 17:33:25 +08:00
|
|
|
|
|
2024-10-31 16:14:58 +08:00
|
|
|
|
.store-distance {
|
|
|
|
|
font-size: 22rpx;
|
|
|
|
|
color: #e83323;
|
|
|
|
|
flex-wrap: wrap;
|
2024-09-18 17:33:25 +08:00
|
|
|
|
|
2024-10-31 16:14:58 +08:00
|
|
|
|
.addressTxt {
|
|
|
|
|
width: 100%;
|
|
|
|
|
text-align: center;
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
}
|
2024-09-18 17:33:25 +08:00
|
|
|
|
|
2024-10-31 16:14:58 +08:00
|
|
|
|
.tb {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: space-around;
|
2024-09-18 17:33:25 +08:00
|
|
|
|
|
2024-10-31 16:14:58 +08:00
|
|
|
|
.img {
|
|
|
|
|
width: 30px;
|
|
|
|
|
height: 30px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-09-18 17:33:25 +08:00
|
|
|
|
|
2024-10-31 16:14:58 +08:00
|
|
|
|
.iconfont {
|
|
|
|
|
font-size: 20rpx;
|
|
|
|
|
}
|
2024-09-18 17:33:25 +08:00
|
|
|
|
|
2024-10-31 16:14:58 +08:00
|
|
|
|
.row-right {
|
2024-11-04 11:13:41 +08:00
|
|
|
|
// flex: 1;
|
|
|
|
|
margin-left: 10px;
|
2024-10-31 16:14:58 +08:00
|
|
|
|
//display: flex;
|
|
|
|
|
//flex-direction: column;
|
|
|
|
|
//align-items: flex-end;
|
|
|
|
|
//width: 33.5%;
|
|
|
|
|
}
|
|
|
|
|
</style>
|