fix[订单服务]:新增订单号查询景区素材,设备序号的逻辑
This commit is contained in:
@@ -4,10 +4,10 @@ server:
|
||||
spring:
|
||||
application:
|
||||
name: device-center
|
||||
# cloud:
|
||||
# nacos:
|
||||
# discovery:
|
||||
# ip: 81.70.164.178
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: 119.45.169.13
|
||||
# cloud:
|
||||
# nacos:
|
||||
# discovery:
|
||||
|
||||
+29
-4
@@ -15,10 +15,8 @@ import com.central.order.feign.UserCenterService;
|
||||
import com.central.order.model.Order;
|
||||
import com.central.order.model.OrderFile;
|
||||
import com.central.order.model.QrCode;
|
||||
import com.central.order.service.IOrderFileService;
|
||||
import com.central.order.service.IOrderService;
|
||||
import com.central.order.service.IQrCodeService;
|
||||
import com.central.order.service.ITourismService;
|
||||
import com.central.order.model.TourismFile;
|
||||
import com.central.order.service.*;
|
||||
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
|
||||
import com.wechat.pay.java.service.payments.jsapi.model.Amount;
|
||||
import com.wechat.pay.java.service.payments.jsapi.model.Payer;
|
||||
@@ -66,6 +64,9 @@ public class OrderController {
|
||||
@Autowired
|
||||
private ITourismService tourismService;
|
||||
|
||||
@Autowired
|
||||
private ITourismFileService tourismFileService;
|
||||
|
||||
@Autowired
|
||||
private UserCenterService userCenterService;
|
||||
|
||||
@@ -363,6 +364,30 @@ public class OrderController {
|
||||
return Result.failed("不满足执行条件");
|
||||
}
|
||||
|
||||
@Operation(summary = "获取订单对应的景区素材")
|
||||
@GetMapping("/tourism/{orderNo}")
|
||||
public Result<List<TourismFile>> getTourismByOrder(@PathVariable("orderNo") String orderNo) {
|
||||
Order order = orderService.getOrderByNumber(orderNo);
|
||||
Assert.notNull(order,"订单数据不存在");
|
||||
List<TourismFile> tourismFiles = tourismFileService.getByTourismId(order.getTourismId());
|
||||
if (!tourismFiles.isEmpty()){
|
||||
for (TourismFile tourismFile : tourismFiles){
|
||||
tourismFile.setImageUrl(fileCenterService.getViewUrlByPath(tourismFile.getImageUrl()));
|
||||
}
|
||||
}
|
||||
return Result.succeed(tourismFiles,"获取成功");
|
||||
}
|
||||
|
||||
@Operation(summary = "获取订单的设备")
|
||||
@GetMapping("/device/{orderNo}")
|
||||
public Result<String> getDeviceByOrder(@PathVariable("orderNo") String orderNo) {
|
||||
Order order = orderService.getOrderByNumber(orderNo);
|
||||
Assert.notNull(order,"订单数据不存在");
|
||||
return Result.succeed(order.getDeviceSn(),"获取成功");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 将分的价格转换为元的str,方便前端显示
|
||||
* @param str
|
||||
|
||||
+38
-11
@@ -15,6 +15,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -25,7 +26,7 @@ import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/refund")
|
||||
public class OrderRefundController {
|
||||
public class RefundController {
|
||||
|
||||
@Autowired
|
||||
private RefundService service;
|
||||
@@ -63,6 +64,10 @@ public class OrderRefundController {
|
||||
// 创建退款订单
|
||||
com.central.order.model.Refund refund = new com.central.order.model.Refund();
|
||||
refund.setRefundNo("RF" + order.getOrderNo());
|
||||
com.central.order.model.Refund existRefund = refundService.getRefundByNo(refund.getRefundNo());
|
||||
if (existRefund != null){
|
||||
return Result.succeed("已提交");
|
||||
}
|
||||
refund.setOrderNo(order.getOrderNo());
|
||||
refund.setUserId(order.getUserId());
|
||||
refund.setOrderAmount(order.getOrderAmount());
|
||||
@@ -72,22 +77,43 @@ public class OrderRefundController {
|
||||
boolean res = refundService.createRefund(refund);
|
||||
if (res) {
|
||||
order.setOrderStatus(OrderStatus.REFUNDING.getId());
|
||||
orderService.updateOrder(order);
|
||||
return Result.succeed("退款成功");
|
||||
}
|
||||
return Result.failed("请重试");
|
||||
}
|
||||
|
||||
@Operation(summary = "微信支付退款")
|
||||
@PatchMapping()
|
||||
@PostMapping("/approve")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result<com.central.order.model.Refund> refundOrder(@RequestBody String orderNo) {
|
||||
public Result<com.central.order.model.Refund> approveOrder(@RequestBody com.central.order.model.Refund refund) {
|
||||
|
||||
// 检查订单是否存在
|
||||
Order order = orderService.getOrderByNumber(refund.getOrderNo());
|
||||
Assert.notNull(order, "ORDER DATA不存在");
|
||||
if (!order.getOrderStatus().equals(OrderStatus.REFUNDING.getId())){
|
||||
return Result.failed("请重试");
|
||||
}
|
||||
if (! refund.getStatus().equals(OrderStatus.REFUNDING.getId())){
|
||||
return Result.failed("该状态不支持审核");
|
||||
}
|
||||
if (refund.getState().equals(RefundState.APPROVED.getId())){
|
||||
dealRefundRequest(order);
|
||||
return Result.succeed("已处理退款");
|
||||
}
|
||||
if (refund.getState().equals(RefundState.REFUSED.getId())){
|
||||
order.setOrderStatus(OrderStatus.REFUND_FAILED.getId());
|
||||
refund.setStatus(OrderStatus.REFUND_FAILED.getId());
|
||||
orderService.updateOrder(order);
|
||||
refundService.updateById(refund);
|
||||
return Result.succeed("处理成功");
|
||||
}
|
||||
return Result.failed("处理退款失败");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Refund dealRefundRequest(Order order) {
|
||||
try {
|
||||
// 检查订单是否存在
|
||||
Order order = orderService.getOrderByNumber(orderNo);
|
||||
Assert.notNull(order, "ORDER DATA不存在");
|
||||
if (!order.getOrderStatus().equals(OrderStatus.REFUNDING.getId())){
|
||||
return Result.failed("请重试");
|
||||
}
|
||||
// 创建微信退款请求
|
||||
CreateRequest request = new CreateRequest();
|
||||
request.setOutTradeNo(order.getOrderNo());
|
||||
@@ -102,17 +128,18 @@ public class OrderRefundController {
|
||||
amount.setTotal(Long.valueOf(order.getOrderAmount()));
|
||||
// 退款金额,单位为分
|
||||
amount.setRefund(Long.valueOf(order.getOrderAmount()));
|
||||
amount.setCurrency("CNY");
|
||||
request.setAmount(amount);
|
||||
|
||||
// 发起退款请求
|
||||
Refund response = service.create(request);
|
||||
Assert.notNull(response, "退款失败");
|
||||
return Result.succeed("已提交,请关注账户资金变化");
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
// 记录异常信息
|
||||
e.printStackTrace();
|
||||
return Result.failed("退款失败:" + e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+6
-3
@@ -1,6 +1,7 @@
|
||||
package com.central.order.controller;
|
||||
|
||||
import com.central.order.enums.OrderStatus;
|
||||
import com.central.order.enums.RefundState;
|
||||
import com.central.order.model.Order;
|
||||
import com.central.order.service.IOrderService;
|
||||
import com.central.order.service.IRefundService;
|
||||
@@ -9,6 +10,7 @@ import com.wechat.pay.java.core.notification.NotificationParser;
|
||||
import com.wechat.pay.java.core.notification.RequestParam;
|
||||
import com.wechat.pay.java.service.payments.model.Transaction;
|
||||
import com.wechat.pay.java.service.refund.model.RefundNotification;
|
||||
import com.wechat.pay.java.service.refund.model.Status;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -134,14 +136,15 @@ public class WxPayController {
|
||||
private void handleRefundResult(RefundNotification notification) {
|
||||
// 获取退款通知中的关键信息
|
||||
String outRefundNo = notification.getOutRefundNo();
|
||||
String refundStatus = notification.getRefundStatus().name();
|
||||
|
||||
log.info("回调返回结果"+notification);
|
||||
// 根据退款状态进行相应处理
|
||||
if ("SUCCESS".equals(refundStatus)) {
|
||||
if (Status.SUCCESS.equals(notification.getRefundStatus())) {
|
||||
// 退款成功,更新订单状态等操作
|
||||
com.central.order.model.Refund refund = refundService.getRefundByNo(outRefundNo);
|
||||
Assert.notNull(refund,"退款订单数据不存在");
|
||||
refund.setStatus(OrderStatus.REFUNDED.getId());
|
||||
refund.setState(RefundState.APPROVED.getId());
|
||||
refund.setRefundTime(new Date());
|
||||
refundService.updateById(refund);
|
||||
|
||||
@@ -149,7 +152,7 @@ public class WxPayController {
|
||||
Assert.notNull(order,"订单数据不存在");
|
||||
order.setOrderStatus(OrderStatus.REFUNDED.getId());
|
||||
orderService.updateOrder(order);
|
||||
} else if ("CLOSED".equals(refundStatus)) {
|
||||
} else if ("CLOSED".equals(notification.getRefundStatus())) {
|
||||
// 退款关闭,处理退款关闭逻辑
|
||||
} else {
|
||||
// 其他退款状态,如退款中、失败等
|
||||
|
||||
@@ -13,9 +13,9 @@ public enum OrderStatus implements ZltEnum {
|
||||
PAID(1, "已支付排队中"),
|
||||
CANCELED(2, "已取消"),
|
||||
DOING(4,"正在服务中"),
|
||||
COMPLETE(3,"用户下载完成"),
|
||||
COMPLETE(3,"设备执行完成"),
|
||||
UPLOADING(5,"素材上传中"),
|
||||
UPLOADED(6,"素材上传完成"),
|
||||
UPLOADED(6,"素材上传完成(任务完成)"),
|
||||
REFUNDING(7,"退款中"),
|
||||
REFUNDED(8,"已退款"),
|
||||
REFUND_FAILED(9,"退款失败");
|
||||
|
||||
@@ -4,10 +4,10 @@ server:
|
||||
spring:
|
||||
application:
|
||||
name: order-center
|
||||
# cloud:
|
||||
# nacos:
|
||||
# discovery:
|
||||
# ip: 81.70.164.178
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: 81.70.164.178
|
||||
# cloud:
|
||||
# nacos:
|
||||
# discovery:
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
########################## 统一变量配置 ##########################
|
||||
##### 数据库配置
|
||||
#zlt.datasource.ip=127.0.0.1
|
||||
#zlt.datasource.username=root
|
||||
#zlt.datasource.password=root
|
||||
zlt.datasource.ip=sh-cdb-i6yxaaec.sql.tencentcdb.com:58797
|
||||
zlt.datasource.ip=127.0.0.1
|
||||
zlt.datasource.username=root
|
||||
zlt.datasource.password=ZXC_zxc!@#123+
|
||||
zlt.datasource.password=root
|
||||
#zlt.datasource.ip=sh-cdb-i6yxaaec.sql.tencentcdb.com:58797
|
||||
#zlt.datasource.username=root
|
||||
#zlt.datasource.password=ZXC_zxc!@#123+
|
||||
|
||||
##### redis配置
|
||||
spring.data.redis.host=192.168.2.20
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
########################## bootstrap级别通用配置 ##########################
|
||||
# 默认开发环境
|
||||
spring.profiles.active=dev
|
||||
spring.profiles.active=prod
|
||||
|
||||
##### nacos(注册中心和配置中心)地址
|
||||
#spring.cloud.nacos.server-addr=47.94.136.130:8848
|
||||
spring.cloud.nacos.server-addr=127.0.0.1:8848
|
||||
spring.cloud.nacos.server-addr=47.94.136.130:8848
|
||||
#spring.cloud.nacos.server-addr=127.0.0.1:8848
|
||||
spring.cloud.nacos.username=nacos
|
||||
spring.cloud.nacos.password=nacos
|
||||
spring.cloud.nacos.config.file-extension=yml
|
||||
|
||||
@@ -9,38 +9,38 @@
|
||||
export default {
|
||||
dev: {
|
||||
'/api-uaa/': {
|
||||
// target: 'http://119.45.169.13:9900',
|
||||
target: 'http://127.0.0.1:9900',
|
||||
target: 'http://119.45.169.13:9900',
|
||||
// target: 'http://127.0.0.1:9900',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/api-user/': {
|
||||
target: 'http://127.0.0.1:9900',
|
||||
// target: 'http://119.45.169.13:9900',
|
||||
// target: 'http://127.0.0.1:9900',
|
||||
target: 'http://119.45.169.13:9900',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/api-log/': {
|
||||
target: 'http://127.0.0.1:9900',
|
||||
// target: 'http://119.45.169.13:9900',
|
||||
// target: 'http://127.0.0.1:9900',
|
||||
target: 'http://119.45.169.13:9900',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/api-search/': {
|
||||
target: 'http://127.0.0.1:9900',
|
||||
// target: 'http://119.45.169.13:9900',
|
||||
// target: 'http://127.0.0.1:9900',
|
||||
target: 'http://119.45.169.13:9900',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/api-generator/': {
|
||||
target: 'http://127.0.0.1:9900',
|
||||
// target: 'http://119.45.169.13:9900',
|
||||
// target: 'http://127.0.0.1:9900',
|
||||
target: 'http://119.45.169.13:9900',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/api-file/': {
|
||||
target: 'http://127.0.0.1:9900',
|
||||
// target: 'http://119.45.169.13:9900',
|
||||
// target: 'http://127.0.0.1:9900',
|
||||
target: 'http://119.45.169.13:9900',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/api-order/': {
|
||||
target: 'http://127.0.0.1:9900',
|
||||
// target: 'http://119.45.169.13:9900',
|
||||
// target: 'http://127.0.0.1:9900',
|
||||
target: 'http://119.45.169.13:9900',
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -30,12 +30,17 @@ const { Link } = Typography;
|
||||
// }
|
||||
// };
|
||||
|
||||
// 状态颜色映射
|
||||
const statusColorMap = {
|
||||
0: { color: 'yellow', text: '待处理' },
|
||||
1: { color: 'orange', text: '待处理' },
|
||||
3: { color: 'green', text: '已完成' },
|
||||
2: { color: 'red', text: '已取消' },
|
||||
0: { color: 'yellow', text: '待支付' },
|
||||
1: { color: 'orange', text: '已支付排队中' },
|
||||
2: { color: 'gray', text: '已取消' },
|
||||
3: { color: 'red', text: '设备执行完成' },
|
||||
4: { color: 'lightblue', text: '正在服务中' },
|
||||
5: { color: 'pink', text: '素材上传中' },
|
||||
6: { color: 'green', text: '素材上传完成' },
|
||||
7: { color: 'darkgray', text: '退款中' },
|
||||
8: { color: 'cyan', text: '已退款' },
|
||||
9: { color: 'purple', text: '退款失败' }
|
||||
};
|
||||
|
||||
// 渲染状态标签
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
|
||||
const [form] = Form.useForm();
|
||||
return (
|
||||
<ModalForm
|
||||
title="修改景区"
|
||||
title="修改二维码"
|
||||
form={form}
|
||||
visible={props.updateModalVisible}
|
||||
onFinish={props.onSubmit}
|
||||
|
||||
+42
-28
@@ -1,24 +1,32 @@
|
||||
import {
|
||||
ModalForm,
|
||||
ProForm,
|
||||
ProFormSelect,
|
||||
ProFormText,
|
||||
} from '@ant-design/pro-components';
|
||||
import { Form } from 'antd';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export type FormValueType = Partial<ORDERS.Tourism>;
|
||||
export type FormValueType = Partial<ORDERS.Refund>;
|
||||
|
||||
export type UpdateFormProps = {
|
||||
onVisibleChange: (flag: boolean) => void;
|
||||
onSubmit: (values: FormValueType) => Promise<void>;
|
||||
updateModalVisible: boolean;
|
||||
values?: ORDERS.Tourism;
|
||||
values?: ORDERS.Refund;
|
||||
};
|
||||
|
||||
const UpdateForm: React.FC<UpdateFormProps> = (props) => {
|
||||
const [form] = Form.useForm();
|
||||
const { values } = props;
|
||||
|
||||
useEffect(() => {
|
||||
form.setFieldsValue(values);
|
||||
}, [form, values]);
|
||||
|
||||
return (
|
||||
<ModalForm
|
||||
title="修改景区"
|
||||
title="退款审核"
|
||||
form={form}
|
||||
visible={props.updateModalVisible}
|
||||
onFinish={props.onSubmit}
|
||||
@@ -26,41 +34,47 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
|
||||
>
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '名称不为空',
|
||||
},
|
||||
]}
|
||||
readonly = {true}
|
||||
width="md"
|
||||
name="tourismName"
|
||||
label="名称"
|
||||
placeholder="输入名称"
|
||||
name="orderNo"
|
||||
label="订单编号"
|
||||
/>
|
||||
<ProFormText
|
||||
readonly={true}
|
||||
width="md"
|
||||
name="refundNo"
|
||||
label="退款编号"
|
||||
/>
|
||||
<ProFormText
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '地址不为空',
|
||||
message: '审核理由不为空',
|
||||
},
|
||||
]}
|
||||
width="md"
|
||||
name="tourismAddress"
|
||||
label="地址"
|
||||
placeholder="输入地址"
|
||||
/>
|
||||
<ProFormText
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '手机号不为空',
|
||||
},
|
||||
]}
|
||||
width="md"
|
||||
name="tourismPhone"
|
||||
label="手机号"
|
||||
placeholder="输入手机号"
|
||||
name="approveReason"
|
||||
label="审核理由"
|
||||
placeholder="输入审核理由"
|
||||
/>
|
||||
<ProFormSelect
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '审核状态不为空',
|
||||
},
|
||||
]}
|
||||
width="md"
|
||||
name="state"
|
||||
label="状态"
|
||||
placeholder="请选择审核状态"
|
||||
options={[
|
||||
{ label: '审核中', value: 0 },
|
||||
{ label: '已通过', value: 1 },
|
||||
{ label: '已拒绝', value: 2 },
|
||||
// 添加更多选项...
|
||||
]}
|
||||
/>
|
||||
</ProForm.Group>
|
||||
</ModalForm>
|
||||
);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { refund } from '@/services/orders/api';
|
||||
import { refund, updateRefund } from '@/services/orders/api';
|
||||
import type { ActionType, ProColumns } from '@ant-design/pro-components';
|
||||
import {
|
||||
PageContainer,
|
||||
@@ -6,29 +6,30 @@ import {
|
||||
ProTable,
|
||||
QueryFilter,
|
||||
} from '@ant-design/pro-components';
|
||||
import { Typography, Popconfirm, Tag } from 'antd';
|
||||
import { Typography, Tag, Space, message } from 'antd';
|
||||
import React, { useRef, useState } from 'react';
|
||||
import UpdateForm from './components/UpdateForm';
|
||||
|
||||
const { Link } = Typography;
|
||||
|
||||
// const handleDelete = async (deletefile: FILES.File) => {
|
||||
// const hide = message.loading('正在删除');
|
||||
// try {
|
||||
// const result = await deleteFile(deletefile.id);
|
||||
// hide();
|
||||
// if (result.resp_code === 0) {
|
||||
// message.success('删除File成功');
|
||||
// return true;
|
||||
// } else {
|
||||
// message.error(result.resp_msg);
|
||||
// return false;
|
||||
// }
|
||||
// } catch (error) {
|
||||
// hide();
|
||||
// message.error('删除File失败');
|
||||
// return false;
|
||||
// }
|
||||
// };
|
||||
const handleEdit = async (fields: ORDERS.Refund) => {
|
||||
const hide = message.loading('正在更新');
|
||||
try {
|
||||
const result = await updateRefund({ ...fields });
|
||||
hide();
|
||||
if (result.resp_code === 0) {
|
||||
message.success('审核成功');
|
||||
return true;
|
||||
} else {
|
||||
message.error(result.resp_msg);
|
||||
return false;
|
||||
}
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('审核失败');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// 状态颜色映射
|
||||
const statusColorMap = {
|
||||
@@ -61,6 +62,8 @@ const renderState = (state: {} | null | undefined) => {
|
||||
const TableList: React.FC = () => {
|
||||
const actionRef = useRef<ActionType>();
|
||||
const [params, setParams] = useState<Record<string, string | number>>({ });
|
||||
const [updateModalVisible, handleUpdateModalVisible] = useState<boolean>(false);
|
||||
const [currentRow, setCurrentRow] = useState<ORDERS.Refund>();
|
||||
const columns: ProColumns<ORDERS.Refund>[] = [
|
||||
{
|
||||
dataIndex: 'index',
|
||||
@@ -100,19 +103,17 @@ const TableList: React.FC = () => {
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
render: (_, entity) => <Popconfirm
|
||||
title={`确认删除文件[${entity.id}]?`}
|
||||
onConfirm={async () => {
|
||||
// const success = await handleDelete(entity);
|
||||
// if (success) {
|
||||
// if (actionRef.current) {
|
||||
// actionRef.current.reload();
|
||||
// }
|
||||
// }
|
||||
}}
|
||||
>
|
||||
<Link>审核</Link>
|
||||
</Popconfirm>,
|
||||
render: (_, entity) =>
|
||||
<Space>
|
||||
<Link
|
||||
onClick={() => {
|
||||
setCurrentRow(entity);
|
||||
handleUpdateModalVisible(true);
|
||||
}}
|
||||
>
|
||||
修改
|
||||
</Link>
|
||||
</Space>
|
||||
},
|
||||
];
|
||||
|
||||
@@ -140,6 +141,24 @@ const TableList: React.FC = () => {
|
||||
showQuickJumper: true,
|
||||
}}
|
||||
/>
|
||||
<UpdateForm
|
||||
onSubmit={async (values) => {
|
||||
if (currentRow) {
|
||||
|
||||
const success = await handleEdit({ ...currentRow, ...values });
|
||||
if (success) {
|
||||
handleUpdateModalVisible(false);
|
||||
if (actionRef.current) {
|
||||
actionRef.current.reload();
|
||||
}
|
||||
}
|
||||
setCurrentRow(undefined);
|
||||
}
|
||||
}}
|
||||
onVisibleChange={handleUpdateModalVisible}
|
||||
updateModalVisible={updateModalVisible}
|
||||
values={currentRow}
|
||||
/>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -137,3 +137,12 @@ export async function refund(params?: { [key: string]: string | number }) {
|
||||
});
|
||||
return { data: result.data, total: result.count };
|
||||
}
|
||||
|
||||
export async function updateRefund(data: ORDERS.Refund): Promise<API.Result<ORDERS.Refund>> {
|
||||
const result = await request<API.Result<ORDERS.Refund>>('/api-order/refund/approve', {
|
||||
method: 'POST',
|
||||
data,
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user