classify.vue 2.3 KB

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