1 line
10 KiB
JavaScript
1 line
10 KiB
JavaScript
|
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-users-user_address_list-index"],{4385:function(t,i,e){"use strict";var n=e("b6b5"),a=e.n(n);a.a},"70bc":function(t,i,e){"use strict";e.r(i);var n=e("98dc"),a=e("9b36");for(var s in a)["default"].indexOf(s)<0&&function(t){e.d(i,t,(function(){return a[t]}))}(s);e("4385");var d=e("828b"),o=Object(d["a"])(a["default"],n["b"],n["c"],!1,null,"7a758bfc",null,!1,n["a"],void 0);i["default"]=o.exports},"8eaf":function(t,i,e){"use strict";e("6a54"),Object.defineProperty(i,"__esModule",{value:!0}),i.default=void 0,e("e966"),e("dd2b");var n=e("672a"),a=e("8f59"),s=e("aa10"),d=e("e44d"),o={components:{},data:function(){return{addressList:[],cartId:"",pinkId:0,couponId:0,loading:!1,loadend:!1,loadTitle:"加载更多",page:1,limit:20,domain:s.HTTP_REQUEST_URL}},computed:(0,a.mapGetters)(["isLogin","viewColor"]),onLoad:function(t){this.isLogin?(this.cartId=t.cartId||"",this.pinkId=t.pinkId||0,this.couponId=t.couponId||0,this.getAddressList(!0)):(0,d.toLogin)()},onReady:function(){},onShow:function(){this.getAddressList(!0)},methods:{getWxAddress:function(){var t=this;uni.authorize({scope:"scope.address",success:function(i){uni.chooseAddress({success:function(i){var e={};e.province=i.provinceName,e.city=i.cityName,e.district=i.countyName,(0,n.editAddress)({is_default:1,real_name:i.userName,phone:i.telNumber,detail:i.detailInfo,province:i.provinceName,district:i.countyName,city:i.cityName,city_id:""}).then((function(i){t.$util.Tips({title:"添加成功",icon:"success"},(function(){t.getAddressList(!0)}))})).catch((function(i){return t.$util.Tips({title:i})}))},fail:function(i){if("chooseAddress:cancel"==i.errMsg)return t.$util.Tips({title:"取消选择"})}})},fail:function(i){uni.showModal({title:"您已拒绝导入微信地址权限",content:"是否进入权限管理,调整授权?",success:function(i){if(i.confirm)uni.openSetting({success:function(t){}});else if(i.cancel)return t.$util.Tips({title:"已取消!"})}})}})},getAddress:function(){var t=this;t.$wechat.openAddress().then((function(i){(0,n.editAddress)({real_name:i.userName,phone:i.telNumber,province:i.provinceName,city:i.cityName,district:i.countryName,detail:i.detailInfo,post_code:i.postalCode,is_default:1,city_id:""}).then((function(){t.$util.Tips({title:"添加成功",icon:"success"},(function(){t.getAddressList(!0)}))})).catch((function(i){return t.$util.Tips({title:i||"添加失败"})}))}))},getAddressList:function(t){var i=this;t&&(i.loadend=!1,i.page=1,i.$set(i,"addressList",[])),i.loading||i.loadend||(i.loading=!0,i.loadTitle="",(0,n.getAddressList)({page:i.page,limit:i.limit}).then((function(t){var e=t.data.list,n=e.length<i.limit;i.addressList=i.$util.SplitArray(e,i.addressList),i.$set(i,"addressList",i.addressList),i.loadend=n,i.loadTitle=n?"我也是有底线的":"加载更多",i.page=i.page+1,i.loading=!1})).catch((function(t){i.loading=!1,i.loadTitle="加载更多"})))},radioChange:function(t){var i=parseInt(t.detail.value),e=this,a=this.addressList[i];if(void 0==a)return e.$util.Tips({title:"您设置的默认地址不存在!"});(0,n.setAddressDefault)(a.address_id).then((function(t){for(var n=0,a=e.addressList.length;n<a;n++)e.addressList[n].is_default=n==i;e.$util.Tips({title:"设置成功",icon:"success"},(function(){e.$set(e,"addressList",e.addressList)}))})).catch((function(t){return e.$util.Tips({title:t})}))},editAddress:function(t){var i=this.cartId,e=this.pinkId,n=this.couponId;this.cartId="",this.pinkId="",this.couponId="",uni.navigateTo({url:"/pages/users/user_address/index?id="+t+"&cartId="+i+"&pinkId="+e+"&couponId="+n})},delAddress:function(t){var i=this,e=this.addressList[t];if(void 0==e)return i.$util.Tips({title:"您删除的地址不存在!"});(0,n.delAddress)(e.address_id).then((function(e){i.$util.Tips({title:"删除成功",icon:"success"},(function(){i.addressList.splice(t,1),i.$set(i,"addressList",i.addressList)}))})).catch((function(t){return i.$util.Tips({title:t})}))},addAddress:function(){var t=this.cartId;this.pinkId,this.couponId;this.cartId="",this.pinkId="",this.c
|