Skip to content

Commit 7d8ab2a

Browse files
committed
后台接入钱包支付
1 parent 473b2f4 commit 7d8ab2a

File tree

4 files changed

+56
-30
lines changed

4 files changed

+56
-30
lines changed

src/utils/constants.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ export const PayChannelEnum = {
163163
MOCK : {
164164
"code": "mock",
165165
"name": "模拟支付"
166+
},
167+
WALLET : {
168+
"code": "wallet",
169+
"name": "钱包支付"
166170
}
167171
}
168172

src/views/pay/app/components/mockChannelForm.vue renamed to src/views/pay/app/components/noneConfigChannelForm.vue

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
<el-form-item label-width="180px" label="渠道状态" prop="status">
66
<el-radio-group v-model="formData.status" size="medium">
77
<el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)" :key="parseInt(dict.value)"
8-
:label="parseInt(dict.value)">
8+
:label="parseInt(dict.value)"
9+
>
910
{{ dict.label }}
1011
</el-radio>
1112
</el-radio-group>
@@ -22,71 +23,71 @@
2223
</div>
2324
</template>
2425
<script>
25-
import { createChannel, getChannel, updateChannel } from "@/api/pay/channel";
26-
import { CommonStatusEnum } from "@/utils/constants";
26+
import { createChannel, getChannel, updateChannel } from '@/api/pay/channel'
27+
import { CommonStatusEnum } from '@/utils/constants'
2728
2829
export default {
29-
name: "mockChannelForm",
30+
name: 'noneConfigChannelForm',
3031
data() {
3132
return {
3233
dialogVisible: false,
3334
formLoading: false,
34-
title:'',
35+
title: '',
3536
formData: {
3637
appId: '',
3738
code: '',
3839
status: undefined,
3940
feeRate: 0,
4041
remark: '',
4142
config: {
42-
name: 'mock-conf'
43+
name: 'none-config'
4344
}
4445
},
4546
rules: {
46-
status: [{ required: true, message: '渠道状态不能为空', trigger: 'blur' }]
47+
status: [{ required: true, message: '渠道状态不能为空', trigger: 'blur' }]
4748
}
4849
}
4950
},
5051
methods: {
5152
open(appId, code) {
52-
this.dialogVisible = true;
53-
this.formLoading = true;
54-
this.reset(appId, code);
53+
this.dialogVisible = true
54+
this.formLoading = true
55+
this.reset(appId, code)
5556
getChannel(appId, code).then(response => {
5657
if (response.data && response.data.id) {
57-
this.formData = response.data;
58-
this.formData.config = JSON.parse(response.data.config);
58+
this.formData = response.data
59+
this.formData.config = JSON.parse(response.data.config)
5960
}
6061
this.title = !this.formData.id ? '创建支付渠道' : '编辑支付渠道'
6162
}).finally(() => {
62-
this.formLoading = false;
63-
});
63+
this.formLoading = false
64+
})
6465
},
6566
close() {
66-
this.dialogVisible = false;
67-
this.reset(undefined, undefined);
67+
this.dialogVisible = false
68+
this.reset(undefined, undefined)
6869
},
6970
submitForm() {
7071
this.$refs['form'].validate(valid => {
7172
if (!valid) {
7273
return
7374
}
74-
const data = { ...this.formData };
75-
data.config = JSON.stringify(this.formData.config);
75+
const data = { ...this.formData }
76+
data.config = JSON.stringify(this.formData.config)
7677
if (!data.id) {
7778
createChannel(data).then(response => {
78-
this.$modal.msgSuccess("新增成功");
79+
this.$modal.msgSuccess('新增成功')
7980
this.$emit('success')
80-
this.close();
81-
});
81+
this.close()
82+
})
8283
} else {
8384
updateChannel(data).then(response => {
84-
this.$modal.msgSuccess("修改成功");
85+
this.$modal.msgSuccess('修改成功')
8586
this.$emit('success')
86-
this.close();
87+
this.close()
8788
})
8889
}
89-
});
90+
})
9091
},
9192
/** 重置表单 */
9293
reset(appId, code) {
@@ -97,11 +98,11 @@ export default {
9798
remark: '',
9899
feeRate: 0,
99100
config: {
100-
name: 'mock-conf'
101+
name: 'none-config'
101102
}
102103
}
103104
this.resetForm('form')
104-
},
105+
}
105106
}
106107
}
107108
</script>

src/views/pay/app/index.vue

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,19 @@
170170
</template>
171171
</el-table-column>
172172
</el-table-column>
173+
<el-table-column label="钱包支付配置" align="center">
174+
<el-table-column :label="payChannelEnum.WALLET.name" align="center">
175+
<template v-slot="scope">
176+
<el-button type="success" icon="el-icon-check" circle
177+
v-if="isChannelExists(scope.row.channelCodes, payChannelEnum.WALLET.code)"
178+
@click="handleChannel(scope.row, payChannelEnum.WALLET.code)">
179+
</el-button>
180+
<el-button v-else type="danger" icon="el-icon-close" circle
181+
@click="handleChannel(scope.row, payChannelEnum.WALLET.code)">
182+
</el-button>
183+
</template>
184+
</el-table-column>
185+
</el-table-column>
173186
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
174187
<template v-slot="scope">
175188
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
@@ -219,7 +232,7 @@
219232
<!-- 对话框(支付应用的配置) -->
220233
<weixin-channel-form ref="weixinChannelFormRef" @success="getList" />
221234
<alipay-channel-form ref="alipayChannelFormRef" @success="getList" />
222-
<mock-channel-form ref="mockChannelFormRef" @success="getList" />
235+
<none-config-channel-form ref="noneConfigChannelFormRef" @success="getList" />
223236
</div>
224237
</template>
225238

@@ -228,14 +241,14 @@ import { createApp, updateApp, changeAppStatus, deleteApp, getApp, getAppPage }
228241
import { PayChannelEnum, CommonStatusEnum } from "@/utils/constants";
229242
import weixinChannelForm from "@/views/pay/app/components/weixinChannelForm";
230243
import alipayChannelForm from "@/views/pay/app/components/alipayChannelForm";
231-
import mockChannelForm from '@/views/pay/app/components/mockChannelForm';
244+
import noneConfigChannelForm from '@/views/pay/app/components/noneConfigChannelForm';
232245
233246
export default {
234247
name: "PayApp",
235248
components: {
236249
weixinChannelForm,
237250
alipayChannelForm,
238-
mockChannelForm
251+
noneConfigChannelForm
239252
},
240253
data() {
241254
return {
@@ -391,7 +404,11 @@ export default {
391404
return
392405
}
393406
if (code === 'mock') {
394-
this.$refs['mockChannelFormRef'].open(row.id, code);
407+
this.$refs['noneConfigChannelFormRef'].open(row.id, code);
408+
return
409+
}
410+
if (code === 'wallet') {
411+
this.$refs['noneConfigChannelFormRef'].open(row.id, code);
395412
return
396413
}
397414
},

src/views/pay/cashier/index.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ export default {
136136
name: '模拟支付',
137137
icon: require("@/assets/images/pay/icon/mock.svg"),
138138
code: "mock"
139+
}, {
140+
name: '钱包支付',
141+
icon: require("@/assets/images/pay/icon/mock.svg"),
142+
code: "wallet"
139143
}],
140144
submitLoading: false, // 提交支付的 loading
141145
interval: undefined, // 定时任务,轮询是否完成支付

0 commit comments

Comments
 (0)