盐都小程序
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.
 
 
 
 
 

250 lines
5.0 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 text-overflow flex-shrink-0">{{item.extract_name}}</view>
<view class="addressStr">
<!-- <view class="flex-shrink-0"></view> -->
<view class="text-overflowRows">地址:{{item.detail_addr}}</view>
</view>
</view>
<view class="item-point-guide" @click.stop="goMap(item)">
<view>
<image :src="showImg('/uploads/20240828/0c74764788025234dccf52e91ac8e706.png')" mode="aspectFill" class="mapPoint"></image>
</view>
<view>去这里</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 = {
goods_id: this.goodsId,
offset: this.list.length,
limit: 10,
lon: uni.getStorageSync('location').lon || '',
lat: uni.getStorageSync('location').lat || '',
}
this.Post(param, "/api/extract/getMerchantExtractListByGoodsIdNew").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
},
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:this.selectItem})
uni.navigateBack()
}
},
onReachBottom() {
setTimeout(() => {
if (!this.load) {
this.getList()
}
}, 1000);
}
}
</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;
height: 160rpx;
background: #FFFFFF;
border-radius: 13rpx;
margin: 0 auto;
margin-bottom: 28rpx;
padding: 2rpx;
}
.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;
}
.item-point-guide{
width:140rpx;
flex-shrink: 0;
border-left: 1px solid #D8D8D8;
color: #71B580;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: 24rpx;
}
.mapPoint{
width: 45rpx;
height: 49rpx;
}
}
.item-bg.active{
background-image: linear-gradient(-20deg, #9EE4FE, #7FD491);
}
.name {
display: flex;
font-size: 31rpx;
font-weight: bold;
color: #333333;
height: 42rpx;
}
.addressStr{
display: flex;
font-size: 27rpx;
color: #999999;
padding-top: 10rpx;
}
.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: 80rpx;
background: linear-gradient(90deg, #F84A56, #FF9834);
border-radius: 40rpx;
font-size: 36rpx;
font-family: PingFang SC;
font-weight: 500;
color: #FFFFFF;
line-height: 80rpx;
text-align: center;
}
}
</style>