...
|
...
|
@@ -9,7 +9,7 @@ Page({ |
|
|
date: '2016-09-01',
|
|
|
time: '12:01',
|
|
|
region: ['请选择', '请选择', '请选择'],
|
|
|
selectregion:"请选择省市区",
|
|
|
selectregion: "请选择省市区",
|
|
|
// customItem: '全部',
|
|
|
|
|
|
status: false,
|
...
|
...
|
@@ -23,28 +23,36 @@ Page({ |
|
|
county: '',
|
|
|
address: '',
|
|
|
type: 0,
|
|
|
noorder:'',
|
|
|
noorderid:'',
|
|
|
num:''
|
|
|
noorder: '',
|
|
|
noorderid: '',
|
|
|
num: '',
|
|
|
multiArray: [],
|
|
|
multiIndex: [0, 0, 0],
|
|
|
selectprocname: '请选择省市区',
|
|
|
pro: '',
|
|
|
selprovince: '',
|
|
|
selcity:'',
|
|
|
zone: ''
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
onLoad: function(options) {
|
|
|
console.log(options)
|
|
|
this.getalladdress()
|
|
|
if (options.id != undefined) {
|
|
|
this.setData({
|
|
|
address_id: options.id,
|
|
|
|
|
|
|
|
|
})
|
|
|
}
|
|
|
|
|
|
if(options.noorder!=undefined){
|
|
|
if (options.noorder != undefined) {
|
|
|
this.setData({
|
|
|
noorder:options.noorder,
|
|
|
noorderid:options.noorderid,
|
|
|
num:options.num
|
|
|
noorder: options.noorder,
|
|
|
noorderid: options.noorderid,
|
|
|
num: options.num
|
|
|
})
|
|
|
}
|
|
|
|
...
|
...
|
@@ -57,6 +65,113 @@ Page({ |
|
|
// this.getaddressEdit()
|
|
|
},
|
|
|
|
|
|
// bindMultiPickerChange(e) {
|
|
|
// console.log('picker发送选择改变,携带值为', e.detail.value)
|
|
|
// this.setData({
|
|
|
// multiIndex: e.detail.value
|
|
|
// })
|
|
|
// },
|
|
|
|
|
|
bindMultiPickerColumnChange(e) {
|
|
|
console.log('修改的列为', e.detail.column, ',值为', e.detail.value)
|
|
|
const data = {
|
|
|
multiArray: this.data.multiArray,
|
|
|
multiIndex: this.data.multiIndex
|
|
|
}
|
|
|
data.multiIndex[e.detail.column] = e.detail.value
|
|
|
switch (e.detail.column) {
|
|
|
|
|
|
case 0:
|
|
|
console.log('修改的列为', e.detail.column, ',值为', e.detail.value)
|
|
|
console.log(data.multiIndex)
|
|
|
|
|
|
let newpro = this.data.pro;
|
|
|
let province = newpro;
|
|
|
let city = newpro[e.detail.value].son
|
|
|
|
|
|
let zone = newpro[e.detail.value].son[0].son;
|
|
|
console.log(province);
|
|
|
console.log(city);
|
|
|
console.log(zone)
|
|
|
this.setData({
|
|
|
selprovince: province,
|
|
|
selcity:city,
|
|
|
zone:zone
|
|
|
})
|
|
|
|
|
|
data.multiArray[1] = city
|
|
|
data.multiArray[2] = zone
|
|
|
break
|
|
|
case 1:
|
|
|
console.log(data.multiIndex)
|
|
|
console.log(e.detail.value)
|
|
|
let secnewpro = this.data.pro;
|
|
|
let secity = this.data.selcity;
|
|
|
console.log(secity)
|
|
|
|
|
|
let seczone = secity[e.detail.value].son
|
|
|
data.multiArray[2] = seczone
|
|
|
break
|
|
|
}
|
|
|
|
|
|
this.setData(data)
|
|
|
},
|
|
|
|
|
|
|
|
|
bindMultiPickerChange(e) {
|
|
|
let that = this
|
|
|
console.log(e)
|
|
|
let p=e.detail.value;
|
|
|
console.log(p)
|
|
|
console.log(that.data.multiArray[0][p[0]].name)
|
|
|
|
|
|
|
|
|
that.setData({
|
|
|
multiIndex: [p[0],p[1], p[2]],
|
|
|
selectprocname: that.data.multiArray[0][p[0]].name + that.data.multiArray[1][p[1]].name + that.data.multiArray[2][p[2]].name,
|
|
|
province: that.data.multiArray[0][p[0]].name,
|
|
|
city: that.data.multiArray[1][p[1]].name,
|
|
|
county: that.data.multiArray[2][p[2]].name,
|
|
|
|
|
|
})
|
|
|
|
|
|
console.log(that.data.selectprocname)
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
//获取省市区
|
|
|
getalladdress() {
|
|
|
let that = this;
|
|
|
let url = '/home/index/getAddress',
|
|
|
params = {
|
|
|
token: wx.getStorageSync('token'),
|
|
|
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
console.log(res)
|
|
|
let pro = res.data;
|
|
|
let province = res.data;
|
|
|
let city = res.data[0].son
|
|
|
let zone = res.data[0].son[0].son;
|
|
|
|
|
|
let arr = [];
|
|
|
that.setData({
|
|
|
pro: res.data,
|
|
|
multiArray: [province, city, zone]
|
|
|
})
|
|
|
|
|
|
console.log(that.data.multiArray)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).catch((err) => {
|
|
|
|
|
|
})
|
|
|
},
|
|
|
|
|
|
// 姓名
|
|
|
enterName(e) {
|
|
|
console.log(e)
|
...
|
...
|
@@ -107,7 +222,7 @@ Page({ |
|
|
city: res.data.city,
|
|
|
county: res.data.city,
|
|
|
address: res.data.address,
|
|
|
selectregion:res.data.province+res.data.city+res.data.county
|
|
|
selectprocname: res.data.province + res.data.city + res.data.county
|
|
|
})
|
|
|
|
|
|
|
...
|
...
|
@@ -124,7 +239,7 @@ Page({ |
|
|
add_1() {
|
|
|
|
|
|
let that = this;
|
|
|
|
|
|
|
|
|
|
|
|
// 接收信息
|
|
|
let name = that.data.name;
|
...
|
...
|
@@ -137,32 +252,32 @@ Page({ |
|
|
// 正则表达式
|
|
|
//let regName = /^[\u4e00-\u9fa5]{0,}$/;
|
|
|
let regPhone = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
|
|
|
if(name ==''){
|
|
|
if (name == '') {
|
|
|
wx.showToast({
|
|
|
title: '请输入姓名',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
}else if(mobile ==''){
|
|
|
} else if (mobile == '') {
|
|
|
wx.showToast({
|
|
|
title: '请输入手机号',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
}else if(!regPhone.test(mobile)){
|
|
|
} else if (!regPhone.test(mobile)) {
|
|
|
wx.showToast({
|
|
|
title: '请输入正确的手机号',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
} else if (that.data.selectregion =="请选择省市区"){
|
|
|
} else if (that.data.selectprocname == "请选择省市区") {
|
|
|
wx.showToast({
|
|
|
title: '请选择省市区',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
} else if (address==''){
|
|
|
} else if (address == '') {
|
|
|
wx.showToast({
|
|
|
title: '请输入详细地址',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
}else{
|
|
|
} else {
|
|
|
let url = 'user/index/addressPost';
|
|
|
let params = {
|
|
|
|
...
|
...
|
@@ -187,29 +302,29 @@ Page({ |
|
|
icon: "none",
|
|
|
duration: 1500
|
|
|
})
|
|
|
console.log(that.data.noorder)
|
|
|
if (that.data.noorder==1){
|
|
|
setTimeout(function () {
|
|
|
console.log(that.data.noorder)
|
|
|
if (that.data.noorder == 1) {
|
|
|
setTimeout(function() {
|
|
|
console.log(that.data.num)
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/kind/firm_order1/firm_order1?num='+that.data.num+'&id='+that.data.noorderid,
|
|
|
url: '/pages/kind/firm_order1/firm_order1?num=' + that.data.num + '&id=' + that.data.noorderid,
|
|
|
})
|
|
|
}, 1000)
|
|
|
}else{
|
|
|
setTimeout(function () {
|
|
|
} else {
|
|
|
setTimeout(function() {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/mine/addr_1/addr_1',
|
|
|
})
|
|
|
}, 1000)
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}).catch((err) => {
|
|
|
|
|
|
})
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
...
|
...
|
@@ -234,7 +349,7 @@ Page({ |
|
|
|
|
|
},
|
|
|
// 选择器
|
|
|
bindRegionChange: function (e) {
|
|
|
bindRegionChange: function(e) {
|
|
|
console.log('picker发送选择改变,携带值为', e.detail.value)
|
|
|
let address_1 = e.detail.value
|
|
|
this.setData({
|
...
|
...
|
@@ -284,49 +399,49 @@ Page({ |
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|
|
|
onReady: function () {
|
|
|
onReady: function() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow: function () {
|
|
|
onShow: function() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
*/
|
|
|
onHide: function () {
|
|
|
onHide: function() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
|
onUnload: function () {
|
|
|
onUnload: function() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
*/
|
|
|
onPullDownRefresh: function () {
|
|
|
onPullDownRefresh: function() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
*/
|
|
|
onReachBottom: function () {
|
|
|
onReachBottom: function() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 用户点击右上角分享
|
|
|
*/
|
|
|
onShareAppMessage: function () {
|
|
|
onShareAppMessage: function() {
|
|
|
|
|
|
}
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|