新增模拟支付渠道,通知查询为空bug 修改

This commit is contained in:
jason
2023-07-27 08:19:24 +08:00
parent 6c174d9c83
commit 6a38738760
9 changed files with 234 additions and 3 deletions

View File

@ -160,6 +160,10 @@ export const PayChannelEnum = {
"code": "alipay_bar",
"name": "支付宝条码支付"
},
MOCK : {
"code": "mock",
"name": "模拟支付"
}
}
/**

View File

@ -0,0 +1,108 @@
<template>
<div>
<el-dialog :visible.sync="dialogVisible" :title="title" @closed="close" append-to-body width="800px">
<el-form ref="form" :model="formData" :rules="rules" size="medium" label-width="100px" v-loading="formLoading">
<el-form-item label-width="180px" label="渠道状态" prop="status">
<el-radio-group v-model="formData.status" size="medium">
<el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)" :key="parseInt(dict.value)"
:label="parseInt(dict.value)">
{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label-width="180px" label="备注" prop="remark">
<el-input v-model="formData.remark" :style="{width: '100%'}"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="close">取消</el-button>
<el-button type="primary" @click="submitForm">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { createChannel, getChannel, updateChannel } from "@/api/pay/channel";
import { CommonStatusEnum } from "@/utils/constants";
export default {
name: "mockChannelForm",
data() {
return {
dialogVisible: false,
formLoading: false,
title:'',
formData: {
appId: '',
code: '',
status: undefined,
feeRate: 0,
remark: '',
config: {
name: 'mock-conf'
}
},
rules: {
status: [{ required: true, message: '渠道状态不能为空', trigger: 'blur' }]
}
}
},
methods: {
open(appId, code) {
this.dialogVisible = true;
this.formLoading = true;
this.reset(appId, code);
getChannel(appId, code).then(response => {
if (response.data && response.data.id) {
this.formData = response.data;
this.formData.config = JSON.parse(response.data.config);
}
this.title = !this.formData.id ? '创建支付渠道' : '编辑支付渠道'
}).finally(() => {
this.formLoading = false;
});
},
close() {
this.dialogVisible = false;
this.reset(undefined, undefined);
},
submitForm() {
this.$refs['form'].validate(valid => {
if (!valid) {
return
}
const data = { ...this.formData };
data.config = JSON.stringify(this.formData.config);
if (!data.id) {
createChannel(data).then(response => {
this.$modal.msgSuccess("新增成功");
this.$emit('success')
this.close();
});
} else {
updateChannel(data).then(response => {
this.$modal.msgSuccess("修改成功");
this.$emit('success')
this.close();
})
}
});
},
/** 重置表单 */
reset(appId, code) {
this.formData = {
appId: appId,
code: code,
status: CommonStatusEnum.ENABLE,
remark: '',
feeRate: 0,
config: {
name: 'mock-conf'
}
}
this.resetForm('form')
},
}
}
</script>

View File

@ -157,6 +157,19 @@
</template>
</el-table-column>
</el-table-column>
<el-table-column label="模拟支付配置" align="center">
<el-table-column :label="payChannelEnum.MOCK.name" align="center">
<template v-slot="scope">
<el-button type="success" icon="el-icon-check" circle
v-if="isChannelExists(scope.row.channelCodes, payChannelEnum.MOCK.code)"
@click="handleChannel(scope.row, payChannelEnum.MOCK.code)">
</el-button>
<el-button v-else type="danger" icon="el-icon-close" circle
@click="handleChannel(scope.row, payChannelEnum.MOCK.code)">
</el-button>
</template>
</el-table-column>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
@ -206,6 +219,7 @@
<!-- 对话框支付应用的配置 -->
<weixin-channel-form ref="weixinChannelFormRef" @success="getList" />
<alipay-channel-form ref="alipayChannelFormRef" @success="getList" />
<mock-channel-form ref="mockChannelFormRef" @success="getList" />
</div>
</template>
@ -214,12 +228,14 @@ import { createApp, updateApp, changeAppStatus, deleteApp, getApp, getAppPage }
import { PayChannelEnum, CommonStatusEnum } from "@/utils/constants";
import weixinChannelForm from "@/views/pay/app/components/weixinChannelForm";
import alipayChannelForm from "@/views/pay/app/components/alipayChannelForm";
import mockChannelForm from '@/views/pay/app/components/mockChannelForm';
export default {
name: "PayApp",
components: {
weixinChannelForm,
alipayChannelForm
alipayChannelForm,
mockChannelForm
},
data() {
return {
@ -374,6 +390,10 @@ export default {
this.$refs['weixinChannelFormRef'].open(row.id, code);
return
}
if (code === 'mock') {
this.$refs['mockChannelFormRef'].open(row.id, code);
return
}
},
/**
* 根据渠道编码判断渠道列表中是否存在

View File

@ -35,7 +35,7 @@
<el-descriptions title="选择其它支付" style="margin-top: 20px;" />
<div class="pay-channel-container">
<div class="box" v-for="channel in channels" :key="channel.code"
v-if="channel.code.indexOf('alipay_') === -1 && channel.code.indexOf('wx_') === -1">
v-if="channel.code.indexOf('alipay_') === -1 && channel.code.indexOf('wx_') === -1" @click="submit(channel.code)">
<img :src="channel.icon">
<div class="title">{{ channel.name }}</div>
</div>