webpackJsonp([60],{"ri+0":function(e,t){},t32k:function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});s("eqfM");var a,i=s("/QYm"),r=s("bOdI"),d=s.n(r),n=(s("f1Vh"),s("ZQVe")),o=s.n(n),l=(s("lrMw"),s("7YS2")),c=s.n(l),h=s("qUD4"),v=s("CCn6"),u=s("NuXJ"),m={name:"",components:(a={MyAddress:h.a},d()(a,c.a.name,c.a),d()(a,o.a.name,o.a),a),data:function(){return{addressData:null,receiveName:"",receiveMobile:"",addressDetail:"",showAddressPicker:!1,addressArea:"",addressAreaCode:"",address:"",deliverId:""}},mounted:function(){if(this.$route.params&&this.$route.params.data){var e=JSON.parse(this.$route.params.data);this.addressData=e,this.receiveName=e.receive_name,this.receiveMobile=e.receive_mobile,this.address=e.address,this.deliverId=e.id,this.addressArea=e.province_name+"-"+e.city_name+"-"+e.area_name}this.getAddressCode()},methods:{closeAdd:function(){this.$emit("closeAdd",!1)},buttonClick:function(e){this.$sa.track("buttonClick",{tabTitle:"商品",moduleTitle:"地址填写",buttonType:"功能",buttonName:e})},getAddressCode:function(){this.addressData.province_name;for(var e=this.addressData.city_name,t=(this.addressData.area_name,void 0),s=void 0,a=void 0,i=0,r=u.a.length;i<r;i++){var d=u.a[i];if(e==d.label){t=d.value;for(var n=d.children,o=0,l=n.length;o<l;o++){var c=n[o];if(e==c.label){s=c.value;for(var h=c.children,v=0,m=h.length;v<m;v++)if(h[v].label){a=h[v].value;break}}}}}this.addressAreaCode=t+"-"+s+"-"+a},onSave:function(){var e=this,t=this.addressAreaCode.split("-"),s=this.addressArea.split("-");if(!this.receiveName)return Object(i.a)("收货人不能为空"),!1;if(!this.receiveMobile)return Object(i.a)("手机号不能为空"),!1;if(!/^1\d{10,12}$/.test(this.receiveMobile))return Object(i.a)("手机号格式不正确"),!1;if(!this.addressArea)return Object(i.a)("所在地区不能为空"),!1;if(!this.address)return Object(i.a)("详细地址不能为空"),!1;var a={};a.receive_name=this.receiveName,a.receive_mobile=this.receiveMobile,a.address=this.address,a.province_id=t[0],a.province_name=s[0],a.city_id=t[1],a.city=s[1],a.area_id=t[2],a.area=s[2],Object(v._0)(a).then(function(t){e.closeAdd(),Object(i.a)("修改成功"),e.$router.replace({name:"Address"})}).catch(function(e){})},onValuesChange:function(e,t){t[0]>t[1]&&e.setSlotValue(1,t[0])},hidePicker:function(){this.showAddressPicker=!1},showPicker:function(){this.showAddressPicker=!this.showAddressPicker},saveAddress:function(e,t){this.addressArea=e,this.addressAreaCode=t,this.showAddressPicker=!this.showAddressPicker}}},b={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"addressEdit"},[s("div",[s("mt-field",{attrs:{label:"收货人",placeholder:"请填写收货人"},model:{value:e.receiveName,callback:function(t){e.receiveName=t},expression:"receiveName"}}),e._v(" "),s("mt-field",{attrs:{label:"手机号",type:"tel",placeholder:"请填写手机号",attr:{maxlength:13}},model:{value:e.receiveMobile,callback:function(t){e.receiveMobile=t},expression:"receiveMobile"}}),e._v(" "),s("mt-field",{attrs:{label:"所在地区",placeholder:"请填写所在地区",readonly:!0,disableClear:!0},model:{value:e.addressArea,callback:function(t){e.addressArea=t},expression:"addressArea"}},[s("mt-cell",{staticStyle:{position:"absolute",width:"40px",height:"100%",right:"0",top:"-24px"},attrs:{"is-link":""}}),e._v(" "),s("div",{staticClass:"stbox",staticStyle:{position:"absolute",right:"0",top:"-24px",left:"0",bottom:"0"}},[s("mt-cell",{staticStyle:{opacity:"0",position:"absolute",width:"300px",height:"100%",right:"10%",top:"0"},attrs:{id:"mtcell",value:e.addressArea},nativeOn:{click:function(t){return e.showPicker(t)}}})],1)],1),e._v(" "),s("mt-field",{attrs:{label:"详细地址",placeholder:"请填写详细地址"},model:{value:e.address,callback:function(t){e.address=t},expression:"address"}}),e._v(" "),s("div",{staticClass:"btn",on:{click:function(t){e.onSave(),e.buttonClick("保存地址")}}},[s("van-button",{attrs:{round:"",size:"large",type:"info"}},[e._v("保存")])],1)],1),e._v(" "),s("my-address",{attrs:{showAddressPicker:e.showAddressPicker,init:e.addressArea},on:{"save-address":e.saveAddress,"hide-picker":e.hidePicker}})],1)},staticRenderFns:[]};var f=s("VU/8")(m,b,!1,function(e){s("ri+0")},null,null);t.default=f.exports}});