require('../common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages_user/user/addAddress"],{"6f01":function(t,e,s){"use strict";s.d(e,"b",(function(){return n})),s.d(e,"c",(function(){return d})),s.d(e,"a",(function(){return i}));var i={evanSwitch:function(){return s.e("components/evan-switch/evan-switch").then(s.bind(null,"4e94"))}},n=function(){var t=this.$createElement;this._self._c},d=[]},9882:function(t,e,s){"use strict";var i=s("b523"),n=s.n(i);n.a},b3e0:function(t,e,s){"use strict";(function(t,e){var i=s("47a9");s("584a");i(s("3240"));var n=i(s("c377"));t.__webpack_require_UNI_MP_PLUGIN__=s,e(n.default)}).call(this,s("3223")["default"],s("df3c")["createPage"])},b523:function(t,e,s){},c377:function(t,e,s){"use strict";s.r(e);var i=s("6f01"),n=s("e944");for(var d in n)["default"].indexOf(d)<0&&function(t){s.d(e,t,(function(){return n[t]}))}(d);s("9882");var a=s("828b"),o=Object(a["a"])(n["default"],i["b"],i["c"],!1,null,null,null,!1,i["a"],void 0);e["default"]=o.exports},e944:function(t,e,s){"use strict";s.r(e);var i=s("f5f0"),n=s.n(i);for(var d in i)["default"].indexOf(d)<0&&function(t){s.d(e,t,(function(){return i[t]}))}(d);e["default"]=n.a},f5f0:function(t,e,s){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=s("30e7"),n={components:{EvanSwitch:function(){s.e("components/evan-switch/evan-switch").then(function(){return resolve(s("4e94"))}.bind(null,s)).catch(s.oe)}},data:function(){return{content:null,type:null,id:null,isDefault:!1,addressList:[[],[],[]],multiIndex:[0,0,0],address:[],form:{realName:null,phone:null,detail:null,address:null,isDefault:0}}},onLoad:function(e){this.type=e.type,"edit"==this.type?(t.setNavigationBarTitle({title:"修改收货地址"}),this.id=e.id,this.getAddressById()):t.setNavigationBarTitle({title:"新增收货地址"}),this.getCitys()},methods:{parseAddress:function(){var e=this;if(null!=this.content&&""!=this.content){var s={content:this.content};(0,i.parseAddress)(s).then((function(s){200==s.code?(e.form.realName=s.data.name,e.form.phone=s.data.mobile,e.form.address=s.data.provinceName+s.data.cityName+s.data.expAreaName,e.form.province=s.data.provinceName,e.form.city=s.data.cityName,e.form.district=s.data.expAreaName,e.form.detail=s.data.streetName+s.data.address,e.form.detail=e.form.detail.replace(/\s+/g,"")):t.showToast({icon:"none",title:s.msg})}),(function(t){}))}else t.showToast({icon:"none",title:"请输入地址信息"})},getAddressById:function(){var e=this,s={id:this.id};(0,i.getAddressById)(s).then((function(s){200==s.code?(e.form=s.data,e.isDefault=1==e.form.isDefault,e.form.address=e.form.province+e.form.city+e.form.district):t.showToast({icon:"none",title:s.msg})}),(function(t){}))},submit:function(){"add"==this.type?this.addAddress():"edit"==this.type&&this.editAddress()},editAddress:function(){this.form.isDefault=this.isDefault?1:0,(0,i.editAddress)(this.form).then((function(e){200==e.code?(t.showToast({icon:"success",title:"操作成功"}),setTimeout((function(){t.$emit("refreshAddress"),t.navigateBack({delta:1})}),500)):t.showToast({icon:"none",title:e.msg})}),(function(t){}))},addAddress:function(){this.form.isDefault=this.isDefault?1:0,(0,i.addAddress)(this.form).then((function(e){200==e.code?(t.showToast({icon:"success",title:"操作成功"}),setTimeout((function(){t.$emit("refreshAddress"),t.navigateBack({delta:1})}),500)):t.showToast({icon:"none",title:e.msg})}),(function(t){}))},pickerChange:function(t){this.multiIndex=t.detail.value,this.form.address=this.addressList[0][this.multiIndex[0]].n+this.addressList[1][this.multiIndex[1]].n+this.addressList[2][this.multiIndex[2]].n,this.form.province=this.addressList[0][this.multiIndex[0]].n,this.form.city=this.addressList[1][this.multiIndex[1]].n,this.form.district=this.addressList[2][this.multiIndex[2]].n,this.form.cityId=this.addressList[1][this.multiIndex[1]].v},pickerColumnchange:function(t){0===t.detail.column&&(this.multiIndex[0]=t.detail.value,this.addressList[1]=this.address[this.multiIndex[0]].c,this.addressList[2]=this.address[this.multiIndex[0]].c[0].c,this.multiIndex.splice(1,1,0),this.multiIndex.splice(2,1,0)),1===t.detail.column&&(this.multiIndex[1]=t.detail.value,this.addressList[2]=this.address[this.multiIndex[0]].c[this.multiIndex[1]].c,this.multiIndex.splice(2,1,0)),2===t.detail.column&&(this.multiIndex[2]=t.detail.value)},getCitys:function(){var e=this;(0,i.getCitys)().then((function(s){if(200==s.code){e.address=s.data;for(var i=0;i<e.address.length;i++)e.addressList[0].push(e.address[i]);for(i=0;i<e.address[0].c.length;i++)e.addressList[1].push(e.address[0].c[i]);for(i=0;i<e.address[0].c[0].c.length;i++)e.addressList[2].push(e.address[0].c[0].c[i])}else t.showToast({icon:"none",title:"请求失败"})}),(function(t){}))}}};e.default=n}).call(this,s("df3c")["default"])}},[["b3e0","common/runtime","common/vendor","pages_user/common/vendor"]]]);