hookehuyr

fix 取消订单操作失败操作优化

......@@ -381,7 +381,7 @@ const cancelOrder = (id) => {
if (res.confirm) {
if (id) {
// 取消订单
const { code, data } = await orderCancelAPI({ id });
const { code, data, msg } = await orderCancelAPI({ id });
if (code) {
Taro.showToast({
title: "取消成功",
......@@ -389,6 +389,15 @@ const cancelOrder = (id) => {
duration: 2000,
});
props.data.status = 2; // 取消订单状态置为已取消
} else {
// 通过状态文本查找状态code值
const key = Object.keys(STATUS_TEXT).find(key => STATUS_TEXT[key] === msg);
props.data.status = key; // 退款失败时,订单状态置为接口返回的状态
Taro.showToast({
title: "请刷新后再试",
icon: "error",
duration: 2000,
});
}
}
} else if (res.cancel) {
......