classify.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <!-- 志愿者 -->
  3. <view class="classify-main" v-if="userType == '2'">
  4. <up-tabs :list="column" :scrollable="false" @change="onChange" :activeStyle="{
  5. color: 'rgba(255, 87, 4, 1)',
  6. fontWeight: 'bold',
  7. transform: 'scale(1.05)'
  8. }" lineColor="rgba(255, 87, 4, 1)" :current="tabKey">
  9. </up-tabs>
  10. <view class="list">
  11. <List :data="data" v-if="data.length > 0" />
  12. <view v-else class="empty-null">
  13. <img src="/static/empty/订单为空.png" alt="">
  14. </view>
  15. </view>
  16. </view>
  17. <!-- 用户 -->
  18. </template>
  19. <script setup>
  20. import {
  21. ref
  22. } from 'vue';
  23. import List from '@/pages_classify/components/orderList/index.vue';
  24. import {
  25. provide
  26. } from 'vue';
  27. import {
  28. getVolunteerOrderList
  29. } from '@/api/volunteer.js'
  30. import {
  31. onMounted
  32. } from 'vue';
  33. import {
  34. useDict
  35. } from '@/utils/dict.js';
  36. import {
  37. onLoad,
  38. onShow
  39. } from '@dcloudio/uni-app';
  40. const {
  41. order_status,
  42. lrr_service_status
  43. } = useDict('order_status','lrr_service_status');
  44. provide('order_status', order_status); //订单/服务状态
  45. provide('lrr_service_status', lrr_service_status); //订单/服务状态
  46. const userType = uni.getStorageSync('userType') //读取本地存储
  47. // 用户/志愿者 识别标识
  48. const userOrWorker = uni.getStorageSync('storage_data').vuex_userOrWorker //读取本地存储
  49. const tab = ref('');
  50. const tabKey = ref(0);
  51. const data = ref([]); //志愿者
  52. const dataList = ref([]); //用户
  53. /**
  54. * 0待支付 1已支付 2支付超时或取消 3进行中 4已完成 5申请退款中 6已退款 7部分退款 8 待确认
  55. */
  56. const column = [{
  57. name: "全部",
  58. value: "",
  59. },
  60. {
  61. name: "待服务",
  62. value: "0",
  63. },
  64. {
  65. name: "进行中",
  66. value: "1",
  67. },
  68. {
  69. name: "待评价",
  70. value: "4",
  71. },
  72. {
  73. name: "已完成",
  74. value: "2",
  75. },
  76. {
  77. name: "已取消",
  78. value: "3",
  79. }
  80. ]
  81. const column2 = [{
  82. name: "全部",
  83. value: "",
  84. },
  85. {
  86. name: "待支付",
  87. value: "1",
  88. },
  89. {
  90. name: "待服务",
  91. value: "2",
  92. },
  93. {
  94. name: "进行中",
  95. value: "3",
  96. },
  97. {
  98. name: "已完成",
  99. value: "4",
  100. },
  101. {
  102. name: "已取消",
  103. value: "5",
  104. }
  105. ]
  106. async function getList() {
  107. try {
  108. uni.hideLoading();
  109. uni.showLoading({
  110. title: '数据加载中...'
  111. });
  112. const res = await getVolunteerOrderList({
  113. orderStatus: tab.value
  114. });
  115. data.value = res.data;
  116. } catch (error) {
  117. console.log('error', error);
  118. uni.showToast({
  119. title: error.msg,
  120. icon: 'error',
  121. })
  122. } finally {
  123. uni.hideLoading();
  124. }
  125. }
  126. /**
  127. * 1: 查看
  128. * 2:沟通
  129. * 3:上传照片
  130. */
  131. function btnClick(row, type) {
  132. console.log('btnClick', type, row, row.orderStatus);
  133. if (type === 1 && row.orderStatus === 2) {
  134. uni.navigateTo({
  135. url: `/pages_classify/pages/order/index?orderId=${row.secondOrderId}`
  136. });
  137. return;
  138. }
  139. if (type === 1) {
  140. uni.navigateTo({
  141. url: `/pages_classify/pages/handle/index?orderId=${row.secondOrderId}`
  142. });
  143. return
  144. }
  145. //前往沟通
  146. uni.navigateTo({
  147. url: `/pages_orderuser/pages/talk/pages/index/index?orderId=${row.secondOrderId}`
  148. });
  149. }
  150. provide('onClick', btnClick);
  151. function onChange(tabItem) {
  152. tab.value = tabItem.value;
  153. getList();
  154. console.log('change', tabItem, tab.value);
  155. }
  156. onMounted(getList)
  157. onShow(() => {
  158. const params = getApp().globalData.switchTabParams || {};
  159. tabKey.value = params.tabKey || 0;
  160. console.log(params);
  161. onChange(column[tabKey.value])
  162. // 使用后建议清除参数,避免重复读取
  163. getApp().globalData.switchTabParams = null;
  164. })
  165. </script>
  166. <style lang="scss" scoped>
  167. .classify-main {
  168. height: 100vh;
  169. .list {
  170. position: fixed;
  171. top: 50px;
  172. bottom: 0px;
  173. left: 0px;
  174. right: 0px;
  175. }
  176. }
  177. </style>