fix(order): 修改订单确认页面的商品名称显示问题
- 将商品名称替换为固定文本“时里院子市集” - 确保配送类型和买家备注正确传递 - 优化注释说明,确保 couponId 类型正确处理
This commit is contained in:
@@ -2,7 +2,8 @@
|
|||||||
export const ENV_CONFIG = {
|
export const ENV_CONFIG = {
|
||||||
// 开发环境
|
// 开发环境
|
||||||
development: {
|
development: {
|
||||||
API_BASE_URL: 'https://cms-api.websoft.top/api',
|
API_BASE_URL: 'http://127.0.0.1:9200/api',
|
||||||
|
// API_BASE_URL: 'https://cms-api.websoft.top/api',
|
||||||
APP_NAME: '开发环境',
|
APP_NAME: '开发环境',
|
||||||
DEBUG: 'true',
|
DEBUG: 'true',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ export const STATUS_COLOR_MAP = {
|
|||||||
// 申请售后
|
// 申请售后
|
||||||
export const applyAfterSale = async (params: AfterSaleApplyParams): Promise<AfterSaleDetailResponse> => {
|
export const applyAfterSale = async (params: AfterSaleApplyParams): Promise<AfterSaleDetailResponse> => {
|
||||||
try {
|
try {
|
||||||
const response = await request({
|
const response = await request<AfterSaleDetailResponse>({
|
||||||
url: '/api/after-sale/apply',
|
url: '/api/after-sale/apply',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: params
|
data: params
|
||||||
@@ -136,7 +136,7 @@ export const getAfterSaleDetail = async (params: {
|
|||||||
afterSaleId?: string
|
afterSaleId?: string
|
||||||
}): Promise<AfterSaleDetailResponse> => {
|
}): Promise<AfterSaleDetailResponse> => {
|
||||||
try {
|
try {
|
||||||
const response = await request({
|
const response = await request<AfterSaleDetailResponse>({
|
||||||
url: '/api/after-sale/detail',
|
url: '/api/after-sale/detail',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
data: params
|
data: params
|
||||||
@@ -154,7 +154,7 @@ export const getAfterSaleDetail = async (params: {
|
|||||||
// 查询售后列表
|
// 查询售后列表
|
||||||
export const getAfterSaleList = async (params: AfterSaleListParams): Promise<AfterSaleListResponse> => {
|
export const getAfterSaleList = async (params: AfterSaleListParams): Promise<AfterSaleListResponse> => {
|
||||||
try {
|
try {
|
||||||
const response = await request({
|
const response = await request<AfterSaleListResponse>({
|
||||||
url: '/api/after-sale/list',
|
url: '/api/after-sale/list',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
data: params
|
data: params
|
||||||
@@ -170,7 +170,7 @@ export const getAfterSaleList = async (params: AfterSaleListParams): Promise<Aft
|
|||||||
// 撤销售后申请
|
// 撤销售后申请
|
||||||
export const cancelAfterSale = async (afterSaleId: string): Promise<{ success: boolean; message?: string }> => {
|
export const cancelAfterSale = async (afterSaleId: string): Promise<{ success: boolean; message?: string }> => {
|
||||||
try {
|
try {
|
||||||
const response = await request({
|
const response = await request<{ success: boolean; message?: string }>({
|
||||||
url: '/api/after-sale/cancel',
|
url: '/api/after-sale/cancel',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { afterSaleId }
|
data: { afterSaleId }
|
||||||
@@ -312,10 +312,8 @@ export const getAfterSaleSteps = (type: AfterSaleType, status: AfterSaleStatus)
|
|||||||
|
|
||||||
// 根据类型调整步骤
|
// 根据类型调整步骤
|
||||||
if (type === 'return' || type === 'exchange') {
|
if (type === 'return' || type === 'exchange') {
|
||||||
baseSteps.splice(2, 1,
|
baseSteps.splice(2, 0, { title: '等待收货', description: '等待用户寄回商品' })
|
||||||
{ title: '寄回商品', description: '请将商品寄回指定地址' },
|
baseSteps.splice(3, 0, { title: '确认收货', description: '商家确认收到退回商品' })
|
||||||
{ title: '处理中', description: '收到商品,正在处理' }
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return baseSteps
|
return baseSteps
|
||||||
|
|||||||
@@ -40,6 +40,33 @@ const OrderDetail = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 申请退款
|
||||||
|
const handleApplyRefund = async () => {
|
||||||
|
if (order) {
|
||||||
|
try {
|
||||||
|
// 更新订单状态为"退款申请中"
|
||||||
|
await updateShopOrder({
|
||||||
|
orderId: order.orderId,
|
||||||
|
orderStatus: 4 // 退款申请中
|
||||||
|
});
|
||||||
|
|
||||||
|
// 更新本地状态
|
||||||
|
setOrder(prev => prev ? {...prev, orderStatus: 4} : null);
|
||||||
|
|
||||||
|
// 跳转到退款申请页面
|
||||||
|
Taro.navigateTo({
|
||||||
|
url: `/user/order/refund/index?orderId=${order.orderId}&orderNo=${order.orderNo}`
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error('更新订单状态失败:', error);
|
||||||
|
Taro.showToast({
|
||||||
|
title: '操作失败,请重试',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const getOrderStatusText = (order: ShopOrder) => {
|
const getOrderStatusText = (order: ShopOrder) => {
|
||||||
// 优先检查订单状态
|
// 优先检查订单状态
|
||||||
if (order.orderStatus === 2) return '已取消';
|
if (order.orderStatus === 2) return '已取消';
|
||||||
@@ -162,7 +189,7 @@ const OrderDetail = () => {
|
|||||||
<Space>
|
<Space>
|
||||||
{!order.payStatus && <Button onClick={() => console.log('取消订单')}>取消订单</Button>}
|
{!order.payStatus && <Button onClick={() => console.log('取消订单')}>取消订单</Button>}
|
||||||
{!order.payStatus && <Button type="primary" onClick={() => console.log('立即支付')}>立即支付</Button>}
|
{!order.payStatus && <Button type="primary" onClick={() => console.log('立即支付')}>立即支付</Button>}
|
||||||
{order.orderStatus === 1 && <Button onClick={() => console.log('申请退款')}>申请退款</Button>}
|
{order.orderStatus === 1 && <Button onClick={handleApplyRefund}>申请退款</Button>}
|
||||||
{order.deliveryStatus === 20 &&
|
{order.deliveryStatus === 20 &&
|
||||||
<Button type="primary" onClick={() => console.log('确认收货')}>确认收货</Button>}
|
<Button type="primary" onClick={() => console.log('确认收货')}>确认收货</Button>}
|
||||||
</Space>
|
</Space>
|
||||||
|
|||||||
@@ -316,11 +316,30 @@ function OrderList(props: OrderListProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 申请退款 (待发货状态)
|
// 申请退款 (待发货状态)
|
||||||
const applyRefund = (order: ShopOrder) => {
|
const applyRefund = async (order: ShopOrder) => {
|
||||||
// 跳转到退款申请页面
|
try {
|
||||||
Taro.navigateTo({
|
// 更新订单状态为"退款申请中"
|
||||||
url: `/user/order/refund/index?orderId=${order.orderId}&orderNo=${order.orderNo}`
|
await updateShopOrder({
|
||||||
});
|
orderId: order.orderId,
|
||||||
|
orderStatus: 4 // 退款申请中
|
||||||
|
});
|
||||||
|
|
||||||
|
// 更新本地状态
|
||||||
|
setDataSource(prev => prev.map(item =>
|
||||||
|
item.orderId === order.orderId ? {...item, orderStatus: 4} : item
|
||||||
|
));
|
||||||
|
|
||||||
|
// 跳转到退款申请页面
|
||||||
|
Taro.navigateTo({
|
||||||
|
url: `/user/order/refund/index?orderId=${order.orderId}&orderNo=${order.orderNo}`
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error('更新订单状态失败:', error);
|
||||||
|
Taro.showToast({
|
||||||
|
title: '操作失败,请重试',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 查看物流 (待收货状态)
|
// 查看物流 (待收货状态)
|
||||||
@@ -738,12 +757,12 @@ function OrderList(props: OrderListProps) {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{/* 待发货状态:显示申请退款 */}
|
{/* 待发货状态:显示申请退款 */}
|
||||||
{/*{item.payStatus && item.deliveryStatus === 10 && item.orderStatus !== 2 && item.orderStatus !== 4 && (*/}
|
{item.payStatus && item.deliveryStatus === 10 && item.orderStatus !== 2 && item.orderStatus !== 4 && (
|
||||||
{/* <Button size={'small'} onClick={(e) => {*/}
|
<Button size={'small'} onClick={(e) => {
|
||||||
{/* e.stopPropagation();*/}
|
e.stopPropagation();
|
||||||
{/* applyRefund(item);*/}
|
applyRefund(item);
|
||||||
{/* }}>申请退款</Button>*/}
|
}}>申请退款</Button>
|
||||||
{/*)}*/}
|
)}
|
||||||
|
|
||||||
{/* 待收货状态:显示查看物流和确认收货 */}
|
{/* 待收货状态:显示查看物流和确认收货 */}
|
||||||
{item.deliveryStatus === 20 && item.orderStatus !== 2 && (
|
{item.deliveryStatus === 20 && item.orderStatus !== 2 && (
|
||||||
@@ -770,10 +789,10 @@ function OrderList(props: OrderListProps) {
|
|||||||
{/* e.stopPropagation();*/}
|
{/* e.stopPropagation();*/}
|
||||||
{/* evaluateGoods(item);*/}
|
{/* evaluateGoods(item);*/}
|
||||||
{/*}}>评价商品</Button>*/}
|
{/*}}>评价商品</Button>*/}
|
||||||
{/*<Button size={'small'} onClick={(e) => {*/}
|
<Button size={'small'} onClick={(e) => {
|
||||||
{/* e.stopPropagation();*/}
|
e.stopPropagation();
|
||||||
{/* applyRefund(item);*/}
|
applyRefund(item);
|
||||||
{/*}}>申请退款</Button>*/}
|
}}>申请退款</Button>
|
||||||
</Space>
|
</Space>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import {
|
|||||||
Empty,
|
Empty,
|
||||||
InputNumber
|
InputNumber
|
||||||
} from '@nutui/nutui-react-taro'
|
} from '@nutui/nutui-react-taro'
|
||||||
|
import { applyAfterSale } from '@/api/afterSale'
|
||||||
|
import { updateShopOrder } from '@/api/shop/shopOrder'
|
||||||
import './index.scss'
|
import './index.scss'
|
||||||
|
|
||||||
// 订单商品信息
|
// 订单商品信息
|
||||||
@@ -232,23 +234,55 @@ const RefundPage: React.FC = () => {
|
|||||||
|
|
||||||
setSubmitting(true)
|
setSubmitting(true)
|
||||||
|
|
||||||
// 模拟API调用
|
// 构造请求参数
|
||||||
await new Promise(resolve => setTimeout(resolve, 2000))
|
const params = {
|
||||||
|
orderId: orderId || '',
|
||||||
|
type: 'refund' as const,
|
||||||
|
reason: refundApp.refundReason,
|
||||||
|
description: refundApp.refundDescription,
|
||||||
|
amount: refundApp.refundAmount,
|
||||||
|
contactPhone: refundApp.contactPhone,
|
||||||
|
evidenceImages: refundApp.evidenceImages,
|
||||||
|
goodsItems: refundApp.refundGoods.filter(item => item.refundNum > 0).map(item => ({
|
||||||
|
goodsId: item.goodsId,
|
||||||
|
quantity: item.refundNum
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
Taro.showToast({
|
// 调用API提交退款申请
|
||||||
title: '退款申请提交成功',
|
const result = await applyAfterSale(params)
|
||||||
icon: 'success'
|
|
||||||
})
|
|
||||||
|
|
||||||
// 延迟返回上一页
|
if (result.success) {
|
||||||
setTimeout(() => {
|
// 更新订单状态为"退款申请中"
|
||||||
Taro.navigateBack()
|
if (orderId) {
|
||||||
}, 1500)
|
try {
|
||||||
|
await updateShopOrder({
|
||||||
|
orderId: parseInt(orderId),
|
||||||
|
orderStatus: 4 // 退款申请中
|
||||||
|
})
|
||||||
|
} catch (updateError) {
|
||||||
|
console.error('更新订单状态失败:', updateError)
|
||||||
|
// 即使更新订单状态失败,也继续执行后续操作
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Taro.showToast({
|
||||||
|
title: '退款申请提交成功',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
|
||||||
|
// 延迟返回上一页
|
||||||
|
setTimeout(() => {
|
||||||
|
Taro.navigateBack()
|
||||||
|
}, 1500)
|
||||||
|
} else {
|
||||||
|
throw new Error(result.message || '提交失败')
|
||||||
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('提交退款申请失败:', error)
|
console.error('提交退款申请失败:', error)
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '提交失败,请重试',
|
title: error instanceof Error ? error.message : '提交失败,请重试',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user