fix:修复bug
This commit is contained in:
+18
-51
@@ -14,60 +14,27 @@ const message = useMessage();
|
||||
function handleClickSearch() {
|
||||
uni.navigateTo({
|
||||
url: '/pages-user/pages/search-address/index',
|
||||
events: {
|
||||
chooseAddress: (data: any) => {
|
||||
console.log('搜索的地址信息', data)
|
||||
if (data) {
|
||||
addressStore.setAddressLocation({
|
||||
displayName: data.displayName,
|
||||
formattedAddress: data.formattedAddress,
|
||||
longitude: data.location.lng,
|
||||
latitude: data.location.lat
|
||||
})
|
||||
setTimeout(()=> {
|
||||
uni.navigateTo({
|
||||
url: '/pages/address/choose-type'
|
||||
})
|
||||
}, 300)
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
useEventEmit(EventEnum.CHOOSE_ADDRESS, (data) => {
|
||||
console.log('搜索的地址信息', data)
|
||||
if(data) {
|
||||
// 从addressComponents中提取州名/省名
|
||||
// let stateName = '';
|
||||
// if (data.addressComponents && Array.isArray(data.addressComponents)) {
|
||||
// // 先判断是否为中国地址
|
||||
// const countryComponent = data.addressComponents.find(component =>
|
||||
// component.types && component.types.includes('country')
|
||||
// );
|
||||
// const isChina = countryComponent && (countryComponent.shortText === 'CN' || countryComponent.longText === '中国');
|
||||
//
|
||||
// if (isChina) {
|
||||
// // 中国地址:优先取市级(locality),如果没有则取省级(administrative_area_level_1)
|
||||
// const cityComponent = data.addressComponents.find(component =>
|
||||
// component.types && component.types.includes('locality')
|
||||
// );
|
||||
// const provinceComponent = data.addressComponents.find(component =>
|
||||
// component.types && component.types.includes('administrative_area_level_1')
|
||||
// );
|
||||
//
|
||||
// if (cityComponent) {
|
||||
// stateName = cityComponent.longText || cityComponent.shortText || '';
|
||||
// } else if (provinceComponent) {
|
||||
// stateName = provinceComponent.longText || provinceComponent.shortText || '';
|
||||
// }
|
||||
// } else {
|
||||
// // 美国等其他国家:取州级(administrative_area_level_1)
|
||||
// const stateComponent = data.addressComponents.find(component =>
|
||||
// component.types && component.types.includes('administrative_area_level_1')
|
||||
// );
|
||||
// if (stateComponent) {
|
||||
// stateName = stateComponent.longText || stateComponent.shortText || '';
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
addressStore.setAddressLocation({
|
||||
displayName: data.displayName,
|
||||
formattedAddress: data.formattedAddress,
|
||||
longitude: data.location.lng,
|
||||
latitude: data.location.lat
|
||||
})
|
||||
setTimeout(()=> {
|
||||
uni.navigateTo({
|
||||
url: '/pages/address/choose-type'
|
||||
})
|
||||
}, 300)
|
||||
}
|
||||
})
|
||||
|
||||
function reservationTime() {
|
||||
uni.navigateTo({ url: '/pages/address/reservation-time' })
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ import dayjs from "dayjs";
|
||||
// MONDAY/TUESDAY/WEDNESDAY 09:00-16:00
|
||||
// MONDAY 09:00-18:00;TUESDAY 09:00-10:00;WEDNESDAY 09:00-18:00;THURSDAY 09:00-18:00;FRIDAY 08:00-09:00
|
||||
const storeBusinessHours = ref('');
|
||||
// 是否仅选择日期(当进入页面传递了 storeBusinessHours 时开启)
|
||||
const onlySelectDay = ref(false);
|
||||
// 是否仅选择日期(当前需求:只选哪一天配送,不选具体时间段)
|
||||
const onlySelectDay = ref(true);
|
||||
|
||||
// 业务规则:只能预约周一 / 周四 / 周五
|
||||
// JS 中:0-周日 1-周一 ... 4-周四 5-周五
|
||||
|
||||
@@ -15,10 +15,11 @@ const addressStore = useAddressStore()
|
||||
const visitMethodRef = ref<InstanceType<typeof VisitMethod>>()
|
||||
const buildingTypeRef = ref<InstanceType<typeof BuildingType>>()
|
||||
function openVisitMethod() {
|
||||
visitMethodRef.value?.onOpen()
|
||||
// deliveryType: 1-亲自送达(0) 2-放门口(1),打开时回显当前选中
|
||||
visitMethodRef.value?.onOpen(+addressStore.addressInfo.deliveryType === 2 ? 1 : 0)
|
||||
}
|
||||
|
||||
const visitMethod = ref(t('components.visit.leaveItToMePersonally')) // 默认选择亲自送达
|
||||
const visitMethod = ref(t('components.visit.putItAtTheDoor')) // 默认选择放在门口
|
||||
function visitMethodConfirm(data: any) {
|
||||
console.log('visitMethodConfirm', data)
|
||||
visitMethod.value = data.label;
|
||||
|
||||
@@ -14,10 +14,11 @@ const addressStore = useAddressStore()
|
||||
const visitMethodRef = ref<InstanceType<typeof VisitMethod>>()
|
||||
const buildingTypeRef = ref<InstanceType<typeof BuildingType>>()
|
||||
function openVisitMethod() {
|
||||
visitMethodRef.value?.onOpen()
|
||||
// deliveryType: 1-亲自送达(0) 2-放门口(1),打开时回显当前选中
|
||||
visitMethodRef.value?.onOpen(+addressStore.addressInfo.deliveryType === 2 ? 1 : 0)
|
||||
}
|
||||
|
||||
const visitMethod = ref(t('components.visit.leaveItToMePersonally')) // 默认选择亲自送达
|
||||
const visitMethod = ref(t('components.visit.putItAtTheDoor')) // 默认选择放在门口
|
||||
function visitMethodConfirm(data: any) {
|
||||
console.log('visitMethodConfirm', data)
|
||||
visitMethod.value = data.label;
|
||||
|
||||
@@ -14,10 +14,11 @@ const addressStore = useAddressStore()
|
||||
const visitMethodRef = ref<InstanceType<typeof VisitMethod>>()
|
||||
const buildingTypeRef = ref<InstanceType<typeof BuildingType>>()
|
||||
function openVisitMethod() {
|
||||
visitMethodRef.value?.onOpen()
|
||||
// deliveryType: 1-亲自送达(0) 2-放门口(1),打开时回显当前选中
|
||||
visitMethodRef.value?.onOpen(+addressStore.addressInfo.deliveryType === 2 ? 1 : 0)
|
||||
}
|
||||
|
||||
const visitMethod = ref(t('components.visit.leaveItToMePersonally')) // 默认选择亲自送达
|
||||
const visitMethod = ref(t('components.visit.putItAtTheDoor')) // 默认选择放在门口
|
||||
function visitMethodConfirm(data: any) {
|
||||
console.log('visitMethodConfirm', data)
|
||||
visitMethod.value = data.label;
|
||||
|
||||
@@ -14,10 +14,11 @@ const addressStore = useAddressStore()
|
||||
const visitMethodRef = ref<InstanceType<typeof VisitMethod>>()
|
||||
const buildingTypeRef = ref<InstanceType<typeof BuildingType>>()
|
||||
function openVisitMethod() {
|
||||
visitMethodRef.value?.onOpen()
|
||||
// deliveryType: 1-亲自送达(0) 2-放门口(1),打开时回显当前选中
|
||||
visitMethodRef.value?.onOpen(+addressStore.addressInfo.deliveryType === 2 ? 1 : 0)
|
||||
}
|
||||
|
||||
const visitMethod = ref(t('components.visit.leaveItToMePersonally')) // 默认选择亲自送达
|
||||
const visitMethod = ref(t('components.visit.putItAtTheDoor')) // 默认选择放在门口
|
||||
function visitMethodConfirm(data: any) {
|
||||
console.log('visitMethodConfirm', data)
|
||||
visitMethod.value = data.label;
|
||||
|
||||
@@ -14,10 +14,11 @@ const addressStore = useAddressStore()
|
||||
const visitMethodRef = ref<InstanceType<typeof VisitMethod>>()
|
||||
const buildingTypeRef = ref<InstanceType<typeof BuildingType>>()
|
||||
function openVisitMethod() {
|
||||
visitMethodRef.value?.onOpen()
|
||||
// deliveryType: 1-亲自送达(0) 2-放门口(1),打开时回显当前选中
|
||||
visitMethodRef.value?.onOpen(+addressStore.addressInfo.deliveryType === 2 ? 1 : 0)
|
||||
}
|
||||
|
||||
const visitMethod = ref(t('components.visit.leaveItToMePersonally')) // 默认选择亲自送达
|
||||
const visitMethod = ref(t('components.visit.putItAtTheDoor')) // 默认选择放在门口
|
||||
function visitMethodConfirm(data: any) {
|
||||
console.log('visitMethodConfirm', data)
|
||||
visitMethod.value = data.label;
|
||||
|
||||
@@ -3,8 +3,8 @@ import type { UserAddressBo } from '@/service/types';
|
||||
export const useAddressStore = defineStore('store-address', () => {
|
||||
const addressInfo = ref<UserAddressBo>({
|
||||
type: '',
|
||||
/** 配送类型 1 2 */
|
||||
deliveryType: '1',
|
||||
/** 配送类型 1-亲自送达 2-放门口,默认放门口 */
|
||||
deliveryType: '2',
|
||||
/** 配送说明 */
|
||||
deliveryRemark: '',
|
||||
/** 配送图片 */
|
||||
@@ -60,8 +60,8 @@ export const useAddressStore = defineStore('store-address', () => {
|
||||
addressInfo.value = {
|
||||
id: '',
|
||||
type: '',
|
||||
/** 配送类型 1 2 */
|
||||
deliveryType: '1',
|
||||
/** 配送类型 1-亲自送达 2-放门口,默认放门口 */
|
||||
deliveryType: '2',
|
||||
/** 配送说明 */
|
||||
deliveryRemark: '',
|
||||
/** 配送图片 */
|
||||
|
||||
Reference in New Issue
Block a user