时味苏州
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

247 lines
5.2 KiB

<template>
<view class="bg">
<view :class="['item-bg',selectItem.id==item.id?'active':'']" v-for="(item,index) in list" :key="index" @click="selectPoint(item)">
<view class="item">
<view class="item-point-title">
<view class="name">{{item.title}}</view>
<view style="padding: 10rpx 0;">营业时间:{{item.remark}}</view>
<view >地址:{{item.address}}</view>
</view>
<view class="item-point-guide" @click.stop="goMap(item)">
<view>
<image src="https://static.ticket.sz-trip.com/uploads/20250617/69e16394a2a95657a08eaa5c685c9f1d.png" mode="aspectFill" class="mapPoint"></image>
</view>
<view class="distance" v-if="item.distance">距离{{item.distance.toFixed(2)}}km</view>
</view>
</view>
</view>
<view class="no-data" v-if="list.length==0">
<image src="https://static.ticket.sz-trip.com/dongtai/images/user/noAddress.png" mode="aspectFill" class="no-address"></image>
<view class="">
暂无自提点地址
</view>
</view>
<view class="btn-bottom">
<view class="addBox" @click.stop="confirmPoint">
确定
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
load: false,
pending: false,
list: [],
pickupId: null,
goodsId: null,
selectItem: {},
};
},
onLoad(options) {
this.pickupId = options.pickupId || null
this.goodsId = options.goodsId
},
onShow(options) {
this.getList()
},
methods: {
getList() {
if (this.pending) {
return
}
this.pending = true
// this.getLocation()
let param = {
product_id: this.goodsId,
lon: uni.getStorageSync('location').lon || '36',
lat: uni.getStorageSync('location').lat || '29',
}
this.Post(param, "/api/product/getDeliverShop").then(res => {
if (res) {
this.list = [...this.list, ...res.data];
if (res.data.length < 10) {
this.load = true;
}
if (this.pickupId && Array.isArray(this.list)) {
let selectItem = this.list.find(v=>v.id==this.pickupId)
if (selectItem) {
this.selectItem = selectItem
}
}
}
this.pending = false
})
},
selectPoint (item) {
this.selectItem = item
// 返回上一个页面并带回selectItem
// uni.$emit("updateDataByConnect", {msgType:'updatePickUpPoint',data:{selectItem: this.selectItem, skuId: this.goodsId}})
// uni.navigateBack()
},
goMap (item) {
uni.openLocation({
latitude: Number(item.lat),
longitude: Number(item.lon),
name: item.extract_name,
address: item.detail_addr,
success: function () {
console.log('success');
}
});
},
confirmPoint () {
if(!this.selectItem.id) {
uni.showToast({icon: "none",title: "请先选择自提点"})
return;
}
// 返回上一个页面并带回selectItem
uni.$emit("updateDataByConnect", {msgType:'updatePickUpPoint',data:{selectItem: this.selectItem, pInfoId: this.goodsId}})
uni.navigateBack()
}
},
onReachBottom() {
}
}
</script>
<style lang="scss" scoped>
view {
box-sizing: border-box;
font-family: PingFang SC;
}
.bg {
position: relative;
background: #F7F7F7;
min-height: 100vh;
padding-bottom: 170rpx;
}
.flex-shrink-0{
flex-shrink: 0;
}
.item-bg{
width: 697rpx;
min-height: 160rpx;
background: #FFFFFF;
border-radius: 13rpx;
margin: 0 auto;
margin-bottom: 28rpx;
&.active{
border:1px solid #6A8A2D;
}
}
.item {
padding: 24rpx;
padding-right: 0;
display: flex;
background: #FFFFFF;
border-radius: 13rpx;
width: 100%;
height: 100%;
.item-point-title{
flex: 1;
width: 10rpx;
padding-right: 78rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
font-weight: 500;
font-size: 27rpx;
color: #999999;
}
.item-point-guide{
width:140rpx;
flex-shrink: 0;
border-left: 1px solid #D8D8D8;
color: #515150;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: 24rpx;
}
.mapPoint{
width: 33rpx;
height: 33rpx;
}
}
.name {
display: flex;
font-size: 31rpx;
font-weight: bold;
color: #333333;
}
.no-data {
width: 100%;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
view:nth-child(2) {
font-size: 30rpx;
font-family: PingFang SC;
font-weight: 500;
color: #333333;
margin-top: 25rpx;
}
image {
width: 160rpx;
height: 160rpx;
}
padding-bottom: 400rpx;
}
.btn-bottom{
position: fixed;
bottom: 0;
width: 750rpx;
height: 150rpx;
background: #FFFFFF;
box-shadow: 0rpx 0rpx 16rpx 0rpx rgba(6, 0, 1, 0.1);
display: flex;
justify-content: space-between;
padding: 30rpx 50rpx 30rpx 50rpx;
.addBox{
margin: 0 auto;
width: 697rpx;
height: 73rpx;
background: #6A8A2D;
border-radius: 11rpx;
font-size: 36rpx;
font-family: PingFang SC;
font-weight: 500;
color: #FFFFFF;
line-height: 80rpx;
text-align: center;
}
}
.distance{
font-weight: 500;
font-size: 24rpx;
color: #6A8A2D;
text-align: center;
padding-top: 11rpx;
word-wrap: break-all;
}
</style>