hookehuyr

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

将NutUI的showToast调用替换为Taro原生的showToast
统一错误提示使用error图标,成功提示使用success图标
1 <!-- 1 <!--
2 * @Date: 2022-09-19 14:11:06 2 * @Date: 2022-09-19 14:11:06
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-07-03 17:29:31 4 + * @LastEditTime: 2025-07-03 17:41:46
5 * @FilePath: /jgdl/src/pages/myOrders/index.vue 5 * @FilePath: /jgdl/src/pages/myOrders/index.vue
6 * @Description: 订单管理页面 6 * @Description: 订单管理页面
7 --> 7 -->
...@@ -271,7 +271,6 @@ ...@@ -271,7 +271,6 @@
271 271
272 <script setup> 272 <script setup>
273 import { ref, computed, onMounted } from 'vue' 273 import { ref, computed, onMounted } from 'vue'
274 -import { showToast } from '@nutui/nutui-taro'
275 import Taro from '@tarojs/taro' 274 import Taro from '@tarojs/taro'
276 // import { deleteOrderAPI, submitReviewAPI } from '@/api/orders' // 预留真实API调用 275 // import { deleteOrderAPI, submitReviewAPI } from '@/api/orders' // 预留真实API调用
277 import './index.less' 276 import './index.less'
...@@ -805,9 +804,10 @@ const closeRatePopup = () => { ...@@ -805,9 +804,10 @@ const closeRatePopup = () => {
805 */ 804 */
806 const submitRate = async () => { 805 const submitRate = async () => {
807 if (!rateContent.value.trim()) { 806 if (!rateContent.value.trim()) {
808 - showToast({ 807 + Taro.showToast({
809 title: '请输入评价内容', 808 title: '请输入评价内容',
810 - type: 'fail' 809 + icon: 'error',
810 + duration: 2000
811 }) 811 })
812 return 812 return
813 } 813 }
...@@ -833,10 +833,7 @@ const submitRate = async () => { ...@@ -833,10 +833,7 @@ const submitRate = async () => {
833 // } 833 // }
834 // order.status = 'completed' 834 // order.status = 'completed'
835 // } 835 // }
836 - // showToast({ 836 + // Toast.success(response.message || '评价提交成功')
837 - // title: response.message || '评价提交成功',
838 - // type: 'success'
839 - // })
840 // closeRatePopup() 837 // closeRatePopup()
841 // } else { 838 // } else {
842 // throw new Error(response.message || '提交失败') 839 // throw new Error(response.message || '提交失败')
...@@ -857,18 +854,20 @@ const submitRate = async () => { ...@@ -857,18 +854,20 @@ const submitRate = async () => {
857 order.status = 'completed' 854 order.status = 'completed'
858 } 855 }
859 856
860 - showToast({ 857 + Taro.showToast({
861 title: '评价提交成功', 858 title: '评价提交成功',
862 - type: 'success' 859 + icon: 'success',
860 + duration: 2000
863 }) 861 })
864 862
865 closeRatePopup() 863 closeRatePopup()
866 864
867 } catch (error) { 865 } catch (error) {
868 // console.error('提交评价失败:', error) 866 // console.error('提交评价失败:', error)
869 - showToast({ 867 + Taro.showToast({
870 title: error.message || '提交失败,请重试', 868 title: error.message || '提交失败,请重试',
871 - type: 'fail' 869 + icon: 'error',
870 + duration: 2000
872 }) 871 })
873 } finally { 872 } finally {
874 submittingRate.value = false 873 submittingRate.value = false
...@@ -918,11 +917,7 @@ const performDeleteOrder = async (orderId) => { ...@@ -918,11 +917,7 @@ const performDeleteOrder = async (orderId) => {
918 // if (orderIndex !== -1) { 917 // if (orderIndex !== -1) {
919 // orders.value.splice(orderIndex, 1) 918 // orders.value.splice(orderIndex, 1)
920 // } 919 // }
921 - // Taro.showToast({ 920 + // Toast.success(response.message || '订单删除成功')
922 - // title: response.message || '订单删除成功',
923 - // icon: 'success',
924 - // duration: 2000
925 - // })
926 // } else { 921 // } else {
927 // throw new Error(response.message || '删除失败') 922 // throw new Error(response.message || '删除失败')
928 // } 923 // }
...@@ -951,7 +946,7 @@ const performDeleteOrder = async (orderId) => { ...@@ -951,7 +946,7 @@ const performDeleteOrder = async (orderId) => {
951 946
952 Taro.showToast({ 947 Taro.showToast({
953 title: error.message || '删除失败,请重试', 948 title: error.message || '删除失败,请重试',
954 - icon: 'none', 949 + icon: 'error',
955 duration: 2000 950 duration: 2000
956 }) 951 })
957 } finally { 952 } finally {
......