Browse Source

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

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

76
src/components/addPay.vue

@ -59,15 +59,15 @@
<div class="alipay" v-if="addPayType==payTypeAlipay"> <div class="alipay" v-if="addPayType==payTypeAlipay">
<el-tabs v-model="isPayPublic" @tab-click="handleClick"> <el-tabs v-model="isPayPublic" @tab-click="handleClick">
<!-- <el-tab-pane label="我有公司,使用本公司支付宝" name="0"> --> <!-- <el-tab-pane label="我有公司,使用本公司支付宝" name="0"> -->
<el-form> <el-form ref="alipayForm" :model="alipayInfo" :rules="alipayRules">
<GuipFormItem column="column" class="mb24" label="1. 公司简称"> <GuipFormItem column="column" class="mb24" label="1. 公司简称">
<span class="desc" slot="formRight">请输入公司简称便于您区分账号所属公司</span> <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>
<GuipFormItem column="column" class="mb24" label="2. 公司支付宝账号"> <GuipFormItem column="column" class="mb24" label="2. 公司支付宝账号">
<span class="desc flex gap12" slot="formRight">仅支持已签约 当面付 功能的公司支付宝 <a href='https://pay.weixin.qq.com/' class="guide" <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> 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> </GuipFormItem>
</el-form> </el-form>
<!-- </el-tab-pane> --> <!-- </el-tab-pane> -->
@ -213,6 +213,18 @@ export default {
isPayPublic: '0', isPayPublic: '0',
// //
pdd_shop_name: '', 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 } // localSiteInfo: { ...this.siteInfo }
} }
@ -291,29 +303,40 @@ export default {
console.error(error, 'error') console.error(error, 'error')
}) })
} else if (this.addPayType == PAY_TYPE_ALIPAY) { } else if (this.addPayType == PAY_TYPE_ALIPAY) { //
this.$http('POST', '/agentnew/ajax_add_alipay', { let falseFlag = false;
company_short_name: this.company_short_name, this.$refs.alipayForm.validate((valid) => {
alipay_account: this.alipay_account, console.log(valid,'valid===');
is_pay_public: this.isPayPublic, if (valid) {
receive_payment_account: this.receive_payment_account, falseFlag = true;
receive_payment_name: this.receive_payment_name this.$http('POST', '/agentnew/ajax_add_alipay', {
}).then(response => { company_short_name: this.alipayRules.company_short_name,
this.$nextTick(() => { alipay_account: this.alipayRules.alipay_account,
if (response.status) { // is_pay_public: this.isPayPublic,
this.init(response.data.payid); // receive_payment_account: this.receive_payment_account,
if (this.isPayPublic == 1) { // receive_payment_name: this.receive_payment_name
this.$Message.success(response.info); }).then(response => {
} else { this.$nextTick(() => {
window.open(response.data.authurl, '_blank'); if (response.status) {
} this.init(response.data.payid);
} else { if (this.isPayPublic == 1) {
this.$Message.error(response.info); this.$Message.success(response.info);
} } else {
}) // window.open(response.data.authurl, '_blank');
}).catch(error => { }
console.error(error, 'error') } 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) { } else if (this.addPayType == PAY_TYPE_PDD) {
this.$http('POST', '/agentnew/ajax_add_pddpay', { this.$http('POST', '/agentnew/ajax_add_pddpay', {
shop_name: this.pdd_shop_name, shop_name: this.pdd_shop_name,
@ -332,6 +355,7 @@ export default {
} else if (this.addPayType == PAY_TYPE_JINGDONG) { } else if (this.addPayType == PAY_TYPE_JINGDONG) {
window.open(this.jdAuthUrl, '_blank'); window.open(this.jdAuthUrl, '_blank');
} }
console.log('addPayment===走到这里了');
this.init(); this.init();
}, },
// //

44
src/views/HosInformation.vue

@ -153,7 +153,7 @@
<el-form> <el-form>
<div class="mb32 flex gap12"> <div class="mb32 flex gap12">
<span class="littleTitle">线上收款</span> <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" class="tipInfo">未绑定微信收款方式无法开启线上收款</span>
<span v-if="!onLinePay == 1"> {{ onLinePay == 1 ? '开启' : '' }}</span> <span v-if="!onLinePay == 1"> {{ onLinePay == 1 ? '开启' : '' }}</span>
</div> </div>
@ -259,7 +259,7 @@
<el-form> <el-form>
<div class="mb32 flex gap12"> <div class="mb32 flex gap12">
<span class="littleTitle">收挂号费</span> <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> <span class="desc">患者在小程序预约时{{hasVisitFee == 1?'':'不'}}需缴纳挂号费</span>
</div> </div>
<div class="bidwrap-item"> <div class="bidwrap-item">
@ -460,7 +460,7 @@
<GuipDialog :dialogVisible="registrationVisible" title="设置挂号费金额" :show-close-button="false" width="599px" <GuipDialog :dialogVisible="registrationVisible" title="设置挂号费金额" :show-close-button="false" width="599px"
:show-cancel-button="true" @confirm="handleRegisterConfirm('registerMoney')" @cancel="handleregisterCancel" ref="visitFee"> :show-cancel-button="true" @confirm="handleRegisterConfirm('registerMoney')" @cancel="handleregisterCancel" ref="visitFee">
<el-form> <el-form>
<GuipInput v-model="registerMoney" placeholder="请输入" unit="元/人"></GuipInput> <GuipInput v-model="registerMoney" ref="registerMoney" class="registerMoney" placeholder="请输入" unit="元/人"></GuipInput>
</el-form> </el-form>
</GuipDialog> </GuipDialog>
<!-- freeRegVisible --> <!-- freeRegVisible -->
@ -470,7 +470,7 @@
<el-form class="freeWrap"> <el-form class="freeWrap">
<div class="flex gap8 mb24 mt24"> <div class="flex gap8 mb24 mt24">
<el-checkbox v-model="hasAgainVisitFreeDays" :true-label="1" :false-label="0"></el-checkbox> <el-checkbox v-model="hasAgainVisitFreeDays" :true-label="1" :false-label="0"></el-checkbox>
患者{{hasAgainVisitFreeDays}} 患者
<GuipInput v-model="againVisitFreeDays" type="number" width="92px" placeholder="请输入"></GuipInput>天内再次就诊免挂号费 <GuipInput v-model="againVisitFreeDays" type="number" width="92px" placeholder="请输入"></GuipInput>天内再次就诊免挂号费
</div> </div>
<p class="flex gap8"> <p class="flex gap8">
@ -737,6 +737,7 @@ export default {
this.fetchPackData() this.fetchPackData()
this.fetchProjectData() this.fetchProjectData()
this.geHosAdress() this.geHosAdress()
this.getPayList()
} else { } else {
await this.getAreaData() await this.getAreaData()
} }
@ -764,7 +765,7 @@ export default {
}, },
methods: { methods: {
goToWxPay(){ goToWxPay(){
this.$router.push(`/weChatPayment?`); this.$router.push(`/weChatPayment?doctor_id=${this.doctor_id}&depart_id=${this.depart_id}`);
}, },
showDialog(type) { showDialog(type) {
if (type == 'register') { if (type == 'register') {
@ -786,17 +787,15 @@ export default {
this.$positionMessage({ this.$positionMessage({
type: type, type: type,
message: msg+'收挂号费', message: msg+'收挂号费',
target: this.$refs['wxPayRef'], target: this.$refs['hasVisitFeeRef'],
position: 'bottom' position: 'top'
}) })
}).catch(error => { }).catch(error => {
console.error(error, 'error') console.error(error, 'error')
}) })
}, },
onLineChange(e) { onLineChange(e) {
this.onLinePay
this.onLinePay = e this.onLinePay = e
if(!this.selectWxpay){ if(!this.selectWxpay){
this.$positionMessage({ this.$positionMessage({
type: 'error', type: 'error',
@ -806,12 +805,12 @@ export default {
}) })
} }
console.log(this.onLinePay, '====-0000');
}, },
// //
getPayList() { getPayList() {
this.$http('POST', '/agentnew/ajax_get_pay_list', { 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 => { }).then(response => {
this.$nextTick(() => { this.$nextTick(() => {
if ( if (
@ -902,7 +901,11 @@ export default {
...params ...params
}).then(response => { }).then(response => {
this.$nextTick(() => { this.$nextTick(() => {
console.log(response); if(response.code == 0) {
this.$Message.success('设置成功');
}else{
this.$Message.error(response.msg);
}
this.freeRegVisible = false; this.freeRegVisible = false;
}) })
}).catch(error => { }).catch(error => {
@ -914,28 +917,19 @@ export default {
this.$positionMessage({ this.$positionMessage({
type: 'error', type: 'error',
message: '请输入正确的金额', message: '请输入正确的金额',
target: '#siteMessage7', target: '.registerMoney',
position: 'top', position: 'top',
}) })
return; return;
} }
this.$http('POST', '/api/admin/set_visit_price', { this.$http('POST', '/api/admin/set_visit_price', {
...params ...params
}).then(response => { }).then(response => {
this.$nextTick(() => { this.$nextTick(() => {
if(response.code !== 0) { if(response.code !== 0) {
this.$positionMessage({ this.$Message.error(response.msg);
type: 'error', }else{
message: response.msg, this.$Message.success('设置成功');
target: '#siteMessage7',
})
}else{
this.$positionMessage({
type: 'success',
message: '设置成功',
target: '#siteMessage7',
})
} }
this.registrationVisible = false; this.registrationVisible = false;
}) })

128
src/views/weChatPayment.vue

@ -17,12 +17,12 @@
</div> </div>
<p class="mt12">2.登录微信商户平台在产品中心开通Native支付如需使用微信版开通JSAPI支付</p> <p class="mt12">2.登录微信商户平台在产品中心开通Native支付如需使用微信版开通JSAPI支付</p>
</div> </div>
<el-form> <el-form ref="wxform" :model="formData1" :rules="rules">
<div class="flex-wrap"> <div class="flex-wrap">
<div class="flex-left"> <div class="flex-left">
<GuipFormItem column="column" class="mb24" label="公司简称" :required="true"> <GuipFormItem column="column" class="mb24" label="公司简称" :required="true">
<span class="desc" slot="formRight">请输入公司简称便于您区分账号所属公司</span> <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="请输入"> prop="company_short_name" placeholder="请输入">
</GuipInput> </GuipInput>
</GuipFormItem> </GuipFormItem>
@ -31,7 +31,7 @@
<a href='https://pay.weixin.qq.com/' class="guide" <a href='https://pay.weixin.qq.com/' class="guide"
target='_blank'><img src="@/assets/site/form_qua_ic.svg" alt="">指南</a> target='_blank'><img src="@/assets/site/form_qua_ic.svg" alt="">指南</a>
</span> </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="请输入"> placeholder="请输入">
</GuipInput> </GuipInput>
</GuipFormItem> </GuipFormItem>
@ -42,14 +42,14 @@
<span class="desc" slot="formRight"><a href='https://pay.weixin.qq.com/' class="guide" <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> target='_blank'><img src="@/assets/site/form_qua_ic.svg" alt="">指南</a>
</span> </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="不能设为纯数字"> placeholder="不能设为纯数字">
</GuipInput> </GuipInput>
</GuipFormItem> </GuipFormItem>
<GuipFormItem column="column" class="mb24" label="公众号APPID" :required="true"> <GuipFormItem column="column" class="mb24" label="公众号APPID" :required="true">
<span class="desc" slot="formRight"><a href='https://mp.weixin.qq.com/' class="guide" <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> 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="不能设为纯数字"> placeholder="不能设为纯数字">
</GuipInput> </GuipInput>
</GuipFormItem> </GuipFormItem>
@ -80,8 +80,8 @@
<i class="bgImg"></i>选择文件 <i class="bgImg"></i>选择文件
</GuipButton> </GuipButton>
</el-upload> </el-upload>
<p class="uploaded" v-if="payinfo.cert_uploaded">已上传</p> <!-- <p class="uploaded" v-if="formData.apiclient_cert">已上传</p>
<p class="normalUpload notuploaded" v-else>未上传任何文件</p> <p class="normalUpload notuploaded" v-else>未上传任何文件</p> -->
</div> </div>
</div> </div>
<div class="flex-line"></div> <div class="flex-line"></div>
@ -95,10 +95,9 @@
:btnstyle="{ width: '118px' }"> :btnstyle="{ width: '118px' }">
<i class="bgImg"></i>选择文件 <i class="bgImg"></i>选择文件
</GuipButton> </GuipButton>
</el-upload> </el-upload>
<p class="uploaded" v-if="payinfo.key_uploaded">已上传</p> <!-- <p class="uploaded" v-if="formData.apiclient_key">已上传</p>
<p class="normalUpload" v-else>未上传任何文件</p> <p class="normalUpload notuploaded" v-else>未上传任何文件</p> -->
</div> </div>
</div> </div>
</div> </div>
@ -127,15 +126,32 @@ export default {
}, },
data() { data() {
return { return {
// formData1:{
company_short_name: '', //
// company_short_name: '',
mch_id: '', //
// mch_id: '',
apiv2: '', //
// APPID key: '',
appid: '', // APPID
payinfo: [], 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: { saveBtnStyleObj: {
width: '144px', width: '144px',
height: '46px', height: '46px',
@ -146,7 +162,6 @@ export default {
}, },
created() { created() {
// //
// this.getPayment()
}, },
methods: { methods: {
getPayment() { getPayment() {
@ -161,39 +176,62 @@ export default {
}) })
}, },
handleAvatarChange(file, fileList) { handleAvatarChange(file, fileList) {
console.log(file, fileList) console.log(file, fileList, 'file')
let fileObj = file.raw let fileObj = file.raw
this.payInfo.apiclient_cert = fileObj;
this.formData.set('apiclient_cert', fileObj) this.formData.set('apiclient_cert', fileObj)
// this.formData.append('apiclient_cert', fileObj)
}, },
handleAvatarChange1(file, fileList) { handleAvatarChange1(file, fileList) {
console.log(file, fileList) console.log(file, fileList, 'file')
let fileObj = file.raw let fileObj = file.raw
this.payInfo.apiclient_key = fileObj;
this.formData.set('apiclient_key', fileObj) this.formData.set('apiclient_key', fileObj)
}, },
saveConfirm() { saveConfirm() {
// //
// this.$positionMessage({ // for (let [key, value] of this.formData.entries()) {
// type: 'error', // console.log(' (Key):', key);
// message: '', // console.log(' (Value):', value);
// target: this.$refs['saveRef'], // DOM // }
// position: 'top' this.$refs.wxform.validate((valid) => {
// }) console.log(valid, 'valid');
// let obj = {} if (valid) {
// obj.uid = this.serviceInfo.uid for (let key in this.formData1) {
// obj.type = this.serviceInfo.type this.formData.set(key, this.formData1[key])
// obj.info = "" }
// const that = this if(!this.formData.has('apiclient_key') || !this.formData.has('apiclient_cert')){
// this.$http('POST', '/agentnew/ajax_payment_switch', obj).then(response => { this.$positionMessage({
// if(response.status){ type: 'error',
// that.$message.success(''); message: '请先上传证书',
// that.payList = response.data.paylist target: this.$refs['saveRef'], // DOM
// that.$emit('saveEvent', that.payList) position: 'top'
// return true; })
// } return false;
// that.$message.error(response.info); }
// }).catch(error => { this.formData.set('doctor_id', this.$route.query.doctor_id)
// console.error(error, 'error') 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;
}
})
}, },
} }

Loading…
Cancel
Save