mall + pay:

1. 简化支付宝支付的配置界面
This commit is contained in:
YunaiV 2023-07-21 09:19:59 +08:00
parent 654b70c514
commit da529851bd
3 changed files with 21 additions and 82 deletions

View File

@ -51,9 +51,6 @@ export const DICT_TYPE = {
// ========== PAY 模块 ========== // ========== PAY 模块 ==========
PAY_CHANNEL_WECHAT_VERSION: 'pay_channel_wechat_version', // 微信渠道版本 PAY_CHANNEL_WECHAT_VERSION: 'pay_channel_wechat_version', // 微信渠道版本
PAY_CHANNEL_ALIPAY_SIGN_TYPE: 'pay_channel_alipay_sign_type', // 支付渠道支付宝算法类型
PAY_CHANNEL_ALIPAY_MODE: 'pay_channel_alipay_mode', // 支付宝公钥类型
PAY_CHANNEL_ALIPAY_SERVER_TYPE: 'pay_channel_alipay_server_type', // 支付宝网关地址
PAY_CHANNEL_CODE: 'pay_channel_code', // 支付渠道编码类型 PAY_CHANNEL_CODE: 'pay_channel_code', // 支付渠道编码类型
PAY_ORDER_STATUS: 'pay_order_status', // 商户支付订单状态 PAY_ORDER_STATUS: 'pay_order_status', // 商户支付订单状态

View File

@ -14,30 +14,26 @@
</el-form-item> </el-form-item>
<el-form-item label-width="180px" label="渠道状态" prop="status"> <el-form-item label-width="180px" label="渠道状态" prop="status">
<el-radio-group v-model="form.status" size="medium"> <el-radio-group v-model="form.status" size="medium">
<el-radio v-for="dict in statusDictDatas" :key="parseInt(dict.value)" :label="parseInt(dict.value)"> <el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)" :key="parseInt(dict.value)" :label="parseInt(dict.value)">
{{ dict.label }} {{ dict.label }}
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label-width="180px" label="网关地址" prop="aliPayConfig.serverUrl"> <el-form-item label-width="180px" label="网关地址" prop="aliPayConfig.serverUrl">
<el-radio-group v-model="form.aliPayConfig.serverUrl" size="medium"> <el-radio-group v-model="form.aliPayConfig.serverUrl" size="medium">
<el-radio v-for="dict in aliPayServerDatas" :key="dict.value" :label="dict.value"> <el-radio label="https://openapi.alipay.com/gateway.do">线上环境</el-radio>
{{ dict.label }} <el-radio label="https://openapi-sandbox.dl.alipaydev.com/gateway.do">沙箱环境</el-radio>
</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label-width="180px" label="算法类型" prop="aliPayConfig.signType"> <el-form-item label-width="180px" label="算法类型" prop="aliPayConfig.signType">
<el-radio-group v-model="form.aliPayConfig.signType" size="medium"> <el-radio-group v-model="form.aliPayConfig.signType" size="medium">
<el-radio v-for="dict in aliPaySignTypeDatas" :key="dict.value" :label="dict.value"> <el-radio key="RSA2" label="RSA2">RSA2</el-radio>
{{ dict.label }}
</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label-width="180px" label="公钥类型" prop="aliPayConfig.mode"> <el-form-item label-width="180px" label="公钥类型" prop="aliPayConfig.mode">
<el-radio-group v-model="form.aliPayConfig.mode" size="medium"> <el-radio-group v-model="form.aliPayConfig.mode" size="medium">
<el-radio v-for="dict in aliPayModeDatas" :key="parseInt(dict.value)" :label="parseInt(dict.value)"> <el-radio key="公钥模式" :label="1">公钥模式</el-radio>
{{ dict.label }} <el-radio key="证书模式" :label="2">证书模式</el-radio>
</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<div v-if="form.aliPayConfig.mode === 1"> <div v-if="form.aliPayConfig.mode === 1">
@ -122,7 +118,6 @@
</div> </div>
</template> </template>
<script> <script>
import {DICT_TYPE, getDictDatas} from "@/utils/dict";
import {createChannel, getChannel, updateChannel} from "@/api/pay/channel"; import {createChannel, getChannel, updateChannel} from "@/api/pay/channel";
const defaultForm = { const defaultForm = {
@ -167,71 +162,19 @@ export default {
title:'', title:'',
form: JSON.parse(JSON.stringify(defaultForm)), form: JSON.parse(JSON.stringify(defaultForm)),
rules: { rules: {
feeRate: [{ feeRate: [{ required: true, message: '请输入渠道费率', trigger: 'blur' }],
required: true, status: [{ required: true, message: '渠道状态不能为空', trigger: 'blur' }],
message: '请输入渠道费率', 'aliPayConfig.appId': [{ required: true, message: '请输入开放平台上创建的应用的 ID', trigger: 'blur' }],
trigger: 'blur' 'aliPayConfig.serverUrl': [{ required: true, message: '请传入网关地址', trigger: 'blur' }],
}], 'aliPayConfig.signType': [{ required: true, message: '请传入签名算法类型', trigger: 'blur' }],
'aliPayConfig.appId': [{ 'aliPayConfig.mode': [{ required: true, message: '公钥类型不能为空', trigger: 'blur'}],
required: true, 'aliPayConfig.privateKey': [{ required: true, message: '请输入商户私钥', trigger: 'blur' }],
message: '请输入开放平台上创建的应用的 ID', 'aliPayConfig.alipayPublicKey': [{ required: true, message: '请输入支付宝公钥字符串', trigger: 'blur' }],
trigger: 'blur' 'aliPayConfig.appCertContent': [{ required: true, message: '请上传商户公钥应用证书', trigger: 'blur' }],
}], 'aliPayConfig.alipayPublicCertContent': [{ required: true, message: '请上传支付宝公钥证书', trigger: 'blur'}],
status: [{ 'aliPayConfig.rootCertContent': [{ required: true, message: '请上传指定根证书', trigger: 'blur' }],
required: true,
message: '渠道状态不能为空',
trigger: 'blur'
}],
'aliPayConfig.serverUrl': [{
required: true,
message: '请传入网关地址',
trigger: 'blur'
}],
'aliPayConfig.signType': [{
required: true,
message: '请传入签名算法类型',
trigger: 'blur'
}],
'aliPayConfig.mode': [{
required: true,
message: '公钥类型不能为空',
trigger: 'blur'
}],
'aliPayConfig.privateKey': [{
required: true,
message: '请输入商户私钥',
trigger: 'blur'
}],
'aliPayConfig.alipayPublicKey': [{
required: true,
message: '请输入支付宝公钥字符串',
trigger: 'blur'
}],
'aliPayConfig.appCertContent': [{
required: true,
message: '请上传商户公钥应用证书',
trigger: 'blur'
}],
'aliPayConfig.alipayPublicCertContent': [{
required: true,
message: '请上传支付宝公钥证书',
trigger: 'blur'
}],
'aliPayConfig.rootCertContent': [{
required: true,
message: '请上传指定根证书',
trigger: 'blur'
}],
}, },
fileAccept: ".crt", fileAccept: ".crt",
//
statusDictDatas: getDictDatas(DICT_TYPE.COMMON_STATUS),
//
aliPaySignTypeDatas: getDictDatas(DICT_TYPE.PAY_CHANNEL_ALIPAY_SIGN_TYPE),
//
aliPayModeDatas: getDictDatas(DICT_TYPE.PAY_CHANNEL_ALIPAY_MODE),
//
aliPayServerDatas: getDictDatas(DICT_TYPE.PAY_CHANNEL_ALIPAY_SERVER_TYPE),
} }
}, },
watch: { watch: {
@ -252,7 +195,6 @@ export default {
} }
} }
}, },
methods: { methods: {
init() { init() {
getChannel(this.transferParam.appId, this.transferParam.payCode) getChannel(this.transferParam.appId, this.transferParam.payCode)
@ -292,10 +234,8 @@ export default {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.close(); this.close();
} }
}) })
} else { } else {
createChannel(data).then(response => { createChannel(data).then(response => {
if (response.code === 0) { if (response.code === 0) {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");

View File

@ -213,7 +213,9 @@
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<wechat-channel-form :transferParam="channelParam"></wechat-channel-form>
<!-- 弹窗 -->
<wechat-channel-form :transferParam="channelParam" />
<ali-pay-channel-form :transferParam="channelParam"></ali-pay-channel-form> <ali-pay-channel-form :transferParam="channelParam"></ali-pay-channel-form>
</div> </div>
</template> </template>