Browse Source

支付相关

paymentMethod-11-10
longchao 4 weeks ago
parent
commit
1cc7c94fd8
  1. 497
      src/components/SetAliPay.vue
  2. 28
      src/views/HosInformation.vue
  3. 8
      src/views/paymentMethod.vue

497
src/components/SetAliPay.vue

@ -0,0 +1,497 @@
<template>
<div class="config-offline-wrap">
<el-form>
<GuipDialog :dialogVisible="addPayDialogVisible" :title="addPayTitle" :show-close-button="false"
:show-cancel-button="showCancelButton" @confirm="addPayment" @cancel="handleCancel"
@close="handleClose" @dialogVisibleChange="dialogVisibleChange" :confirmText="addPayconfirmText" width="599px">
<!-- 自定义内容 -->
<div>
<!-- 淘宝 -->
<div class="taobaopay" v-if="addPayType==payTypeTaoBao">
<div class="beforeNotice">
<h4 class="flex"> <img src="@/assets/site/siteSemInfo_Icon.svg" alt=""> 前期准备事项</h4>
<p class="mt12 flex">
请确保使用要添加的淘宝主账号登录并授权
</p>
<p class="mt10 flex">
如未购买快乐帮手服务或已过期会跳转到购买服务页面
</p>
</div>
</div>
<!-- 微信 -->
<div class="weixinpay" v-if="addPayType==payTypeWeixin">
<div class="beforeNotice">
<h4 class="flex"> <img src="@/assets/site/siteSemInfo_Icon.svg" alt=""> 前期准备事项</h4>
<p class="mt12">1.申请公司微信支付<a href="https://zhic.yuque.com/staff-chwecz/xhk8nt/ggkqm3" target="_blank"><img src="@/assets/site/form_qua_ic.svg" alt="">常见问题</a> </p>
<p class="mt12 flex">
2.前往<a href="https://pay.weixin.qq.com/"
class="flex" target="_blank">
<img src="@/assets/site/form_linkActive.svg" alt="">微信商户平台</a>
</p>
<p> 在产品中心开通Native支付如需使用微信版开通JSAPI支付</p>
</div>
<el-form>
<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>
</GuipFormItem>
<GuipFormItem column="column" class="mb24" label="2. 支付商户号(mch_id)">
<span class="desc" slot="formRight"><a href='https://pay.weixin.qq.com/' target='_blank'>微信支付平台</a>账户中心商户信息微信支付商户号</span>
<GuipInput slot="formDom" ref="GuipInput" column="column" v-model="mch_id" prop="mch_id" placeholder="请输入商户号">
</GuipInput>
</GuipFormItem>
<GuipFormItem column="column" class="mb24" label="3. 微信支付秘钥">
<span class="desc" slot="formRight"><a href='https://pay.weixin.qq.com/' target='_blank'>微信支付平台</a>账号中心账户设置API安全APIv2密钥<p class="mt10">注意支付密钥不能设置为纯数字</p></span>
<GuipInput slot="formDom" ref="GuipInput" column="column" v-model="apiv2" prop="apiv2" placeholder="请输入微信支付秘钥">
</GuipInput>
</GuipFormItem>
<GuipFormItem column="column" class="mb24" label="4. 公众号APPID">
<span class="desc" slot="formRight"><a href='https://mp.weixin.qq.com/' target='_blank'>公众平台</a>设置与开发基本配置公众号开发信息开发者IDAPPID</span>
<GuipInput slot="formDom" ref="GuipInput" column="column" v-model="appid" prop="appid" placeholder="请输入公众号APPID">
</GuipInput>
</GuipFormItem>
</el-form>
</div>
<!-- 支付宝 -->
<div class="alipay" v-if="addPayType==payTypeAlipay">
<el-tabs v-model="isPayPublic" @tab-click="handleClick">
<!-- <el-tab-pane label="我有公司,使用本公司支付宝" name="0"> -->
<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" :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="alipayInfo.appid" prop="appid" placeholder="请输入公司支付宝账号"></GuipInput>
</GuipFormItem>
</el-form>
<!-- </el-tab-pane> -->
<!-- <el-tab-pane label="我无公司,申请平台代收款" name="1" v-if="isExistSelfSupplys===false">
<div class="beforeNotice">
<h4 class="flex"> <img src="@/assets/site/siteSemInfo_Icon.svg" alt=""> 须知</h4>
<p class="mt12">使用平台支付宝支付平台收取5%的服务费</p>
<p class="mt12 flex">使用平台支付宝支付真实姓名必须和支付宝账号实名认证姓名统一</p>
</div>
<el-form>
<GuipFormItem column="column" class="mb24" label="1. 收款人姓名">
<span class="desc" slot="formRight">请输入支付宝绑定的银行卡的持卡人姓名</span>
<GuipInput slot="formDom" ref="GuipInput" column="column" v-model="receive_payment_name" prop="company_short_name" placeholder="6字以内"></GuipInput>
</GuipFormItem>
<GuipFormItem column="column" class="mb24" label="2. 收款支付宝账号">
<span class="desc" slot="formRight">请输入有效账号</span>
<GuipInput slot="formDom" ref="GuipInput" column="column" v-model="receive_payment_account" prop="mch_id" placeholder="请输入有效收款支付宝账号"></GuipInput>
</GuipFormItem>
</el-form>
</el-tab-pane> -->
</el-tabs>
</div>
<!-- 拼多多 -->
<div class="pddpay" v-if="addPayType==payTypePdd">
<div class="beforeNotice">
<h4 class="flex"> <img src="@/assets/site/siteSemInfo_Icon.svg" alt=""> 前期准备事项</h4>
<p class="mt12 flex">主账号登录并授权<a :href="pddAuthUrl" class="flex" target="_blank"><img src="@/assets/site/form_linkActive.svg" alt="">去授权</a></p>
<p class="mt12 flex gray">如未购买快乐帮手服务或已过期会跳转到购买服务页面</p>
<p class="mt5 flex gray">授权成功后会进入快乐帮手烽火台复制右上角名称填入下方保存</p>
</div>
<el-form>
<GuipFormItem column="column" class="mb24" label="账号名称">
<!-- <span class="desc" slot="formRight">账号名称</span> -->
<GuipInput slot="formDom" ref="GuipInput" column="column" v-model="pdd_shop_name" prop="company_short_name" placeholder="请输入账号名称"></GuipInput>
</GuipFormItem>
</el-form>
</div>
</div>
</GuipDialog>
</el-form>
</div>
</template>
<script>
import GuipInput from '@/components/GuipInput.vue';
import GuipFormItem from '@/components/GuipFormItem.vue';
import GuipDialog from '@/components/GuipDialog.vue';
//
const PAY_TYPE_TAOBAO = 0; //
const PAY_TYPE_WEIXIN = 2; //
const PAY_TYPE_ALIPAY = 3; //
const PAY_TYPE_JINGDONG = 4; //
const PAY_TYPE_PDD = 11; //
export default {
//
name: 'addPay',
props: {
//
payType: {
type: [String, Number],
default: '-1',
// validator: value => ['success', 'warning', 'error', 'info'].includes(value)
},
//
visible: {
type: Boolean,
default: false
},
// url
taobaoAuthUrl: {
type: String,
default: ''
},
// url
pddAuthUrl: {
type: String,
default: ''
},
// url
jdAuthUrl: {
type: String,
default: ''
},
//
isExistSelfSupplys: {
type: Boolean,
default: false
},
depart_id:{
type: String,
default: ''
},
doctor_id:{
type: String,
default: ''
},
checkAliPay:{
type: Object,
}
},
components: {
GuipInput,
GuipFormItem,
GuipDialog,
},
data() {
return {
//
payTypeTaoBao: PAY_TYPE_TAOBAO,
payTypeWeixin: PAY_TYPE_WEIXIN,
payTypeAlipay: PAY_TYPE_ALIPAY,
payTypeJingdong: PAY_TYPE_JINGDONG,
payTypePdd: PAY_TYPE_PDD,
paytypeDesc: {
payTypeTaoBao: '淘宝/天猫店铺',
payTypeWeixin: '微信收款',
payTypeAlipay: '支付宝收款',
payTypeJingdong: '京东店铺',
payTypePdd: '拼多多店铺'
},
//
addPayType: -1,
//
addPayDialogVisible: false,
//
showCancelButton: true,
//
showCloseButton: true,
//
addPayTitle: '',
//
addPayconfirmText: '确定',
//
company_short_name: '',
//
mch_id: '',
//
apiv2: '',
// APPID
appid: '',
//
// alipay_account: '',
//
receive_payment_account: '',
//
receive_payment_name: '',
// 0 1
isPayPublic: '0',
//
pdd_shop_name: '',
alipayInfo:{
company_short_name: '',
appid:''
},
alipayRules:{
company_short_name: [
{ required: true, message: '请输入公司简称', trigger: 'blur' }
],
appid: [
{ required: true, message: '请输入支付宝账号', trigger: 'blur' }
],
}
// localSiteInfo: { ...this.siteInfo }
}
},
computed: {
// ...mapState(['pageTitle']) // VuexshowSidebar
},
mounted() {
// store.commit('SET_PAGETITLE', '广');
},
methods: {
updateDialogByPayType() {
if (this.addPayType > -1) {
//
let typeDesc = '';
// addPayType
for (let key in this.paytypeDesc) {
if (this[key] === this.addPayType) {
typeDesc = this.paytypeDesc[key];
break;
}
}
this.addPayTitle = '添加' + typeDesc;
//
if (this.addPayType === this.payTypeTaoBao || this.addPayType === this.payTypeJingdong) {
this.addPayconfirmText = '去授权';
} else {
this.addPayconfirmText = '确定';
}
}
},
resetForm() {
//
this.company_short_name = '';
this.mch_id = '';
this.apiv2 = '';
this.appid = '';
this.receive_payment_account = '';
this.receive_payment_name = '';
this.pdd_shop_name = '';
this.isPayPublic = '0'; //
},
// ---start
showAddPaymentMethodDialog(type, type_desc) {
console.log(type, 'type');
this.addPayDialogVisible = true;
this.addPayTitle = '添加' + type_desc;
this.addPayType = type;
if (type == PAY_TYPE_TAOBAO || type == PAY_TYPE_JINGDONG) {
this.addPayconfirmText = '去授权';
}
},
//
addPayment() {
if (this.addPayType == PAY_TYPE_TAOBAO) {
window.open(this.taobaoAuthUrl, '_blank');
} else if (this.addPayType == PAY_TYPE_WEIXIN) {
this.$http('POST', '/agentnew/ajax_add_weixinpay', {
company_short_name: this.company_short_name,
mch_id: this.mch_id,
apiv2: this.apiv2,
appid: this.appid
}).then(response => {
this.$nextTick(() => {
if (response.status) {
this.init(response.data);
this.$Message.success(response.info);
} else {
this.$Message.error(response.info);
}
})
}).catch(error => {
console.error(error, 'error')
})
} else if (this.addPayType == PAY_TYPE_ALIPAY) { //
let falseFlag = false;
// console.log(this.doctor_id,this.depart_id,'depart_id');
this.$refs.alipayForm.validate((valid) => {
console.log(valid,'valid===');
if (valid) {
falseFlag = true;
this.$http('POST', '/api/admin/set_pay_method', {
doctor_id:this.doctor_id,
depart_id:this.depart_id,
type:this.payTypeAlipay,
company_short_name: this.alipayInfo.company_short_name,
appid: this.alipayInfo.appid,
// pay_id:1
// is_pay_public: this.isPayPublic,
}).then(response => {
if (response.code == 0) {
if (!response.data.auth_url) {
this.$Message.success(response.msg);
} else {
window.open(response.data.auth_url, '_blank');
}
} else {
this.$Message.error(response.msg);
}
}).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,
}).then(response => {
this.$nextTick(() => {
if (response.status) {
this.init(response.data);
this.$Message.success(response.info);
} else {
this.$Message.error(response.info);
}
})
}).catch(error => {
console.error(error, 'error')
})
} else if (this.addPayType == PAY_TYPE_JINGDONG) {
window.open(this.jdAuthUrl, '_blank');
}
console.log('addPayment===走到这里了');
this.init();
},
//
handleCancel() {
this.init();
},
//
handleClose() {
this.init();
},
dialogVisibleChange(data) {
console.log(data, 'data098908090');
},
handleClick(tab, event) {
console.log(tab, event);
},
init(payid) {
this.addPayDialogVisible = false;
this.$emit('update:visible', false);
this.resetForm(); //
if(payid){
this.$http('POST', '/agentnew/ajax_get_payinfo', {
payid: payid,
}).then(response => {
this.$nextTick(() => {
if (response.status) {
this.$emit('update:data', response.data);
}
})
}).catch(error => {
console.error(error, 'error')
})
}
},
},
watch: {
visible(newVal) {
this.addPayDialogVisible = newVal;
},
payType(newVal) {
this.addPayType = newVal;
this.updateDialogByPayType();
this.resetForm(); //
},
checkAliPay(newVal){
if(newVal){
this.alipayInfo = {...newVal}
console.log(this.alipayInfo,'newVal=====newVal');
}
}
}
}
</script>
<style scoped lang="scss">
.beforeNotice {
h4 {
margin: 0;
gap: 8px;
}
margin-bottom: 18px;
text-align: left;
box-sizing: border-box;
padding: 20px 14px;
border-radius: 4px;
/* middle/middle_blue_1 */
background: #F2F7FF;
/* middle/middle_blue_3 */
border: 1px solid #BFDAFF;
div {
margin-top: 2px;
padding-left: 23px;
p {
color: #8A9099;
}
}
p {
color: #1E2226;
i {
font-style: normal;
}
&:last-child {
display: flex;
align-items: stretch;
b {
font-weight: normal;
color: #8A9099;
display: inline-flex;
img {
margin-left: 4px;
}
}
}
}
a {
text-decoration: none;
color: #006AFF;
margin-right: 10px;
img {
margin-left: 5px;
margin-right: 5px;
}
}
}
.guide{
display: flex;
align-items: center;
gap: 6px;
color: #8A9099 !important;
font-size: 12px;
}
a {
color: #006AFF;
text-decoration: none;
}
</style>

28
src/views/HosInformation.vue

@ -184,7 +184,7 @@
<p>需在微信商户平台-产品中心开通Native支付</p>
</div>
<div class="right">
<GuipButton type="primary" size="medium" @click="goToAddPay">
<GuipButton type="primary" size="medium" @click="goToAddPay(payTypeWeixin)">
前往添加</GuipButton>
</div>
</div>
@ -496,7 +496,8 @@
</el-form>
</GuipDialog>
<SetAliPay payType="3" :visible="isShowAddAliPay" @update:visible="handleEvent" @update:data="handleUpdateEvent"
:isExistSelfSupplys="isExistSelfSupplys" :doctor_id="doctor_id" :depart_id="depart_id" :checkAliPay="checkAliPay"></SetAliPay>
</div>
</template>
<script>
@ -513,6 +514,8 @@ import GuipTable from '@/components/GuipTable.vue';
import GuipDialog from '@/components/GuipDialog.vue';
//import GuipSelectFilter from '@/components/GuipSelectFilter.vue';
import CustomDropdown from '@/components/CustomDropdown.vue';
import SetAliPay from '@/components/SetAliPay.vue';
import { mapState } from 'vuex';
import { Object } from 'core-js';
const PAY_TYPE_WEIXIN = 2; //
@ -533,6 +536,7 @@ export default {
GuipSelect,
GuipTextarea,
GroupFormBtns,
SetAliPay
},
data() {
return {
@ -691,6 +695,9 @@ export default {
hasAgainVisitFreeDays:0,
againVisitFreeDays:0,
hasRemainVisitFree:0,
isShowAddAliPay:false,
isExistSelfSupplys: false,
checkAliPay:null
}
},
created() {
@ -737,11 +744,20 @@ export default {
...mapState(['hosMenuData']) // VuexshowSidebar
},
methods: {
// goToWxPay(){
// this.$router.push(`/weChatPayment?doctor_id=${this.doctor_id}&depart_id=${this.depart_id}`);
// },
goToAddPay(){
handleEvent(data) {
this.isShowAddAliPay = data;
},
handleUpdateEvent(data){
this.bindAlipayId = data.payid;
this.selectAlipay = data;
},
goToAddPay(pay_type){
if(pay_type == this.payTypeWeixin) {
this.$router.push(`/setPaymentForm?doctor_id=${this.doctor_id}&depart_id=${this.depart_id}`);
return
}
this.isShowAddAliPay = true;
},
showDialog(type) {
if (type == 'register') {

8
src/views/paymentMethod.vue

@ -158,14 +158,18 @@ export default {
this.checkAliPay = {...row}
this.goBindPay()
}else{
this.goToWxPay(row.doctor_id,row.id)
this.goToWxPay(this.doctor_id,row.id)
}
},
updatePayStatus(row) {
this.$emit('updatePayStatus', row)
},
goToWxPay(doctor_id, pay_id){
this.$router.push(`/setPaymentForm?doctor_id=${doctor_id}&pay_id=${pay_id}`);
if(!doctor_id) doctor_id = this.doctor_id;
var urlpath = `/setPaymentForm?doctor_id=${doctor_id}`;
if(pay_id) urlpath += `&pay_id=${pay_id}`;
this.$router.push(urlpath);
},
goBindPay() {
this.addPayType = this.payTypeAlipay;

Loading…
Cancel
Save