mall + pay:

1. 调整 cashier 的 channels 的读取实现方式
This commit is contained in:
YunaiV 2023-07-10 18:28:43 +08:00
parent 2485a5ebc9
commit ca4afc2909
8 changed files with 51 additions and 44 deletions

View File

@ -238,7 +238,7 @@ public interface TradeOrderConvert {
AppTradeOrderDetailRespVO orderVO = convert3(order, orderItems); AppTradeOrderDetailRespVO orderVO = convert3(order, orderItems);
orderVO.setPayExpireTime(addTime(tradeOrderProperties.getExpireTime())); orderVO.setPayExpireTime(addTime(tradeOrderProperties.getExpireTime()));
if (StrUtil.isNotEmpty(order.getPayChannelCode())) { if (StrUtil.isNotEmpty(order.getPayChannelCode())) {
orderVO.setPayChannelName(DictFrameworkUtils.getDictDataLabel(DictTypeConstants.CHANNEL_CODE_TYPE, order.getPayChannelCode())); orderVO.setPayChannelName(DictFrameworkUtils.getDictDataLabel(DictTypeConstants.CHANNEL_CODE, order.getPayChannelCode()));
} }
// 处理商品属性 // 处理商品属性
Map<Long, ProductPropertyValueDetailRespDTO> propertyValueDetailMap = convertMap(propertyValueDetails, ProductPropertyValueDetailRespDTO::getValueId); Map<Long, ProductPropertyValueDetailRespDTO> propertyValueDetailMap = convertMap(propertyValueDetails, ProductPropertyValueDetailRespDTO::getValueId);

View File

@ -7,7 +7,7 @@ package cn.iocoder.yudao.module.pay.enums;
*/ */
public interface DictTypeConstants { public interface DictTypeConstants {
String CHANNEL_CODE_TYPE = "pay_channel_code_type"; // 支付-渠道名 String CHANNEL_CODE = "pay_channel_code"; // 支付-渠道名
String ORDER_STATUS = "pay_order_status"; // 支付-订单-订单状态 String ORDER_STATUS = "pay_order_status"; // 支付-订单-订单状态
String ORDER_NOTIFY_STATUS = "pay_order_notify_status"; // 支付-订单-订单回调商户状态 String ORDER_NOTIFY_STATUS = "pay_order_notify_status"; // 支付-订单-订单回调商户状态

View File

@ -54,7 +54,7 @@ export const DICT_TYPE = {
PAY_CHANNEL_ALIPAY_SIGN_TYPE: 'pay_channel_alipay_sign_type', // 支付渠道支付宝算法类型 PAY_CHANNEL_ALIPAY_SIGN_TYPE: 'pay_channel_alipay_sign_type', // 支付渠道支付宝算法类型
PAY_CHANNEL_ALIPAY_MODE: 'pay_channel_alipay_mode', // 支付宝公钥类型 PAY_CHANNEL_ALIPAY_MODE: 'pay_channel_alipay_mode', // 支付宝公钥类型
PAY_CHANNEL_ALIPAY_SERVER_TYPE: 'pay_channel_alipay_server_type', // 支付宝网关地址 PAY_CHANNEL_ALIPAY_SERVER_TYPE: 'pay_channel_alipay_server_type', // 支付宝网关地址
PAY_CHANNEL_CODE_TYPE: 'pay_channel_code_type', // 支付渠道编码类型 PAY_CHANNEL_CODE: 'pay_channel_code', // 支付渠道编码类型
PAY_ORDER_NOTIFY_STATUS: 'pay_order_notify_status', // 商户支付订单回调状态 PAY_ORDER_NOTIFY_STATUS: 'pay_order_notify_status', // 商户支付订单回调状态
PAY_ORDER_STATUS: 'pay_order_status', // 商户支付订单状态 PAY_ORDER_STATUS: 'pay_order_status', // 商户支付订单状态
PAY_ORDER_REFUND_STATUS: 'pay_order_refund_status', // 商户支付订单退款状态 PAY_ORDER_REFUND_STATUS: 'pay_order_refund_status', // 商户支付订单退款状态

View File

@ -17,7 +17,7 @@
<el-descriptions-item label="商家备注">{{ order.remark }}</el-descriptions-item> <el-descriptions-item label="商家备注">{{ order.remark }}</el-descriptions-item>
<el-descriptions-item label="支付单号">{{ order.payOrderId }}</el-descriptions-item> <el-descriptions-item label="支付单号">{{ order.payOrderId }}</el-descriptions-item>
<el-descriptions-item label="付款方式"> <el-descriptions-item label="付款方式">
<dict-tag :type="DICT_TYPE.PAY_CHANNEL_CODE_TYPE" :value="order.payChannelCode" /> <dict-tag :type="DICT_TYPE.PAY_CHANNEL_CODE" :value="order.payChannelCode" />
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="买家">{{ order.user.nickname }}</el-descriptions-item> <!-- TODO --> <el-descriptions-item label="买家">{{ order.user.nickname }}</el-descriptions-item> <!-- TODO -->
<el-descriptions-item label="收货地址"> <el-descriptions-item label="收货地址">

View File

@ -42,7 +42,7 @@
<el-col :span="6" :xs="24"> <el-col :span="6" :xs="24">
<el-form-item label="支付方式" prop="payChannelCode"> <el-form-item label="支付方式" prop="payChannelCode">
<el-select v-model="queryParams.payChannelCode" clearable style="width: 240px"> <el-select v-model="queryParams.payChannelCode" clearable style="width: 240px">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.PAY_CHANNEL_CODE_TYPE)" <el-option v-for="dict in this.getDictDatas(DICT_TYPE.PAY_CHANNEL_CODE)"
:key="dict.value" :label="dict.label" :value="dict.value"/> :key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -86,7 +86,7 @@
<dict-tag :type="DICT_TYPE.TERMINAL" :value="row.terminal" /> <dict-tag :type="DICT_TYPE.TERMINAL" :value="row.terminal" />
</el-col> </el-col>
<el-col :span="4">支付方式 <el-col :span="4">支付方式
<dict-tag v-if="row.payChannelCode" :type="DICT_TYPE.PAY_CHANNEL_CODE_TYPE" :value="row.payChannelCode" /> <dict-tag v-if="row.payChannelCode" :type="DICT_TYPE.PAY_CHANNEL_CODE" :value="row.payChannelCode" />
<span v-else>未支付</span> <span v-else>未支付</span>
</el-col> </el-col>
<el-col :span="6" align="right"> <el-col :span="6" align="right">

View File

@ -18,15 +18,15 @@
<el-descriptions title="选择支付宝支付"> <el-descriptions title="选择支付宝支付">
</el-descriptions> </el-descriptions>
<div class="pay-channel-container"> <div class="pay-channel-container">
<div class="box" v-for="channel in aliPayChannels" :key="channel.code" @click="submit(channel.code)"> <div class="box" v-for="channel in channels" v-if="channel.code.indexOf('alipay_') === 0" :key="channel.code" @click="submit(channel.code)">
<img :src="icons[channel.code]"> <img :src="channel.icon">
<div class="title">{{ channel.name }}</div> <div class="title">{{ channel.name }}</div>
</div> </div>
</div> </div>
<!-- 微信支付 --> <!-- 微信支付 -->
<el-descriptions title="选择微信支付" style="margin-top: 20px;" /> <el-descriptions title="选择微信支付" style="margin-top: 20px;" />
<div class="pay-channel-container"> <div class="pay-channel-container">
<div class="box" v-for="channel in wxPayChannels" :key="channel.code"> <div class="box" v-for="channel in channels" v-if="channel.code.indexOf('wx_') === 0" :key="channel.code">
<img :src="icons[channel.code]"> <img :src="icons[channel.code]">
<div class="title">{{ channel.name }}</div> <div class="title">{{ channel.name }}</div>
</div> </div>
@ -34,7 +34,8 @@
<!-- 其它支付 --> <!-- 其它支付 -->
<el-descriptions title="选择其它支付" style="margin-top: 20px;" /> <el-descriptions title="选择其它支付" style="margin-top: 20px;" />
<div class="pay-channel-container"> <div class="pay-channel-container">
<div class="box" v-for="channel in otherPayChannels" :key="channel.code"> <div class="box" v-for="channel in channels" :key="channel.code"
v-if="channel.code.indexOf('alipay_') === -1 && channel.code.indexOf('wx_') === -1">
<img :src="icons[channel.code]"> <img :src="icons[channel.code]">
<div class="title">{{ channel.name }}</div> <div class="title">{{ channel.name }}</div>
</div> </div>
@ -101,20 +102,43 @@ export default {
returnUrl: undefined, // returnUrl: undefined, //
loading: false, // loading loading: false, // loading
payOrder: {}, // payOrder: {}, //
aliPayChannels: [], // channels: [{
wxPayChannels: [], // name: '支付宝 PC 网站支付',
otherPayChannels: [], // icon: require("@/assets/images/pay/icon/alipay_pc.svg"),
icons: { code: "alipay_pc"
alipay_qr: require("@/assets/images/pay/icon/alipay_qr.svg"), }, {
alipay_app: require("@/assets/images/pay/icon/alipay_app.svg"), name: '支付宝 Wap 网站支付',
alipay_wap: require("@/assets/images/pay/icon/alipay_wap.svg"), icon: require("@/assets/images/pay/icon/alipay_wap.svg"),
alipay_pc: require("@/assets/images/pay/icon/alipay_pc.svg"), code: "alipay_wap"
alipay_bar: require("@/assets/images/pay/icon/alipay_bar.svg"), }, {
wx_app: require("@/assets/images/pay/icon/wx_app.svg"), name: '支付宝 App 网站支付',
wx_lite: require("@/assets/images/pay/icon/wx_lite.svg"), icon: require("@/assets/images/pay/icon/alipay_app.svg"),
wx_pub: require("@/assets/images/pay/icon/wx_pub.svg"), code: "alipay_app"
mock: require("@/assets/images/pay/icon/mock.svg"), }, {
}, name: '支付宝扫码支付',
icon: require("@/assets/images/pay/icon/alipay_app.svg"),
code: "alipay_qr"
}, {
name: '支付宝条码支付',
icon: require("@/assets/images/pay/icon/alipay_bar.svg"),
code: "alipay_bar"
}, {
name: '微信公众号支付',
icon: require("@/assets/images/pay/icon/wx_pub.svg"),
code: "wx_pub"
}, {
name: '微信小程序支付',
icon: require("@/assets/images/pay/icon/wx_lite.svg"),
code: "wx_lite"
}, {
name: '微信 App 支付',
icon: require("@/assets/images/pay/icon/wx_lite.svg"),
code: "wx_app"
}, {
name: '模拟支付',
icon: require("@/assets/images/pay/icon/mock.svg"),
code: "mock"
}],
submitLoading: false, // loading submitLoading: false, // loading
interval: undefined, // interval: undefined, //
qrCode: { // qrCode: { //
@ -144,26 +168,8 @@ export default {
this.returnUrl = decodeURIComponent(this.$route.query.returnUrl) this.returnUrl = decodeURIComponent(this.$route.query.returnUrl)
} }
this.getDetail(); this.getDetail();
this.initPayChannels();
}, },
methods: { methods: {
/** 初始化支付渠道 */
initPayChannels() {
//
for (const dict of getDictDatas(DICT_TYPE.PAY_CHANNEL_CODE_TYPE)) {
const payChannel = {
name: dict.label,
code: dict.value
}
if (dict.value.indexOf('wx_') === 0) {
this.wxPayChannels.push(payChannel);
} else if (dict.value.indexOf('alipay_') === 0) {
this.aliPayChannels.push(payChannel);
} else {
this.otherPayChannels.push(payChannel);
}
}
},
/** 获得支付信息 */ /** 获得支付信息 */
getDetail() { getDetail() {
// 1.1 // 1.1
@ -180,6 +186,7 @@ export default {
return; return;
} }
// 1.3 // 1.3
// TODO
if (response.data.status !== PayOrderStatusEnum.WAITING.status) { if (response.data.status !== PayOrderStatusEnum.WAITING.status) {
this.$message.error('支付订单不处于待支付状态,请检查!'); this.$message.error('支付订单不处于待支付状态,请检查!');
this.goBackToList(); this.goBackToList();

View File

@ -285,7 +285,7 @@ export default {
// //
appList: null, appList: null,
// //
payChannelCodeDictDatum: getDictDatas(DICT_TYPE.PAY_CHANNEL_CODE_TYPE), payChannelCodeDictDatum: getDictDatas(DICT_TYPE.PAY_CHANNEL_CODE),
// //
payOrderNotifyDictDatum: getDictDatas(DICT_TYPE.PAY_ORDER_NOTIFY_STATUS), payOrderNotifyDictDatum: getDictDatas(DICT_TYPE.PAY_ORDER_NOTIFY_STATUS),
// //

View File

@ -298,7 +298,7 @@ export default {
// //
appList: null, appList: null,
// //
payChannelCodeDictDatum: getDictDatas(DICT_TYPE.PAY_CHANNEL_CODE_TYPE), payChannelCodeDictDatum: getDictDatas(DICT_TYPE.PAY_CHANNEL_CODE),
// 退 // 退
payRefundOrderDictDatum: getDictDatas(DICT_TYPE.PAY_REFUND_ORDER_STATUS), payRefundOrderDictDatum: getDictDatas(DICT_TYPE.PAY_REFUND_ORDER_STATUS),
// 退 // 退