This commit is contained in:
952108534@qq.com
2022-01-19 21:55:17 +08:00
parent bcc04c1d11
commit ef1120ec7c
9 changed files with 601 additions and 367 deletions

View File

@@ -1,27 +1,29 @@
<template>
<div>
<Myheader></Myheader>
<div class="usermain">
<div class="rc-main" v-for="(item, index) in list" :key="index">
<Myheader></Myheader>
<div class="rc-top"></div>
<div class="usercontend">
<div class="rc-max-width--xl rc-main">
<div class="rc-cat" v-for="(item, index) in list" :key="index">
<div class="rc-center">
<div class="rc-header">
<div class=" rc-title">
<em>
{{ item.recipient }}
{{ item.name }}
</em>
<span>
{{ item.recipientPhone }}
{{ item.tel }}
</span>
</div>
<div class="rc-address">
<span>
{{ item.detailAddress }}
{{ item.address }}
</span>
</div>
<div class="rc-footer">
<div class="rc-foot">
<img src="../../assets/image/userselect.png" alt="">
<span>设置为默认收货地址</span>
<!-- <van-switch v-model="checked" /> -->
</div>
<div class="rc-right">
<span @click="onEdit(item, index)">编辑</span>
@@ -32,7 +34,14 @@
</div>
</div>
<div class="usercontend useradd">
<img src="../../assets/image/userselect.png" alt="">
<span>添加收货地址</span>
</div>
</div>
<div class="rc-button">
<div class="rc-footbutton" @click="onAdd()">
<span>新增收货地址</span>
@@ -42,11 +51,8 @@
</template>
<script>
import { areaList } from "@vant/area-data";
import { selectaddress } from "../../ajax/getData";
import { editdelete } from "../../ajax/getData";
import Myheader from "~/components/header.vue";
import { Toast } from "vant";
import { areaList } from '@vant/area-data';
import Myheader from '~/components/header.vue'
export default {
data() {
return {
@@ -78,14 +84,9 @@ export default {
areaList,
};
},
methods: {
onAdd() {
Toast("新增地址");
this.$router.push({ path: "/useraddress/addaddress" });
},
methods: {
onEdit(item, index) {
let userid = item.id;
// let userid = item.id;
console.log(item);
this.$router.push({
path: "/useraddress/editaddress",
@@ -94,201 +95,50 @@ export default {
},
});
},
//删除地址
async userdelete(item) {
console.log(item.memberId);
let data = await editdelete(this.userid, item.id);
this.editaddress(this.usermessage);
console.log(data);
onAdd(item, index) {
// let userid = item.id;
// console.log(item);
this.$router.push({
path: "/useraddress/addaddress",
// query: {
// id: userid,
// },
});
},
//删除地址
// async userdelete(item) {
// console.log(item.memberId);
// let data = await editdelete(this.userid, item.id);
// this.editaddress(this.usermessage);
// console.log(data);
// },
//查询人的所有地址
async editaddress(user) {
user.data.id=844350
let data = await selectaddress(user.data.id);
this.list=data.data;
console.log(this.list);
console.log(data);
},
// async editaddress(user) {
// user.data.id=844350
// let data = await selectaddress(user.data.id);
// this.list=data.data;
// console.log(this.list);
// console.log(data);
// },
},
components: {
Myheader,
Myheader
},
mounted() {
//地址的查询
this.usermessage = JSON.parse(localStorage.getItem("userInfo"));
this.editaddress(this.usermessage);
this.userid = this.usermessage.data.id;
// this.usermessage = JSON.parse(localStorage.getItem("userInfo"));
// this.editaddress(this.usermessage);
// this.userid = this.usermessage.data.id;
},
};
</script>
<style lang="less" scoped >
.rc-main {
width: 93%;
margin: 0 auto;
margin-top: 8px;
}
//手机端
@media screen and(min-width: 320px) and(max-width:768px) {
.rc-button {
height: 80px;
background: #ffffff;
box-shadow: 0px -3px 6px rgba(0, 0, 0, 0.1);
opacity: 1;
display: flex;
align-items: center;
justify-content: center;
.rc-footbutton {
width: 164px;
height: 48px;
border: 2px solid #e2001a;
opacity: 1;
border-radius: 30px;
display: flex;
align-items: center;
background: #e2001a;
span {
display: block;
text-align: center;
color: white;
font-size: 16px;
width: 100%;
}
}
}
.rc-header {
display: flex;
align-items: center;
color: #333333;
em {
font-style: normal;
font-size: 14px;
}
span {
display: block;
margin-left: 8px;
}
}
.rc-address {
margin-top: 8px;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
font-size: 14px;
color: #333333;
}
.rc-footer {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 20px;
margin-top: 8px;
.rc-right {
span {
border-bottom: 1px solid #666666;
}
span:first-child {
margin-right: 16px;
}
}
}
}
//pc端
@media screen and (min-width: 768px) and (max-width: 1920px) {
.usermain{
width: 90%;
margin: 0 auto;
}
.rc-main{
width: 45%;
height: 164px;
margin-top: 60px;
background: #FFFFFF;
border: 1px solid #D7D7D7;
opacity: 1;
border-radius: 3px;
margin-left: 40px;
float: left;
.rc-center{
margin-top: 24px;
margin-left: 24px;
}
}
.rc-button {
height: 80px;
background: #ffffff;
box-shadow: 0px -3px 6px rgba(0, 0, 0, 0.1);
opacity: 1;
display: flex;
align-items: center;
justify-content: center;
display: block;
.rc-footbutton {
width: 164px;
height: 48px;
border: 2px solid #e2001a;
opacity: 1;
border-radius: 30px;
display: flex;
align-items: center;
background: #e2001a;
span {
display: block;
text-align: center;
color: white;
font-size: 16px;
width: 100%;
}
}
}
.rc-header {
display: flex;
align-items: center;
color: #333333;
em {
font-style: normal;
font-size: 14px;
}
span {
display: block;
margin-left: 8px;
}
}
.rc-address {
margin-top: 8px;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
font-size: 14px;
color: #333333;
}
.rc-footer {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 20px;
margin-top: 8px;
.rc-right {
span {
border-bottom: 1px solid #666666;
}
span:first-child {
margin-right: 16px;
}
}
}
}
@import url("../../assets/css/global.less");
@import url("../../assets/css/openaddress.less");
</style>