var $url="/wx/account",$urlMp="/wx/account/mp",$urlTenPay="/wx/account/tenPay",data=utils.init({siteId:utils.getQueryInt("siteId"),mpUrl:null,defaultTenPayAuthorizeUrl:null,defaultTenPayNotifyUrl:null,account:null,mpForm:null,tenPayForm:null,mpResult:null}),methods={apiGet:function(){var t=this;utils.loading(this,!0),$api.get($url,{params:{siteId:this.siteId}}).then(function(e){var n=e.data;t.mpUrl=n.mpUrl,t.defaultTenPayAuthorizeUrl=n.defaultTenPayAuthorizeUrl,t.defaultTenPayNotifyUrl=n.defaultTenPayNotifyUrl,t.account=n.account,t.mpForm=Object.assign({},n.account),t.tenPayForm=Object.assign({},n.account)}).catch(function(t){utils.error(t)}).then(function(){utils.loading(t,!1)})},apiMpSubmit:function(){this.mpResult=null;var t=this;utils.loading(this,!0),$api.post($urlMp,{siteId:this.siteId,mpAppId:this.mpForm.mpAppId,mpAppSecret:this.mpForm.mpAppSecret}).then(function(e){var n=e.data;t.mpResult={success:n.success,errorMessage:n.errorMessage},t.account=n.account}).catch(function(t){utils.error(t)}).then(function(){utils.loading(t,!1)})},apiTenPaySubmit:function(){var t=this;utils.loading(this,!0),$api.post($urlTenPay,{siteId:this.siteId,tenPayAppId:this.tenPayForm.tenPayAppId,tenPayAppSecret:this.tenPayForm.tenPayAppSecret,tenPayMchId:this.tenPayForm.tenPayMchId,tenPayKey:this.tenPayForm.tenPayKey,tenPayAuthorizeUrl:this.tenPayForm.tenPayAuthorizeUrl,tenPayNotifyUrl:this.tenPayForm.tenPayNotifyUrl}).then(function(t){t.data;utils.success("微信支付设置保存成功！")}).catch(function(t){utils.error(t)}).then(function(){utils.loading(t,!1)})},btnResetClick:function(t){"mpUrl"===t?this.mpForm.mpUrl=this.mpUrl:"tenPayAuthorizeUrl"===t?this.tenPayForm.tenPayAuthorizeUrl=this.defaultTenPayAuthorizeUrl:"tenPayNotifyUrl"===t&&(this.tenPayForm.tenPayNotifyUrl=this.defaultTenPayNotifyUrl)},btnMpSubmitClick:function(){var t=this;this.$refs.mpForm.validate(function(e){e&&t.apiMpSubmit()})},btnTenPaySubmitClick:function(){var t=this;this.$refs.tenPayForm.validate(function(e){e&&t.apiTenPaySubmit()})}},$vue=new Vue({el:"#main",data:data,methods:methods,created:function(){this.apiGet()}});