Commit 3c644244 by 陈超

T

parent da2ae541
...@@ -142,6 +142,8 @@ ...@@ -142,6 +142,8 @@
name: "{$address['name']}", name: "{$address['name']}",
phone: "{$address['phone']}", phone: "{$address['phone']}",
area: "{$address.location}", area: "{$address.location}",
provinceCode: "{$address['province']}",
cityCode: "{$address['city']}",
areaCode: "{$address['area']}", areaCode: "{$address['area']}",
address: "{$address['address']}", address: "{$address['address']}",
showPicker: false, showPicker: false,
...@@ -167,12 +169,58 @@ ...@@ -167,12 +169,58 @@
let that = this let that = this
that.showPicker = false that.showPicker = false
that.area = values.reduce( (v, e) => { return v.length == 0 ? e.name : (v + " " + e.name) }, "") that.area = values.reduce( (v, e) => { return v.length == 0 ? e.name : (v + " " + e.name) }, "")
console.log(values) if(values.length > 2) {
//that.areaCode = values[values.length - 1]. that.provinceCode = values[0].code
that.cityCode = values[1].code
that.areaCode = values[2].code
}
if(values.lengths > 1) {
that.provinceCode = values[0].code
that.cityCode = values[1].code
that.areaCode = ''
}
}, },
saveAddress: function() { saveAddress: function() {
let that = this
let address = that.address
let name = that.name
let phone = that.phone
let province = that.provinceCode
let city = that.cityCode
let area = that.areaCode
if(!name){ui.error('请输入收货人姓名')return}
if(!phone){ui.error('请输入联系电话')return}
if(!PHONE_MATCH.test(phone)){
ui.error('请输入正确的联系电话')
return
}
if(province<=0||city<=0){
ui.error('请选择收货地区');
return
}
if(!address){ui.error('请输入详细地址')return}
let data = "address=" + address + "&"
data = data + "name=" + name + "&"
data = data + "phone=" + phone + "&"
data = data + "province=" + province + "&"
data = data + "city=" + city + "&"
data = data + "area=" + area + "&"
let is_default = 0
let id = that.id
let param = "{$_GET['param']}"
$.post(U('home/User/updateAddress'), data+"&is_default="+is_default+"&id="+id , function(data){
if(data.status){
ui.success(data.info)
setTimeout(function(){
location.href="{:U('home/User/address')}"+'?'+'param'+'='+param
}, 1000)
return false
}else{
ui.error(data.info)
}
}, 'json')
}, },
} }
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment