|
|
|
|
|
|
|
|
submitData: this.data.submitData |
|
|
submitData: this.data.submitData |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
if (app.globalData.userInfoData) { |
|
|
|
|
|
|
|
|
if (app.globalData.userInfoData.nickName) { |
|
|
this.data.userData.avatarUrl = app.globalData.userInfoData.avatarUrl; |
|
|
this.data.userData.avatarUrl = app.globalData.userInfoData.avatarUrl; |
|
|
this.data.userData.nickName = app.globalData.userInfoData.nickName; |
|
|
this.data.userData.nickName = app.globalData.userInfoData.nickName; |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
|
|
|
|
|
|
this.data.submitData.mobile = res.data.mobile; |
|
|
this.data.submitData.mobile = res.data.mobile; |
|
|
this.data.submitData.province = res.data.province; |
|
|
this.data.submitData.province = res.data.province; |
|
|
this.data.submitData.city = res.data.city; |
|
|
this.data.submitData.city = res.data.city; |
|
|
|
|
|
this.data.submitData.agentDetail = res.data.agentDetail; |
|
|
|
|
|
this.data.submitData.agent_code = res.data.agent_code; |
|
|
this.data.submitData.addressDetail = res.data.addressDetail; |
|
|
this.data.submitData.addressDetail = res.data.addressDetail; |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
submitData: this.data.submitData |
|
|
|
|
|
|
|
|
submitData: this.data.submitData, |
|
|
|
|
|
mobile2:res.data.mobile |
|
|
}) |
|
|
}) |
|
|
if(!res.data.agentDetail){ |
|
|
|
|
|
this.getUserLocation();//获取用户当前位置 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// if(!res.data.agentDetail){ |
|
|
|
|
|
this.getDistributorList("",""); |
|
|
|
|
|
// this.getUserLocation();//获取用户当前位置 |
|
|
|
|
|
// } |
|
|
|
|
|
}else{ |
|
|
|
|
|
this.getUserLocation();//获取用户当前位置 |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
wx.showToast({ |
|
|
wx.showToast({ |
|
|
|
|
|
|
|
|
}, this); |
|
|
}, this); |
|
|
}, |
|
|
}, |
|
|
addAddress: function () {//添加地址 |
|
|
addAddress: function () {//添加地址 |
|
|
app.wxRequest(app.globalData.urlRoot + "address/addAddress", this.data.submitData, res => { |
|
|
|
|
|
|
|
|
var mobile = this.data.submitData.mobile; |
|
|
|
|
|
if(this.data.selectType==2){ |
|
|
|
|
|
this.data.submitData.mobile = this.data.mobile2; |
|
|
|
|
|
} |
|
|
|
|
|
app.wxRequest(app.globalData.urlRoot + "address/addAddressV2", this.data.submitData, res => { |
|
|
wx.showToast({ |
|
|
wx.showToast({ |
|
|
title: res.msg, |
|
|
title: res.msg, |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
}, this, "POST") |
|
|
}, this, "POST") |
|
|
}, |
|
|
}, |
|
|
updateAddress: function () {//更新地址 |
|
|
updateAddress: function () {//更新地址 |
|
|
app.wxRequest(app.globalData.urlRoot + "address/updateAddress", this.data.submitData, res => { |
|
|
|
|
|
|
|
|
var mobile = this.data.submitData.mobile; |
|
|
|
|
|
if(this.data.selectType==2){ |
|
|
|
|
|
this.data.submitData.mobile = this.data.mobile2; |
|
|
|
|
|
} |
|
|
|
|
|
app.wxRequest(app.globalData.urlRoot + "address/updateAddressV2", this.data.submitData, res => { |
|
|
wx.showToast({ |
|
|
wx.showToast({ |
|
|
title: res.msg, |
|
|
title: res.msg, |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
getMobile2: function (e) {//获取用户输入的电话---无验证码 |
|
|
getMobile2: function (e) {//获取用户输入的电话---无验证码 |
|
|
this.data.mobile2 = e.detail.value; |
|
|
|
|
|
|
|
|
this.setData({ |
|
|
|
|
|
mobile2:e.detail.value |
|
|
|
|
|
}) |
|
|
}, |
|
|
}, |
|
|
getAddressDetail: function (e) {//获取详细地址 |
|
|
getAddressDetail: function (e) {//获取详细地址 |
|
|
this.data.submitData.addressDetail = e.detail.value; |
|
|
this.data.submitData.addressDetail = e.detail.value; |
|
|
|
|
|
|
|
|
saveUserMsg:function(){ |
|
|
saveUserMsg:function(){ |
|
|
if (!this.data.submitData.realName) { |
|
|
if (!this.data.submitData.realName) { |
|
|
wx.showToast({ |
|
|
wx.showToast({ |
|
|
title: '请输入收货人', |
|
|
|
|
|
|
|
|
title: '请输入姓名', |
|
|
icon: "none" |
|
|
icon: "none" |
|
|
}) |
|
|
}) |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (!app.mobileVerify(this.data.submitData.mobile)) { |
|
|
|
|
|
if (this.data.submitData.mobile) { |
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
title: '请输入正确的电话', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
title: '请输入电话', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if (!this.data.submitData.province) { |
|
|
|
|
|
|
|
|
if (!this.data.mobile2 && this.data.selectType==2) { |
|
|
wx.showToast({ |
|
|
wx.showToast({ |
|
|
title: '请选择所在地区', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
|
|
|
title: '请输入电话', |
|
|
|
|
|
icon: "none" |
|
|
}) |
|
|
}) |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
if (this.data.selectType == 2) { |
|
|
|
|
|
if (!this.data.submitData.captcha) { |
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
title: '请输入验证码', |
|
|
|
|
|
icon: "none" |
|
|
|
|
|
}) |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
if (!this.data.submitData.addressDetail) { |
|
|
if (!this.data.submitData.addressDetail) { |
|
|
wx.showToast({ |
|
|
wx.showToast({ |
|
|
title: '请输入详细地址', |
|
|
title: '请输入详细地址', |
|
|
|
|
|
|
|
|
}) |
|
|
}) |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
this.data.submitData.province = this.data.provinceDataArr[0][this.data.provinceDataValue[0]]; |
|
|
|
|
|
this.data.submitData.city = this.data.provinceDataArr[1][this.data.provinceDataValue[1]]; |
|
|
|
|
|
this.data.submitData.agent_code = this.data.storeArr[this.data.storeValue].agent_code; |
|
|
|
|
|
this.data.submitData.agentDetail = this.data.storeArr[this.data.storeValue].agent_detail; |
|
|
|
|
|
this.data.submitData.scene = app.globalData.sceneSource; |
|
|
|
|
|
// console.log(this.data.submitData); |
|
|
|
|
|
|
|
|
|
|
|
// return; |
|
|
wx.showLoading({ |
|
|
wx.showLoading({ |
|
|
title: '保存中', |
|
|
title: '保存中', |
|
|
mask: true |
|
|
mask: true |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
getCaptcha: function (e) {//获取用户输入的验证码 |
|
|
getCaptcha: function (e) {//获取用户输入的验证码 |
|
|
this.data.submitData.captcha = e.detail.value; |
|
|
this.data.submitData.captcha = e.detail.value; |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
submitData:this.data.submitData |
|
|
|
|
|
}) |
|
|
}, |
|
|
}, |
|
|
getCode: function (e) {//获取验证码 |
|
|
getCode: function (e) {//获取验证码 |
|
|
if (!app.mobileVerify(this.data.mobile2)) { |
|
|
if (!app.mobileVerify(this.data.mobile2)) { |
|
|
|
|
|
|
|
|
for (let i = 0; i < res.data.list.length; i++) { |
|
|
for (let i = 0; i < res.data.list.length; i++) { |
|
|
province.push(res.data.list[i].province); |
|
|
province.push(res.data.list[i].province); |
|
|
} |
|
|
} |
|
|
|
|
|
for(let i=0;i<province.length;i++){ |
|
|
|
|
|
if(province[i]==this.data.submitData.province){ |
|
|
|
|
|
res.data.nearData.provinceIndex = i; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
for (let j = 0; j < res.data.list[res.data.nearData.provinceIndex].children.length; j++) { |
|
|
for (let j = 0; j < res.data.list[res.data.nearData.provinceIndex].children.length; j++) { |
|
|
city.push(res.data.list[res.data.nearData.provinceIndex].children[j].city) |
|
|
city.push(res.data.list[res.data.nearData.provinceIndex].children[j].city) |
|
|
} |
|
|
} |
|
|
|
|
|
for(let i=0;i<city.length;i++){ |
|
|
|
|
|
if(city[i]==this.data.submitData.city){ |
|
|
|
|
|
res.data.nearData.cityIndex = i; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if(this.data.submitData.agentDetail){ |
|
|
|
|
|
for(let i=0;i<res.data.list[res.data.nearData.provinceIndex].children[res.data.nearData.cityIndex].children.length;i++){ |
|
|
|
|
|
if(res.data.list[res.data.nearData.provinceIndex].children[res.data.nearData.cityIndex].children[i]==this.data.submitData.agentDetail){ |
|
|
|
|
|
res.data.nearData.agentIndex = i; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}else{ |
|
|
|
|
|
res.data.nearData.agentIndex = 0; |
|
|
|
|
|
} |
|
|
//将数据赋值给变量 |
|
|
//将数据赋值给变量 |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
provinceDataAll: res.data.list, |
|
|
provinceDataAll: res.data.list, |