diff --git a/src/api/business.js b/src/api/business.js index c85f271..d78b096 100644 --- a/src/api/business.js +++ b/src/api/business.js @@ -178,3 +178,12 @@ export function getHnaPayInfo(businessId) { method: 'get' }) } + + +export function changeBusinessPayMode(data) { + return request({ + url: '/hnaPay/changeBusinessPayMode', + method: 'post', + data + }) +} diff --git a/src/views/business/businessList/index.vue b/src/views/business/businessList/index.vue index 46c04c9..a7b0329 100644 --- a/src/views/business/businessList/index.vue +++ b/src/views/business/businessList/index.vue @@ -406,7 +406,19 @@ label="新账通支付" name="third" > -
+ +
+ +
+ +
上传资料 资料审核中 审核通过 @@ -414,6 +426,7 @@
+
+ +
+ 确 定 提 交 @@ -637,7 +661,8 @@ import { delBusinessById, hnapaySave, uploadCertInfo, - getHnaPayInfo + getHnaPayInfo, + changeBusinessPayMode } from '@/api/business' import SharesettingDialog from '../../../components/Sharesetting'; import DomainSettingDialog from '../../../components/DomainSetting'; @@ -842,6 +867,14 @@ export default { hasUploadAfterCard: false, hasUploadCertNo: false, hasUploadPermitCert: false, + hnapayOpen: false, + lastHnaPayOpen: false,//记录切换前的状态(用于失败回退) + isHnaPayOpenLoading: false, + wxaliPayOpen: false, + lastWxaliPayOpen: false,//记录切换前的状态(用于失败回退) + isWxaliPayOpenLoading: false, + //商家支付模式 + businessPayMode: '0', } }, // 监听属性 类似于data概念 @@ -1022,6 +1055,9 @@ export default { // 编辑 async edit (row) { this.currentBusinessId = row.businessId + this.businessPayMode = row.payMode + this.hnapayOpen = row.payMode === 1 + this.wxaliPayOpen = row.payMode === 2 this.hnapayStatus = row.hnapayStatus this.currentHnapayId = row.hnaPayId if (this.currentHnapayId) { @@ -1398,6 +1434,41 @@ export default { _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; + } } } }