[锶源昆仑-寺庙捐赠活动]
This commit is contained in:
208
pages/address/index.vue
Normal file
208
pages/address/index.vue
Normal file
@@ -0,0 +1,208 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<view class="list" v-if="listArr.length > 0">
|
||||
<view class="address" v-for="(item, index) in listArr" :key="index">
|
||||
<view class="address-name"><view class="defaultEdit" v-if="item.default">默认</view><text>{{item.name}}</text>{{item.mobile}}</view>
|
||||
<view class="address-info">
|
||||
{{item.full_address}}
|
||||
</view>
|
||||
<view class="address-tool">
|
||||
<view class="address-tool-btn" @click="addressRemove(item.address_id, index)"><image src="@/static/icons/address_01.png" mode="widthFix"></image>删除</view>
|
||||
<!-- <view class="address-tool-btn" @click="$Router.push({name: 'addressAdd', params: { ediStatet: 'compile', id: item.address_id}})"><image src="@/static/icons/address_02.png" mode="widthFix"></image>编辑</view> -->
|
||||
</view>
|
||||
<view class="select" v-if="type == 'selectAddress'">
|
||||
<view class="select-btn" @click="selectAddress(index)">
|
||||
选择地址
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="edit-no" v-else>
|
||||
<image src="@/static/imgs/site_no.png"></image>
|
||||
<view>暂无地址</view>
|
||||
</view>
|
||||
<view class="footer">
|
||||
<view class="btn" @click="$Router.push({name: 'addressAdd', params:{experience: Experience}})">添加地址</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { siteList, siteDel } from '@/apis/interfaces/stock'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
Experience: '', //是否从体验官进入
|
||||
listArr: [], //收货地址
|
||||
type : ''
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
// 获取提货前置
|
||||
this.listInfo();
|
||||
this.type = this.$Route.query.type
|
||||
this.Experience = this.$Route.query.experience
|
||||
},
|
||||
methods: {
|
||||
// 提货前置
|
||||
listInfo (){
|
||||
siteList().then(res => {
|
||||
this.listArr = res
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon: "none"
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// 删除地址
|
||||
addressRemove(newid, newindex){
|
||||
let list = this.listArr
|
||||
uni.showModal({
|
||||
title : '提示',
|
||||
content : '是否删除地址',
|
||||
success : res=> {
|
||||
if (res.confirm) {
|
||||
uni.showLoading({
|
||||
title: '删除中',
|
||||
})
|
||||
siteDel(newid).then(res=>{
|
||||
this.listArr = list
|
||||
uni.showToast({
|
||||
title: res,
|
||||
icon : "none"
|
||||
})
|
||||
list.splice(newindex, 1)
|
||||
uni.hideLoading()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 选择地址
|
||||
selectAddress(e){
|
||||
let atAdds = this.listArr[e]
|
||||
let pages = getCurrentPages()
|
||||
let nowPage = pages[ pages.length - 1] // 当前页页面实例
|
||||
let prevPage= pages[ pages.length - 2 ] // 上一页页面实例
|
||||
prevPage.$vm.address = atAdds // 修改上一页data里面的参数值为
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content {
|
||||
background-color: #f4f4f4;
|
||||
min-height: 100vh;
|
||||
}
|
||||
.list {
|
||||
border-bottom: 60px solid transparent;
|
||||
padding: $padding;
|
||||
box-sizing: border-box;
|
||||
.address {
|
||||
background-color: #FFFFFF;
|
||||
margin-bottom: $margin;
|
||||
padding: $padding;
|
||||
box-sizing: border-box;
|
||||
border-radius: $radius;
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.address-name {
|
||||
display: flex;
|
||||
font-weight: 600;
|
||||
text {
|
||||
font-weight: normal;
|
||||
font-size: $title-size + 2;
|
||||
flex: 1;
|
||||
display: block;
|
||||
}
|
||||
.defaultEdit {
|
||||
font-size: $title-size-sm;
|
||||
height: 36rpx;
|
||||
line-height: 36rpx;
|
||||
border: 2rpx solid #eb504c;
|
||||
color: #eb504c;
|
||||
padding: 0 10rpx;
|
||||
margin-right: 20rpx;
|
||||
margin-top: 4rpx;
|
||||
border-radius: $radius-m;
|
||||
}
|
||||
}
|
||||
.address-info {
|
||||
margin: $margin - 10 0;
|
||||
font-size: $title-size-lg;
|
||||
color: $text-gray;
|
||||
}
|
||||
.address-tool {
|
||||
border-top: 2rpx solid #f3f3f3;
|
||||
padding-top: 20rpx;
|
||||
font-size: $title-size-m;
|
||||
text-align: right;
|
||||
.address-tool-btn {
|
||||
display: inline-block;
|
||||
color: #666666;
|
||||
margin-left: $margin * 2;
|
||||
image {
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
vertical-align: -2rpx;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.select {
|
||||
text-align: center;
|
||||
border: 2rpx solid #e64248;
|
||||
color: #e64248;
|
||||
font-size: $title-size-m;
|
||||
margin-top: $margin;
|
||||
line-height: 72rpx;
|
||||
font-weight: 600;
|
||||
border-radius: $radius-m;
|
||||
}
|
||||
}
|
||||
}
|
||||
.footer {
|
||||
width: 100%;
|
||||
height: 60px;
|
||||
background-color: #FFFFFF;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
z-index: 9;
|
||||
padding: 8px;
|
||||
box-sizing: border-box;
|
||||
.btn {
|
||||
line-height: 44px;
|
||||
background-color: #1d37e2;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
color: #FFFFFF;
|
||||
border-radius: $radius-sm;
|
||||
}
|
||||
}
|
||||
|
||||
.edit-no {
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-box-pack: center;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
z-index: 1;
|
||||
text-align: center;
|
||||
color: $text-gray;
|
||||
image {
|
||||
width: 240rpx;
|
||||
height: 240rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user