user_address.js 5.4 KB

1
  1. require('./common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/points_mall/user_address"],{"1d61":function(t,e,s){"use strict";var i=s("f6ce"),n=s.n(i);n.a},"2b37":function(t,e,s){"use strict";(function(t,e){var i=s("4ea4");s("59a4");i(s("66fd"));var n=i(s("87ac"));t.__webpack_require_UNI_MP_PLUGIN__=s,e(n.default)}).call(this,s("bc2e")["default"],s("543d")["createPage"])},"82dc":function(t,e,s){"use strict";s.r(e);var i=s("875e"),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},"875e":function(t,e,s){"use strict";(function(t){var i=s("4ea4");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=s("4818"),d=s("8e8a"),o=s("26cb"),a=i(s("5c3b")),r=s("865e"),u={components:{home:function(){Promise.all([s.e("common/vendor"),s.e("components/home/index")]).then(function(){return resolve(s("377d"))}.bind(null,s)).catch(s.oe)}},mixins:[a.default],data:function(){return{addressList:[],loading:!1,loadend:!1,loadTitle:"加载更多",page:1,limit:20,isAuto:!1,isShowAuth:!1,news:"",unique:"",num:"",imgHost:r.HTTP_REQUEST_URL}},computed:(0,o.mapGetters)(["isLogin"]),onLoad:function(t){this.unique=t.unique,this.num=t.num,this.isLogin?(this.cartId=t.cartId||"",this.pinkId=t.pinkId||0,this.couponId=t.couponId||0,this.news=t.news||0,this.getAddressList(!0)):(0,d.toLogin)()},onShow:function(){t.removeStorageSync("form_type_cart")},methods:{onLoadFun:function(){this.getAddressList(),this.isShowAuth=!1},authColse:function(t){this.isShowAuth=t},getWxAddress:function(){var e=this;t.authorize({scope:"scope.address",success:function(s){t.chooseAddress({success:function(t){var s={};s.province=t.provinceName,s.city=t.cityName,s.district=t.countyName,(0,n.editAddress)({address:s,is_default:1,real_name:t.userName,post_code:t.postalCode,phone:t.telNumber,detail:t.detailInfo,id:0,type:1}).then((function(t){e.$util.Tips({title:"添加成功",icon:"success"},(function(){e.getAddressList(!0)}))})).catch((function(t){return e.$util.Tips({title:t})}))},fail:function(t){if("chooseAddress:cancel"==t.errMsg)return e.$util.Tips({title:"取消选择"})}})},fail:function(s){t.showModal({title:"您已拒绝导入微信地址权限",content:"是否进入权限管理,调整授权?",success:function(s){if(s.confirm)t.openSetting({success:function(t){}});else if(s.cancel)return e.$util.Tips({title:"已取消!"})}})}})},getAddress:function(){var t=this;t.$wechat.openAddress().then((function(e){(0,n.editAddress)({real_name:e.userName,phone:e.telNumber,address:{province:e.provinceName,city:e.cityName,district:e.countryName},detail:e.detailInfo,post_code:e.postalCode,is_default:1,type:1}).then((function(){t.$util.Tips({title:"添加成功",icon:"success"},(function(){t.getAddressList(!0)}))})).catch((function(e){return t.$util.Tips({title:e||"添加失败"})}))}))},getAddressList:function(t){var e=this;t&&(e.loadend=!1,e.page=1,e.$set(e,"addressList",[])),e.loading||e.loadend||(e.loading=!0,e.loadTitle="",(0,n.getAddressList)({page:e.page,limit:e.limit}).then((function(t){var s=t.data,i=s.length<e.limit;e.addressList=e.$util.SplitArray(s,e.addressList),e.$set(e,"addressList",e.addressList),e.loadend=i,e.loadTitle=i?"没有更多内容啦~":"加载更多",e.page=e.page+1,e.loading=!1})).catch((function(t){e.loading=!1,e.loadTitle="加载更多"})))},radioChange:function(t){var e=parseInt(t.detail.value),s=this,i=this.addressList[e];if(void 0==i)return s.$util.Tips({title:"您设置的默认地址不存在!"});(0,n.setAddressDefault)(i.id).then((function(t){for(var i=0,n=s.addressList.length;i<n;i++)s.addressList[i].is_default=i==e;s.$util.Tips({title:"设置成功",icon:"success"},(function(){s.$set(s,"addressList",s.addressList)}))})).catch((function(t){return s.$util.Tips({title:t})}))},editAddress:function(e){this.cartId;var s=this.pinkId,i=this.couponId;this.cartId="",this.pinkId="",this.couponId="",t.navigateTo({url:"/pages/users/user_address/index?id="+e+"&pinkId="+s+"&couponId="+i+"&new="+this.news})},delAddress:function(t){var e=this,s=this.addressList[t];if(void 0==s)return e.$util.Tips({title:"您删除的地址不存在!"});(0,n.delAddress)(s.id).then((function(s){e.$util.Tips({title:"删除成功",icon:"success"},(function(){e.addressList.splice(t,1),e.$set(e,"addressList",e.addressList)}))})).catch((function(t){return e.$util.Tips({title:t})}))},addAddress:function(){t.navigateTo({url:"/pages/users/user_address/index?&new="+this.news})},goOrder:function(e){e&&t.redirectTo({url:"/pages/points_mall/integral_order?is_address=1&new="+this.news+"&addressId="+e+"&num="+this.num+"&unique="+this.unique})}},onReachBottom:function(){this.getAddressList()}};e.default=u}).call(this,s("543d")["default"])},"87ac":function(t,e,s){"use strict";s.r(e);var i=s("ef5e"),n=s("82dc");for(var d in n)["default"].indexOf(d)<0&&function(t){s.d(e,t,(function(){return n[t]}))}(d);s("1d61");var o=s("f0c5"),a=Object(o["a"])(n["default"],i["b"],i["c"],!1,null,null,null,!1,i["a"],void 0);e["default"]=a.exports},ef5e:function(t,e,s){"use strict";s.d(e,"b",(function(){return i})),s.d(e,"c",(function(){return n})),s.d(e,"a",(function(){}));var i=function(){var t=this,e=t.$createElement,s=(t._self._c,t.addressList.length<1&&t.page>1),i=t.addressList.length,n=t.addressList.length,d=t.addressList.length,o=t.addressList.length<1&&t.page>1;t.$mp.data=Object.assign({},{$root:{g0:s,g1:i,g2:n,g3:d,g4:o}})},n=[]},f6ce:function(t,e,s){}},[["2b37","common/runtime","common/vendor"]]]);