classify.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <view class="classify-main">
  3. <up-tabs :list="column" :scrollable="false" @change="onChange" :activeStyle="{
  4. color: 'rgba(255, 87, 4, 1)',
  5. fontWeight: 'bold',
  6. transform: 'scale(1.05)'
  7. }" lineColor="rgba(255, 87, 4, 1)">
  8. </up-tabs>
  9. <view class="list">
  10. <List :data="data" v-if="data.length > 0" />
  11. <view v-else class="empty-null">
  12. <img src="/static/empty/订单为空.png" alt="">
  13. </view>
  14. </view>
  15. </view>
  16. </template>
  17. <script setup>
  18. import { ref } from 'vue';
  19. import List from './order/list/index.vue';
  20. import { provide } from 'vue';
  21. import { getVolunteerOrderList } from '@/api/volunteer.js'
  22. import { onMounted } from 'vue';
  23. import {useDict} from '@/utils/dict.js';
  24. const { order_status } = useDict('order_status');
  25. provide('order_status', order_status);//订单/服务状态
  26. const tab = ref({});
  27. const data = ref([]);
  28. /**
  29. * 0待支付 1已支付 2支付超时或取消 3进行中 4已完成 5申请退款中 6已退款 7部分退款 8 待确认
  30. */
  31. const column = [
  32. {
  33. name: "全部",
  34. value: "",
  35. },
  36. {
  37. name: "待服务",
  38. value: "1",
  39. },
  40. {
  41. name: "进行中",
  42. value: "3",
  43. },
  44. {
  45. name: "已完成",
  46. value: "4",
  47. },
  48. {
  49. name: "已取消",
  50. value: "2",
  51. }
  52. ]
  53. async function getList(parmas) {
  54. console.log('getList', parmas);
  55. try {
  56. uni.hideLoading();
  57. uni.showLoading({
  58. title: '数据加载中...'
  59. });
  60. const res = await getVolunteerOrderList({ orderStatus: tab.value.value });
  61. data.value = res.data;
  62. } catch (error) {
  63. console.log('error', error);
  64. uni.showToast({
  65. title: error.msg,
  66. icon: 'error',
  67. })
  68. } finally {
  69. uni.hideLoading();
  70. }
  71. }
  72. /**
  73. * 1: 查看
  74. * 2:沟通
  75. * 3:上传照片
  76. */
  77. function btnClick(row,type) {
  78. console.log('btnClick', type, row);
  79. if (type === 1) {
  80. uni.navigateTo({
  81. url: `/pages/order/order?orderId=${row.secondOrderId}`
  82. });
  83. return
  84. }
  85. uni.navigateTo({
  86. url: `/pages/order/handle?orderId=${row.secondOrderId}`
  87. });
  88. }
  89. provide('onClick', btnClick);
  90. function onChange(tabItem) {
  91. tab.value = tabItem;
  92. getList();
  93. console.log('change', tabItem, tab.value);
  94. }
  95. async function init(){
  96. getList();
  97. }
  98. onMounted(init)
  99. </script>
  100. <style lang="scss" scoped>
  101. .classify-main {
  102. height: 100vh;
  103. .list {
  104. position: fixed;
  105. top: 50px;
  106. bottom: 0px;
  107. left: 0px;
  108. right: 0px;
  109. }
  110. }
  111. </style>