feat: 标记分拣、取货门店展示
This commit is contained in:
+133
-33
@@ -25,7 +25,7 @@
|
||||
<view class="rulesTitle flex flex-wrap align-center"> 核销时间 </view>
|
||||
<view class="info">
|
||||
每日:
|
||||
<text class="time">{{ systemStore.openingTime }} - {{ systemStore.closingTime }}</text>
|
||||
<text class="time">{{ openingTimeText }} - {{ closingTimeText }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item">
|
||||
@@ -39,12 +39,19 @@
|
||||
</view>
|
||||
<view
|
||||
v-if="orderInfo.deliveryType === 2"
|
||||
class="map flex flex-wrap align-center ss-row-between borRadius14"
|
||||
class="pickup-card borRadius14"
|
||||
>
|
||||
<view>自提地址信息</view>
|
||||
<view class="place cart-color flex flex-wrap flex-center" @tap="showMaoLocation">
|
||||
查看位置
|
||||
<image v-if="coverImageUrl" class="pickup-cover" :src="coverImageUrl" mode="aspectFill" />
|
||||
<view class="pickup-hd">
|
||||
<view class="pickup-title">{{ systemStore.name || '自提门店' }}</view>
|
||||
<view v-if="distanceText" class="pickup-distance">{{ distanceText }}</view>
|
||||
</view>
|
||||
<view class="pickup-address">{{ pickupAddressText || '--' }}</view>
|
||||
<view class="pickup-hours">
|
||||
<uni-icons type="clock" size="14" color="#8c8c8c" />
|
||||
<view class="pickup-hours__text">营业时间:{{ openingTimeText }} - {{ closingTimeText }}</view>
|
||||
</view>
|
||||
<view class="pickup-btn" @tap="showMaoLocation">查看位置导航</view>
|
||||
</view>
|
||||
<!-- 海报画板:默认隐藏只用来生成海报。生成方式为主动调用 -->
|
||||
<l-painter
|
||||
@@ -60,7 +67,7 @@
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { reactive, ref } from 'vue';
|
||||
import { computed, reactive, ref } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
orderInfo: {
|
||||
@@ -87,26 +94,70 @@
|
||||
/**
|
||||
* 打开地图
|
||||
*/
|
||||
const formatHm = (hm) => {
|
||||
if (!Array.isArray(hm) || hm.length < 2) return '';
|
||||
const h = String(hm[0]).padStart(2, '0');
|
||||
const m = String(hm[1]).padStart(2, '0');
|
||||
return `${h}:${m}`;
|
||||
};
|
||||
|
||||
const openingTimeText = computed(() => {
|
||||
return props.systemStore?.openingTime || formatHm(props.systemStore?.businessHoursStart) || '--';
|
||||
});
|
||||
|
||||
const closingTimeText = computed(() => {
|
||||
return props.systemStore?.closingTime || formatHm(props.systemStore?.businessHoursEnd) || '--';
|
||||
});
|
||||
|
||||
const pickupAddressText = computed(() => {
|
||||
const s = props.systemStore || {};
|
||||
const province = s.province || '';
|
||||
const city = s.city || '';
|
||||
const district = s.district || '';
|
||||
const address = s.address || '';
|
||||
const legacy = `${s.areaName || ''}${s.detailAddress || ''}`;
|
||||
return `${province}${city}${district}${address}` || legacy || s.description || '';
|
||||
});
|
||||
|
||||
const distanceText = computed(() => {
|
||||
const d = Number(props.systemStore?.distance);
|
||||
if (!(d > 0)) return '';
|
||||
const t = d >= 1000 ? `${(d / 1000).toFixed(1)}km` : `${Math.round(d)}m`;
|
||||
return `距离${t}`;
|
||||
});
|
||||
|
||||
const sanitizeUrl = (value) => String(value || '').replace(/[`"'\s]/g, '');
|
||||
|
||||
const coverImageUrl = computed(() => {
|
||||
const raw = sanitizeUrl(props.systemStore?.coverImage);
|
||||
if (!raw) return '';
|
||||
if (/^https?:\/\//i.test(raw)) return raw;
|
||||
return sheep.$url.cdn(raw);
|
||||
});
|
||||
|
||||
const addressText = computed(() => {
|
||||
const s = props.systemStore || {};
|
||||
const province = s.province || '';
|
||||
const city = s.city || '';
|
||||
const district = s.district || '';
|
||||
const description = s.description || '';
|
||||
const legacy = `${s.areaName || ''}${s.detailAddress || ''}`;
|
||||
return `${province}${city}${district}${description}` || legacy || s.address || '';
|
||||
});
|
||||
|
||||
const showMaoLocation = () => {
|
||||
if (!props.systemStore.latitude || !props.systemStore.longitude) {
|
||||
const latitude = Number(props.systemStore?.latitude);
|
||||
const longitude = Number(props.systemStore?.longitude);
|
||||
if (!(latitude && longitude)) {
|
||||
sheep.$helper.toast('缺少经纬度信息无法查看地图!');
|
||||
return;
|
||||
}
|
||||
uni.openLocation({
|
||||
latitude: props.systemStore.latitude,
|
||||
longitude: props.systemStore.longitude,
|
||||
latitude,
|
||||
longitude,
|
||||
scale: 8,
|
||||
name: props.systemStore.name,
|
||||
address: props.systemStore.areaName + props.systemStore.detailAddress,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 拨打电话
|
||||
*/
|
||||
const makePhone = () => {
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: props.systemStore.phone,
|
||||
name: props.systemStore?.name,
|
||||
address: addressText.value,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -270,23 +321,72 @@
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
.order-details .map {
|
||||
height: 86rpx;
|
||||
font-size: 30rpx;
|
||||
color: #282828;
|
||||
line-height: 86rpx;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
.order-details .pickup-card {
|
||||
margin-top: 15rpx;
|
||||
background-color: #fff;
|
||||
padding: 0 24rpx;
|
||||
padding: 22rpx 24rpx 24rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.order-details .map .place {
|
||||
.order-details .pickup-hd {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.order-details .pickup-title {
|
||||
font-size: 30rpx;
|
||||
color: #282828;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.order-details .pickup-distance {
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 999rpx;
|
||||
font-size: 22rpx;
|
||||
color: #2556ec;
|
||||
background: rgba(37, 86, 236, 0.12);
|
||||
}
|
||||
|
||||
.order-details .pickup-address {
|
||||
margin-top: 10rpx;
|
||||
font-size: 26rpx;
|
||||
width: 176rpx;
|
||||
height: 50rpx;
|
||||
border-radius: 25rpx;
|
||||
line-height: 50rpx;
|
||||
text-align: center;
|
||||
color: #666;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
|
||||
.order-details .pickup-cover {
|
||||
width: 100%;
|
||||
height: 168rpx;
|
||||
border-radius: 16rpx;
|
||||
display: block;
|
||||
margin-bottom: 14rpx;
|
||||
background: #f2f4f7;
|
||||
}
|
||||
|
||||
.order-details .pickup-hours {
|
||||
margin-top: 10rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10rpx;
|
||||
}
|
||||
|
||||
.order-details .pickup-hours__text {
|
||||
font-size: 24rpx;
|
||||
color: #8c8c8c;
|
||||
}
|
||||
|
||||
.order-details .pickup-btn {
|
||||
margin-top: 16rpx;
|
||||
height: 76rpx;
|
||||
border-radius: 16rpx;
|
||||
border: 2rpx solid rgba(37, 86, 236, 0.35);
|
||||
background: #fff;
|
||||
color: #2556ec;
|
||||
font-size: 28rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user