Browse Source

Merge pull request 'zq-1011-paymentSetting' (#10) from zq-1011-paymentSetting into master

Reviewed-on: #10
master
zhangqi 2 weeks ago
parent
commit
d97527ca41
  1. 2
      src/components/addPay.vue
  2. 55
      src/views/HosInformation.vue
  3. 145
      src/views/weChatPayment.vue

2
src/components/addPay.vue

@ -312,7 +312,7 @@ export default {
this.$http('POST', '/agentnew/ajax_add_alipay', { this.$http('POST', '/agentnew/ajax_add_alipay', {
company_short_name: this.alipayRules.company_short_name, company_short_name: this.alipayRules.company_short_name,
alipay_account: this.alipayRules.alipay_account, 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_account: this.receive_payment_account,
// receive_payment_name: this.receive_payment_name // receive_payment_name: this.receive_payment_name
}).then(response => { }).then(response => {

55
src/views/HosInformation.vue

@ -737,7 +737,6 @@ export default {
this.fetchPackData() this.fetchPackData()
this.fetchProjectData() this.fetchProjectData()
this.geHosAdress() this.geHosAdress()
this.getPayList()
} else { } else {
await this.getAreaData() 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) { changeSelectWeixin(item) {
console.log(item, 'item') console.log(item, 'item')
if(this.bindWxpayId === item.payid){ if(this.bindWxpayId === item.payid){
@ -903,6 +875,7 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
if(response.code == 0) { if(response.code == 0) {
this.$Message.success('设置成功'); this.$Message.success('设置成功');
this.fetchDoctorData()
}else{ }else{
this.$Message.error(response.msg); this.$Message.error(response.msg);
} }
@ -1034,6 +1007,30 @@ export default {
this.hasVisitFee = response.data.has_visit_fee this.hasVisitFee = response.data.has_visit_fee
this.registerMoney = response.data.visit_price 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.hasAgainVisitFreeDays = response.data.has_again_visit_free_days
this.againVisitFreeDays = response.data.again_visit_free_days this.againVisitFreeDays = response.data.again_visit_free_days
this.hasRemainVisitFree = response.data.has_remain_visit_free this.hasRemainVisitFree = response.data.has_remain_visit_free

145
src/views/weChatPayment.vue

@ -42,7 +42,7 @@
<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="formData1.key" prop="key" <GuipInput slot="formDom" ref="GuipInput" column="column" v-model="formData1.pkey" prop="pkey"
placeholder="不能设为纯数字"> placeholder="不能设为纯数字">
</GuipInput> </GuipInput>
</GuipFormItem> </GuipFormItem>
@ -73,15 +73,15 @@
<div class="uploadwrap"> <div class="uploadwrap">
<label class="flex upload-title gap8">上传 apiclient_cert.pem 证书<img class="ml-4" <label class="flex upload-title gap8">上传 apiclient_cert.pem 证书<img class="ml-4"
src="@/assets/require.svg" /></label> src="@/assets/require.svg" /></label>
<el-upload class="upload-demo" :on-change="handleAvatarChange" action="#" :multiple="false" <el-upload class="upload-demo" :file-list="fileList" :on-change="handleAvatarChange" :on-remove="handRemove" action="#" :multiple="false"
:limit="Number(1)" ref="avatorUpload" :auto-upload="false"> :limit="Number(1)" ref="avatorUpload" :auto-upload="false">
<GuipButton class="upload-button" slot="trigger" type="ignore" <GuipButton class="upload-button" slot="trigger" type="ignore"
: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="formData.apiclient_cert">已上传</p> <!-- <p class="uploaded" v-if="formData.apiclient_cert">已上传</p> -->
<p class="normalUpload notuploaded" v-else>未上传任何文件</p> --> <!-- <p :class="['normalUpload', noFileFlag ?'notuploaded' :'']" v-if="!('apiclient_cert' in payInfo)">未上传任何文件</p> -->
</div> </div>
</div> </div>
<div class="flex-line"></div> <div class="flex-line"></div>
@ -89,15 +89,15 @@
<div class="uploadwrap"> <div class="uploadwrap">
<label class="flex upload-title gap8">上传 apiclient_key.pem 证书<img class="ml-4" <label class="flex upload-title gap8">上传 apiclient_key.pem 证书<img class="ml-4"
src="@/assets/require.svg" /></label> src="@/assets/require.svg" /></label>
<el-upload class="upload-demo" :on-change="handleAvatarChange1" action="#" :multiple="false" <el-upload class="upload-demo" :file-list="fileList1" :on-change="handleAvatarChange1" :on-remove="handRemove1" action="#" :multiple="false"
:limit="Number(1)" ref="avatorUpload" :auto-upload="false"> :limit="Number(1)" ref="avatorUpload" :auto-upload="false">
<GuipButton class="upload-button" slot="trigger" type="ignore" <GuipButton class="upload-button" slot="trigger" type="ignore"
: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="formData.apiclient_key">已上传</p> <!-- <p class="uploaded" v-if="formData.apiclient_key">已上传</p> -->
<p class="normalUpload notuploaded" v-else>未上传任何文件</p> --> <!-- <p :class="['normalUpload', noFileFlag1 ?'notuploaded' :'']" v-if="!('apiclient_key' in payInfo)">未上传任何文件</p> -->
</div> </div>
</div> </div>
</div> </div>
@ -105,7 +105,7 @@
</div> </div>
<div class="save-button"> <div class="save-button">
<GuipButton type="primary" ref="saveRef" :btnstyle="saveBtnStyleObj" @click="saveConfirm">保存</GuipButton> <GuipButton type="primary" ref="saveRef" :btnstyle="saveBtnStyleObj" @click="saveConfirm">完成设置</GuipButton>
</div> </div>
</div> </div>
@ -115,6 +115,8 @@
import GuipInput from '@/components/GuipInput.vue'; import GuipInput from '@/components/GuipInput.vue';
import GuipButton from '@/components/GuipButton.vue'; import GuipButton from '@/components/GuipButton.vue';
import GuipFormItem from '@/components/GuipFormItem.vue'; import GuipFormItem from '@/components/GuipFormItem.vue';
const PAY_TYPE_WEIXIN = 2; //
const PAY_TYPE_ALIPAY = 3; //
export default { export default {
// //
name: 'addPay', name: 'addPay',
@ -125,6 +127,15 @@ export default {
GuipFormItem, GuipFormItem,
}, },
data() { data() {
const notPureNumberRule = (rule, value, callback) => {
if (!value) {
callback(new Error('该字段为必填项'));
} else if (/^\d+$/.test(value)) {
callback(new Error('不能设为纯数字'));
} else {
callback();
}
};
return { return {
formData1:{ formData1:{
// //
@ -132,7 +143,7 @@ export default {
// //
mch_id: '', mch_id: '',
// //
key: '', pkey: '',
// APPID // APPID
appid: '', appid: '',
}, },
@ -141,13 +152,20 @@ export default {
{ required: true, message: '请输入公司简称', trigger: 'blur' } { required: true, message: '请输入公司简称', trigger: 'blur' }
], ],
appid: [ appid: [
{ required: true, message: '请输入公众号APPID', trigger: 'blur' } { required: true, message: '请输入公众号APPID', trigger: 'blur' },
{ validator: notPureNumberRule, trigger: 'blur' }
], ],
mch_id: [ mch_id: [
{ required: true, message: '请输入微信支付商户号', trigger: 'blur' } { required: true, message: '请输入微信支付商户号', trigger: 'blur' },
{
pattern: /^\d+$/,
message: '商户号必须为纯数字',
trigger: 'blur'
}
], ],
key: [ pkey: [
{ required: true, message: '请输入微信支付秘钥', trigger: 'blur' } { required: true, message: '请输入微信支付秘钥', trigger: 'blur' },
{ validator: notPureNumberRule, trigger: 'blur' }
], ],
}, },
formData: new FormData(), formData: new FormData(),
@ -158,71 +176,114 @@ export default {
borderRadius: '4px', borderRadius: '4px',
background: '#006AFF', background: '#006AFF',
}, },
fileList: [],
fileList1: [],
noFileFlag: false,
noFileFlag1: false,
payTypeWeixin: PAY_TYPE_WEIXIN,
payTypeAlipay: PAY_TYPE_ALIPAY,
} }
}, },
created() { created() {
// //
this.formData.set('doctor_id', this.$route.query.doctor_id)
this.formData.set('depart_id', this.$route.query.depart_id)
console.log('apiclient_cert' in this.payInfo,'apiclient_key');
}, },
methods: { methods: {
getPayment() { handRemove() {
this.$http('POST', '/agentnew/ajax_get_payinfo', { this.formData.delete('apiclient_cert');
payid: this.$route.query.payid, this.payInfo.delete('apiclient_cert');
}).then(response => { this.noFileFlag = true;
this.$nextTick(() => { },
this.payinfo = response.data handRemove1() {
}) this.formData.delete('apiclient_key');
}).catch(error => { this.payInfo.delete('apiclient_key');
console.error(error, 'error') this.noFileFlag1 = true;
})
}, },
handleAvatarChange(file, fileList) { handleAvatarChange(file, fileList) {
console.log(file, fileList, 'file') console.log(file, fileList, 'file')
let fileObj = file.raw let fileObj = file.raw
this.noFileFlag = false;
this.payInfo.apiclient_cert = fileObj; this.payInfo.apiclient_cert = fileObj;
this.formData.set('apiclient_cert', fileObj) this.formData.set('apiclient_cert', fileObj)
// this.formData.append('apiclient_cert', fileObj) // this.uoload_apipem()
}, },
handleAvatarChange1(file, fileList) { handleAvatarChange1(file, fileList) {
console.log(file, fileList, 'file') console.log(file, fileList, 'file')
let fileObj = file.raw let fileObj = file.raw;
this.noFileFlag1 = false;
this.payInfo.apiclient_key = fileObj; this.payInfo.apiclient_key = fileObj;
this.formData.set('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() { saveConfirm() {
// // pay_id
// -
// for (let [key, value] of this.formData.entries()) { // for (let [key, value] of this.formData.entries()) {
// console.log(' (Key):', key); // console.log(' (Key):', key);
// console.log(' (Value):', value); // 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) => { this.$refs.wxform.validate((valid) => {
console.log(valid, 'valid'); console.log(valid, 'valid');
if (valid) { if (valid) {
for (let key in this.formData1) { for (let key in this.formData1) {
this.formData.set(key, this.formData1[key]) 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('doctor_id', this.$route.query.doctor_id)
this.formData.set('depart_id', this.$route.query.depart_id) this.formData.set('depart_id', this.$route.query.depart_id)
const that = this this.formData.set('type',this.payTypeWeixin)// 2 \ 3
this.$http('POST', '/agentnew/ajax_payment_switch', this.formData).then(response => { this.formData.set('is_pay_public','0')
if(response.status){ const that = this;
this.$http('POST', '/api/admin/set_pay_method', this.formData).then(response => {
if(response.code == 0){
that.$message.success('保存成功'); that.$message.success('保存成功');
// that.payList = response.data.paylist // that.payList = response.data.paylist
// that.$emit('saveEvent', that.payList) // that.$emit('saveEvent', that.payList)
this.$router.go(-1); this.$router.go(-1);
return true; return true;
} }
that.$message.error(response.info); that.$message.error(response.msg);
}).catch(error => { }).catch(error => {
console.error(error, 'error') console.error(error, 'error')
}) })
@ -230,8 +291,6 @@ export default {
return false; return false;
} }
}) })
}, },
} }

Loading…
Cancel
Save