Commit f14ce197 authored by youjie's avatar youjie

邮寄地址

parent 49fb06e4
......@@ -222,6 +222,18 @@ export default {
USED: '已使用',
EXPIRED: '已过期',
},
postAddress: '邮寄地址',
addPostAddress: '新增邮寄地址',
editPostAddress: '修改邮寄地址',
defaultAddress: '默认地址',
recipient: '收件人',
placeholderRecipient: '请输入收件人',
postalCode: '邮政编码',
placeholderPostalCode: '请输入邮政编码',
address: '详细地址',
placeholderAddress: '请输入详细地址',
city: '城市',
placeholderCity: '请输入城市',
},
// HTTP 错误状态码
httpError: {
......
......@@ -706,7 +706,7 @@ class UserService {
return response as unknown as HttpResponse
}
/**
* 旅客列表
* 旅客分页列表
* @param tenantId 租户ID(可选)
*/
static async memberGuest(tenantId: string,data:any): Promise<HttpResponse> {
......@@ -753,6 +753,55 @@ class UserService {
)
return response as unknown as HttpResponse
}
/**
* 邮寄地址分页列表
* @param tenantId 租户ID(可选)
*/
static async memberMailingAddress(tenantId: string,data:any): Promise<HttpResponse> {
const response = await OtaRequest.get(
'/member-mailing-address/paged',
data,
{
headers: tenantId ? {
'__tenant': tenantId
} : {}
}
)
return response as unknown as HttpResponse
}
/**
* 新增修改邮寄地址
* @param tenantId 租户ID(可选)
*/
static async updateMemberMailingAddress(tenantId: string,data:any): Promise<HttpResponse> {
const response = await OtaRequest.post(
'/member-mailing-address/or-update',
data,
{
headers: tenantId ? {
'__tenant': tenantId
} : {}
}
)
return response as unknown as HttpResponse
}
/**
* 删除旅客
* @param tenantId 租户ID(可选)
*/
static async deleteMemberMailingAddress(tenantId: string,id:any): Promise<HttpResponse> {
const response = await OtaRequest.delete(
`/member-mailing-address/${id}`,
{
headers: tenantId ? {
'__tenant': tenantId
} : {}
}
)
return response as unknown as HttpResponse
}
}
export default UserService
<template>
<div class="w-[977px] h-full flex flex-col flex-shrink-0"
:class="[current!=3?'overflow-hidden':'']">
:class="[current<3?'overflow-hidden':'']">
<a-spin :loading="loading">
<div class="flex pl-[13px]">
<div v-for="(item,index) in TitleBars"
......@@ -13,13 +13,14 @@
</div>
</div>
<a-divider class="!m-[0]"/>
<a-scrollbar v-if="current!=3" class="max-h-[735px] mt-[20px] overflow-auto"
<a-scrollbar v-if="current<3" class="max-h-[735px] mt-[20px] overflow-auto"
ref="scrollContainer">
<basicInfor v-if="current==1"></basicInfor>
<account v-if="current==2"></account>
</a-scrollbar>
<div v-else class="max-h-[735px] mt-[20px]">
<passengerList></passengerList>
<passengerList v-if="current==3"></passengerList>
<mailingAddressList v-if="current==4"></mailingAddressList>
</div>
</a-spin>
</div>
......@@ -31,6 +32,7 @@ import { useRouter } from 'vue-router'
import account from "./components/accountCenter/account.vue"
import basicInfor from "./components/accountCenter/basicInfor.vue"
import passengerList from "./components/accountCenter/passengerList.vue"
import mailingAddressList from "./components/accountCenter/mailingAddressList.vue"
const { t } = useI18n();
const router = useRouter()
......@@ -54,6 +56,10 @@ const TitleBars = [
{
label: t('personal.commonPassenger'),
value: 3
},
{
label: t('personal.postAddress'),
value: 4
}
]
......
<template>
<a-spin :loading="loading" class="w-full">
<div v-if="!showType">
<a-scrollbar class="max-h-[692px] overflow-auto">
<div v-show="!showType">
<a-scrollbar class="max-h-[692px] overflow-auto"
@scroll="handleDivScroll"
ref="scrollContainer">
<div class="accountCenter rounded-[14px]
border-[1px] mb-[18px] flex items-center
justify-between py-[15px] pl-[36px] pr-[22px]"
......@@ -22,7 +24,7 @@
{{item.phoneCode}}{{ item.phone }}
</div>
<div class="flex items-center justify-between">
<div class="w-[16px] h-[16px] editIcon cursor-pointer" @click="clickItem(item,2)">&nbsp;</div>
<div class="w-[16px] h-[16px] editIcon cursor-pointer" @click="clickItem(item,1)">&nbsp;</div>
<div class="w-[14px] h-[16px] deleteIcon ml-[17px] cursor-pointer" @click="clickItem(item)">&nbsp;</div>
</div>
</div>
......@@ -111,7 +113,7 @@
:placeholder="t('personal.placeholder')">
<a-option v-for="item of AreaCodeList" :value="item.phoneCode" :label="item.phoneCode" >
<span>{{ item.name }}</span>
<span>{{ item.phoneCode }}</span>
<span>({{ item.phoneCode }})</span>
</a-option>
</a-select>
</a-form-item>
......@@ -170,15 +172,13 @@
</a-spin>
</template>
<script setup lang="ts">
import { ref,reactive, onMounted, watch, computed } from 'vue'
import { ref,reactive, computed } from 'vue'
import { useI18n } from 'vue-i18n'
import { useUserStore } from '@/stores/user'
import { useSystemConfigStore } from '@/stores/index'
import { Message } from '@arco-design/web-vue'
import { query } from '@/utils/common'
import { useRouter } from 'vue-router'
import UserService from '@/services/UserService'
import providerTypeEnum from '@/utils/providerTypeEnum'
import CountryService from '@/services/CountryService'
const { t } = useI18n();
......@@ -189,20 +189,8 @@ const systemConfig = reactive({
tenantId: systemConfigStore.tenantId || null,
distributorId: systemConfigStore.distributorId as any,
})
const loginType = ref(userStore.loginType)
const userInfor = ref<any>(userStore.personalInfor)
const loading = ref(true)
// 绑定Google账号
const googleButtonContainer = ref(null);
// 绑定账号信息
const WeChatInfor = ref(null as any)
const GoogleInfor = ref(null as any)
const LnlineInfor = ref(null as any)
// 打开微信绑定账号弹窗信息
const openInfo = ref({} as any)
const genderOptions = ref([
{
label: t('ORDER.GENDER_MALE'),
......@@ -214,13 +202,12 @@ const genderOptions = ref([
},
])
const formData = reactive({
id: 0,//旅客ID
id: null as any,//旅客ID
name: '',//名
surName: '',//姓氏
birthday: null as any,//出生日期
phone: null as any,//手机号
phoneCode: null as any,//手机号国家码
photo: null as any,//头像
countryId: null as any,//国籍
sex: null as any,//性别 1男 2女
idCard: null as any,//身份证号
......@@ -243,16 +230,38 @@ const rules = computed(() => ({
},
],
}))
const AreaCodeList = ref([] as any[])
const params = reactive({
SkipCount: 0,//跳过的记录数
MaxResultCount: 1,//最大结果数
const AreaCodeList = ref([] as any[])//手机号国家码列表
const queryParams = reactive({
SkipCount: 1,//跳过的记录数
MaxResultCount: 15,//最大结果数
Name: '',
})
const noMoreData = ref(true)
const scrollContainer = ref<any>(null)
const scrollThreshold = 0 // 阈值,距离底部多少距离时触发加载
const totalCount = ref(100)//总记录数
const pageCount = ref(10)//总页数
const showType = ref(null)
const showType = ref(null)//null列表 1新增 2编辑
const dataList = ref([])
// 处理 div 滚动事件(核心修改)
const handleDivScroll = (e: any) => {
if (loading.value || noMoreData.value) return;
const container = e.target;
if (!container) return;
// 计算滚动位置(兼容不同浏览器)
const scrollTop = container.scrollTop;
const clientHeight = container.clientHeight;
const scrollHeight = container.scrollHeight;
// 触底条件:滚动距离 + 可见高度 ≥ 总高度 - 阈值
if (scrollTop + clientHeight >= scrollHeight - scrollThreshold&&queryParams.SkipCount<pageCount.value) {
noMoreData.value = false
queryParams.SkipCount ++
loadData(); // 加载下一页
}
}
const initPullDown = () =>{
loadData()
getSimples()
......@@ -268,12 +277,25 @@ const getSimples = async () => {
}
}
const resetQuery = () => {
queryParams.SkipCount = 1
queryParams.Name = ''
dataList.value = []
noMoreData.value = true
loadData()
}
const loadData = async () => {
loading.value = true
try{
const response = await UserService.memberGuest(systemConfig.tenantId,params)
const response = await UserService.memberGuest(systemConfig.tenantId,queryParams)
if(response){
dataList.value = response.items || []
dataList.value = [...dataList.value,...(response.items || [])]
if(queryParams.SkipCount==1){
totalCount.value = response.totalCount || 0
pageCount.value = Math.ceil(totalCount.value/queryParams.MaxResultCount) || 0
}
noMoreData.value = pageCount.value >= queryParams.SkipCount
}
} catch (error: any) {
console.error('加载失败:', error)
......@@ -284,6 +306,7 @@ const loadData = async () => {
}
// 点击列表项
const clickItem = (item: any,type: number = 1) => {
if(type==1){
showType.value = 2
......@@ -293,7 +316,6 @@ const clickItem = (item: any,type: number = 1) => {
formData.birthday = item.birthday || null
formData.phone = item.phone || null
formData.phoneCode = item.phoneCode || null
formData.photo = item.photo || null
formData.countryId = item.countryId || null
formData.sex = item.sex || null
formData.idCard = item.idCard || null
......@@ -308,7 +330,7 @@ const deleteItem = async (item: any) => {
const response = await UserService.deleteMemberGuest(systemConfig.tenantId || 'default',item.id)
if (response) {
Message.success(t('personal.deleteSuccess'))
loadData()
resetQuery()
}
} catch (error: any) {
console.error('删除失败:', error)
......@@ -318,29 +340,27 @@ const deleteItem = async (item: any) => {
}
}
// 取消
const cancel = () => {
showType.value = null
formData.id = ''
formData.id = null
formData.name = ''
formData.surName = ''
formData.birthday = null
formData.isReceivePush = null
formData.lineId = null
formData.phone = null
formData.phoneCode = null
formData.photo = null
formData.countryId = null
formData.sex = null
formData.wechatId = null
formData.idCard = null
formData.email = null
}
const verification = () => {
let msg = ''
// 简单验证必填字段
if (msg==''&&(formData.name==''||!formData.name
||userInfor.value.surName==''||!formData.surName
|| formData.countryId==''||!formData.countryId
|| formData.idCard==''||!formData.idCard
||formData.surName==''||!formData.surName
||formData.countryId==''||!formData.countryId
||formData.idCard==''||!formData.idCard
)) {
msg = t('login.pleaseComplete')
}
......@@ -356,12 +376,9 @@ const handleSubmit = async () => {
loading.value = true
try {
const registerData = formData
const response = await UserService.updateMemberGuest(formData.tenantId || 'default',registerData)
console.log(response,'========------')
if (response) {
showType.value = null
loadData()
}
const response = await UserService.updateMemberGuest(systemConfig.tenantId || 'default',registerData)
showType.value = null
resetQuery()
} catch (error: any) {
console.error('提交失败:', error)
Message.error(error.message)
......@@ -370,15 +387,6 @@ const handleSubmit = async () => {
}
}
onMounted(async () => {
try {
} catch (error) {
console.error('SDK 初始化失败:', error);
}
});
initPullDown()
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment