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