fix(订单评价): 修复评价提交后数据不一致问题
确保评价数据同时更新到order.review和order.details.review字段,保持状态一致
Showing
1 changed file
with
13 additions
and
2 deletions
| ... | @@ -678,18 +678,29 @@ const submitRate = async () => { | ... | @@ -678,18 +678,29 @@ const submitRate = async () => { |
| 678 | const currentOrders = viewMode.value === 'buy' ? boughtOrders : soldOrders | 678 | const currentOrders = viewMode.value === 'buy' ? boughtOrders : soldOrders |
| 679 | const order = currentOrders.value.find(o => o.id === currentRateOrder.value.id) | 679 | const order = currentOrders.value.find(o => o.id === currentRateOrder.value.id) |
| 680 | if (order) { | 680 | if (order) { |
| 681 | - order.review = { | 681 | + // 创建评价数据对象 |
| 682 | + const reviewData = { | ||
| 682 | rating: rateScore.value, | 683 | rating: rateScore.value, |
| 683 | note: rateContent.value, | 684 | note: rateContent.value, |
| 684 | - date: new Date().toLocaleString('zh-CN') | 685 | + created_time: new Date().toLocaleString('zh-CN') |
| 685 | } | 686 | } |
| 687 | + | ||
| 688 | + // 同时更新order.review和order.details.review,确保状态一致 | ||
| 689 | + order.review = reviewData | ||
| 690 | + if (order.details) { | ||
| 691 | + order.details.review = reviewData | ||
| 692 | + } | ||
| 693 | + | ||
| 694 | + // 确保订单状态为已完成 | ||
| 686 | order.status = 5 | 695 | order.status = 5 |
| 687 | } | 696 | } |
| 697 | + | ||
| 688 | Taro.showToast({ | 698 | Taro.showToast({ |
| 689 | title: response.msg || '评价提交成功', | 699 | title: response.msg || '评价提交成功', |
| 690 | icon: 'success', | 700 | icon: 'success', |
| 691 | duration: 2000 | 701 | duration: 2000 |
| 692 | }) | 702 | }) |
| 703 | + | ||
| 693 | closeRatePopup() | 704 | closeRatePopup() |
| 694 | } else { | 705 | } else { |
| 695 | throw new Error(response.msg || '提交失败') | 706 | throw new Error(response.msg || '提交失败') | ... | ... |
-
Please register or login to post a comment