card-address.vue
2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<template>
<view class="card-address" @click="onClick">
<view class="card-address__lf">
<view class="title">
<text>{{ district }}</text>
<view class="tag" v-if="value.defaultFlag">默认</view>
</view>
<view class="content">
<text>{{ value.address }}</text>
</view>
<view class="desc">
<text class="name">{{ value.name }}</text>
<text>{{ value.mobile | mobileMask }}</text>
</view>
</view>
<view class="card-address__rt">
<u-icon name="arrow-right" class="arrow"></u-icon>
</view>
</view>
</template>
<script>
export default {
name: 'CardAddress',
props: {
value: {
type: Object,
default () {
return {};
},
},
},
filters: {
mobileMask(val) {
const arr = (val || '').split('');
arr.splice(3, 4, '*', '*', '*', '*');
return arr.join('');
},
},
computed: {
district() {
const {
provinceName = '', cityName = '', areaName = ''
} = this.value;
return `${provinceName}${cityName}${areaName}`;
},
},
methods: {
onClick() {
this.$emit('click');
},
},
};
</script>
<style lang="scss">
.card-address {
background-color: $color-white;
color: $color-text;
padding: $padding-md;
border-radius: $radius-md;
box-shadow: $shadow-normal;
font-size: $font-md;
display: flex;
justify-content: space-between;
align-items: center;
&__lf {
.title {
display: flex;
flex-direction: row;
align-items: center;
font-size: $font-sm;
}
.tag {
display: inline-flex;
align-items: center;
justify-content: center;
margin-left: $padding-base;
height: $padding-md;
padding: 0 $padding-base;
line-height: 1;
font-size: $font-sm;
color: $color-red;
border: 1px solid $color-red;
border-radius: 8upx;
}
.content {
font-weight: bold;
line-height: 1.2;
margin: $padding-xs 0;
}
.desc {
color: $color-text-caption;
font-size: $font-sm;
.name {
margin-right: $padding-xs;
}
}
}
&__rt {
margin-left: $padding-lg;
.arrow {
font-size: $font-lg;
}
}
}
</style>