Browse Source

商家添加支付模式功能业务

master
dy-hu 2 years ago
parent
commit
0c193abe3f
  1. 9
      src/api/business.js
  2. 77
      src/views/business/businessList/index.vue

9
src/api/business.js

@ -178,3 +178,12 @@ export function getHnaPayInfo(businessId) {
method: 'get' method: 'get'
}) })
} }
export function changeBusinessPayMode(data) {
return request({
url: '/hnaPay/changeBusinessPayMode',
method: 'post',
data
})
}

77
src/views/business/businessList/index.vue

@ -406,7 +406,19 @@
label="新账通支付" label="新账通支付"
name="third" name="third"
> >
<div style="margin-left: 15px; margin-bottom: 20px">
<div style="display: flex;flex-direction: row;margin-bottom: 15px;justify-content: flex-end">
<el-switch
active-text="开启"
inactive-text="关闭"
:loading="isHnaPayOpenLoading"
:disable="isHnaPayOpenLoading"
v-model="hnapayOpen"
@change="hnapayOpenChange"
/>
</div>
<div style="margin-left: 15px; margin-bottom: 20px" v-if="hnapayOpen">
<span v-if="hnapayStatus != '2' && currentHnapayId" style="color: orange;cursor: pointer" @click="showUploadCert()">上传资料</span> <span v-if="hnapayStatus != '2' && currentHnapayId" style="color: orange;cursor: pointer" @click="showUploadCert()">上传资料</span>
<span v-if="hnapayStatus === '1'" style="margin-left: 15px;color: #2e60f8">资料审核中</span> <span v-if="hnapayStatus === '1'" style="margin-left: 15px;color: #2e60f8">资料审核中</span>
<span v-if="hnapayStatus === '2'">审核通过</span> <span v-if="hnapayStatus === '2'">审核通过</span>
@ -414,6 +426,7 @@
</div> </div>
<el-form <el-form
v-if="hnapayOpen"
ref="hnapayForm" ref="hnapayForm"
:model="hnapayForm" :model="hnapayForm"
:rules="hnaPayRules" :rules="hnaPayRules"
@ -483,6 +496,17 @@
label="微信支付宝" label="微信支付宝"
name="fourth" name="fourth"
> >
<div style="display: flex;flex-direction: row;margin-bottom: 15px;justify-content: flex-end">
<el-switch
active-text="开启"
inactive-text="关闭"
:loading="isWxaliPayOpenLoading"
:disable="isWxaliPayOpenLoading"
v-model="wxaliPayOpen"
@change="wxaliPayOpenChange"
/>
</div>
<el-form <el-form
ref="ruleForm" ref="ruleForm"
:model="ruleForm" :model="ruleForm"
@ -540,7 +564,7 @@
>确 定</el-button> >确 定</el-button>
<el-button <el-button
v-if="activeName == 'third'"
v-if="activeName == 'third' && hnapayOpen"
type="primary" type="primary"
@click="handleSubmitHnapay" @click="handleSubmitHnapay"
>提 交</el-button> >提 交</el-button>
@ -637,7 +661,8 @@ import {
delBusinessById, delBusinessById,
hnapaySave, hnapaySave,
uploadCertInfo, uploadCertInfo,
getHnaPayInfo
getHnaPayInfo,
changeBusinessPayMode
} from '@/api/business' } from '@/api/business'
import SharesettingDialog from '../../../components/Sharesetting'; import SharesettingDialog from '../../../components/Sharesetting';
import DomainSettingDialog from '../../../components/DomainSetting'; import DomainSettingDialog from '../../../components/DomainSetting';
@ -842,6 +867,14 @@ export default {
hasUploadAfterCard: false, hasUploadAfterCard: false,
hasUploadCertNo: false, hasUploadCertNo: false,
hasUploadPermitCert: false, hasUploadPermitCert: false,
hnapayOpen: false,
lastHnaPayOpen: false,//记录切换前的状态(用于失败回退)
isHnaPayOpenLoading: false,
wxaliPayOpen: false,
lastWxaliPayOpen: false,//记录切换前的状态(用于失败回退)
isWxaliPayOpenLoading: false,
//商家支付模式
businessPayMode: '0',
} }
}, },
// 监听属性 类似于data概念 // 监听属性 类似于data概念
@ -1022,6 +1055,9 @@ export default {
// 编辑 // 编辑
async edit (row) { async edit (row) {
this.currentBusinessId = row.businessId this.currentBusinessId = row.businessId
this.businessPayMode = row.payMode
this.hnapayOpen = row.payMode === 1
this.wxaliPayOpen = row.payMode === 2
this.hnapayStatus = row.hnapayStatus this.hnapayStatus = row.hnapayStatus
this.currentHnapayId = row.hnaPayId this.currentHnapayId = row.hnaPayId
if (this.currentHnapayId) { if (this.currentHnapayId) {
@ -1398,6 +1434,41 @@ export default {
_this.hnapayForm = res.data _this.hnapayForm = res.data
} }
}) })
},
async hnapayOpenChange(newVal){
this.isHnaPayOpenLoading = true;
this.lastHnaPayOpen = !newVal;
let param = {
type: 1,
businessId: this.currentBusinessId,
enable: newVal
}
const res = await changeBusinessPayMode(param)
if (res.code === '') {
this.hnapayOpen = newVal;
this.wxaliPayOpen = false;
}else {
this.hnapayOpen = this.lastHnaPayOpen;
}
},
async wxaliPayOpenChange(newVal){
this.isWxaliPayOpenLoading = true;
this.lastWxaliPayOpen = !newVal;
let param = {
type: 2,
businessId: this.currentBusinessId,
enable: newVal
}
const res = await changeBusinessPayMode(param)
if (res.code === '') {
this.wxaliPayOpen = newVal;
this.hnapayOpen = false
}else {
this.wxaliPayOpen = this.lastWxaliPayOpen;
}
} }
} }
} }

Loading…
Cancel
Save