first commit
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
import { defineStore } from "pinia";
|
||||
import type { UserAddressBo } from '@/service/types';
|
||||
export const useAddressStore = defineStore('store-address', () => {
|
||||
const addressInfo = ref<UserAddressBo>({
|
||||
type: '',
|
||||
/** 配送类型 1 2 */
|
||||
deliveryType: '1',
|
||||
/** 配送说明 */
|
||||
deliveryRemark: '',
|
||||
/** 配送图片 */
|
||||
deliveryImage: '',
|
||||
/** 门牌号(住宅专用) */
|
||||
houseNumber: '',
|
||||
/** 其他信息(住宅专用) */
|
||||
houseExtra: '',
|
||||
/** 楼宇名称(公寓专用) */
|
||||
buildingName: '',
|
||||
/** 公寓单元楼层(公寓专用) */
|
||||
apartmentUnitFloor: '',
|
||||
/** 入口代码(公寓专用) */
|
||||
entranceCodeApartment: '',
|
||||
/** 公司名称(公司专用) */
|
||||
companyName: '',
|
||||
/** 办公楼楼层(公司专用) */
|
||||
officeFloor: '',
|
||||
/** 酒店名称(酒店专用) */
|
||||
hotelName: '',
|
||||
/** 酒店房间号(酒店专用) */
|
||||
hotelRoom: '',
|
||||
/** 入口代码(酒店专用) */
|
||||
entranceCodeHotel: '',
|
||||
/** 公寓/套房/楼层(其他专用) */
|
||||
otherLocation: '',
|
||||
/** 公司/楼宇名称(其他专用) */
|
||||
otherBuilding: '',
|
||||
longitude: '',
|
||||
latitude: '',
|
||||
displayName: '',
|
||||
formattedAddress: '',
|
||||
state: '', // 州信息
|
||||
stateName: '', // 州名称
|
||||
})
|
||||
|
||||
// 地图经纬度信息
|
||||
const addressLocation = ref({
|
||||
location: '',
|
||||
longitude: '',
|
||||
latitude: '',
|
||||
});
|
||||
|
||||
function setAddressLocation(data: any) {
|
||||
addressLocation.value = data
|
||||
addressInfo.value.longitude = data.longitude
|
||||
addressInfo.value.latitude = data.latitude
|
||||
addressInfo.value.displayName = data.displayName
|
||||
addressInfo.value.formattedAddress = data.formattedAddress
|
||||
}
|
||||
|
||||
function clearAddressInfo() {
|
||||
addressInfo.value = {
|
||||
id: '',
|
||||
type: '',
|
||||
/** 配送类型 1 2 */
|
||||
deliveryType: '1',
|
||||
/** 配送说明 */
|
||||
deliveryRemark: '',
|
||||
/** 配送图片 */
|
||||
deliveryImage: '',
|
||||
/** 门牌号(住宅专用) */
|
||||
houseNumber: '',
|
||||
/** 其他信息(住宅专用) */
|
||||
houseExtra: '',
|
||||
/** 楼宇名称(公寓专用) */
|
||||
buildingName: '',
|
||||
/** 公寓单元楼层(公寓专用) */
|
||||
apartmentUnitFloor: '',
|
||||
/** 入口代码(公寓专用) */
|
||||
entranceCodeApartment: '',
|
||||
/** 公司名称(公司专用) */
|
||||
companyName: '',
|
||||
/** 办公楼楼层(公司专用) */
|
||||
officeFloor: '',
|
||||
/** 酒店名称(酒店专用) */
|
||||
hotelName: '',
|
||||
/** 酒店房间号(酒店专用) */
|
||||
hotelRoom: '',
|
||||
/** 入口代码(酒店专用) */
|
||||
entranceCodeHotel: '',
|
||||
/** 公寓/套房/楼层(其他专用) */
|
||||
otherLocation: '',
|
||||
/** 公司/楼宇名称(其他专用) */
|
||||
otherBuilding: '',
|
||||
longitude: '',
|
||||
latitude: '',
|
||||
displayName: '',
|
||||
formattedAddress: '',
|
||||
state: '', // 州信息
|
||||
stateName: '', // 州名称
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
addressInfo,
|
||||
addressLocation,
|
||||
setAddressLocation,
|
||||
clearAddressInfo
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user