java-mall-app/unpackage/dist/build/mp-weixin/member/address/manage.js
2025-12-12 17:04:03 +08:00

1 line
14 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

require('../common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["member/address/manage"],{1580:function(t,e,a){"use strict";a.r(e);var i=a("f7948"),r=a("cd45");for(var s in r)["default"].indexOf(s)<0&&function(t){a.d(e,t,(function(){return r[t]}))}(s);a("32e6");var n=a("828b"),o=Object(n["a"])(r["default"],i["b"],i["c"],!1,null,"1dcc384c",null,!1,i["a"],void 0);e["default"]=o.exports},"32e6":function(t,e,a){"use strict";var i=a("c4fb"),r=a.n(i);r.a},"72ee":function(t,e,a){"use strict";(function(t,e){var i=a("47a9");a("ec76");i(a("3240"));var r=i(a("1580"));t.__webpack_require_UNI_MP_PLUGIN__=a,e(r.default)}).call(this,a("3223")["default"],a("df3c")["createPage"])},8088:function(t,e,a){"use strict";(function(t){var i=a("47a9");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=i(a("af34")),s=i(a("7ca3")),n=i(a("36ea")),o=a("8f59");function d(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,i)}return a}function c(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?d(Object(a),!0).forEach((function(e){(0,s.default)(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):d(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}var u=a("5c2c"),l={components:{uMask:function(){a.e("member/address/umask").then(function(){return resolve(a("d7e1"))}.bind(null,a)).catch(a.oe)}},data:function(){return{map:null,showMask:!1,originalData:{result:{addressComponent:{city:"正在定位"},sematic_description:"定位中.."}},nearbyAddressList:[],formData:{detailAddress:"",userName:"",userPhone:"",lableName:null,sexType:1},labelData:["家","公司","学校"],addressInfo:{},agreeState:!1,longitude:null,latitude:null,markerIcon:"/static/images/marker.png",seleIcon:a("7456"),sele2Icon:"/static/images/sele2.png",noseleIcon:a("b71f"),oldObj:"",showMarkerIcon:!1,showPoisList:!1,showSearchAddress:!1,searchAddress:[],map_markers:[],markers:[],showSelectAddBtn:!0,showSearchIpunt:!1,showCurrAdd:!1,isDragMarker:!1,isEnableScroll:!1,showReposition:!1,currAddress:"",currRoadAddress:"",ud_id:null,areaData:[],cityData:[],provinceData:[],isFound:!1,issub:!1,options:{},spid:""}},computed:c({},(0,o.mapState)(["Config","StateCode","notice","plantformInfo","shopInfo","userInfo","hasLogin"])),onUnload:function(){t.removeStorageSync("city")},onShow:function(e){this.getAppDistrict();var a=t.getStorageSync("city");a?this.originalData.result.addressComponent.city=a:this.ud_id&&"-1"!=this.ud_id?this.getCurrAddress():this.getLocation()},onLoad:function(t){t.ud_id&&(this.ud_id=t.ud_id),this.setData({issub:t.issub,ud_id:t.ud_id||0,spid:t.spid||"",options:t})},methods:{getAppDistrict:function(){var e=this,a=t.getStorageSync("district_data");a?e.setDistrictData(a):e.$.request({url:e.cf.URL.getAppDistrict,data:{},loading:!1,ajaxCache:{timeout:this.cf.CACHE_EXPIRE},success:function(a,i,r,s){200==i&&(t.setStorageSync("district_data",a),e.setDistrictData(a))}})},setDistrictData:function(t){this.provinceData=t.provinceData,this.cityData=t.cityData,this.areaData=t.areaData},getCurrAddress:function(){var t=this,e={ud_id:t.ud_id};t.$.request({url:this.Config.URL.user.address_get,data:e,success:function(e,a,i,r){if(200==a){t.formData.detailAddress=e.ud_street_no,t.formData.userName=e.ud_name,t.formData.userPhone=e.ud_mobile,t.formData.lableName=e.ud_label-1,t.formData.sexType=e.ud_gender;var s={name:e.ud_marker,location:{lat:e.ud_latitude,lng:e.ud_longitude},addr:e.ud_street_addr};t.handerSetAddress(s);var n={id:94,latitude:e.ud_latitude,longitude:e.ud_longitude,iconPath:t.markerIcon,width:20,height:30};t.$nextTick((function(){t.markers.push(n)}))}}})},getBaiduOriginalData:function(e,a,i){var s=this,n=new u.BMapWX({ak:s.bdMapAk});"found"==i&&(s.isFound=!0,t.removeStorageSync("city"));n.regeocoding({location:e,coordtype:a,ret_coordtype:"gcj02ll",fail:function(t){console.log("fail",t)},success:function(e){s.latitude=e.originalData.result.location.lat,s.longitude=e.originalData.result.location.lng,console.log(s.latitude,s.longitude),s.originalData=e.originalData;var a=t.getStorageSync("city");a&&(s.originalData.result.addressComponent.city=a);var i=e.originalData.result.pois,n=i.find((function(t){return"附近"===t.distance})),o=i.filter((function(t){return"附近"!==t.distance}));if(o.sort((function(t,e){return parseInt(t.distance,10)-parseInt(e.distance,10)})),s.nearbyAddressList=n?[n].concat((0,r.default)(o)):o,s.markers.length>0&&s.isFound){var d=s.nearbyAddressList[0];s.markers[0].latitude=s.latitude,s.markers[0].longitude=s.longitude,s.markers[1].latitude=s.latitude,s.markers[1].longitude=s.longitude,s.markers[0].callout={content:d.name,color:"#000",fontSize:14,borderRadius:6,bgColor:"#fff",borderWidth:1,borderColor:"rgba(0, 0, 0, 0.4)",padding:8,display:"ALWAYS",textAlign:"center"},s.currAddress=""}s.isFound=!1}})},handerSetAddress:function(t){this.showMarkerIcon=!0,this.showCurrAdd=!0,this.showMask=!1,this.showSearchAddress=!1,this.showPoisList=!1,this.showSelectAddBtn=!1,this.showSearchIpunt=!1,this.isEnableScroll=!1,this.showReposition=!1,this.currAddress=t.name,this.isDragMarker=!1,this.currRoadAddress=t.addr?t.addr:t.province+t.address.replace(/-/g,"");var e=t.location?t.location.lat+","+t.location.lng:t.point.y+","+t.point.x;this.getBaiduOriginalData(e,"gcj02ll")},onSearch:function(){this.showMask=!0},handerSkip:function(){t.navigateTo({url:"/address/selectCity?isAdd=true"})},handerRegionchange:function(t){if(console.log(t),"begin"==t.type&&this.markers.length>0&&(this.showPoisList&&(this.isDragMarker=!0),this.markers[0].latitude=0,this.markers[0].longitude=0,this.markers[0].iconPath="",!this.isDragMarker&&this.showCurrAdd&&this.clearMarkes(),console.log("触发了begin")),"end"==t.type&&this.showMarkerIcon&&!this.showCurrAdd){if(console.log("触发了:","end"),!t.target.centerLocation)return;console.log(t.target.centerLocation),this.isDragMarker=!1;var e=t.target.centerLocation,a=e.latitude,i=e.longitude;this.markers.length>0&&(this.markers[0].latitude=a,this.markers[0].longitude=i,this.markers[0].iconPath=this.markerIcon);var s=a+","+i,n=this,o=new u.BMapWX({ak:n.bdMapAk});o.regeocoding({location:s,coordtype:"gcj02ll",ret_coordtype:"gcj02ll",fail:function(t){console.log("fail",t)},success:function(t){console.log("结果地址",t),n.originalData=t.originalData;var e=t.originalData.result.pois,a=e.find((function(t){return"附近"===t.distance})),i=e.filter((function(t){return"附近"!==t.distance}));i.sort((function(t,e){return parseInt(t.distance,10)-parseInt(e.distance,10)})),n.nearbyAddressList=a?[a].concat((0,r.default)(i)):i;var s=n.nearbyAddressList[0];n.markers[0].callout={content:s.name,color:"#000",fontSize:14,borderRadius:6,bgColor:"#fff",borderWidth:1,borderColor:"rgba(0, 0, 0, 0.4)",padding:8,display:"ALWAYS",textAlign:"center"}}})}},getLocation:function(e){var a=this;console.log(a.markers),t.showLoading({title:"正在获取定位中..."}),t.getLocation({type:"wgs84",isHighAccuracy:!0,geocode:"true",highAccuracyExpireTime:3500,success:function(i){t.hideLoading();var r=i.latitude+","+i.longitude;a.getBaiduOriginalData(r,"wgs84ll",e)},fail:function(e){"getLocation:fail auth deny"==e.errMsg&&t.showModal({content:"检测到您没打开获取信息功能权限,是否去设置打开?",confirmText:"确认",cancelText:"取消",success:function(e){if(!e.confirm)return!1;t.openSetting({success:function(t){}})}})}})},isValidPhoneNumber:function(t){return/^1[3-9]\d{9}$/.test(t)},fuzzyMatch:function(t,e){if(t&&e){var a=t.toLowerCase(),i=e.toLowerCase();return a.includes(i)}console.log("找不到地址")},submitAddress:function(){var e,a=this;if(this.currAddress)if(this.formData.userName)if(this.formData.userPhone){var i=this.isValidPhoneNumber(this.formData.userPhone);if(i){var r=this.originalData,n={label:"",value:0},o={label:"",value:0},d={label:"",value:0};this.provinceData.forEach((function(t){var e=a.fuzzyMatch(r.result.addressComponent.province,t.label);e&&(n=t)})),this.cityData.forEach((function(t){t.forEach((function(t){var e=a.fuzzyMatch(t.label,r.result.addressComponent.city);e&&(o=t)}))})),this.areaData.forEach((function(t){t.forEach((function(t){t.forEach((function(t){var e=a.fuzzyMatch(t.label,r.result.addressComponent.district);e&&(d=t)}))}))}));var c=this.formData.lableName;""===c||-1==c?c="":c+=1;var u=(e={ud_id:this.ud_id||0,ud_city:r.result.addressComponent.city,ud_gender:this.formData.sexType,ud_intl:"+86",ud_mobile:this.formData.userPhone,ud_name:this.formData.userName,ud_marker:this.currAddress,ud_street_addr:this.currRoadAddress,ud_street_no:this.formData.detailAddress,ud_latitude:this.latitude,ud_longitude:this.longitude,ud_label:c||"",ud_province_id:n.value,ud_province:n.label,ud_city_id:o.value},(0,s.default)(e,"ud_city",o.label),(0,s.default)(e,"ud_county_id",d.value),(0,s.default)(e,"ud_county",d.label),(0,s.default)(e,"ud_address",this.currAddress+this.formData.detailAddress),(0,s.default)(e,"ud_is_default",1),e),l=this,h=l.options;this.$.request({url:this.Config.URL.user.address_edit,method:"post",data:u,success:function(t,e,i,r){200==e&&(a.$.showToast({title:"添加成功",icon:"success",duration:2e3}),h.issub?l.$.navigateBack(1,(function(){h.ud_id=t.ud_id,l.notice.postNotificationName("RefreshOrder",h)})):l.$.navigateBack(1,(function(){l.notice.postNotificationName("RefreshAddress",1)})))}})}else t.showToast({title:"请输入正确的手机号",icon:"none"})}else t.showToast({title:"请输入手机号",icon:"none"});else t.showToast({title:"请输入联系人",icon:"none"});else t.showToast({title:"请选择收货地址",icon:"none"})},deleteAddress:function(){var e=this;e.$.showModal({title:e.__("提示"),content:e.__("确认删除这个地址吗?"),showCancel:!0,success:function(a){if(a.confirm){var i={ud_id:e.ud_id};e.$.request({url:e.Config.URL.user.address_remove,method:"post",data:i,success:function(a,i,r,s){200==i&&(e.$.showToast({title:e.__("删除成功!")}),e.notice.postNotificationName("RefreshOrder",0),t.navigateBack())}})}}})},chooseAddressView:function(){var t=this;this.showMarkerIcon=!0,this.showPoisList=!0,this.showSearchIpunt=!0,this.isEnableScroll=!0,this.showCurrAdd=!1,this.showReposition=!0;var e={},a=this.nearbyAddressList.find((function(e){return e.name==t.currAddress}));e=a||this.nearbyAddressList[0];var i=e.point,r=i.x,s=i.y;console.log(r,s);var n={id:94,latitude:s,longitude:r,iconPath:this.markerIcon,width:20,height:30,callout:{content:e.name,color:"#000",fontSize:14,borderRadius:6,bgColor:"#fff",borderWidth:1,borderColor:"rgba(0, 0, 0, 0.4)",padding:8,display:"ALWAYS",textAlign:"center"}},o={id:2,latitude:Number(this.latitude),longitude:Number(this.longitude),iconPath:this.sele2Icon,width:25,height:25},d=[];d.push(n),d.push(o),this.$nextTick((function(){t.markers=d}))},chooseSex:function(t){this.formData.sexType=t},clearMarkes:function(){var t=this;this.$nextTick((function(){console.log(t.latitude,t.longitude),t.markers[0].latitude=t.latitude,t.markers[0].longitude=t.longitude,t.markers[0].iconPath=t.markerIcon,t.markers[0].callout={},t.markers[1]&&(t.markers[1].iconPath="",t.markers[1].latitude=0,t.markers[1].longitude=0)}))},chooseLable:function(t){this.formData.lableName==t?this.formData.lableName=-1:this.formData.lableName=t},changeAgree:function(){this.agreeState=!this.agreeState},acitveAddress:function(t){return t.name==this.currAddress?this.sele2Icon:this.noseleIcon},handerAddress:function(e){var a=this,i=e.target.value;0==i.length?this.showSearchAddress=!1:this.showSearchAddress=!0;var r=function(t){console.log("fail",t)},s={lat:a.originalData.result.location.lat,lng:a.originalData.result.location.lng},o=function(t){var e=t/1e3;return e.toFixed(2)},d=function(e){console.log("结果地址",e),0==e.data.status?(a.searchAddress=e.data.result.filter((function(t){return"location"in t})).map((function(t){var e=c(c({},t),{},{name:t.name,detailedInformation:t.address.replace(/-/g,""),distance:o(n.default.GeoUtils.getDistance(s,t.location))});return e})),console.log("that.searchAddress",a.searchAddress),a.searchAddress.forEach((function(t){t.name.indexOf(i)>=0?t.searchName=t.name.replaceAll(i,"<font style='color:#ee852f;padding:0 4px'>"+i+"</font>"):t.searchName=t.name})),console.log("searchAddress",a.searchAddress)):t.showToast({title:e.message,icon:"none",duration:3e3})},u={query:i,region:this.originalData.result.addressComponent.city,output:"json",city_limit:!0,ak:a.bdMapAk,ret_coordtype:"gcj02ll"},l=a.originalData.result.addressComponent.city;l&&(u.center=""),null!==this.time&&clearTimeout(this.time),this.time=setTimeout((function(){t.request({url:"https://api.map.baidu.com/place/v2/suggestion",data:u,success:d,fail:r})}),600)}}};e.default=l}).call(this,a("df3c")["default"])},c4fb:function(t,e,a){},cd45:function(t,e,a){"use strict";a.r(e);var i=a("8088"),r=a.n(i);for(var s in i)["default"].indexOf(s)<0&&function(t){a.d(e,t,(function(){return i[t]}))}(s);e["default"]=r.a},f7948:function(t,e,a){"use strict";a.d(e,"b",(function(){return r})),a.d(e,"c",(function(){return s})),a.d(e,"a",(function(){return i}));var i={uniNavBar:function(){return a.e("components/uni-nav-bar/uni-nav-bar").then(a.bind(null,"77f4"))},uniIcons:function(){return Promise.all([a.e("common/vendor"),a.e("components/uni-icons/uni-icons")]).then(a.bind(null,"4704"))}},r=function(){var t=this,e=t.$createElement,a=(t._self._c,t.showPoisList&&!t.showSearchAddress?t.__map(t.nearbyAddressList,(function(e,a){var i=t.__get_orig(e),r=t.acitveAddress(e);return{$orig:i,m0:r}})):null),i=t.showSearchAddress&&t.searchAddress.length>0;t._isMounted||(t.e0=function(e){t.showMask=!1}),t.$mp.data=Object.assign({},{$root:{l0:a,g0:i}})},s=[]}},[["72ee","common/runtime","common/vendor","member/common/vendor"]]]);