diff --git a/src/components/addPay.vue b/src/components/addPay.vue index c65c028..8514ed5 100644 --- a/src/components/addPay.vue +++ b/src/components/addPay.vue @@ -59,15 +59,15 @@
- + 请输入公司简称,便于您区分账号所属公司 - + 仅支持已签约 “当面付” 功能的公司支付宝 指南 - + @@ -213,6 +213,18 @@ export default { isPayPublic: '0', // 拼多多店铺名称 pdd_shop_name: '', + alipayInfo:{ + company_short_name: '', + alipay_account:'' + }, + alipayRules:{ + company_short_name: [ + { required: true, message: '请输入公司简称', trigger: 'blur' } + ], + alipay_account: [ + { required: true, message: '请输入公众号APPID', trigger: 'blur' } + ], + } // localSiteInfo: { ...this.siteInfo } } @@ -291,29 +303,40 @@ export default { console.error(error, 'error') }) - } else if (this.addPayType == PAY_TYPE_ALIPAY) { - this.$http('POST', '/agentnew/ajax_add_alipay', { - company_short_name: this.company_short_name, - alipay_account: this.alipay_account, - is_pay_public: this.isPayPublic, - receive_payment_account: this.receive_payment_account, - receive_payment_name: this.receive_payment_name - }).then(response => { - this.$nextTick(() => { - if (response.status) { - this.init(response.data.payid); - if (this.isPayPublic == 1) { - this.$Message.success(response.info); - } else { - window.open(response.data.authurl, '_blank'); - } - } else { - this.$Message.error(response.info); - } - }) - }).catch(error => { - console.error(error, 'error') - }) + } else if (this.addPayType == PAY_TYPE_ALIPAY) { //支付宝 + let falseFlag = false; + this.$refs.alipayForm.validate((valid) => { + console.log(valid,'valid==='); + if (valid) { + falseFlag = true; + 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, + // receive_payment_account: this.receive_payment_account, + // receive_payment_name: this.receive_payment_name + }).then(response => { + this.$nextTick(() => { + if (response.status) { + this.init(response.data.payid); + if (this.isPayPublic == 1) { + this.$Message.success(response.info); + } else { + // window.open(response.data.authurl, '_blank'); + } + } else { + this.$Message.error(response.info); + } + }) + }).catch(error => { + console.error(error, 'error') + }) + } else { + return false; + } + }); + if (!falseFlag) return; + } else if (this.addPayType == PAY_TYPE_PDD) { this.$http('POST', '/agentnew/ajax_add_pddpay', { shop_name: this.pdd_shop_name, @@ -332,6 +355,7 @@ export default { } else if (this.addPayType == PAY_TYPE_JINGDONG) { window.open(this.jdAuthUrl, '_blank'); } + console.log('addPayment===走到这里了'); this.init(); }, // 取消按钮事件 diff --git a/src/views/HosInformation.vue b/src/views/HosInformation.vue index ba9ba75..6197042 100644 --- a/src/views/HosInformation.vue +++ b/src/views/HosInformation.vue @@ -153,7 +153,7 @@
线上收款 - + 未绑定微信收款方式,无法开启线上收款 {{ onLinePay == 1 ? '开启' : '' }}
@@ -259,7 +259,7 @@
收挂号费 - + 患者在小程序预约时,{{hasVisitFee == 1?'':'不'}}需缴纳挂号费
@@ -460,7 +460,7 @@ - + @@ -470,7 +470,7 @@
- 患者{{hasAgainVisitFreeDays}} + 患者 天内再次就诊,免挂号费

@@ -737,6 +737,7 @@ export default { this.fetchPackData() this.fetchProjectData() this.geHosAdress() + this.getPayList() } else { await this.getAreaData() } @@ -764,7 +765,7 @@ export default { }, methods: { goToWxPay(){ - this.$router.push(`/weChatPayment?`); + this.$router.push(`/weChatPayment?doctor_id=${this.doctor_id}&depart_id=${this.depart_id}`); }, showDialog(type) { if (type == 'register') { @@ -786,17 +787,15 @@ export default { this.$positionMessage({ type: type, message: msg+'收挂号费', - target: this.$refs['wxPayRef'], - position: 'bottom' + target: this.$refs['hasVisitFeeRef'], + position: 'top' }) }).catch(error => { console.error(error, 'error') }) }, onLineChange(e) { - this.onLinePay this.onLinePay = e - if(!this.selectWxpay){ this.$positionMessage({ type: 'error', @@ -806,12 +805,12 @@ export default { }) } - console.log(this.onLinePay, '====-0000'); }, // 获取支付列表 getPayList() { this.$http('POST', '/agentnew/ajax_get_pay_list', { - uid: this.$route.query.uid, + doctor_id: this.doctor_id, + depart_id:this.depart_id }).then(response => { this.$nextTick(() => { if ( @@ -902,7 +901,11 @@ export default { ...params }).then(response => { this.$nextTick(() => { - console.log(response); + if(response.code == 0) { + this.$Message.success('设置成功'); + }else{ + this.$Message.error(response.msg); + } this.freeRegVisible = false; }) }).catch(error => { @@ -914,28 +917,19 @@ export default { this.$positionMessage({ type: 'error', message: '请输入正确的金额', - target: '#siteMessage7', + target: '.registerMoney', position: 'top', }) return; } - this.$http('POST', '/api/admin/set_visit_price', { ...params }).then(response => { this.$nextTick(() => { if(response.code !== 0) { - this.$positionMessage({ - type: 'error', - message: response.msg, - target: '#siteMessage7', - }) - }else{ - this.$positionMessage({ - type: 'success', - message: '设置成功', - target: '#siteMessage7', - }) + this.$Message.error(response.msg); + }else{ + this.$Message.success('设置成功'); } this.registrationVisible = false; }) diff --git a/src/views/weChatPayment.vue b/src/views/weChatPayment.vue index 0ef1804..18fb2e0 100644 --- a/src/views/weChatPayment.vue +++ b/src/views/weChatPayment.vue @@ -17,12 +17,12 @@

2.登录微信商户平台,在产品中心开通Native支付,如需使用微信版,开通JSAPI支付。

- +
请输入公司简称,便于您区分账号所属公司 - @@ -31,7 +31,7 @@ 指南 - @@ -42,14 +42,14 @@ 指南 - 指南 - @@ -80,8 +80,8 @@ 选择文件 -

已上传

-

未上传任何文件

+
@@ -95,10 +95,9 @@ :btnstyle="{ width: '118px' }"> 选择文件 - -

已上传

-

未上传任何文件

+ @@ -127,15 +126,32 @@ export default { }, data() { return { - // 公司简称 - company_short_name: '', - // 商户号 - mch_id: '', - // 微信支付秘钥 - apiv2: '', - // 公众号APPID - appid: '', - payinfo: [], + formData1:{ + // 公司简称 + company_short_name: '', + // 商户号 + mch_id: '', + // 微信支付秘钥 + key: '', + // 公众号APPID + appid: '', + }, + rules: { + company_short_name: [ + { required: true, message: '请输入公司简称', trigger: 'blur' } + ], + appid: [ + { required: true, message: '请输入公众号APPID', trigger: 'blur' } + ], + mch_id: [ + { required: true, message: '请输入微信支付商户号', trigger: 'blur' } + ], + key: [ + { required: true, message: '请输入微信支付秘钥', trigger: 'blur' } + ], + }, + formData: new FormData(), + payInfo:{}, saveBtnStyleObj: { width: '144px', height: '46px', @@ -146,7 +162,6 @@ export default { }, created() { // 初始化反显 - // this.getPayment() }, methods: { getPayment() { @@ -161,39 +176,62 @@ export default { }) }, handleAvatarChange(file, fileList) { - console.log(file, fileList) + console.log(file, fileList, 'file') let fileObj = file.raw + this.payInfo.apiclient_cert = fileObj; this.formData.set('apiclient_cert', fileObj) + // this.formData.append('apiclient_cert', fileObj) }, handleAvatarChange1(file, fileList) { - console.log(file, fileList) + console.log(file, fileList, 'file') let fileObj = file.raw + this.payInfo.apiclient_key = fileObj; this.formData.set('apiclient_key', fileObj) }, + saveConfirm() { - // - // this.$positionMessage({ - // type: 'error', - // message: '请先上传证书', - // target: this.$refs['saveRef'], // 可以是DOM元素或选择器 - // position: 'top' - // }) - // let obj = {} - // obj.uid = this.serviceInfo.uid - // obj.type = this.serviceInfo.type - // obj.info = "" - // const that = this - // this.$http('POST', '/agentnew/ajax_payment_switch', obj).then(response => { - // if(response.status){ - // that.$message.success('保存成功'); - // that.payList = response.data.paylist - // that.$emit('saveEvent', that.payList) - // return true; - // } - // that.$message.error(response.info); - // }).catch(error => { - // console.error(error, 'error') - // }) + // 查看有多少参数 + // for (let [key, value] of this.formData.entries()) { + // console.log('键 (Key):', key); + // console.log('值 (Value):', value); + // } + 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) + const that = this + this.$http('POST', '/agentnew/ajax_payment_switch', 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; + } + }) + + }, }