mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-11-22 18:36:52 +08:00
地址以及数据
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user