1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["bundle-pages-address_edit-address_edit"],{"0932":function(e,t,i){"use strict";i.d(t,"b",(function(){return n})),i.d(t,"c",(function(){return s})),i.d(t,"a",(function(){return a}));var a={uIcon:i("4569").default},n=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("v-uni-view",{staticClass:"u-checkbox",style:[e.checkboxStyle]},[i("v-uni-view",{staticClass:"u-checkbox__icon-wrap",class:[e.iconClass],style:[e.iconStyle],on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.toggle.apply(void 0,arguments)}}},[i("u-icon",{staticClass:"u-checkbox__icon-wrap__icon",attrs:{name:"checkbox-mark",size:e.checkboxIconSize,color:e.iconColor}})],1),i("v-uni-view",{staticClass:"u-checkbox__label",style:{fontSize:e.$u.addUnit(e.labelSize)},on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.onClickLabel.apply(void 0,arguments)}}},[e._t("default")],2)],1)},s=[]},"0f83":function(e,t,i){"use strict";var a=i("4ea4");i("99af"),i("e25e"),Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,i("96cf");var n=a(i("1da1")),s=i("e9dc"),r=a(i("bf22")),c={data:function(){return{addressObj:{contact:"",telephone:"",province:"",city:"",district:"",address:"",is_default:!1},region:"",addressId:"",defaultRegion:["广东省","广州市","番禺区"],defaultRegionCode:"440113",showRegion:!1,lists:[]}},onLoad:function(e){var t=this;this.addressId=parseInt(e.id),e.id?(uni.setNavigationBarTitle({title:"编辑地址"}),this.getOneAddressFun()):(uni.setNavigationBarTitle({title:"添加地址"}),this.getWxAddressFun()),this.$nextTick((function(){t.lists=r.default}))},onUnload:function(){uni.removeStorageSync("wxAddress")},methods:{formSubmit:function(){var e=this;return(0,n.default)(regeneratorRuntime.mark((function t(){var i,a,n,r,c,o,d,l,u,h,f,p,b,v;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(i=e.addressObj,a=i.contact,n=i.telephone,r=i.province_id,c=i.city_id,o=i.district_id,d=i.is_default,l=i.address,u=e.addressId,h=e.region,a){t.next=3;break}return t.abrupt("return",e.$toast({title:"请填写收货人姓名"}));case 3:if(n){t.next=5;break}return t.abrupt("return",e.$toast({title:"请填写手机号码"}));case 5:if(h){t.next=7;break}return t.abrupt("return",e.$toast({title:"请选择省、市、区"}));case 7:if(l){t.next=9;break}return t.abrupt("return",e.$toast({title:"请填写小区、街道、门牌号等信息"}));case 9:if(f={contact:a,telephone:n,province_id:parseInt(r),city_id:parseInt(c),district_id:parseInt(o),is_default:d?1:0,id:u,address:l},!u){t.next=16;break}return t.next=13,(0,s.editAddress)(f);case 13:t.t0=t.sent,t.next=19;break;case 16:return t.next=18,(0,s.addAddress)(f);case 18:t.t0=t.sent;case 19:p=t.t0,b=p.code,v=p.msg,1==b&&e.$toast({title:v},{tab:3,url:1});case 23:case"end":return t.stop()}}),t)})))()},regionChange:function(e){this.addressObj.province_id=e[0].value,this.addressObj.city_id=e[1].value,this.addressObj.district_id=e[2].value,this.region=e[0].label+" "+e[1].label+" "+e[2].label},getOneAddressFun:function(){var e=this;(0,s.getOneAddress)(this.addressId).then((function(t){if(1==t.code){var i=t.data,a=i.city,n=i.province,s=i.district;e.addressObj=t.data,e.region="".concat(n," ").concat(a," ").concat(s)}}))},getWxAddressFun:function(){var e=this,t=uni.getStorageSync("wxAddress");if(t){t=JSON.parse(t);var i=t,a=i.userName,n=i.telNumber,r=i.provinceName,c=i.cityName,o=i.detailInfo,d=t.countryName||t.countyName;(0,s.hasRegionCode)({province:r,city:c,district:d}).then((function(t){1==t.code&&(t.data.province&&t.data.city&&t.data.district&&(e.region="".concat(r," ").concat(c," ").concat(d),e.addressObj.province_id=t.data.province,e.addressObj.city_id=t.data.city,e.addressObj.district_id=t.data.district),e.addressObj.contact=a,e.addressObj.telephone=n,e.addressObj.address=o)}))}}}};t.default=c},"244d":function(e,t,i){"use strict";i.d(t,"b",(function(){return n})),i.d(t,"c",(function(){return s})),i.d(t,"a",(function(){return a}));var a={uField:i("2ae6").default,uCheckbox:i("88d4").default,uSelect:i("1f2b").default},n=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("v-uni-view",{staticClass:"address-edit"},[i("v-uni-view",{staticClass:"form bg-white"},[i("u-field",{attrs:{label:"收货人",placeholder:"请填写收货人姓名"},model:{value:e.addressObj.contact,callback:function(t){e.$set(e.addressObj,"contact",t)},expression:"addressObj.contact"}}),i("u-field",{attrs:{label:"联系方式",placeholder:"请填写手机号码"},model:{value:e.addressObj.telephone,callback:function(t){e.$set(e.addressObj,"telephone",t)},expression:"addressObj.telephone"}}),i("v-uni-view",{on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.showRegion=!0}}},[i("u-field",{attrs:{disabled:!0,label:"所在地区",placeholder:"请选择省、市、区","right-icon":"arrow-right"},model:{value:e.region,callback:function(t){e.region=t},expression:"region"}})],1),i("v-uni-view",[i("u-field",{attrs:{type:"textarea",label:"详细地址",placeholder:"请填写小区、街道、门牌号等信息","field-style":{flex:1,height:"200rpx"}},model:{value:e.addressObj.address,callback:function(t){e.$set(e.addressObj,"address",t)},expression:"addressObj.address"}})],1)],1),i("v-uni-view",{staticClass:"m-t-10 m-b-10 bg-white p-20"},[i("u-checkbox",{attrs:{shape:"circle"},on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.changeDefault.apply(void 0,arguments)}},model:{value:e.addressObj.is_default,callback:function(t){e.$set(e.addressObj,"is_default",t)},expression:"addressObj.is_default"}},[i("v-uni-text",{staticClass:"xs"},[e._v("设置为默认")])],1)],1),i("v-uni-button",{staticClass:"my-btn bg-primary white br60",on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.formSubmit.apply(void 0,arguments)}}},[e._v("完成")]),i("u-select",{attrs:{mode:"mutil-column-auto",list:e.lists},on:{confirm:function(t){arguments[0]=t=e.$handleEvent(t),e.regionChange.apply(void 0,arguments)}},model:{value:e.showRegion,callback:function(t){e.showRegion=t},expression:"showRegion"}})],1)},s=[]},"24be":function(e,t,i){"use strict";var a=i("5bb7"),n=i.n(a);n.a},"27a3":function(e,t,i){"use strict";i.r(t);var a=i("df20"),n=i.n(a);for(var s in a)"default"!==s&&function(e){i.d(t,e,(function(){return a[e]}))}(s);t["default"]=n.a},"34f9":function(e,t,i){var a=i("55a8");"string"===typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);var n=i("4f06").default;n("d7201518",a,!0,{sourceMap:!1,shadowMode:!1})},"41a5":function(e,t,i){var a=i("24fb");t=a(!1),t.push([e.i,'@charset "UTF-8";\n/**\n * 这里是uni-app内置的常用样式变量\n *\n * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量\n * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App\n *\n */\n/**\n * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能\n *\n * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件\n */\n/* 颜色变量 */\n/* 行为相关颜色 */.address-edit[data-v-1944a97a]{padding-top:%?10?%}.address-edit .my-btn[data-v-1944a97a]{margin:%?30?% %?26?%;text-align:center}',""]),e.exports=t},"55a8":function(e,t,i){var a=i("24fb");t=a(!1),t.push([e.i,'@charset "UTF-8";\n/**\n * 这里是uni-app内置的常用样式变量\n *\n * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量\n * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App\n *\n */\n/**\n * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能\n *\n * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件\n */\n/* 颜色变量 */\n/* 行为相关颜色 */.u-checkbox[data-v-455821ba]{display:inline-flex;align-items:center;overflow:hidden;-webkit-user-select:none;user-select:none;line-height:1.8}.u-checkbox__icon-wrap[data-v-455821ba]{color:#606266;flex:none;display:-webkit-flex;display:flex;flex-direction:row;align-items:center;justify-content:center;box-sizing:border-box;width:%?42?%;height:%?42?%;color:transparent;text-align:center;transition-property:color,border-color,background-color;font-size:20px;border:1px solid #c8c9cc;transition-duration:.2s}.u-checkbox__icon-wrap--circle[data-v-455821ba]{border-radius:100%}.u-checkbox__icon-wrap--square[data-v-455821ba]{border-radius:%?6?%}.u-checkbox__icon-wrap--checked[data-v-455821ba]{color:#fff;background-color:#ff2c3c;border-color:#ff2c3c}.u-checkbox__icon-wrap--disabled[data-v-455821ba]{background-color:#ebedf0;border-color:#c8c9cc}.u-checkbox__icon-wrap--disabled--checked[data-v-455821ba]{color:#c8c9cc!important}.u-checkbox__label[data-v-455821ba]{word-wrap:break-word;margin-left:%?10?%;margin-right:%?24?%;color:#606266;font-size:%?30?%}.u-checkbox__label--disabled[data-v-455821ba]{color:#c8c9cc}',""]),e.exports=t},"5bb7":function(e,t,i){var a=i("41a5");"string"===typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);var n=i("4f06").default;n("0c1659fe",a,!0,{sourceMap:!1,shadowMode:!1})},"5ebc":function(e,t,i){"use strict";var a=i("34f9"),n=i.n(a);n.a},"88d4":function(e,t,i){"use strict";i.r(t);var a=i("0932"),n=i("27a3");for(var s in n)"default"!==s&&function(e){i.d(t,e,(function(){return n[e]}))}(s);i("5ebc");var r,c=i("f0c5"),o=Object(c["a"])(n["default"],a["b"],a["c"],!1,null,"455821ba",null,!1,a["a"],r);t["default"]=o.exports},d57b:function(e,t,i){"use strict";i.r(t);var a=i("244d"),n=i("de8d");for(var s in n)"default"!==s&&function(e){i.d(t,e,(function(){return n[e]}))}(s);i("24be");var r,c=i("f0c5"),o=Object(c["a"])(n["default"],a["b"],a["c"],!1,null,"1944a97a",null,!1,a["a"],r);t["default"]=o.exports},de8d:function(e,t,i){"use strict";i.r(t);var a=i("0f83"),n=i.n(a);for(var s in a)"default"!==s&&function(e){i.d(t,e,(function(){return a[e]}))}(s);t["default"]=n.a},df20:function(e,t,i){"use strict";i("d81d"),i("a9e3"),Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a={name:"u-checkbox",props:{name:{type:[String,Number],default:""},shape:{type:String,default:""},value:{type:Boolean,default:!1},disabled:{type:[String,Boolean],default:""},labelDisabled:{type:[String,Boolean],default:""},activeColor:{type:String,default:""},iconSize:{type:[String,Number],default:""},labelSize:{type:[String,Number],default:""},size:{type:[String,Number],default:""}},data:function(){return{parentDisabled:!1,newParams:{}}},created:function(){this.parent=this.$u.$parent.call(this,"u-checkbox-group"),this.parent&&this.parent.children.push(this)},computed:{isDisabled:function(){return""!==this.disabled?this.disabled:!!this.parent&&this.parent.disabled},isLabelDisabled:function(){return""!==this.labelDisabled?this.labelDisabled:!!this.parent&&this.parent.labelDisabled},checkboxSize:function(){return this.size?this.size:this.parent?this.parent.size:34},checkboxIconSize:function(){return this.iconSize?this.iconSize:this.parent?this.parent.iconSize:20},elActiveColor:function(){return this.activeColor?this.activeColor:this.parent?this.parent.activeColor:"primary"},elShape:function(){return this.shape?this.shape:this.parent?this.parent.shape:"square"},iconStyle:function(){var e={};return this.elActiveColor&&this.value&&!this.isDisabled&&(e.borderColor=this.elActiveColor,e.backgroundColor=this.elActiveColor),e.width=this.$u.addUnit(this.checkboxSize),e.height=this.$u.addUnit(this.checkboxSize),e},iconColor:function(){return this.value?"#ffffff":"transparent"},iconClass:function(){var e=[];return e.push("u-checkbox__icon-wrap--"+this.elShape),1==this.value&&e.push("u-checkbox__icon-wrap--checked"),this.isDisabled&&e.push("u-checkbox__icon-wrap--disabled"),this.value&&this.isDisabled&&e.push("u-checkbox__icon-wrap--disabled--checked"),e.join(" ")},checkboxStyle:function(){var e={};return this.parent&&this.parent.width&&(e.width=this.parent.width,e.flex="0 0 ".concat(this.parent.width)),this.parent&&this.parent.wrap&&(e.width="100%",e.flex="0 0 100%"),e}},methods:{onClickLabel:function(){this.isLabelDisabled||this.isDisabled||this.setValue()},toggle:function(){this.isDisabled||this.setValue()},emitEvent:function(){var e=this;this.$emit("change",{value:!this.value,name:this.name}),setTimeout((function(){e.parent&&e.parent.emitEvent&&e.parent.emitEvent()}),80)},setValue:function(){var e=0;if(this.parent&&this.parent.children&&this.parent.children.map((function(t){t.value&&e++})),1==this.value)this.emitEvent(),this.$emit("input",!this.value);else{if(this.parent&&e>=this.parent.max)return this.$u.toast("最多可选".concat(this.parent.max,"项"));this.emitEvent(),this.$emit("input",!this.value)}}}};t.default=a}}]); |