Browse Source

增加收款设置交互、校验拦截

pull/9/head
zq 2 weeks ago
parent
commit
8a24eac192
  1. 44
      src/components/addPay.vue
  2. 42
      src/views/HosInformation.vue
  3. 110
      src/views/weChatPayment.vue

44
src/components/addPay.vue

@ -59,15 +59,15 @@
<div class="alipay" v-if="addPayType==payTypeAlipay">
<el-tabs v-model="isPayPublic" @tab-click="handleClick">
<!-- <el-tab-pane label="我有公司,使用本公司支付宝" name="0"> -->
<el-form>
<el-form ref="alipayForm" :model="alipayInfo" :rules="alipayRules">
<GuipFormItem column="column" class="mb24" label="1. 公司简称">
<span class="desc" slot="formRight">请输入公司简称便于您区分账号所属公司</span>
<GuipInput slot="formDom" ref="GuipInput" column="column" v-model="company_short_name" prop="company_short_name" placeholder="6字以内"></GuipInput>
<GuipInput slot="formDom" ref="GuipInput" column="column" :maxlength="6" v-model="alipayInfo.company_short_name" prop="company_short_name" placeholder="6字以内"></GuipInput>
</GuipFormItem>
<GuipFormItem column="column" class="mb24" label="2. 公司支付宝账号">
<span class="desc flex gap12" slot="formRight">仅支持已签约 当面付 功能的公司支付宝 <a href='https://pay.weixin.qq.com/' class="guide"
target='_blank'><img src="@/assets/site/form_qua_ic.svg" alt="">指南</a></span>
<GuipInput slot="formDom" ref="GuipInput" column="column" v-model="alipay_account" prop="mch_id" placeholder="请输入公司支付宝账号"></GuipInput>
<GuipInput slot="formDom" ref="GuipInput" column="column" v-model="alipayInfo.alipay_account" prop="alipay_account" placeholder="请输入公司支付宝账号"></GuipInput>
</GuipFormItem>
</el-form>
<!-- </el-tab-pane> -->
@ -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,13 +303,18 @@ export default {
console.error(error, 'error')
})
} else if (this.addPayType == PAY_TYPE_ALIPAY) {
} 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.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
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) {
@ -305,7 +322,7 @@ export default {
if (this.isPayPublic == 1) {
this.$Message.success(response.info);
} else {
window.open(response.data.authurl, '_blank');
// window.open(response.data.authurl, '_blank');
}
} else {
this.$Message.error(response.info);
@ -314,6 +331,12 @@ export default {
}).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();
},
//

42
src/views/HosInformation.vue

@ -153,7 +153,7 @@
<el-form>
<div class="mb32 flex gap12">
<span class="littleTitle">线上收款</span>
<GuipSwitch :value="onLinePay" :active-value="1" :inactive-value="0" @change="onLineChange"></GuipSwitch>
<GuipSwitch :value="onLinePay" :active-value="1" :inactive-value="0" :disabled="!selectWxpay?.short_name" @change="onLineChange"></GuipSwitch>
<span v-if="!onLinePay" class="tipInfo">未绑定微信收款方式无法开启线上收款</span>
<span v-if="!onLinePay == 1"> {{ onLinePay == 1 ? '开启' : '' }}</span>
</div>
@ -259,7 +259,7 @@
<el-form>
<div class="mb32 flex gap12">
<span class="littleTitle">收挂号费</span>
<GuipSwitch :value="hasVisitFee" :active-value="1" :inactive-value="0" @change="onVisitFeeChange"></GuipSwitch>
<GuipSwitch :value="hasVisitFee" ref="hasVisitFeeRef" :active-value="1" :inactive-value="0" @change="onVisitFeeChange"></GuipSwitch>
<span class="desc">患者在小程序预约时{{hasVisitFee == 1?'':'不'}}需缴纳挂号费</span>
</div>
<div class="bidwrap-item">
@ -460,7 +460,7 @@
<GuipDialog :dialogVisible="registrationVisible" title="设置挂号费金额" :show-close-button="false" width="599px"
:show-cancel-button="true" @confirm="handleRegisterConfirm('registerMoney')" @cancel="handleregisterCancel" ref="visitFee">
<el-form>
<GuipInput v-model="registerMoney" placeholder="请输入" unit="元/人"></GuipInput>
<GuipInput v-model="registerMoney" ref="registerMoney" class="registerMoney" placeholder="请输入" unit="元/人"></GuipInput>
</el-form>
</GuipDialog>
<!-- freeRegVisible -->
@ -470,7 +470,7 @@
<el-form class="freeWrap">
<div class="flex gap8 mb24 mt24">
<el-checkbox v-model="hasAgainVisitFreeDays" :true-label="1" :false-label="0"></el-checkbox>
患者{{hasAgainVisitFreeDays}}
患者
<GuipInput v-model="againVisitFreeDays" type="number" width="92px" placeholder="请输入"></GuipInput>天内再次就诊免挂号费
</div>
<p class="flex gap8">
@ -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',
})
this.$Message.error(response.msg);
}else{
this.$positionMessage({
type: 'success',
message: '设置成功',
target: '#siteMessage7',
})
this.$Message.success('设置成功');
}
this.registrationVisible = false;
})

110
src/views/weChatPayment.vue

@ -17,12 +17,12 @@
</div>
<p class="mt12">2.登录微信商户平台在产品中心开通Native支付如需使用微信版开通JSAPI支付</p>
</div>
<el-form>
<el-form ref="wxform" :model="formData1" :rules="rules">
<div class="flex-wrap">
<div class="flex-left">
<GuipFormItem column="column" class="mb24" label="公司简称" :required="true">
<span class="desc" slot="formRight">请输入公司简称便于您区分账号所属公司</span>
<GuipInput slot="formDom" ref="GuipInput" column="column" v-model="company_short_name"
<GuipInput slot="formDom" ref="GuipInput" column="column" v-model="formData1.company_short_name"
prop="company_short_name" placeholder="请输入">
</GuipInput>
</GuipFormItem>
@ -31,7 +31,7 @@
<a href='https://pay.weixin.qq.com/' class="guide"
target='_blank'><img src="@/assets/site/form_qua_ic.svg" alt="">指南</a>
</span>
<GuipInput slot="formDom" ref="GuipInput" column="column" v-model="mch_id" prop="mch_id"
<GuipInput slot="formDom" ref="GuipInput" column="column" v-model="formData1.mch_id" prop="mch_id"
placeholder="请输入">
</GuipInput>
</GuipFormItem>
@ -42,14 +42,14 @@
<span class="desc" slot="formRight"><a href='https://pay.weixin.qq.com/' class="guide"
target='_blank'><img src="@/assets/site/form_qua_ic.svg" alt="">指南</a>
</span>
<GuipInput slot="formDom" ref="GuipInput" column="column" v-model="apiv2" prop="apiv2"
<GuipInput slot="formDom" ref="GuipInput" column="column" v-model="formData1.key" prop="key"
placeholder="不能设为纯数字">
</GuipInput>
</GuipFormItem>
<GuipFormItem column="column" class="mb24" label="公众号APPID" :required="true">
<span class="desc" slot="formRight"><a href='https://mp.weixin.qq.com/' class="guide"
target='_blank'><img src="@/assets/site/form_qua_ic.svg" alt="">指南</a></span>
<GuipInput slot="formDom" ref="GuipInput" column="column" v-model="appid" prop="appid"
<GuipInput slot="formDom" ref="GuipInput" column="column" v-model="formData1.appid" prop="appid"
placeholder="不能设为纯数字">
</GuipInput>
</GuipFormItem>
@ -80,8 +80,8 @@
<i class="bgImg"></i>选择文件
</GuipButton>
</el-upload>
<p class="uploaded" v-if="payinfo.cert_uploaded">已上传</p>
<p class="normalUpload notuploaded" v-else>未上传任何文件</p>
<!-- <p class="uploaded" v-if="formData.apiclient_cert">已上传</p>
<p class="normalUpload notuploaded" v-else>未上传任何文件</p> -->
</div>
</div>
<div class="flex-line"></div>
@ -95,10 +95,9 @@
:btnstyle="{ width: '118px' }">
<i class="bgImg"></i>选择文件
</GuipButton>
</el-upload>
<p class="uploaded" v-if="payinfo.key_uploaded">已上传</p>
<p class="normalUpload" v-else>未上传任何文件</p>
<!-- <p class="uploaded" v-if="formData.apiclient_key">已上传</p>
<p class="normalUpload notuploaded" v-else>未上传任何文件</p> -->
</div>
</div>
</div>
@ -127,15 +126,32 @@ export default {
},
data() {
return {
formData1:{
//
company_short_name: '',
//
mch_id: '',
//
apiv2: '',
key: '',
// APPID
appid: '',
payinfo: [],
},
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('');
//
// 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)
// return true;
// }
// that.$message.error(response.info);
// }).catch(error => {
// console.error(error, 'error')
// })
this.$router.go(-1);
return true;
}
that.$message.error(response.info);
}).catch(error => {
console.error(error, 'error')
})
} else {
return false;
}
})
},
}

Loading…
Cancel
Save