Commit 9074312fe301b54a093448427209529622e7b4d9

Authored by jason
1 parent 4a0fa2a3

后台接入钱包支付

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