hookehuyr

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

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