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.

340 lines
6.5 KiB

1 year ago
<template>
<view class="bg">
<view class="cancat-nav flex-around">
<view :class="['concat-nav-item',showType===0?'active':'']" @click="showType=0">
<view>出行人信息</view>
<view v-if="showType===0" class="active-bar"></view>
</view>
<view :class="['concat-nav-item',showType===1?'active':'']" @click="showType=1">
<view>收货地址</view>
<view v-if="showType===1" class="active-bar"></view>
</view>
</view>
1 year ago
<!-- 出行人信息 -->
<view v-if="showType===0">
<view class="item" v-for="(item,index) in travelList" :key="index">
<view class="name">
<view class="">
{{item.name}}
</view>
<view class="">
{{item.tel}}
12 months ago
<span v-if="item.is_default==1">默认</span>
1 year ago
</view>
</view>
<view class="idcard">
<view class="">
{{item.document_type_text}}:
</view>
<view class="">
{{item.id_number}}
</view>
</view>
<view class="item-btn">
<view class="choice">
12 months ago
<!-- <image src="https://static.ticket.sz-trip.com/yandu/images/user/dui.png" mode="aspectFill"
1 year ago
v-if="item.is_default==1">
</image>
<view class="yuan" v-else @click.stop="defaultC(item)">
1 year ago
1 year ago
</view>
<view class="">
默认出行人
12 months ago
</view> -->
1 year ago
</view>
<view class="btn-list">
<view class="btn-item" @click.stop="edit(item.id)">
修改
</view>
<view class="btn-item" @click.stop="delet(item)">
删除
</view>
</view>
</view>
</view>
</view>
<!-- 收货地址 -->
<view v-else>
<view class="item" v-for="(item,index) in addressList" :key="index">
<view class="name">
<view>
{{item.name}}
</view>
<view class="">
{{item.tel}}
<span v-if="item.is_default==1">默认</span>
</view>
</view>
<view class="idcard">
<view class="">
收货地址:
</view>
<view class="text-overflow">
{{item.address}}
</view>
</view>
<view class="item-btn" style="justify-content: flex-end;">
<view class="btn-list">
<view class="btn-item" @click.stop="edit(item.id)">
修改
</view>
<view class="btn-item" @click.stop="delet(item)">
删除
</view>
</view>
</view>
</view>
1 year ago
</view>
1 year ago
<view class="btn-box">
<navigator :url="showType ? '/subPackages/user/myAddressAdd' : '/subPackages/user/myContactsAdd'" class="btn">
12 months ago
{{showType ? '添加联系人' : '添加收货地址'}}
1 year ago
</navigator>
</view>
1 year ago
</view>
</template>
<script>
export default {
name: "travelerList",
data() {
return {
1 year ago
showType: 0,
travelList: [],
addressList: []
1 year ago
};
},
onShow() {
1 year ago
this.init()
1 year ago
},
methods: {
init () {
1 year ago
// 出行人信息
this.Post({}, "/api/user/contactList").then(res => {
if (res) this.travelList = res.data
})
// 收货地址
this.Post({}, '/api/user/consigneeList').then(res => {
if(res) this.addressList = res.data
})
},
delet(item) {
let that = this
uni.showModal({
title: '提示',
content: '确定要删除该出行人吗?',
success: function(res) {
if (res.confirm) {
that.Post({
id: item.id
}, "/api/user/delDetail").then(res => {
if (res) {
uni.showToast({
icon: "none",
title: res.msg
})
}
1 year ago
that.init()
1 year ago
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
defaultC(item) {
this.Post({
id: item.id,
is_default: 1
}, "/api/user/editContact").then(res => {
if (res.code == 1) {
this.travelList.forEach(i => i.is_default = 0)
item.is_default = !item.is_default
}
})
},
// 修改出行人信息
edit(id){
let url = ''
if(this.showType) {
url = '/subPackages/user/myAddressAdd?id='+id
}else {
url = "/subPackages/user/myContactsAdd?type=edit&id="+id
1 year ago
}
1 year ago
uni.navigateTo({
url: url
});
1 year ago
}
}
}
</script>
<style lang="scss" scoped>
.bg {
position: relative;
background: #F7F7F7;
height: 100vh;
overflow-x: hidden;
1 year ago
padding-bottom: 200rpx;
1 year ago
}
1 year ago
1 year ago
.cancat-nav{
width: 100%;
display: flex;
height: 112rpx;
flex-shrink: 0;
12 months ago
background-color: #fff;
1 year ago
.concat-nav-item{
ffont-weight: 500;
font-size: 35rpx;
color: #000000;
12 months ago
height: 100%;
1 year ago
text-align: center;
12 months ago
position: relative;
padding-top: 35rpx;
1 year ago
}
.concat-nav-item.active{
color: #000000;
}
.active-bar{
12 months ago
width: 73rpx;
height: 7rpx;
background: #515150;
border-radius: 3rpx;
margin: auto;
position: absolute;
bottom: 0;
left: 0;
right: 0;
1 year ago
}
}
1 year ago
.item {
width: 697rpx;
background: #FFFFFF;
border-radius: 13rpx;
12 months ago
margin: 28rpx auto 0;
1 year ago
padding: 26rpx;
.name,
.idcard {
display: flex;
font-size: 31rpx;
font-weight: bold;
color: #333333;
}
.name {
12 months ago
view:last-child{
1 year ago
margin-left: 40rpx;
}
span {
padding: 3rpx 9rpx;
12 months ago
background: #515150;
1 year ago
border-radius: 7rpx;
font-weight: bold;
font-size: 24rpx;
color: #FFFFFF;
margin-left: 15rpx;
}
}
.idcard {
margin-top: 26rpx;
view:last-child {
margin-left: 14rpx;
font-weight: 400;
max-width: 492rpx;
}
}
.item-btn {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 40rpx;
.choice {
display: flex;
align-items: center;
view:last-child {
margin-left: 20rpx;
font-size: 27rpx;
font-weight: 500;
color: #333333;
}
image {
width: 40rpx;
height: 40rpx;
}
.yuan {
width: 40rpx;
height: 40rpx;
background: rgba(255, 200, 37, 0);
border: 1rpx solid #999999;
border-radius: 20rpx;
}
}
.btn-list {
display: flex;
align-items: center;
view {
width: 134rpx;
height: 54rpx;
background: #FFFFFF;
border: 1px solid #999999;
border-radius: 27rpx;
font-size: 27rpx;
font-weight: 500;
color: #333333;
line-height: 52rpx;
text-align: center;
}
view:last-child {
margin-left: 14rpx;
}
}
}
}
.btn-box {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 200rpx;
background-color: #fff;
.btn {
width: 697rpx;
line-height: 80rpx;
12 months ago
background: #C3282E;
1 year ago
border-radius: 37rpx;
font-weight: 500;
font-size: 36rpx;
1 year ago
color: #fff;
1 year ago
text-align: center;
position: fixed;
bottom: 53rpx;
left: 26.67rpx;
}
1 year ago
}
</style>