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 : {
|
||||
"code": "mock",
|
||||
"name": "模拟支付"
|
||||
},
|
||||
WALLET : {
|
||||
"code": "wallet",
|
||||
"name": "钱包支付"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,8 @@
|
||||
<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)">
|
||||
:label="parseInt(dict.value)"
|
||||
>
|
||||
{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
@ -22,16 +23,16 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { createChannel, getChannel, updateChannel } from "@/api/pay/channel";
|
||||
import { CommonStatusEnum } from "@/utils/constants";
|
||||
import { createChannel, getChannel, updateChannel } from '@/api/pay/channel'
|
||||
import { CommonStatusEnum } from '@/utils/constants'
|
||||
|
||||
export default {
|
||||
name: "mockChannelForm",
|
||||
name: 'noneConfigChannelForm',
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
formLoading: false,
|
||||
title:'',
|
||||
title: '',
|
||||
formData: {
|
||||
appId: '',
|
||||
code: '',
|
||||
@ -39,7 +40,7 @@ export default {
|
||||
feeRate: 0,
|
||||
remark: '',
|
||||
config: {
|
||||
name: 'mock-conf'
|
||||
name: 'none-config'
|
||||
}
|
||||
},
|
||||
rules: {
|
||||
@ -49,44 +50,44 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
open(appId, code) {
|
||||
this.dialogVisible = true;
|
||||
this.formLoading = true;
|
||||
this.reset(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.formData = response.data
|
||||
this.formData.config = JSON.parse(response.data.config)
|
||||
}
|
||||
this.title = !this.formData.id ? '创建支付渠道' : '编辑支付渠道'
|
||||
}).finally(() => {
|
||||
this.formLoading = false;
|
||||
});
|
||||
this.formLoading = false
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.dialogVisible = false;
|
||||
this.reset(undefined, undefined);
|
||||
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);
|
||||
const data = { ...this.formData }
|
||||
data.config = JSON.stringify(this.formData.config)
|
||||
if (!data.id) {
|
||||
createChannel(data).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.$modal.msgSuccess('新增成功')
|
||||
this.$emit('success')
|
||||
this.close();
|
||||
});
|
||||
this.close()
|
||||
})
|
||||
} else {
|
||||
updateChannel(data).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.$modal.msgSuccess('修改成功')
|
||||
this.$emit('success')
|
||||
this.close();
|
||||
this.close()
|
||||
})
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
/** 重置表单 */
|
||||
reset(appId, code) {
|
||||
@ -97,11 +98,11 @@ export default {
|
||||
remark: '',
|
||||
feeRate: 0,
|
||||
config: {
|
||||
name: 'mock-conf'
|
||||
name: 'none-config'
|
||||
}
|
||||
}
|
||||
this.resetForm('form')
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
@ -170,6 +170,19 @@
|
||||
</template>
|
||||
</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">
|
||||
<template v-slot="scope">
|
||||
<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" />
|
||||
<alipay-channel-form ref="alipayChannelFormRef" @success="getList" />
|
||||
<mock-channel-form ref="mockChannelFormRef" @success="getList" />
|
||||
<none-config-channel-form ref="noneConfigChannelFormRef" @success="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -228,14 +241,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';
|
||||
import noneConfigChannelForm from '@/views/pay/app/components/noneConfigChannelForm';
|
||||
|
||||
export default {
|
||||
name: "PayApp",
|
||||
components: {
|
||||
weixinChannelForm,
|
||||
alipayChannelForm,
|
||||
mockChannelForm
|
||||
noneConfigChannelForm
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -391,7 +404,11 @@ export default {
|
||||
return
|
||||
}
|
||||
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
|
||||
}
|
||||
},
|
||||
|
@ -136,6 +136,10 @@ export default {
|
||||
name: '模拟支付',
|
||||
icon: require("@/assets/images/pay/icon/mock.svg"),
|
||||
code: "mock"
|
||||
}, {
|
||||
name: '钱包支付',
|
||||
icon: require("@/assets/images/pay/icon/mock.svg"),
|
||||
code: "wallet"
|
||||
}],
|
||||
submitLoading: false, // 提交支付的 loading
|
||||
interval: undefined, // 定时任务,轮询是否完成支付
|
||||
|
Loading…
Reference in New Issue
Block a user