地址以及数据

This commit is contained in:
952108534@qq.com 2022-01-20 19:57:51 +08:00
parent 3a954530d7
commit 1059e75bfe
9 changed files with 509 additions and 195 deletions

View File

@ -517,6 +517,7 @@ export const goodsmessage = (productCode) => {
//地址的添加 //id/详细地址/ 收货人姓名/收货人电话号码/省份id/城市id/区域编码
export const editaddress = (memberId, detailAddress,recipient,tel,provinceId,cityId,districtId) => {
var data = {
memberId:844350,
provinceId:25,
@ -528,7 +529,7 @@ export const goodsmessage = (productCode) => {
zipCode:'214423',
default:false,
}
return fetch('memberAddress?type=add', data, 'POST' )
return fetch('memberAddress?type=add', memberId, 'POST' )
}
//删除
@ -541,21 +542,13 @@ export const goodsmessage = (productCode) => {
}
//地址的编辑
export const editupdate = (mobile, pet,address) => {
var data = {
memberId:'3242',
id:'620111',
provinceId:'',
cityId:'',
districtId:'',
detailAddress:'江西省萍乡市',
recipient:'刘佳敏',
recipientPhone:'13407998521',
zipCode:'',
isDefault:'',
}
return fetch('memberAddress?type=update', data, 'POST' )
export const editupdate = (userid,) => {
// var data = {
// memberId:userid,
// id:id,
// isDefault:isDefault,
// }
return fetch('memberAddress?type=update', userid, 'POST' )
}
//修改密码

View File

@ -2,50 +2,51 @@
@media screen and (max-width:768px){
.usercontend{
.rc-button{
display: flex;
justify-content: center;
font-size: 14px;
width: 100%;
box-shadow: 0px -3px 6px rgba(0, 0, 0, 0.1);
height: 80px;
align-items: center;
padding:0 20px 0 20px;
span
{
width: 160px;
height: 48px;
border: 2px solid #E2001A;
border-radius: 30px;
display: flex;
align-items: center;
justify-content: center;
color: #E2001A;
}
em{
font-style: normal;
width: 164px;
height: 48px;
background: #E2001A;
cursor: pointer;
border-radius: 30px;
display: flex;
align-items: center;
justify-content: center;
color: #FFFFFF;
margin-left: 40px;
}
}
.usercontend{
align-items: center;
justify-content: center;
flex-direction: column;
min-height: 70vh;
.rc-useaddress{
textarea{
display: none;
}
}
.rc-button{
display: flex;
justify-content: center;
font-size: 14px;
width: 100%;
box-shadow: 0px -3px 6px rgba(0, 0, 0, 0.1);
height: 80px;
align-items: center;
padding:0 20px 0 20px;
span
{
width: 160px;
height: 48px;
border: 2px solid #E2001A;
border-radius: 30px;
display: flex;
align-items: center;
justify-content: center;
color: #E2001A;
}
em{
font-style: normal;
width: 164px;
height: 48px;
background: #E2001A;
cursor: pointer;
border-radius: 30px;
display: flex;
align-items: center;
justify-content: center;
color: #FFFFFF;
margin-left: 40px;
}
}
.rc-max-width--xl{
h2{
display: none;
@ -55,7 +56,7 @@
}
.rc-max-width--xl{
margin-top: 16px;
padding: 24px 20px 0 20px;
input{
width: 258px;
height: 34px;
@ -100,6 +101,40 @@
@media screen and (min-width: 769px)
{
.rc-button{
display: flex;
justify-content: center;
font-size: 14px;
width: 100%;
box-shadow: 0px -3px 6px rgba(0, 0, 0, 0.1);
height: 80px;
align-items: center;
padding:0 20px 0 20px;
span
{
width: 160px;
height: 48px;
border: 2px solid #E2001A;
border-radius: 30px;
display: flex;
align-items: center;
justify-content: center;
color: #E2001A;
}
em{
font-style: normal;
width: 164px;
height: 48px;
background: #E2001A;
cursor: pointer;
border-radius: 30px;
display: flex;
align-items: center;
justify-content: center;
color: #FFFFFF;
margin-left: 40px;
}
}
.usercontend{
display: flex;
align-items: center;
@ -197,12 +232,11 @@
// .rc-phone{
// }
// .rc-address{
.rc-address{
position: relative;
// }
// .rc-useaddress{
}
// }

View File

@ -1,3 +1,6 @@
@media screen and (max-width:768px){
.rc-button{
display: flex;
@ -7,8 +10,6 @@
box-shadow: 0px -3px 6px rgba(0, 0, 0, 0.1);
height: 80px;
align-items: center;
position: absolute;
bottom: 0;
padding:0 20px 0 20px;
span
{
@ -35,8 +36,27 @@
margin-left: 40px;
}
}
.usercontend{
align-items: center;
justify-content: center;
flex-direction: column;
min-height: 70vh;
.rc-useaddress{
textarea{
display: none;
}
}
.rc-max-width--xl{
h2{
display: none;
}
}
}
.rc-max-width--xl{
margin-top: 16px;
padding: 24px 20px 0 20px;
input{
width: 258px;
height: 34px;
@ -61,8 +81,6 @@
span{
text-align: left;
}
}
// .rc-phone{
@ -83,7 +101,146 @@
@media screen and (min-width: 769px)
{
.rc-button{
display: flex;
justify-content: center;
font-size: 14px;
width: 100%;
box-shadow: 0px -3px 6px rgba(0, 0, 0, 0.1);
height: 80px;
align-items: center;
padding:0 20px 0 20px;
span
{
width: 160px;
height: 48px;
border: 2px solid #E2001A;
border-radius: 30px;
display: flex;
align-items: center;
justify-content: center;
color: #E2001A;
}
em{
font-style: normal;
width: 164px;
height: 48px;
background: #E2001A;
cursor: pointer;
border-radius: 30px;
display: flex;
align-items: center;
justify-content: center;
color: #FFFFFF;
margin-left: 40px;
}
}
.usercontend{
display: flex;
align-items: center;
justify-content: center;
position: relative;
flex-direction: column;
.rc-button{
display: flex;
justify-content: center;
font-size: 14px;
width: 100%;
box-shadow: 0px -3px 6px rgba(0, 0, 0, 0.1);
height: 80px;
align-items: center;
padding:0 20px 0 20px;
span
{
width: 160px;
height: 48px;
border: 2px solid #E2001A;
border-radius: 30px;
display: flex;
align-items: center;
justify-content: center;
color: #E2001A;
}
em{
font-style: normal;
width: 164px;
height: 48px;
background: #E2001A;
cursor: pointer;
border-radius: 30px;
display: flex;
align-items: center;
justify-content: center;
color: #FFFFFF;
margin-left: 40px;
}
}
h2{
font-size: 26px;
color: #333333;
text-align: center;
font-weight: bold;
}
.rc-useaddress{
display: flex;
align-items: center;
textarea{
width: 680px;
height: 118px;
background: #FFFFFF;
border: 1px solid #808285;
opacity: 1;
border-radius: 0px;
padding-top: 12px;
padding-left: 16px;
}
.userinput{
display: none;
}
}
}
.rc-max-width--xl{
margin-top: 16px;
input{
width: 680px;
height: 45px;
border: 1px solid #808285;
color: #999999;
font-size: 16px;
margin-left: 2px;
padding-left: 16px;
}
span{
font-size: 16px;
font-weight: bold;
width: 10%;
text-align: center;
color: #333333;
margin-top: 2px;
}
.rc-people{
width: 100%;
display: flex;
align-items: center;
}
// .rc-phone{
// }
.rc-address{
position: relative;
}
}
}

View File

@ -3,8 +3,6 @@
.rc-margin-bottom--lg{
margin: 0;
}
@media screen and (max-width:768px){
.online{
width:100%;
@ -61,9 +59,7 @@ color: #FFFFFF;
margin-left: 8px;
}
}
.rc-center{
padding-top: 24px;
}
}
@ -112,17 +108,19 @@ color: #FFFFFF;
}
@media screen and (min-width: 769px)
@media screen and (min-width: 768px)
{
.rc-max-width--xl{
margin-bottom: 80px;
}
.rc-button{
display: none;
}
.usercontend {
display:inline-block;
}
.usercontshow{
.rc-button{
display: none;
}
}
.usercontend{
margin-top: 40px;
@ -134,15 +132,17 @@ color: #FFFFFF;
display: none;
}
.useredit{
width: 680px;
height: 164px;
width: 640px;
height: 166px;
background: #FFFFFF;
border: 1px solid #D7D7D7;
opacity: 1;
border-radius: 3px;
display: flex;
align-items: center;
justify-content: center;
display:inline-block;
margin-left: 35px;
img{
width: 31px;
height: 31px;
@ -153,6 +153,13 @@ span{
font-size: 18px;
}
.alledit{
display: flex;
align-items: center;
justify-content: center;
height: 100%;
}
}
.usercontend{
.useradd{
@ -210,6 +217,7 @@ img{
top: 24px;
span {
border-bottom: 1px solid #666666;
cursor: pointer;
}
span:first-child {
margin-right: 16px;
@ -235,32 +243,7 @@ img{
.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%;
}
}
display: none;
}
.rc-header {
display: flex;

View File

@ -1,6 +1,6 @@
<template>
<div class="ts-area-picker-container">
<input class="ts-area-picker-value-displayer" placeholder="请选择收货地址" @focus="initAddress" v-model="displayValue"></input>
<input class="ts-area-picker-value-displayer" @focus="initAddress" v-model="displayValue" placeholder="请选择所在地区"></input>
<input type="hidden" :value="returnValue">
<div class="ts-area-picker-desktop" v-if="show">
@ -277,7 +277,9 @@ export default {
<style lang="less" scoped>
.ts-area-picker-container{display:inline-block;}
.ts-area-picker-value-displayer{
width:40rem;
width:42.5rem;
height: 2.81rem;
padding-left: 1rem;
}
.ts-area-picker-tmp-value{
border-bottom:1px solid #D7D7D7;
@ -401,6 +403,17 @@ export default {
.ts-area-picker-desktop{
display:none;
}
.ts-area-picker-value-displayer{
width: 258px;
height: 34px;
border: none;
border-bottom: 1px
solid #808285;
color: #999999;
font-size: 16px;
margin-left: 2px;
padding-left: 0;
}
}
@media screen and (min-width:769px)
{

View File

@ -7,32 +7,34 @@
<h2>新增收货地址</h2>
<div class="rc-max-width--xl rc-people">
<span>收货人:</span>
<input type="text" placeholder="请输入收货人姓名">
<input type="text" placeholder="请输入收货人姓名" v-model="userpeople">
</div>
<div class="rc-max-width--xl rc-phone">
<span>手机号码:</span>
<input type="text" placeholder="请输入11位手机号码">
<input type="text" placeholder="请输入11位手机号码" v-model="tel" :error-message="usertel">
</div>
<div class="rc-max-width--xl rc-address">
<span>所在地区:</span>
<input type="text" placeholder="请选择所在地区">
<!-- <input type="text" placeholder="请选择所在地区"> -->
<addressInput @getmenu="onGetMenu" @closeDialog = "handleClose1" :dialogInfo1="dialogInfo1"></addressInput>
</div>
<div class="rc-max-width--xl rc-useaddress">
<span>详细地址:</span>
<input type="text" placeholder="小区、门牌号等" class="userinput">
<input type="text" placeholder="小区、门牌号等" class="userinput" v-model="alladdress">
<textarea rows="10" cols="30" placeholder="请输入详细地址">
</textarea>
</div>
<addressInput @getmenu="onGetMenu" @closeDialog = "handleClose1" :dialogInfo1="dialogInfo1"></addressInput>
</div>
</div>
<div class="rc-button">
<span @click="openclose()">取消</span>
<em @click="openclose()">确认</em>
<em @click="register()">确认</em>
</div>
</div>
<!-- <div class="rc-button">
<div class="rc-footbutton" @click="onAdd()">
<span>新增收货地址</span>
@ -51,14 +53,19 @@
import Myheader from '~/components/header.vue'
import MyFooter from '~/components/rc-footer.vue'
import addressInput from '~/components/addressInput.vue'
import {editaddress} from "../../ajax/getData";
export default {
data() {
return {
chosenAddressId: "1",
usermessage:null,
checked: true,
tel: "",
alladdress:'',
userid: null,
usermessage:null,
dialogInfo1:false,
userpeople:'',
list: [
{
id: 1,
@ -89,36 +96,58 @@ export default {
handleClose1(){
this.dialogInfo1 = false
},
onEdit(item, index) {
// let userid = item.id;
console.log(item);
this.$router.push({
path: "/useraddress/editaddress",
query: {
id: item,
},
});
register(){
console.log(this.tel)
if (!/^[1][3,4,5,7,8][0-9]{9}$/.test(this.tel) || this.tel === "") {
this.$message({
type: 'warning',
message: '手机号码输入有误'
});
return
}else if(this.alladdress===''){
this.$message({
type: 'warning',
message: '请输入详细地址'
});
return
}
else if(this.userpeople===''){
this.$message({
type: 'warning',
message: '请输入姓名'
});
return
}
else{
this.editaddress();
}
},
//
async editaddress(item) {
// this.userid
let useradd={
memberId:this.userid,
detailAddress:this.alladdress,
recipient:this.userpeople,
recipientPhone:this.tel,
provinceId:'',
cityId:'',
districtId:'',
}
let data = await editaddress(useradd);
if(data){
this.$message({
type: 'warning',
message: '地址添加成功'
});
}
},
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) {
@ -134,8 +163,23 @@ export default {
MyFooter,
addressInput
},
computed:{
usertel() {
if (this.tel === "") {
return "";
} else if (!/^[1][3,4,5,7,8][0-9]{9}$/.test(this.tel)) {
return "手机号格式错误";
} else {
return "";
}
},
},
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);

View File

@ -2,23 +2,23 @@
<div>
<Myheader></Myheader>
<div class="rc-top"></div>
<div class="rc-max-width--xl rc-main">
<div class="usercontend">
<div class="rc-max-width--xl">
<div class="rc-max-width--xl rc-people">
<span>收货人:</span>
<input type="text" placeholder="李某某">
<input type="text" placeholder="" v-model="recipient">
</div>
<div class="rc-max-width--xl rc-phone">
<span>手机号码:</span>
<input type="text" placeholder="15279944631">
<input type="text" placeholder="" v-model="recipientPhone">
</div>
<div class="rc-max-width--xl rc-address">
<span>所在地区:</span>
<input type="text" placeholder="请选择所在地区">
<addressInput @getmenu="onGetMenu" @closeDialog = "handleClose1" :dialogInfo1="dialogInfo1"></addressInput>
</div>
<div class="rc-max-width--xl rc-useaddress">
<span>详细地址:</span>
<input type="text" placeholder="天河客运站">
<input type="text" placeholder="" v-model="detailAddress" >
</div>
</div>
@ -27,12 +27,14 @@
<span>新增收货地址</span>
</div>
</div> -->
<div class="rc-button">
<span @click="openclose()">取消</span>
<em @click="openclose()">确认</em>
</div>
<!-- <MyFooter></MyFooter> -->
</div>
<div class="rc-button">
<span @click="openclose()">取消</span>
<em @click="register()">确认</em>
</div>
<MyFooter></MyFooter>
</div>
</template>
@ -40,13 +42,20 @@
import Myheader from '~/components/header.vue'
import MyFooter from '~/components/rc-footer.vue'
import { editupdate} from "../../ajax/getData";
import addressInput from '~/components/addressInput.vue'
export default {
data() {
return {
chosenAddressId: "1",
checked: true,
userid: null,
dialogInfo1:false,
usermessage:null,
detailAddress:'',
recipientPhone:'',
recipient:'',
addressid:'',
list: [
{
id: 1,
@ -71,27 +80,64 @@ export default {
};
},
methods: {
onEdit(item, index) {
// let userid = item.id;
console.log(item);
this.$router.push({
path: "/useraddress/editaddress",
query: {
id: item,
},
});
onGetMenu(values){
console.log(values,+'111111');
},
onAdd(item, index) {
// let userid = item.id;
// console.log(item);
this.$router.push({
path: "/useraddress/addaddress",
// query: {
// id: userid,
// },
});
handleClose1(){
this.dialogInfo1 = false
},
register(){
console.log(this.tel)
if (!/^[1][3,4,5,7,8][0-9]{9}$/.test(this.recipientPhone) || this.recipientPhone === "") {
this.$message({
type: 'warning',
message: '手机号码输入有误'
});
return
}else if(this.alladdress===''){
this.$message({
type: 'warning',
message: '请输入详细地址'
});
return
}
else if(this.userpeople===''){
this.$message({
type: 'warning',
message: '请输入姓名'
});
return
}
else{
this.editaddress();
}
},
//
async editaddress(item) {
let useradd={
memberId:this.userid,
id:this.id,
provinceId:'',//id,
cityId:'',//id,
districtId:'',//id,
detailAddress:this.detailAddress, //
recipient:this.recipient, //
recipientPhone:this.recipientPhone, //
}
let data = await editupdate(useradd);
if(data){
this.$message({
type: 'warning',
message: '地址修改成功'
});
}
},
//
@ -114,9 +160,19 @@ export default {
components: {
Myheader,
MyFooter,
addressInput
},
mounted() {
// if(this.$route.query.id){
this.userid = JSON.parse(localStorage.getItem("userInfo")).data.id;
this.recipient=this.$route.query.recipient
this.recipientPhone=this.$route.query.recipientPhone
this.detailAddress=this.$route.query.detailAddress
this.id=this.$route.query.id;
console.log(this.recipient,this.recipientPhone,this.detailAddress, this.id)
// }
//
// this.usermessage = JSON.parse(localStorage.getItem("userInfo"));
// this.editaddress(this.usermessage);

View File

@ -10,15 +10,15 @@
<div class="rc-center">
<div class=" rc-title">
<em>
{{ item.name }}
{{ item.recipient }}
</em>
<span>
{{ item.tel }}
{{ item.recipientPhone }}
</span>
</div>
<div class="rc-address">
<span>
{{ item.address }}
{{item.provinceName}}{{ item.districtName }}{{item.detailAddress}}
</span>
</div>
<div class="rc-footer">
@ -47,9 +47,10 @@
</div>
<div class="usercontshow useredit">
<img src="../../assets/image/userselect.png" alt="">
<div class="usercontshow alledit" @click="onAdd()">
<img src="../../static/images/adddress.png" alt="">
<span>添加收货地址</span>
</div>
</div>
<div class="rc-button">
<div class="rc-footbutton" @click="onAdd()">
@ -65,6 +66,7 @@
<script>
import Myheader from '~/components/header.vue'
import MyFooter from '~/components/rc-footer.vue'
import { selectaddress,editupdate,editdelete} from "../../ajax/getData";
export default {
data() {
return {
@ -96,13 +98,30 @@ export default {
};
},
methods: {
changeadddress(item,index){
console.log(item,index);
console.log(item.isDefault)
if(item.isDefault==false){
item.isDefault=true
}else{
item.isDefault=false;
}
this.editupdate(this.userid,item.id,item.isDefault)
this.editaddress();
},
onEdit(item, index) {
// let userid = item.id;
console.log(item);
// debugger
this.$router.push({
path: "/useraddress/editaddress",
query: {
id: item,
recipient: item.recipient,
recipientPhone:item.recipientPhone,
detailAddress:item.detailAddress,
id:item.id
},
});
},
@ -117,24 +136,37 @@ export default {
});
},
//
async editupdate(userid,addressid,isDefault) {
let useradd={
memberId:userid,
id:addressid,
isDefault:isDefault,
}
let data = await editupdate(useradd);
// if(data){
// this.editaddress();
// }
},
//
// async userdelete(item) {
// console.log(item.memberId);
// let data = await editdelete(this.userid, item.id);
// this.editaddress(this.usermessage);
// console.log(data);
// },
async userdelete(item) {
console.log(item.memberId);
let data = await editdelete(this.userid, item.id);
this.editaddress();
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(this.userid);
console.log(data);
// this.list=data;
// console.log(this.list);
console.log(data);
},
},
components: {
Myheader,
@ -143,9 +175,11 @@ export default {
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.userid = this.usermessage.data.id;
console.log(this.userid);
this.editaddress(this.userid);
},
};
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB