Commit 9074312fe301b54a093448427209529622e7b4d9

Authored by jason
1 parent 4a0fa2a3

后台接入钱包支付

yudao-ui-admin/src/utils/constants.js
... ... @@ -163,6 +163,10 @@ export const PayChannelEnum = {
163 163 MOCK : {
164 164 "code": "mock",
165 165 "name": "模拟支付"
  166 + },
  167 + WALLET : {
  168 + "code": "wallet",
  169 + "name": "钱包支付"
166 170 }
167 171 }
168 172  
... ...
yudao-ui-admin/src/views/pay/app/components/mockChannelForm.vue renamed to yudao-ui-admin/src/views/pay/app/components/noneConfigChannelForm.vue
... ... @@ -5,7 +5,8 @@
5 5 <el-form-item label-width="180px" label="渠道状态" prop="status">
6 6 <el-radio-group v-model="formData.status" size="medium">
7 7 <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 + >
9 10 {{ dict.label }}
10 11 </el-radio>
11 12 </el-radio-group>
... ... @@ -22,16 +23,16 @@
22 23 </div>
23 24 </template>
24 25 <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'
27 28  
28 29 export default {
29   - name: "mockChannelForm",
  30 + name: 'noneConfigChannelForm',
30 31 data() {
31 32 return {
32 33 dialogVisible: false,
33 34 formLoading: false,
34   - title:'',
  35 + title: '',
35 36 formData: {
36 37 appId: '',
37 38 code: '',
... ... @@ -39,54 +40,54 @@ export default {
39 40 feeRate: 0,
40 41 remark: '',
41 42 config: {
42   - name: 'mock-conf'
  43 + name: 'none-config'
43 44 }
44 45 },
45 46 rules: {
46   - status: [{ required: true, message: '渠道状态不能为空', trigger: 'blur' }]
  47 + status: [{ required: true, message: '渠道状态不能为空', trigger: 'blur' }]
47 48 }
48 49 }
49 50 },
50 51 methods: {
51 52 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)
55 56 getChannel(appId, code).then(response => {
56 57 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)
59 60 }
60 61 this.title = !this.formData.id ? '创建支付渠道' : '编辑支付渠道'
61 62 }).finally(() => {
62   - this.formLoading = false;
63   - });
  63 + this.formLoading = false
  64 + })
64 65 },
65 66 close() {
66   - this.dialogVisible = false;
67   - this.reset(undefined, undefined);
  67 + this.dialogVisible = false
  68 + this.reset(undefined, undefined)
68 69 },
69 70 submitForm() {
70 71 this.$refs['form'].validate(valid => {
71 72 if (!valid) {
72 73 return
73 74 }
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)
76 77 if (!data.id) {
77 78 createChannel(data).then(response => {
78   - this.$modal.msgSuccess("新增成功");
  79 + this.$modal.msgSuccess('新增成功')
79 80 this.$emit('success')
80   - this.close();
81   - });
  81 + this.close()
  82 + })
82 83 } else {
83 84 updateChannel(data).then(response => {
84   - this.$modal.msgSuccess("修改成功");
  85 + this.$modal.msgSuccess('修改成功')
85 86 this.$emit('success')
86   - this.close();
  87 + this.close()
87 88 })
88 89 }
89   - });
  90 + })
90 91 },
91 92 /** 重置表单 */
92 93 reset(appId, code) {
... ... @@ -97,11 +98,11 @@ export default {
97 98 remark: '',
98 99 feeRate: 0,
99 100 config: {
100   - name: 'mock-conf'
  101 + name: 'none-config'
101 102 }
102 103 }
103 104 this.resetForm('form')
104   - },
  105 + }
105 106 }
106 107 }
107 108 </script>
... ...
yudao-ui-admin/src/views/pay/app/index.vue
... ... @@ -170,6 +170,19 @@
170 170 </template>
171 171 </el-table-column>
172 172 </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>
173 186 <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
174 187 <template v-slot="scope">
175 188 <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
... ... @@ -219,7 +232,7 @@
219 232 <!-- 对话框(支付应用的配置) -->
220 233 <weixin-channel-form ref="weixinChannelFormRef" @success="getList" />
221 234 <alipay-channel-form ref="alipayChannelFormRef" @success="getList" />
222   - <mock-channel-form ref="mockChannelFormRef" @success="getList" />
  235 + <none-config-channel-form ref="noneConfigChannelFormRef" @success="getList" />
223 236 </div>
224 237 </template>
225 238  
... ... @@ -228,14 +241,14 @@ import { createApp, updateApp, changeAppStatus, deleteApp, getApp, getAppPage }
228 241 import { PayChannelEnum, CommonStatusEnum } from "@/utils/constants";
229 242 import weixinChannelForm from "@/views/pay/app/components/weixinChannelForm";
230 243 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';
232 245  
233 246 export default {
234 247 name: "PayApp",
235 248 components: {
236 249 weixinChannelForm,
237 250 alipayChannelForm,
238   - mockChannelForm
  251 + noneConfigChannelForm
239 252 },
240 253 data() {
241 254 return {
... ... @@ -391,7 +404,11 @@ export default {
391 404 return
392 405 }
393 406 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);
395 412 return
396 413 }
397 414 },
... ...
yudao-ui-admin/src/views/pay/cashier/index.vue
... ... @@ -136,6 +136,10 @@ export default {
136 136 name: '模拟支付',
137 137 icon: require("@/assets/images/pay/icon/mock.svg"),
138 138 code: "mock"
  139 + }, {
  140 + name: '钱包支付',
  141 + icon: require("@/assets/images/pay/icon/mock.svg"),
  142 + code: "wallet"
139 143 }],
140 144 submitLoading: false, // 提交支付的 loading
141 145 interval: undefined, // 定时任务,轮询是否完成支付
... ...