From 0256440a3096552b4cda16406bf7262a1372c4da Mon Sep 17 00:00:00 2001 From: zq <136432190602163.com> Date: Mon, 13 Oct 2025 15:47:34 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BA=AF=E6=95=B0?= =?UTF-8?q?=E5=AD=97=E6=A0=A1=E9=AA=8C=E5=8F=8A=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/addPay.vue | 2 +- src/views/HosInformation.vue | 1 + src/views/weChatPayment.vue | 114 ++++++++++++++++++++++++++++++------------- 3 files changed, 81 insertions(+), 36 deletions(-) diff --git a/src/components/addPay.vue b/src/components/addPay.vue index 8514ed5..ccfce4e 100644 --- a/src/components/addPay.vue +++ b/src/components/addPay.vue @@ -312,7 +312,7 @@ export default { this.$http('POST', '/agentnew/ajax_add_alipay', { company_short_name: this.alipayRules.company_short_name, alipay_account: this.alipayRules.alipay_account, - // is_pay_public: this.isPayPublic, + is_pay_public: this.isPayPublic, // receive_payment_account: this.receive_payment_account, // receive_payment_name: this.receive_payment_name }).then(response => { diff --git a/src/views/HosInformation.vue b/src/views/HosInformation.vue index 6197042..8229547 100644 --- a/src/views/HosInformation.vue +++ b/src/views/HosInformation.vue @@ -903,6 +903,7 @@ export default { this.$nextTick(() => { if(response.code == 0) { this.$Message.success('设置成功'); + this.fetchDoctorData() }else{ this.$Message.error(response.msg); } diff --git a/src/views/weChatPayment.vue b/src/views/weChatPayment.vue index 18fb2e0..6330f0b 100644 --- a/src/views/weChatPayment.vue +++ b/src/views/weChatPayment.vue @@ -42,7 +42,7 @@ 指南 - @@ -73,15 +73,15 @@
- 选择文件 - + +
@@ -89,15 +89,15 @@
- 选择文件 - + +
@@ -105,7 +105,7 @@
- 保存 + 完成设置
@@ -125,6 +125,15 @@ export default { GuipFormItem, }, data() { + const notPureNumberRule = (rule, value, callback) => { + if (!value) { + callback(new Error('该字段为必填项')); + } else if (/^\d+$/.test(value)) { + callback(new Error('不能设为纯数字')); + } else { + callback(); + } + }; return { formData1:{ // 公司简称 @@ -132,7 +141,7 @@ export default { // 商户号 mch_id: '', // 微信支付秘钥 - key: '', + pkey: '', // 公众号APPID appid: '', }, @@ -141,13 +150,15 @@ export default { { required: true, message: '请输入公司简称', trigger: 'blur' } ], appid: [ - { required: true, message: '请输入公众号APPID', trigger: 'blur' } + { required: true, message: '请输入公众号APPID', trigger: 'blur' }, + { validator: notPureNumberRule, trigger: 'blur' } ], mch_id: [ { required: true, message: '请输入微信支付商户号', trigger: 'blur' } ], - key: [ - { required: true, message: '请输入微信支付秘钥', trigger: 'blur' } + pkey: [ + { required: true, message: '请输入微信支付秘钥', trigger: 'blur' }, + { validator: notPureNumberRule, trigger: 'blur' } ], }, formData: new FormData(), @@ -158,33 +169,54 @@ export default { borderRadius: '4px', background: '#006AFF', }, + fileList: [], + fileList1: [], + noFileFlag: false, + noFileFlag1: false, } }, created() { - // 初始化反显 + // 初始化 + this.getPayment(); + console.log('apiclient_cert' in this.payInfo,'apiclient_key'); }, methods: { getPayment() { - this.$http('POST', '/agentnew/ajax_get_payinfo', { - payid: this.$route.query.payid, - }).then(response => { - this.$nextTick(() => { - this.payinfo = response.data - }) - }).catch(error => { - console.error(error, 'error') - }) + // 初始化数据、证书文件列表??? + + // this.$http('POST', '/agentnew/ajax_get_payinfo', { + // doctor_id : this.doctor_id, + // depart_id : this.depart_id + // }).then(response => { + // this.$nextTick(() => { + // this.payinfo = response.data + // this.formData1 = response.data + // }) + // }).catch(error => { + // console.error(error, 'error') + // }) + }, + handRemove() { + this.formData.delete('apiclient_cert'); + this.payInfo.delete('apiclient_cert'); + this.noFileFlag = true; + }, + handRemove1() { + this.formData.delete('apiclient_key'); + this.payInfo.delete('apiclient_key'); + this.noFileFlag1 = true; }, handleAvatarChange(file, fileList) { console.log(file, fileList, 'file') let fileObj = file.raw + this.noFileFlag = false; this.payInfo.apiclient_cert = fileObj; this.formData.set('apiclient_cert', fileObj) - // this.formData.append('apiclient_cert', fileObj) }, handleAvatarChange1(file, fileList) { console.log(file, fileList, 'file') - let fileObj = file.raw + let fileObj = file.raw; + this.noFileFlag1 = false; this.payInfo.apiclient_key = fileObj; this.formData.set('apiclient_key', fileObj) }, @@ -195,31 +227,43 @@ export default { // console.log('键 (Key):', key); // console.log('值 (Value):', value); // } + if(!this.formData.has('apiclient_key') ){ + this.noFileFlag1 = true; + if( !this.formData.has('apiclient_cert')){ + this.noFileFlag = true; + this.$positionMessage({ + type: 'error', + message: '请先上传证书', + target: this.$refs['saveRef'], // 可以是DOM元素或选择器 + position: 'top' + }) + return false; + } + this.$positionMessage({ + type: 'error', + message: '请先上传证书', + target: this.$refs['saveRef'], // 可以是DOM元素或选择器 + position: 'top' + }) + return false; + } + this.$refs.wxform.validate((valid) => { console.log(valid, 'valid'); if (valid) { for (let key in this.formData1) { this.formData.set(key, this.formData1[key]) } - if(!this.formData.has('apiclient_key') || !this.formData.has('apiclient_cert')){ - this.$positionMessage({ - type: 'error', - message: '请先上传证书', - target: this.$refs['saveRef'], // 可以是DOM元素或选择器 - position: 'top' - }) - return false; - } this.formData.set('doctor_id', this.$route.query.doctor_id) this.formData.set('depart_id', this.$route.query.depart_id) + this.formData.set('type','2') const that = this - this.$http('POST', '/agentnew/ajax_payment_switch', this.formData).then(response => { + this.$http('POST', '/api/admin/set_pay_method', this.formData).then(response => { if(response.status){ that.$message.success('保存成功'); // that.payList = response.data.paylist // that.$emit('saveEvent', that.payList) this.$router.go(-1); - return true; } that.$message.error(response.info); From 1237eb0fcb4971c6e6cc588f6348133695e50e6c Mon Sep 17 00:00:00 2001 From: zq <136432190602163.com> Date: Tue, 14 Oct 2025 16:20:09 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=8E=A5=E6=94=B6=E6=94=B6=E6=AC=BE?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=88=97=E8=A1=A8=E5=8F=82=E6=95=B0=E3=80=81?= =?UTF-8?q?=E5=95=86=E6=88=B7=E5=8F=B7=E6=95=B0=E5=AD=97=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/HosInformation.vue | 54 +++++++++---------- src/views/weChatPayment.vue | 125 +++++++++++++++++++++++++++---------------- 2 files changed, 103 insertions(+), 76 deletions(-) diff --git a/src/views/HosInformation.vue b/src/views/HosInformation.vue index 8229547..a555795 100644 --- a/src/views/HosInformation.vue +++ b/src/views/HosInformation.vue @@ -737,7 +737,6 @@ export default { this.fetchPackData() this.fetchProjectData() this.geHosAdress() - this.getPayList() } else { await this.getAreaData() } @@ -806,34 +805,7 @@ export default { } }, - // 获取支付列表 - getPayList() { - this.$http('POST', '/agentnew/ajax_get_pay_list', { - doctor_id: this.doctor_id, - depart_id:this.depart_id - }).then(response => { - this.$nextTick(() => { - if ( - response.data && - response.data.paylist && - response.data.paylist[this.payTypeWeixin] && - response.data.paylist[this.payTypeWeixin].length > 0 - ) { - this.wxpayList = response.data.paylist[this.payTypeWeixin] - } - if ( - response.data && - response.data.paylist && - response.data.paylist[this.payTypeAlipay] && - response.data.paylist[this.payTypeAlipay].length > 0 - ) { - this.alipayList = response.data.paylist[this.payTypeAlipay] - } - }) - }).catch(error => { - console.error(error, 'error') - }) - }, + changeSelectWeixin(item) { console.log(item, 'item') if(this.bindWxpayId === item.payid){ @@ -1035,6 +1007,30 @@ export default { this.hasVisitFee = response.data.has_visit_fee this.registerMoney = response.data.visit_price + // 1.获取2种收款列表 + // if ( + // response.data && + // response.data.paylist && + // response.data.paylist[this.payTypeWeixin] && + // response.data.paylist[this.payTypeWeixin].length > 0 + // ) { + // this.wxpayList = response.data.paylist[this.payTypeWeixin] + // } + // if ( + // response.data && + // response.data.paylist && + // response.data.paylist[this.payTypeAlipay] && + // response.data.paylist[this.payTypeAlipay].length > 0 + // ) { + // this.alipayList = response.data.paylist[this.payTypeAlipay] + // } + + // 2.到时候看下哪种方式比较合适 + // this.wxpayList = response.data.wxpay_list;//微信支付列表 + // this.alipayList = response.data.alipayList;//支付宝支付列表 + // this.selectWxpay = response.data.site_pays[this.payTypeWeixin];//当前微信收款账号 + // this.selectAlipay = response.data.site_pays[this.payTypeAlipay];//当前微信收款账号 + this.hasAgainVisitFreeDays = response.data.has_again_visit_free_days this.againVisitFreeDays = response.data.again_visit_free_days this.hasRemainVisitFree = response.data.has_remain_visit_free diff --git a/src/views/weChatPayment.vue b/src/views/weChatPayment.vue index 6330f0b..7fc48de 100644 --- a/src/views/weChatPayment.vue +++ b/src/views/weChatPayment.vue @@ -115,6 +115,8 @@ import GuipInput from '@/components/GuipInput.vue'; import GuipButton from '@/components/GuipButton.vue'; import GuipFormItem from '@/components/GuipFormItem.vue'; +const PAY_TYPE_WEIXIN = 2; // 微信 +const PAY_TYPE_ALIPAY = 3; // 支付宝 export default { // 站点设置 name: 'addPay', @@ -154,7 +156,12 @@ export default { { validator: notPureNumberRule, trigger: 'blur' } ], mch_id: [ - { required: true, message: '请输入微信支付商户号', trigger: 'blur' } + { required: true, message: '请输入微信支付商户号', trigger: 'blur' }, + { + pattern: /^\d+$/, + message: '商户号必须为纯数字', + trigger: 'blur' + } ], pkey: [ { required: true, message: '请输入微信支付秘钥', trigger: 'blur' }, @@ -173,10 +180,14 @@ export default { fileList1: [], noFileFlag: false, noFileFlag1: false, + payTypeWeixin: PAY_TYPE_WEIXIN, + payTypeAlipay: PAY_TYPE_ALIPAY, } }, created() { // 初始化 + this.formData.set('doctor_id', this.$route.query.doctor_id) + this.formData.set('depart_id', this.$route.query.depart_id) this.getPayment(); console.log('apiclient_cert' in this.payInfo,'apiclient_key'); }, @@ -212,6 +223,7 @@ export default { this.noFileFlag = false; this.payInfo.apiclient_cert = fileObj; this.formData.set('apiclient_cert', fileObj) + // this.uoload_apipem() }, handleAvatarChange1(file, fileList) { console.log(file, fileList, 'file') @@ -220,62 +232,81 @@ export default { this.payInfo.apiclient_key = fileObj; this.formData.set('apiclient_key', fileObj) }, + // 文件上传 + // uoload_apipem(){ + // // pay_id ??? + + // // const formData = new FormData(); + // // formData.set('doctor_id', this.$route.query.doctor_id) + // // formData.set('depart_id', this.$route.query.depart_id) + // // formData.set('apiclient_cert',this.formData.apiclient_cert) + + // this.$http('POST', '/api/admin/upload_wx_api_cert', this.formData).then(response => { + // if(response.code == 0){ + // this.$message.success('上传成功'); + // return true; + // } + // this.$message.error(response.msg); + // }).catch(error => { + // console.error(error, 'error') + // }) + // }, saveConfirm() { - // 查看有多少参数 + // pay_id ??? + // 测试-查看有多少参数 // for (let [key, value] of this.formData.entries()) { // console.log('键 (Key):', key); // console.log('值 (Value):', value); // } - if(!this.formData.has('apiclient_key') ){ - this.noFileFlag1 = true; - if( !this.formData.has('apiclient_cert')){ - this.noFileFlag = true; - this.$positionMessage({ - type: 'error', - message: '请先上传证书', - target: this.$refs['saveRef'], // 可以是DOM元素或选择器 - position: 'top' - }) - return false; - } - this.$positionMessage({ - type: 'error', - message: '请先上传证书', - target: this.$refs['saveRef'], // 可以是DOM元素或选择器 - position: 'top' - }) - return false; - } + // if(!this.formData.has('apiclient_key') ){ + // this.noFileFlag1 = true; + // if( !this.formData.has('apiclient_cert')){ + // this.noFileFlag = true; + // this.$positionMessage({ + // type: 'error', + // message: '请先上传证书', + // target: this.$refs['saveRef'], // 可以是DOM元素或选择器 + // position: 'top' + // }) + // return false; + // } + // this.$positionMessage({ + // type: 'error', + // message: '请先上传证书', + // target: this.$refs['saveRef'], // 可以是DOM元素或选择器 + // position: 'top' + // }) + // return false; + // } this.$refs.wxform.validate((valid) => { console.log(valid, 'valid'); - if (valid) { - for (let key in this.formData1) { - this.formData.set(key, this.formData1[key]) - } - this.formData.set('doctor_id', this.$route.query.doctor_id) - this.formData.set('depart_id', this.$route.query.depart_id) - this.formData.set('type','2') - const that = this - this.$http('POST', '/api/admin/set_pay_method', this.formData).then(response => { - if(response.status){ - that.$message.success('保存成功'); - // that.payList = response.data.paylist - // that.$emit('saveEvent', that.payList) - this.$router.go(-1); - return true; - } - that.$message.error(response.info); - }).catch(error => { - console.error(error, 'error') - }) - } else { - return false; - } + // if (valid) { + // for (let key in this.formData1) { + // this.formData.set(key, this.formData1[key]) + // } + // this.formData.set('doctor_id', this.$route.query.doctor_id) + // this.formData.set('depart_id', this.$route.query.depart_id) + // this.formData.set('type',this.payTypeWeixin)//这个参数 待定 2 微信支付 \ 3 支付宝 + // this.formData.set('is_pay_public','0') + // const that = this; + // this.$http('POST', '/api/admin/set_pay_method', this.formData).then(response => { + // if(response.code == 0){ + // that.$message.success('保存成功'); + // // that.payList = response.data.paylist + // // that.$emit('saveEvent', that.payList) + // this.$router.go(-1); + // return true; + // } + // that.$message.error(response.msg); + // }).catch(error => { + // console.error(error, 'error') + // }) + // } else { + // return false; + // } }) - - }, } From 63afdf25dcda9b6cb7bb35bcd95ec896e63ab80d Mon Sep 17 00:00:00 2001 From: zq <136432190602163.com> Date: Tue, 14 Oct 2025 16:24:16 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=92=A4=E9=94=80=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/weChatPayment.vue | 104 +++++++++++++++++++------------------------- 1 file changed, 44 insertions(+), 60 deletions(-) diff --git a/src/views/weChatPayment.vue b/src/views/weChatPayment.vue index 7fc48de..f249720 100644 --- a/src/views/weChatPayment.vue +++ b/src/views/weChatPayment.vue @@ -188,25 +188,9 @@ export default { // 初始化 this.formData.set('doctor_id', this.$route.query.doctor_id) this.formData.set('depart_id', this.$route.query.depart_id) - this.getPayment(); console.log('apiclient_cert' in this.payInfo,'apiclient_key'); }, methods: { - getPayment() { - // 初始化数据、证书文件列表??? - - // this.$http('POST', '/agentnew/ajax_get_payinfo', { - // doctor_id : this.doctor_id, - // depart_id : this.depart_id - // }).then(response => { - // this.$nextTick(() => { - // this.payinfo = response.data - // this.formData1 = response.data - // }) - // }).catch(error => { - // console.error(error, 'error') - // }) - }, handRemove() { this.formData.delete('apiclient_cert'); this.payInfo.delete('apiclient_cert'); @@ -259,53 +243,53 @@ export default { // console.log('键 (Key):', key); // console.log('值 (Value):', value); // } - // if(!this.formData.has('apiclient_key') ){ - // this.noFileFlag1 = true; - // if( !this.formData.has('apiclient_cert')){ - // this.noFileFlag = true; - // this.$positionMessage({ - // type: 'error', - // message: '请先上传证书', - // target: this.$refs['saveRef'], // 可以是DOM元素或选择器 - // position: 'top' - // }) - // return false; - // } - // this.$positionMessage({ - // type: 'error', - // message: '请先上传证书', - // target: this.$refs['saveRef'], // 可以是DOM元素或选择器 - // position: 'top' - // }) - // return false; - // } + if(!this.formData.has('apiclient_key') ){ + this.noFileFlag1 = true; + if( !this.formData.has('apiclient_cert')){ + this.noFileFlag = true; + this.$positionMessage({ + type: 'error', + message: '请先上传证书', + target: this.$refs['saveRef'], // 可以是DOM元素或选择器 + position: 'top' + }) + return false; + } + this.$positionMessage({ + type: 'error', + message: '请先上传证书', + target: this.$refs['saveRef'], // 可以是DOM元素或选择器 + position: 'top' + }) + return false; + } this.$refs.wxform.validate((valid) => { console.log(valid, 'valid'); - // if (valid) { - // for (let key in this.formData1) { - // this.formData.set(key, this.formData1[key]) - // } - // this.formData.set('doctor_id', this.$route.query.doctor_id) - // this.formData.set('depart_id', this.$route.query.depart_id) - // this.formData.set('type',this.payTypeWeixin)//这个参数 待定 2 微信支付 \ 3 支付宝 - // this.formData.set('is_pay_public','0') - // const that = this; - // this.$http('POST', '/api/admin/set_pay_method', this.formData).then(response => { - // if(response.code == 0){ - // that.$message.success('保存成功'); - // // that.payList = response.data.paylist - // // that.$emit('saveEvent', that.payList) - // this.$router.go(-1); - // return true; - // } - // that.$message.error(response.msg); - // }).catch(error => { - // console.error(error, 'error') - // }) - // } else { - // return false; - // } + if (valid) { + for (let key in this.formData1) { + this.formData.set(key, this.formData1[key]) + } + this.formData.set('doctor_id', this.$route.query.doctor_id) + this.formData.set('depart_id', this.$route.query.depart_id) + this.formData.set('type',this.payTypeWeixin)//这个参数 待定 2 微信支付 \ 3 支付宝 + this.formData.set('is_pay_public','0') + const that = this; + this.$http('POST', '/api/admin/set_pay_method', this.formData).then(response => { + if(response.code == 0){ + that.$message.success('保存成功'); + // that.payList = response.data.paylist + // that.$emit('saveEvent', that.payList) + this.$router.go(-1); + return true; + } + that.$message.error(response.msg); + }).catch(error => { + console.error(error, 'error') + }) + } else { + return false; + } }) }, }