mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-27 01:32:03 +08:00
后台接入钱包支付
This commit is contained in:
parent
4a0fa2a3a4
commit
9074312fe3
@ -163,6 +163,10 @@ export const PayChannelEnum = {
|
|||||||
MOCK : {
|
MOCK : {
|
||||||
"code": "mock",
|
"code": "mock",
|
||||||
"name": "模拟支付"
|
"name": "模拟支付"
|
||||||
|
},
|
||||||
|
WALLET : {
|
||||||
|
"code": "wallet",
|
||||||
|
"name": "钱包支付"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
<el-form-item label-width="180px" label="渠道状态" prop="status">
|
<el-form-item label-width="180px" label="渠道状态" prop="status">
|
||||||
<el-radio-group v-model="formData.status" size="medium">
|
<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)"
|
<el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)" :key="parseInt(dict.value)"
|
||||||
:label="parseInt(dict.value)">
|
:label="parseInt(dict.value)"
|
||||||
|
>
|
||||||
{{ dict.label }}
|
{{ dict.label }}
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
@ -22,16 +23,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { createChannel, getChannel, updateChannel } from "@/api/pay/channel";
|
import { createChannel, getChannel, updateChannel } from '@/api/pay/channel'
|
||||||
import { CommonStatusEnum } from "@/utils/constants";
|
import { CommonStatusEnum } from '@/utils/constants'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "mockChannelForm",
|
name: 'noneConfigChannelForm',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
formLoading: false,
|
formLoading: false,
|
||||||
title:'',
|
title: '',
|
||||||
formData: {
|
formData: {
|
||||||
appId: '',
|
appId: '',
|
||||||
code: '',
|
code: '',
|
||||||
@ -39,54 +40,54 @@ export default {
|
|||||||
feeRate: 0,
|
feeRate: 0,
|
||||||
remark: '',
|
remark: '',
|
||||||
config: {
|
config: {
|
||||||
name: 'mock-conf'
|
name: 'none-config'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
status: [{ required: true, message: '渠道状态不能为空', trigger: 'blur' }]
|
status: [{ required: true, message: '渠道状态不能为空', trigger: 'blur' }]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
open(appId, code) {
|
open(appId, code) {
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true
|
||||||
this.formLoading = true;
|
this.formLoading = true
|
||||||
this.reset(appId, code);
|
this.reset(appId, code)
|
||||||
getChannel(appId, code).then(response => {
|
getChannel(appId, code).then(response => {
|
||||||
if (response.data && response.data.id) {
|
if (response.data && response.data.id) {
|
||||||
this.formData = response.data;
|
this.formData = response.data
|
||||||
this.formData.config = JSON.parse(response.data.config);
|
this.formData.config = JSON.parse(response.data.config)
|
||||||
}
|
}
|
||||||
this.title = !this.formData.id ? '创建支付渠道' : '编辑支付渠道'
|
this.title = !this.formData.id ? '创建支付渠道' : '编辑支付渠道'
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
this.formLoading = false;
|
this.formLoading = false
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
this.dialogVisible = false;
|
this.dialogVisible = false
|
||||||
this.reset(undefined, undefined);
|
this.reset(undefined, undefined)
|
||||||
},
|
},
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs['form'].validate(valid => {
|
this.$refs['form'].validate(valid => {
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const data = { ...this.formData };
|
const data = { ...this.formData }
|
||||||
data.config = JSON.stringify(this.formData.config);
|
data.config = JSON.stringify(this.formData.config)
|
||||||
if (!data.id) {
|
if (!data.id) {
|
||||||
createChannel(data).then(response => {
|
createChannel(data).then(response => {
|
||||||
this.$modal.msgSuccess("新增成功");
|
this.$modal.msgSuccess('新增成功')
|
||||||
this.$emit('success')
|
this.$emit('success')
|
||||||
this.close();
|
this.close()
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
updateChannel(data).then(response => {
|
updateChannel(data).then(response => {
|
||||||
this.$modal.msgSuccess("修改成功");
|
this.$modal.msgSuccess('修改成功')
|
||||||
this.$emit('success')
|
this.$emit('success')
|
||||||
this.close();
|
this.close()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
/** 重置表单 */
|
/** 重置表单 */
|
||||||
reset(appId, code) {
|
reset(appId, code) {
|
||||||
@ -97,11 +98,11 @@ export default {
|
|||||||
remark: '',
|
remark: '',
|
||||||
feeRate: 0,
|
feeRate: 0,
|
||||||
config: {
|
config: {
|
||||||
name: 'mock-conf'
|
name: 'none-config'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.resetForm('form')
|
this.resetForm('form')
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
@ -170,6 +170,19 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="钱包支付配置" align="center">
|
||||||
|
<el-table-column :label="payChannelEnum.WALLET.name" align="center">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<el-button type="success" icon="el-icon-check" circle
|
||||||
|
v-if="isChannelExists(scope.row.channelCodes, payChannelEnum.WALLET.code)"
|
||||||
|
@click="handleChannel(scope.row, payChannelEnum.WALLET.code)">
|
||||||
|
</el-button>
|
||||||
|
<el-button v-else type="danger" icon="el-icon-close" circle
|
||||||
|
@click="handleChannel(scope.row, payChannelEnum.WALLET.code)">
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||||
@ -219,7 +232,7 @@
|
|||||||
<!-- 对话框(支付应用的配置) -->
|
<!-- 对话框(支付应用的配置) -->
|
||||||
<weixin-channel-form ref="weixinChannelFormRef" @success="getList" />
|
<weixin-channel-form ref="weixinChannelFormRef" @success="getList" />
|
||||||
<alipay-channel-form ref="alipayChannelFormRef" @success="getList" />
|
<alipay-channel-form ref="alipayChannelFormRef" @success="getList" />
|
||||||
<mock-channel-form ref="mockChannelFormRef" @success="getList" />
|
<none-config-channel-form ref="noneConfigChannelFormRef" @success="getList" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -228,14 +241,14 @@ import { createApp, updateApp, changeAppStatus, deleteApp, getApp, getAppPage }
|
|||||||
import { PayChannelEnum, CommonStatusEnum } from "@/utils/constants";
|
import { PayChannelEnum, CommonStatusEnum } from "@/utils/constants";
|
||||||
import weixinChannelForm from "@/views/pay/app/components/weixinChannelForm";
|
import weixinChannelForm from "@/views/pay/app/components/weixinChannelForm";
|
||||||
import alipayChannelForm from "@/views/pay/app/components/alipayChannelForm";
|
import alipayChannelForm from "@/views/pay/app/components/alipayChannelForm";
|
||||||
import mockChannelForm from '@/views/pay/app/components/mockChannelForm';
|
import noneConfigChannelForm from '@/views/pay/app/components/noneConfigChannelForm';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "PayApp",
|
name: "PayApp",
|
||||||
components: {
|
components: {
|
||||||
weixinChannelForm,
|
weixinChannelForm,
|
||||||
alipayChannelForm,
|
alipayChannelForm,
|
||||||
mockChannelForm
|
noneConfigChannelForm
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -391,7 +404,11 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (code === 'mock') {
|
if (code === 'mock') {
|
||||||
this.$refs['mockChannelFormRef'].open(row.id, code);
|
this.$refs['noneConfigChannelFormRef'].open(row.id, code);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (code === 'wallet') {
|
||||||
|
this.$refs['noneConfigChannelFormRef'].open(row.id, code);
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -136,6 +136,10 @@ export default {
|
|||||||
name: '模拟支付',
|
name: '模拟支付',
|
||||||
icon: require("@/assets/images/pay/icon/mock.svg"),
|
icon: require("@/assets/images/pay/icon/mock.svg"),
|
||||||
code: "mock"
|
code: "mock"
|
||||||
|
}, {
|
||||||
|
name: '钱包支付',
|
||||||
|
icon: require("@/assets/images/pay/icon/mock.svg"),
|
||||||
|
code: "wallet"
|
||||||
}],
|
}],
|
||||||
submitLoading: false, // 提交支付的 loading
|
submitLoading: false, // 提交支付的 loading
|
||||||
interval: undefined, // 定时任务,轮询是否完成支付
|
interval: undefined, // 定时任务,轮询是否完成支付
|
||||||
|
Loading…
Reference in New Issue
Block a user