You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
8.2 KiB
1 lines
8.2 KiB
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["user-pages-address-edit"],{"022d":function(t,e,i){"use strict";i.d(e,"b",(function(){return a})),i.d(e,"c",(function(){return n})),i.d(e,"a",(function(){}));var a=function(){var t=this,e=t.$createElement,i=t._self._c||e;return t.isLoad?i("v-uni-view",{staticClass:"apply-pages"},[i("v-uni-view",{staticClass:"apply-form pl-lg pr-lg"},[i("v-uni-view",{staticClass:"fill-base mt-md radius-16"},[i("v-uni-view",{staticClass:"flex-between ml-lg mr-lg b-1px-b"},[i("v-uni-view",{staticClass:"item-text"},[t._v("联系人")]),i("v-uni-input",{staticClass:"item-input flex-1",attrs:{type:"text",maxlength:"20",placeholder:t.rule[0].errorMsg},model:{value:t.form.user_name,callback:function(e){t.$set(t.form,"user_name",e)},expression:"form.user_name"}})],1),i("v-uni-view",{staticClass:"flex-between ml-lg mr-lg"},[i("v-uni-view",{staticClass:"item-text"},[t._v("手机号")]),i("v-uni-input",{staticClass:"item-input flex-1",attrs:{type:"text",placeholder:t.rule[1].errorMsg},model:{value:t.form.mobile,callback:function(e){t.$set(t.form,"mobile",e)},expression:"form.mobile"}})],1)],1),i("v-uni-view",{staticClass:"fill-base mt-md radius-16"},[i("v-uni-view",{staticClass:"flex-between ml-lg mr-lg b-1px-b"},[i("v-uni-view",{staticClass:"item-text"},[t._v("选择地区")]),i("v-uni-view",{staticClass:"item-input text flex-1",on:{click:function(e){e.stopPropagation(),arguments[0]=e=t.$handleEvent(e),t.toChooseLocation.apply(void 0,arguments)}}},[i("v-uni-view",{staticClass:"flex-y-center text-right"},[i("v-uni-view",{staticClass:"flex-1 text-right"},[t._v(t._s(t.form.address||"点击右边图标设置"))]),i("i",{staticClass:"iconfont iconjuli ml-sm",style:{color:t.primaryColor}})],1)],1)],1),i("v-uni-view",{staticClass:"flex-between ml-lg mr-lg"},[i("v-uni-view",{staticClass:"item-text"},[t._v("详细地址")]),i("v-uni-input",{staticClass:"item-input flex-1",attrs:{type:"text",placeholder:t.rule[3].errorMsg},model:{value:t.form.address_info,callback:function(e){t.$set(t.form,"address_info",e)},expression:"form.address_info"}})],1)],1),i("v-uni-view",{staticClass:"fill-base mt-md radius-16"},[i("v-uni-view",{staticClass:"flex-between ml-lg mr-lg"},[i("v-uni-view",{staticClass:"item-text flex-1",staticStyle:{width:"300rpx"}},[t._v("设为默认地址")]),i("v-uni-view",{staticClass:"item-input",on:{click:function(e){e.stopPropagation(),arguments[0]=e=t.$handleEvent(e),t.form.status=1==t.form.status?0:1}}},[i("i",{staticClass:"iconfont icon-switch",class:[{"icon-switch-on":1==t.form.status}],style:{color:1==t.form.status?t.primaryColor:"#f2f2f2"}})])],1)],1),i("v-uni-view",{staticClass:"f-icontext c-caption mt-md"},[t._v("设置后,下单时优先展示该地址")])],1),i("v-uni-view",{staticClass:"space-max-footer"}),i("fix-bottom-button",{attrs:{text:t.textArr,bgColor:"#fff"},on:{cancel:function(e){arguments[0]=e=t.$handleEvent(e),t.toDel.apply(void 0,arguments)},confirm:function(e){arguments[0]=e=t.$handleEvent(e),t.submit.apply(void 0,arguments)}}})],1):t._e()},n=[]},3032:function(t,e,i){"use strict";i.r(e);var a=i("022d"),n=i("c1d5");for(var r in n)["default"].indexOf(r)<0&&function(t){i.d(e,t,(function(){return n[t]}))}(r);var s=i("828b"),o=Object(s["a"])(n["default"],a["b"],a["c"],!1,null,"70cd46f7",null,!1,a["a"],void 0);e["default"]=o.exports},83453:function(t,e,i){"use strict";i("6a54");var a=i("f5bd").default;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,i("dd2b"),i("fd3c");var n=a(i("5de6")),r=a(i("2634")),s=a(i("2fdc")),o=a(i("9b1b")),l=i("8f59"),u={components:{},data:function(){return{isLoad:!1,options:{},textArr:[{text:"删除",type:"cancel"},{text:"保存",type:"confirm"}],form:{id:0,user_name:"",mobile:"",address:"",address_info:"",lng:"",lat:"",status:0},rule:[{name:"user_name",checkType:"isNotNull",errorMsg:"输入联系人姓名",regType:2},{name:"mobile",checkType:"isMobile",errorMsg:"输入手机号"},{name:"address",checkType:"isNotNull",errorMsg:"设置地区"},{name:"address_info",checkType:"isNotNull",errorMsg:"输入街道、楼牌号等",regType:2}],lockTap:!1}},computed:(0,l.mapState)({primaryColor:function(t){return t.config.configInfo.primaryColor},subColor:function(t){return t.config.configInfo.subColor},location:function(t){return t.user.location}}),onLoad:function(t){this.options=t,this.initIndex()},methods:(0,o.default)((0,o.default)({},(0,l.mapMutations)(["updateUserItem","updateOrderItem"])),{},{initIndex:function(){var t=this;return(0,s.default)((0,r.default)().mark((function e(){var i,a,n,s;return(0,r.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(!t.$jweixin.isWechat()){e.next=4;break}return e.next=3,t.$jweixin.initJssdk();case 3:t.$jweixin.wxReady((function(){t.$jweixin.hideOptionMenu()}));case 4:if(i=t.options.id,a=void 0===i?0:i,uni.setNavigationBarTitle({title:a?"编辑地址":"添加新地址"}),a){e.next=11;break}return t.textArr.splice(0,1),t.isLoad=!0,t.$util.setNavigationBarColor({bg:t.primaryColor}),e.abrupt("return");case 11:return e.next=13,t.$api.mine.addressInfo({id:a});case 13:for(s in n=e.sent,t.form)t.form[s]=n[s];t.$util.setNavigationBarColor({bg:t.primaryColor}),t.isLoad=!0;case 17:case"end":return e.stop()}}),e)})))()},toChooseLocation:function(t){var e=this;return(0,s.default)((0,r.default)().mark((function t(){var i,a,s,o,l,u,c,d,f,p,m,v,x,w,b,h,g,k,C,$,y;return(0,r.default)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,e.$util.checkAuth({type:"userLocation"});case 2:if(i=e.location,a=i.lat,s=void 0===a?"":a,o=i.lng,l=void 0===o?"":o,u=e.form,c=u.id,d=void 0===c?0:c,f=u.lat,p=u.lng,d&&(s=f,l=p),m={},s||l){t.next=18;break}if(!e.$jweixin.isWechat()){t.next=18;break}return e.$util.showLoading(),t.next=11,e.$jweixin.wxReady2();case 11:return t.next=13,e.$jweixin.getWxLocation();case 13:v=t.sent,x=v.latitude,w=v.longitude,s=x,l=w;case 18:return m={latitude:s,longitude:l},t.next=21,uni.chooseLocation(m);case 21:if(b=t.sent,h=(0,n.default)(b,2),g=h[1],k=g.address,C=void 0===k?"":k,$=g.longitude,y=g.latitude,g.name,C){t.next=31;break}return t.abrupt("return");case 31:e.form.address=C,e.form.lng=$,e.form.lat=y;case 34:case"end":return t.stop()}}),t)})))()},toDel:function(){var t=this;return(0,s.default)((0,r.default)().mark((function e(){var i,a,s,o,l,u;return(0,r.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,uni.showModal({title:"提示",content:"请确认是否要删除此数据?"});case 2:if(i=e.sent,a=(0,n.default)(i,2),a[0],s=a[1].confirm,s){e.next=8;break}return e.abrupt("return");case 8:if(o=t.form.id,l=t.$util.getPage(-1),u=l.check_id,!t.lockTap){e.next=12;break}return e.abrupt("return");case 12:return t.lockTap=!0,t.$util.showLoading(),e.prev=14,e.next=17,t.$api.mine.addressDel({id:o});case 17:t.$util.hideAll(),t.$util.showToast({title:"删除成功"}),t.lockTap=!1,o==u&&t.updateOrderItem({key:"haveOperItem",val:!0}),setTimeout((function(){t.$util.back(),t.$util.goUrl({url:1,openType:"navigateBack"})}),1e3),e.next=27;break;case 24:e.prev=24,e.t0=e["catch"](14),setTimeout((function(){t.lockTap=!1,t.$util.hideAll()}),2e3);case 27:case"end":return e.stop()}}),e,null,[[14,24]])})))()},validate:function(t){var e=new this.$util.Validate;this.rule.map((function(i){var a=i.name;e.add(t[a],i)}));var i=e.start();return i},submit:function(){var t=this;return(0,s.default)((0,r.default)().mark((function e(){var i,a,n;return(0,r.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(i=t.$util.deepCopy(t.form),a=t.validate(i),!a){e.next=5;break}return t.$util.showToast({title:a}),e.abrupt("return");case 5:if(!t.lockTap){e.next=7;break}return e.abrupt("return");case 7:return t.lockTap=!0,t.$util.showLoading(),e.prev=9,n=i.id?"addressUpdate":"addressAdd",e.next=13,t.$api.mine[n](i);case 13:t.$util.hideAll(),t.$util.showToast({title:"保存成功"}),setTimeout((function(){t.$util.back(),t.$util.goUrl({url:1,openType:"navigateBack"})}),1e3),e.next=21;break;case 18:e.prev=18,e.t0=e["catch"](9),setTimeout((function(){t.lockTap=!1,t.$util.hideAll()}),2e3);case 21:case"end":return e.stop()}}),e,null,[[9,18]])})))()}})};e.default=u},c1d5:function(t,e,i){"use strict";i.r(e);var a=i("83453"),n=i.n(a);for(var r in a)["default"].indexOf(r)<0&&function(t){i.d(e,t,(function(){return a[t]}))}(r);e["default"]=n.a}}]); |