addressItem.vue
2.99 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
<template>
<li class="addressitem-div">
<div class="address-top">
<span class="name">{{item.buyerNickName}}</span>
<span class="phone">{{item.buyerMobile}}</span>
</div>
<div class="address-mid">
<p>{{item.buyerAddress}}</p>
</div>
<div class="address-bottom">
<label class="mint-radiolist-label" @click.self="selectedlabel(index,item.buyerAddressId)"
:class="{'colorpurple':item.isDefault==1}">
<span class="mint-radio">
<input class="mint-radio-input" type="radio" :value="item.buyerAddressId" checked="checked"
v-if="item.isDefault==1">
<input class="mint-radio-input" type="radio" :value="item.buyerAddressId" v-else>
<span class="mint-radio-core"></span>
</span>
<span class="mint-radio-label">默认地址</span>
</label>
<div class="address-btn">
<router-link :to="{name:'addAddress',params: {Id: item.buyerAddressId,teype:'edit' }}" tag="span"><img
src="../../static/images/edit.svg"/></router-link>
<span @click="openConfirm(item.buyerAddressId)" size="large"><img src="../../static/images/delete.svg"/></span>
</div>
</div>
</li>
</template>
<script type="text/ecmascript-6">
import {MessageBox, Toast} from 'mint-ui';
import {setDefaultAddress, ClearAddresslist, getmyAddressList, deleteAddress} from '../../vuex/actions';
export default {
data() {
return {}
},
props: {
index: '',
item: '',
pageNum: ''
},
components: {},
vuex: {
getters: {},
actions: {
setDefaultAddress,
ClearAddresslist,
getmyAddressList,
deleteAddress
}
},
methods: {
selectedlabel(index, id){
$(".mint-radio-input").removeAttr("checked");
$(".mint-radio-label").removeClass("colorpurple");
$(".mint-radio-input").eq(index).attr("checked", "checked");
$(".mint-radio-label").eq(index).addClass("colorpurple");
this.setDefaultAddress(id);
},
openConfirm(id) {
var self = this;
MessageBox.confirm('确定删除该地址?', '提示').then(action => {
self.deleteAddress(id).then(function () {
Toast({
message: '删除成功',
position: 'bottom',
duration: 5000
});
self.ClearAddresslist().then(function () {
self.getmyAddressList(0, self.pageNum);
})
});
});
}
}
}
</script>