orderlist.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <!-- 用户 -->
  3. <view>
  4. <view class="classify-main" v-if="userType == '1'">
  5. <up-tabs v-if="column2 && column2.length > 0" :list="column2" :scrollable="false" @change="onChange"
  6. :activeStyle="{
  7. color: 'rgba(255, 87, 4, 1)',
  8. fontWeight: 'bold',
  9. transform: 'scale(1.05)'
  10. }" lineColor="rgba(255, 87, 4, 1)" :current="tabKey">
  11. </up-tabs>
  12. <view class="list">
  13. <OrderItem v-if="dataList && dataList.length > 0" :dataList="dataList" />
  14. <view v-else class="empty-null">
  15. <img src="/static/empty/订单为空.png" alt="">
  16. </view>
  17. </view>
  18. </view>
  19. <view>
  20. <up-list @scrolltolower="scrolltolower">
  21. <up-list-item v-for="(item, index) in dataList" :key="index">
  22. <view class="list-item">
  23. <!-- 左侧图片 -->
  24. <image :src="item.volunteerPicture" mode="aspectFill" class="item-image"></image>
  25. <!-- 中间信息 -->
  26. <view class="item-info">
  27. <view class="info-line">姓名:{{item.name}}</view>
  28. <view class="info-line">类别:{{item.businessTierName}}</view>
  29. <view class="info-line skill-description">技能介绍:{{ item.skillDescribe }}</view>
  30. </view>
  31. <!-- 右侧信息 -->
  32. <view class="item-right">
  33. <view class="rating">评分:9.5</view>
  34. <view class="status-tags">
  35. {{dictSortMap[item.orderStatus]}}
  36. </view>
  37. <view class="Wrap-Btn">
  38. <up-button type="primary" text="沟通" size="mini" shape="circle" class="action-btn"></up-button>
  39. <up-button type="error" text="查看" size="mini" shape="circle" class="action-btn" @click="handlClick(item)"></up-button>
  40. </view>
  41. </view>
  42. </view>
  43. </up-list-item>
  44. </up-list>
  45. </view>
  46. </view>
  47. </template>
  48. <script setup>
  49. import {
  50. ref,
  51. onMounted,
  52. computed
  53. } from "vue"
  54. const userType = uni.getStorageSync('userType') //读取本地存储
  55. // 用户/志愿者 识别标识
  56. const userOrWorker = uni.getStorageSync('storage_data').vuex_userOrWorker //读取本地存储
  57. const orderStatus = ref(0)
  58. const column2 = [{
  59. name: "全部",
  60. value: "",
  61. },
  62. {
  63. name: "待支付",
  64. value: "0",
  65. },
  66. {
  67. name: "待服务",
  68. value: "1",
  69. },
  70. {
  71. name: "进行中",
  72. value: "3",
  73. },
  74. {
  75. name: "已完成",
  76. value: "4",
  77. },
  78. {
  79. name: "已取消",
  80. value: "2",
  81. }
  82. ]
  83. const props = defineProps({
  84. dataList: {
  85. typeof: Array,
  86. default: () => [],
  87. },
  88. dictSort: {
  89. type: Array,
  90. default: () => [], // 默认值
  91. },
  92. fetchData: Function, // 刷新数据的方法
  93. })
  94. const emits = defineEmits([
  95. 'fetchData'
  96. ])
  97. const dictSortMap = computed(() => {
  98. let mapObj = {}
  99. props.dictSort.forEach((item => {
  100. mapObj[item.dictValue] = item.dictLabel
  101. }))
  102. return mapObj
  103. })
  104. const handlClick = (item) => {
  105. const mainOrderId = item.mainOrderId; // 获取详情id
  106. uni.navigateTo({
  107. url: `/pages_classify/pages/orderItem/orderdetails?mainOrderId=${mainOrderId}`
  108. });
  109. }
  110. // 评论
  111. const handleComment = () =>{
  112. uni.navigateTo({
  113. url: `/pages_classify/pages/orderItem/userComment`
  114. });
  115. }
  116. function onChange(tabItem) {
  117. emits('fetchData', tabItem.value)
  118. }
  119. </script>
  120. <style scoped>
  121. .list-item {
  122. display: flex;
  123. padding: 12px;
  124. border-bottom: 1px solid #f5f5f5;
  125. }
  126. .item-image {
  127. width: 60px;
  128. height: 60px;
  129. border-radius: 8px;
  130. margin-right: 12px;
  131. }
  132. .item-info {
  133. flex: 1;
  134. margin-right: 12px;
  135. overflow: hidden;
  136. }
  137. .info-line {
  138. margin-bottom: 6px;
  139. font-size: 12px;
  140. color: #333;
  141. }
  142. .skill-description {
  143. display: -webkit-box;
  144. -webkit-line-clamp: 2;
  145. /* 限制两行 */
  146. -webkit-box-orient: vertical;
  147. overflow: hidden;
  148. text-overflow: ellipsis;
  149. line-height: 1.4;
  150. min-height: 2.8em;
  151. /* 两行高度 */
  152. }
  153. .item-right {
  154. width: 120px;
  155. display: flex;
  156. flex-direction: column;
  157. align-items: flex-end;
  158. }
  159. .rating {
  160. font-size: 13px;
  161. color: #f39c12;
  162. margin-bottom: 6px;
  163. }
  164. .status-tags {
  165. margin-bottom: 6px;
  166. }
  167. .Wrap-Btn {
  168. display: flex;
  169. gap: 6px;
  170. /* 按钮间距 */
  171. }
  172. .action-btn {
  173. padding: 0 8px;
  174. height: 28px;
  175. line-height: 28px;
  176. font-size: 12px;
  177. }
  178. </style>