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.
166 lines
3.5 KiB
166 lines
3.5 KiB
<template>
|
|
<view class="addressList">
|
|
<view style="overflow: hidden;" v-if="addList.length>0">
|
|
<view class="title-wrap" v-for="(item, index) in addList" :key="item.address_id">
|
|
<view class="item" :style="{'border-top':index==0?'none':'1px solid #EEEEEE'}" @click="changeAdd(item)">
|
|
<view class="a">{{item.name}} {{item.phone}}<text v-if="item.address_id==defaultId">默认</text>
|
|
</view>
|
|
<view class="b">
|
|
<view class="d">
|
|
{{item.detail}}
|
|
</view>
|
|
<u-icon @click="changeAdd(item)" name="checkbox-mark" :color="addIndex==item.address_id?'#F34A40':'#979797'" size="42"></u-icon>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<u-empty text="暂无数据显示哦~" v-else mode="list"></u-empty>
|
|
<view class="footer">
|
|
<view class="operaBtn" @click="addAddress">
|
|
确认
|
|
</view>
|
|
</view>
|
|
<u-toast ref="uToast" />
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import * as newFunApi from '@/api/newFun'
|
|
export default {
|
|
data() {
|
|
return {
|
|
addList: [],
|
|
defaultId: '',
|
|
disabled: false,
|
|
btnWidth: 180,
|
|
show: false,
|
|
delShow: false,
|
|
options: [{
|
|
text: '删除',
|
|
style: {
|
|
backgroundColor: '#dd524d'
|
|
}
|
|
}],
|
|
addressId: '',
|
|
addIndex:''
|
|
};
|
|
},
|
|
onShow() {
|
|
this.getAddressList()
|
|
},
|
|
methods: {
|
|
changeAdd(item){
|
|
this.addressData=item
|
|
this.addIndex=item.address_id
|
|
},
|
|
getAddressList() {
|
|
const that = this
|
|
return new Promise((resolve, reject) => {
|
|
newFunApi.addressList({
|
|
user_id: 10006
|
|
})
|
|
.then(result => {
|
|
this.addressData=result.data.list[0]
|
|
that.addIndex=result.data.list[0].address_id
|
|
that.addList = result.data.list
|
|
})
|
|
.catch(reject)
|
|
})
|
|
},
|
|
addAddress() {
|
|
let pages = getCurrentPages()//获取所有页面栈的实例列表
|
|
let nowPage = pages[ pages.length - 1 ] //当前页面的实例
|
|
let prevPage = pages[ pages.length - 2 ] //上一个页面的实例
|
|
prevPage.$vm.addressData = this.addressData //更改上一个页面的数据
|
|
uni.navigateBack({
|
|
delta:1 //返回上一页
|
|
})
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
::v-deep .u-empty {
|
|
padding: 100rpx 0;
|
|
}
|
|
|
|
.addressList {
|
|
padding: 0 45rpx;
|
|
background-color: #FFFFFF;
|
|
overflow: hidden;
|
|
margin-top: 2rpx;
|
|
|
|
.item {
|
|
padding: 30rpx 0;
|
|
overflow: hidden;
|
|
border-top: 1px solid #EEEEEE;
|
|
|
|
.a {
|
|
font-size: 32rpx;
|
|
font-weight: 500;
|
|
color: #1E1E1E;
|
|
padding-bottom: 25rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
text {
|
|
width: 66rpx;
|
|
line-height: 34rpx;
|
|
background: #F32020;
|
|
border-radius: 4rpx;
|
|
text-align: center;
|
|
display: block;
|
|
margin-left: 10rpx;
|
|
font-size: 24rpx;
|
|
font-weight: 400;
|
|
color: #FFFFFF;
|
|
border-radius: 5rpx;
|
|
}
|
|
}
|
|
|
|
.b {
|
|
display: flex;
|
|
align-items: flex-start;
|
|
justify-content: space-between;
|
|
|
|
.d {
|
|
font-size: 32rpx;
|
|
font-weight: 400;
|
|
color: #979797;
|
|
max-width: 600rpx;
|
|
}
|
|
|
|
image {
|
|
width: 36rpx;
|
|
height: 36rpx;
|
|
margin-right: 10rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.footer {
|
|
display: flex;
|
|
width: 100%;
|
|
height: 120rpx;
|
|
justify-content: center;
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 0;
|
|
|
|
.operaBtn {
|
|
width: 686rpx;
|
|
height: 92rpx;
|
|
background: #F34A40;
|
|
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
|
opacity: 1;
|
|
line-height: 92rpx;
|
|
font-size: 28rpx;
|
|
font-family: PingFang SC, PingFang SC;
|
|
font-weight: 600;
|
|
color: #FFFFFF;
|
|
text-align: center;
|
|
}
|
|
}
|
|
</style>
|
|
|