在这里插入代码片
//设置默认的 html
<span
:class="scope.row.is_default == 1 ? 'default_address' : 'no-default-address'"
@click="setDefaultAddress(scope.row.id,scope.row.is_default)"
>{{scope.row.is_default == 1 ? '默认地址' : '设为默认'}}</span>
//设置默认的方法
setDefaultAddress(id, status) {
console.log(id, status);
if (status == 1) {
return;
} else {
this.$axios({
method: "post",
url: "/index/Customer_addr/set_default",
params: {
id: id,
status: 1,
name: ""
}
})
.then(res => {
if (res.data.status == "ok") {
this.$message1(res.data.msg);
this.getAddress();
}
})
.catch(err => {
// this.$message(res.data.msg);
});
}
},
设置默认地址
最新推荐文章于 2022-08-10 11:33:16 发布