classify.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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" @refresh="getList" 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 { lrr_service_category, lrr_chitchat,lrr_study,order_status } = useDict('lrr_service_category','lrr_chitchat','lrr_study','order_status');
  25. provide('lrr_service_category', lrr_service_category); //服务类别
  26. provide('lrr_chitchat', lrr_chitchat);//陪伴陪聊
  27. provide('lrr_study', lrr_study);//家庭辅导
  28. provide('order_status', order_status);//订单/服务状态
  29. const tab = ref({});
  30. const data = ref([]);
  31. /**
  32. * 0待支付 1已支付 2支付超时或取消 3进行中 4已完成 5申请退款中 6已退款 7部分退款 8 待确认
  33. */
  34. const column = [
  35. {
  36. name: "全部",
  37. value: "",
  38. },
  39. {
  40. name: "待服务",
  41. value: "1",
  42. },
  43. {
  44. name: "进行中",
  45. value: "3",
  46. },
  47. {
  48. name: "已完成",
  49. value: "4",
  50. },
  51. {
  52. name: "已取消",
  53. value: "2",
  54. }
  55. ]
  56. async function getList(parmas) {
  57. console.log('getList', parmas);
  58. try {
  59. uni.hideLoading();
  60. uni.showLoading({
  61. title: '数据加载中...'
  62. });
  63. const res = await getVolunteerOrderList({ orderStatus: tab.value.value });
  64. data.value = res.data;
  65. } catch (error) {
  66. console.log('error', error);
  67. uni.showToast({
  68. title: error.msg,
  69. icon: 'error',
  70. })
  71. } finally {
  72. uni.hideLoading();
  73. }
  74. }
  75. /**
  76. * 1: 查看
  77. * 2:沟通
  78. * 3:上传照片
  79. */
  80. function btnClick(row,type) {
  81. console.log('btnClick', type, row);
  82. if (type === 1) {
  83. uni.navigateTo({
  84. url: `/pages/order/order?orderId=${row.orderId}`
  85. });
  86. }
  87. }
  88. provide('onClick', btnClick);
  89. function onChange(tabItem) {
  90. tab.value = tabItem;
  91. getList();
  92. console.log('change', tabItem, tab.value);
  93. }
  94. async function init(){
  95. getList();
  96. }
  97. onMounted(init)
  98. </script>
  99. <style lang="scss" scoped>
  100. .classify-main {
  101. height: 100vh;
  102. .list {
  103. position: fixed;
  104. top: 50px;
  105. bottom: 0px;
  106. left: 0px;
  107. right: 0px;
  108. }
  109. }
  110. </style>