1 line
4.2 KiB
JavaScript
Executable File
1 line
4.2 KiB
JavaScript
Executable File
webpackJsonp([94],{NOL4:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a("Xxa5"),s=a.n(r),i=a("exGp"),n=a.n(i),o={data:function(){return{fileName:"",subForm:{mch_id:"",pay_key:"",cert_path:"",key_path:""},subFormRules:{mch_id:{required:!0,type:"string",message:"请输入商户号",trigger:"blur"},pay_key:[{required:!0,type:"string",message:"请输入支付秘钥",trigger:"blur"},{validator:function(e,t,a){/^[0-9a-zA-Z]*$/g.test(t)?a():a(new Error("请输入字母数字类型"))},trigger:"blur"}],cert_path:{required:!0,type:"string",message:"请上传证书",trigger:"change"},key_path:{required:!0,type:"string",message:"请上传证书",trigger:"change"}}}},created:function(){this.getFormInfo()},methods:{handleBtnUplaod:function(e){this.fileName=e,this.$refs.inputFile.click()},uploadFiles:function(e){var t=this,a=e.target.files[0];if(a.name.indexOf("pem")<0)this.$message.error("请上传pem格式的文件");else{var r=new FormData;r.append("file[]",a),r.append("type","cert"),this.$api.upload.uploadFiles(r).then(function(e){200===e.code&&(t.$message.success(t.$t("tips.successUpload")),t.subForm[t.fileName]=e.data[0].attachment)})}},getFormInfo:function(){var e=this;return n()(s.a.mark(function t(){var a,r,i,n;return s.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.$api.system.payConfigInfo();case 2:if(a=t.sent,r=a.code,i=a.data,200===r){t.next=7;break}return t.abrupt("return");case 7:for(n in e.subForm)e.subForm[n]=i[n];case 8:case"end":return t.stop()}},t,e)}))()},submitFormInfo:function(){var e=this;this.$refs.subForm.validate(function(t){if(t){var a=e.subForm;e.$api.system.payConfigUpdate(a).then(function(t){200===t.code&&e.$message.success(e.$t("tips.successSub"))})}})},handleFileUrl:function(e){return e?e.substring(e.lastIndexOf("cert")+1):""}},watch:{"subForm.cert_path":function(e,t){e&&!t&&this.$refs.subForm.clearValidate("cert_path")},"subForm.key_path":function(e,t){e&&!t&&this.$refs.subForm.clearValidate("key_path")}},filters:{handleFileName:function(e){return e?e.substring(e.lastIndexOf("/")+1):"请上传文件"}}},l={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"lb-system-payment"},[a("top-nav"),e._v(" "),a("div",{staticClass:"page-main"},[a("el-form",{ref:"subForm",attrs:{model:e.subForm,rules:e.subFormRules,"label-width":"130px"},nativeOn:{submit:function(e){e.preventDefault()}}},[a("el-form-item",{attrs:{label:"商户号",prop:"mch_id"}},[a("el-input",{attrs:{placeholder:"请输入商户号"},model:{value:e.subForm.mch_id,callback:function(t){e.$set(e.subForm,"mch_id",t)},expression:"subForm.mch_id"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"支付秘钥",prop:"pay_key"}},[a("el-input",{attrs:{placeholder:"请输入支付秘钥"},model:{value:e.subForm.pay_key,callback:function(t){e.$set(e.subForm,"pay_key",t)},expression:"subForm.pay_key"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"cert_path",prop:"cert_path"}},[a("div",{staticClass:"upload-file-warp"},[a("div",{staticClass:"upload-file-warp-content"},[e._v("\n "+e._s(e._f("handleFileName")(e.subForm.cert_path))+"\n ")]),e._v(" "),a("lb-button",{staticClass:"lb-cover-wrap",attrs:{size:"mini",type:"primary"},on:{click:function(t){return e.handleBtnUplaod("cert_path")}}},[e._v(e._s(e.$t("action.upload")))])],1)]),e._v(" "),a("el-form-item",{attrs:{label:"key_path",prop:"key_path"}},[a("div",{staticClass:"upload-file-warp"},[a("div",{staticClass:"upload-file-warp-content"},[e._v("\n "+e._s(e._f("handleFileName")(e.subForm.key_path))+"\n ")]),e._v(" "),a("lb-button",{attrs:{size:"mini",type:"primary"},on:{click:function(t){return e.handleBtnUplaod("key_path")}}},[e._v(e._s(e.$t("action.upload")))])],1)]),e._v(" "),a("el-form-item",[a("lb-button",{directives:[{name:"preventReClick",rawName:"v-preventReClick"}],attrs:{type:"primary"},on:{click:e.submitFormInfo}},[e._v(e._s(e.$t("action.submit")))])],1)],1)],1),e._v(" "),a("input",{ref:"inputFile",staticStyle:{display:"none"},attrs:{type:"file",accept:"text"},on:{change:e.uploadFiles}})],1)},staticRenderFns:[]};var u=a("VU/8")(o,l,!1,function(e){a("q9Fh")},"data-v-111047d2",null);t.default=u.exports},q9Fh:function(e,t){}}); |