(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["plugins/mch/mch/config/config"],{"1b31":function(e,t,i){"use strict";var a,o=function(){var e=this,t=e.$createElement;e._self._c},c=[];i.d(t,"b",(function(){return o})),i.d(t,"c",(function(){return c})),i.d(t,"a",(function(){return a}))},6114:function(e,t,i){"use strict";var a=i("ebbd"),o=i.n(a);o.a},"9de2":function(e,t,i){"use strict";(function(e){i("8748");a(i("66fd"));var t=a(i("ebd3"));function a(e){return e&&e.__esModule?e:{default:e}}e(t.default)}).call(this,i("543d")["createPage"])},a76c:function(e,t,i){"use strict";i.r(t);var a=i("ccd9"),o=i.n(a);for(var c in a)"default"!==c&&function(e){i.d(t,e,(function(){return a[e]}))}(c);t["default"]=o.a},bde3:function(e,t,i){"use strict";var a=i("e4ae"),o=i.n(a);o.a},ccd9:function(e,t,i){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=function(){i.e("components/page-component/app-area-picker/app-area-picker").then(function(){return resolve(i("30cb"))}.bind(null,i)).catch(i.oe)},o={name:"config",components:{appAreaPicker:a},data:function(){return{mch_id:-1,category_list:[],area:{province_id:0,city_id:0,district_id:0},form:{},form_data:{}}},onLoad:function(e){this.mch_id=e.mch_id,this.getCategory()},methods:{getCategory:function(){var e=this;e.$request({url:e.$api.mch.category,data:{id:e.mch_id}}).then((function(t){0===t.code&&(e.category_list=t.data.list,e.loadData())}))},loadData:function(){var e=this;e.$showLoading(),e.$request({url:e.$api.mch.detail,data:{id:e.mch_id,review_status:1}}).then((function(t){if(e.$hideLoading(),0===t.code){var i=t.data.detail,a="",o=0;e.category_list.map((function(e,t){e.id==i.mch_common_cat_id&&(a=e.name,o=t)})),e.form={id:i.id,realname:i.realname,mobile:i.mobile,wechat:i.wechat,address:i.store.address,name:i.store.name,service_mobile:i.store.mobile,mch_common_cat_str:a,mch_common_cat_key:o,mch_common_cat_id:i.mch_common_cat_id,cover_url:i.store.cover_url,username:i.mchUser.username,pic_url:i.store.pic_url.length>0?i.store.pic_url[0].pic_url:"",form_data:i.form_data},e.area={province_id:i.store.province_id,city_id:i.store.city_id,district_id:i.store.district_id}}}))},navPassword:function(){e.navigateTo({url:"/plugins/mch/mch/password/password?mch_id="+this.mch_id})},applyInput:function(e){var t=e.currentTarget.dataset.type;this.form[t]=e.detail.value},categoryChange:function(e){var t=this.category_list[e.detail.value];this.form.mch_common_cat_id=t.id,this.form.mch_common_cat_str=t.name,this.form.mch_common_cat_key=e.detail.value},areaEvent:function(e){e&&(this.area.province_id=e.province.id,this.area.city_id=e.city.id,this.area.district_id=e.district.id)},uploadCoverUrl:function(t){var i=this;e.chooseImage({count:1,success:function(t){e.uploadFile({url:i.$api.upload.file,filePath:t.tempFilePaths[0],name:"file",formData:{file:t.tempFilePaths[0]},success:function(t){var a=JSON.parse(t.data);0===a.code?(i.form.cover_url=a.data.url,e.showToast({title:"上传成功"})):e.showToast({icon:"none",title:a.msg})}})}})},uploadPicUrl:function(t){var i=this;e.chooseImage({count:1,success:function(t){e.uploadFile({url:i.$api.upload.file,filePath:t.tempFilePaths[0],name:"file",formData:{file:t.tempFilePaths[0]},success:function(t){var a=JSON.parse(t.data);0===a.code?(i.form.pic_url=a.data.url,i.form.pic_url_id=a.data.id,e.showToast({title:"上传成功"})):e.showToast({icon:"none",title:a.msg})},file:function(e){console.error(e)}})},fail:function(e){console.error(e)}})},formSubmit:function(t){var i=this,a=i.form,o=i.area,c=function(){return a.realname?a.mobile?a.username?a.mch_common_cat_id?!a.name&&"店铺名称不能为空":"类目不能为空":"账号不能为空":"联系电话不能为空":"联系人不能为空"}();c?e.showToast({icon:"none",title:c}):(i.$showLoading({title:"保存中"}),i.$request({url:i.$api.mch.apply,data:{id:a.id,mch_common_cat_id:a.mch_common_cat_id,address:a.address,username:a.username,name:a.name,service_mobile:a.service_mobile,realname:a.realname,mobile:a.mobile,wechat:a.wechat,form_data:JSON.stringify(a.form_data),province_id:o.province_id,city_id:o.city_id,district_id:o.district_id,logo:a.cover_url,bg_pic_url:JSON.stringify({pic_url:a.pic_url,id:a.pic_url_id})},method:"POST"}).then((function(t){i.$hideLoading(),0===t.code?e.showModal({title:"提示",content:t.msg,showCancel:!1,success:function(t){t.confirm&&e.navigateBack({delta:1})}}):e.showToast({icon:"none",title:t.msg})})))}}};t.default=o}).call(this,i("543d")["default"])},e4ae:function(e,t,i){},ebbd:function(e,t,i){},ebd3:function(e,t,i){"use strict";i.r(t);var a=i("1b31"),o=i("a76c");for(var c in o)"default"!==c&&function(e){i.d(t,e,(function(){return o[e]}))}(c);i("6114"),i("bde3");var n,r=i("f0c5"),d=Object(r["a"])(o["default"],a["b"],a["c"],!1,null,"39e666b6",null,!1,a["a"],n);t["default"]=d.exports}},[["9de2","common/runtime","common/vendor"]]]);