yurong/.svn/pristine/59/59b1b9e129e501452d39c5cde37...

109 lines
3.4 KiB
Plaintext

<template>
<view>
<view class="pb-40">
<view v-if="address && address[0]">
<view @tap="selectAddress(item)" class="w-710 ml-20 mt-20 mb-20 br-20 pl-32 pr-32 bgff" v-for="(item,index) in address" :key="index">
<view class="pt-26 pb-26 rows rowsm">
<image src="/static/dingwiea.png" class="w-60 h-60"></image>
<view class="pl-16">
<view><text class="fs-32 col000">{{ item.name }}</text><text class="col999 fs-28 ml-10 mr-10">{{ item.mobile }}</text></view>
<view class="fs-28 col333 mt-12">{{item.areas}}{{item.address}}</view>
</view>
</view>
<view class="rowsb rowsm h-76" style="border-top: 2rpx solid #f1f1f1;">
<view class="col999 fs-26">
<image v-if="item.default==1" src="/static/xuanzhonghou-1.png" class="w-30 h-30 mr-15 mb-6" style="vertical-align: middle;"></image>
<image v-else @tap.stop="noselectTap(item)" src="/static/xuanzhonghou.png" class="w-30 h-30 mr-15 mb-6" style="vertical-align: middle;"></image>
设为默认地址
</view>
<view style="color: #333;" class="fs-26 ml-20 rows">
<view class="rows mr-20" @tap.stop="editAddress(item.id)">
<image src="/static/bianji.png" class="w-40 h-40 mr-10"></image>
</view>
<view class="rows" @tap.stop="detletAddress(index,item.id)">
<image src="/static/sahnchu.png" class="w-40 h-40 mr-10"></image>
</view>
</view>
</view>
</view>
</view>
<view v-else class="tct pt-200">
<image class="w-60 h-60 mb-20" src="/static/address.png"></image>
<view class="col999">暂无地址,快去新建一个吧</view>
</view>
</view>
<view @tap="gonewAddress()" class="w-630 h-100 lh-100 tct colfff br-50 ml-60 fixed rowsc rowsm bg" style="bottom: 76rpx;">
<text class="fs-44 mr-10">+</text> 新增收货地址
</view>
<view class="w-630 h-176"></view>
</view>
</template>
<script>
export default {
data() {
return {
address: [{
name: '祝锦鹏',mobile: 13184129096,area: '山东省济南市历下区',
address: '经十路武警医院花样家缘',default: '1'
}],
type: null
}
},
onLoad(option) {
this.type = option.type
},
onShow() {
this.getAddress()
},
methods: {
selectAddress(item) {//选择地址
if (this.type == 1) {
this.app.onAddress = item
this.goBack()
}
},
// 跳往新建地址页
gonewAddress() {
this.$tools.goNext('/pages/me/pagesOne/address/newAddress/newAddress')
},
//设置默认地址
noselectTap(item) {
item.default = 1
item.id = item.id
this.$tools.axiosFromToken('POST','index/edit_address',item).then(res => {
this.getAddress()
if (this.type == '1') {
this.$tools.goBack(1)
}
})
},
// 编辑地址
editAddress(id) {
this.$tools.goNext(`/pages/me/pagesOne/address/newAddress/newAddress?id=${id}`)
},
//删除地址
detletAddress(index,id) {
this.$tools.axiosFromToken('POST','index/del_address',{id,type: 4},'加载中').then(res => {
this.address.splice(index,1)
this.getAddress()
})
},
//获取地址列表
getAddress() {
this.$tools.axiosFromToken('POST','user/sel_address', {},'加载中').then(res => {
this.address = res.data
})
}
},
}
</script>
<style>
page {
background: #f6f6f6;
}
</style>