hookehuyr

refactor(订单管理): 替换showToast为Taro.showToast并统一错误提示样式

将NutUI的showToast调用替换为Taro原生的showToast
统一错误提示使用error图标,成功提示使用success图标
<!--
* @Date: 2022-09-19 14:11:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-07-03 17:29:31
* @LastEditTime: 2025-07-03 17:41:46
* @FilePath: /jgdl/src/pages/myOrders/index.vue
* @Description: 订单管理页面
-->
......@@ -271,7 +271,6 @@
<script setup>
import { ref, computed, onMounted } from 'vue'
import { showToast } from '@nutui/nutui-taro'
import Taro from '@tarojs/taro'
// import { deleteOrderAPI, submitReviewAPI } from '@/api/orders' // 预留真实API调用
import './index.less'
......@@ -805,9 +804,10 @@ const closeRatePopup = () => {
*/
const submitRate = async () => {
if (!rateContent.value.trim()) {
showToast({
Taro.showToast({
title: '请输入评价内容',
type: 'fail'
icon: 'error',
duration: 2000
})
return
}
......@@ -833,10 +833,7 @@ const submitRate = async () => {
// }
// order.status = 'completed'
// }
// showToast({
// title: response.message || '评价提交成功',
// type: 'success'
// })
// Toast.success(response.message || '评价提交成功')
// closeRatePopup()
// } else {
// throw new Error(response.message || '提交失败')
......@@ -857,18 +854,20 @@ const submitRate = async () => {
order.status = 'completed'
}
showToast({
Taro.showToast({
title: '评价提交成功',
type: 'success'
icon: 'success',
duration: 2000
})
closeRatePopup()
} catch (error) {
// console.error('提交评价失败:', error)
showToast({
Taro.showToast({
title: error.message || '提交失败,请重试',
type: 'fail'
icon: 'error',
duration: 2000
})
} finally {
submittingRate.value = false
......@@ -918,11 +917,7 @@ const performDeleteOrder = async (orderId) => {
// if (orderIndex !== -1) {
// orders.value.splice(orderIndex, 1)
// }
// Taro.showToast({
// title: response.message || '订单删除成功',
// icon: 'success',
// duration: 2000
// })
// Toast.success(response.message || '订单删除成功')
// } else {
// throw new Error(response.message || '删除失败')
// }
......@@ -951,7 +946,7 @@ const performDeleteOrder = async (orderId) => {
Taro.showToast({
title: error.message || '删除失败,请重试',
icon: 'none',
icon: 'error',
duration: 2000
})
} finally {
......