...
|
...
|
@@ -9,6 +9,7 @@ Page({ |
|
|
date: '2016-09-01',
|
|
|
time: '12:01',
|
|
|
region: ['请选择', '请选择', '请选择'],
|
|
|
selectregion:"请选择省市区",
|
|
|
// customItem: '全部',
|
|
|
|
|
|
status: false,
|
...
|
...
|
@@ -65,7 +66,6 @@ Page({ |
|
|
})
|
|
|
},
|
|
|
|
|
|
|
|
|
// 获取编辑地址的信息、
|
|
|
getEditInfo() {
|
|
|
|
...
|
...
|
@@ -110,39 +110,81 @@ Page({ |
|
|
add_1() {
|
|
|
|
|
|
let that = this;
|
|
|
let url = 'user/index/addressPost';
|
|
|
let params = {
|
|
|
|
|
|
address_id: that.data.address_id,
|
|
|
name: that.data.name,
|
|
|
mobile: that.data.mobile,
|
|
|
status: that.data.type,
|
|
|
province: that.data.province,
|
|
|
city: that.data.city,
|
|
|
county: that.data.county,
|
|
|
address: that.data.address
|
|
|
}
|
|
|
let header = {
|
|
|
"XX-Token": wx.getStorageSync('token'),
|
|
|
"XX-Device-Type": 'wxapp'
|
|
|
}
|
|
|
app.post(url, params, header).then((res) => {
|
|
|
console.log(res);
|
|
|
|
|
|
|
|
|
|
|
|
// 接收信息
|
|
|
let name = that.data.name;
|
|
|
let mobile = that.data.mobile;
|
|
|
let province = that.data.province;
|
|
|
let city = that.data.city;
|
|
|
let county = that.data.county;
|
|
|
let address = that.data.address;
|
|
|
|
|
|
// 正则表达式
|
|
|
//let regName = /^[\u4e00-\u9fa5]{0,}$/;
|
|
|
let regPhone = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
|
|
|
if(name ==''){
|
|
|
wx.showToast({
|
|
|
title: '请输入姓名',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
}else if(mobile ==''){
|
|
|
wx.showToast({
|
|
|
title: '请输入手机号',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
}else if(!regPhone.test(mobile)){
|
|
|
wx.showToast({
|
|
|
title: '请输入正确的手机号',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
} else if (that.data.selectregion =="请选择省市区"){
|
|
|
wx.showToast({
|
|
|
title: '请选择省市区',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
} else if (address==''){
|
|
|
wx.showToast({
|
|
|
title: '保存成功',
|
|
|
icon: "none",
|
|
|
duration: 1500
|
|
|
title: '请输入详细地址',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
setTimeout(function () {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/mine/addr_1/addr_1',
|
|
|
}else{
|
|
|
let url = 'user/index/addressPost';
|
|
|
let params = {
|
|
|
|
|
|
address_id: that.data.address_id,
|
|
|
name: that.data.name,
|
|
|
mobile: that.data.mobile,
|
|
|
status: that.data.type,
|
|
|
province: that.data.province,
|
|
|
city: that.data.city,
|
|
|
county: that.data.county,
|
|
|
address: that.data.address
|
|
|
}
|
|
|
let header = {
|
|
|
"XX-Token": wx.getStorageSync('token'),
|
|
|
"XX-Device-Type": 'wxapp'
|
|
|
}
|
|
|
app.post(url, params, header).then((res) => {
|
|
|
console.log(res);
|
|
|
|
|
|
wx.showToast({
|
|
|
title: '保存成功',
|
|
|
icon: "none",
|
|
|
duration: 1500
|
|
|
})
|
|
|
}, 1000)
|
|
|
setTimeout(function () {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/mine/addr_1/addr_1',
|
|
|
})
|
|
|
}, 1000)
|
|
|
|
|
|
}).catch((err) => {
|
|
|
}).catch((err) => {
|
|
|
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
...
|
...
|
@@ -177,6 +219,7 @@ Page({ |
|
|
province: address_1[0],
|
|
|
city: address_1[1],
|
|
|
county: address_1[2],
|
|
|
selectregion: address_1[0] + address_1[1] + address_1[2]
|
|
|
|
|
|
})
|
|
|
|
...
|
...
|
|