orderlist.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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" @click="handlClick(item)"></image>
  25. <!-- 中间信息 -->
  26. <view class="item-info" @click="handlClick(item)">
  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. <!-- 沟通按钮 -->
  39. <up-button type="primary" text="沟通" shape="circle" :customStyle="wrapqx">
  40. </up-button>
  41. <!-- 当 orderStatus 为 3 显示退款按钮 -->
  42. <up-button v-if="item.orderStatus === '3'" type="error" text="退款"
  43. shape="circle" :customStyle="wrapqx" @click="handleRefund(item)">
  44. </up-button>
  45. <!-- 当 orderStatus 为 1 显示取消订单按钮 -->
  46. <up-button v-if="item.orderStatus === '1'" type="warning" text="取消"
  47. shape="circle" :customStyle="wrapqx" @click="handleCancel(item)">
  48. </up-button>
  49. </view>
  50. </view>
  51. </view>
  52. </up-list-item>
  53. </up-list>
  54. </view>
  55. </view>
  56. </template>
  57. <script setup>
  58. import {
  59. ref,
  60. onMounted,
  61. computed
  62. } from "vue"
  63. const userType = uni.getStorageSync('userType') //读取本地存储
  64. const afterSaleStatusArr = ref([])
  65. // 用户/志愿者 识别标识
  66. const userOrWorker = uni.getStorageSync('storage_data').vuex_userOrWorker //读取本地存储
  67. const orderStatus = ref(0)
  68. const column2 = [
  69. {
  70. name: "全部",
  71. value: "",
  72. },
  73. {
  74. name: "待支付",
  75. value: "0",
  76. },
  77. {
  78. name: "待服务",
  79. value: "1",
  80. },
  81. {
  82. name: "进行中",
  83. value: "3",
  84. },
  85. {
  86. name: "已完成",
  87. value: "4",
  88. },
  89. {
  90. name: "售后",
  91. value: afterSaleStatusArr.value,
  92. }
  93. ]
  94. const props = defineProps({
  95. dataList: {
  96. typeof: Array,
  97. default: () => [],
  98. },
  99. dictSort: {
  100. type: Array,
  101. default: () => [], // 默认值
  102. },
  103. fetchData: Function, // 刷新数据的方法
  104. })
  105. const emits = defineEmits([
  106. 'fetchData'
  107. ])
  108. const dictSortMap = computed(() => {
  109. let mapObj = {}
  110. props.dictSort.forEach((item => {
  111. mapObj[item.dictValue] = item.dictLabel
  112. }))
  113. return mapObj
  114. })
  115. const handlClick = (item) => {
  116. const mainOrderId = item.mainOrderId; // 获取详情id
  117. uni.navigateTo({
  118. url: `/pages_classify/pages/orderItem/orderdetails?mainOrderId=${mainOrderId}`
  119. });
  120. }
  121. function onChange(tabItem) {
  122. emits('fetchData', tabItem.value)
  123. }
  124. //申请退款
  125. const handleRefund = (item) => {
  126. const mainOrderId = item.mainOrderId; // 获取详情id
  127. uni.navigateTo({
  128. url: `/pages_classify/pages/requestaRefund/requestaRefund?mainOrderId=${mainOrderId}`
  129. });
  130. };
  131. const wrapqx = {
  132. height: '50rpx',
  133. width: '100rpx',
  134. marginLeft: '8rpx'
  135. }
  136. // 取消订单
  137. const handleCancel = (item) => {
  138. const mainOrderId = item.mainOrderId;
  139. uni.navigateTo({
  140. url: `/pages_classify/pages/cancelationOforder/cancelationOforder?mainOrderId=${mainOrderId}`
  141. });
  142. };
  143. </script>
  144. <style scoped>
  145. .list-item {
  146. display: flex;
  147. padding: 12px;
  148. border-bottom: 1px solid #f5f5f5;
  149. }
  150. .item-image {
  151. width: 60px;
  152. height: 60px;
  153. border-radius: 8px;
  154. margin-right: 12px;
  155. }
  156. .item-info {
  157. flex: 1;
  158. margin-right: 12px;
  159. overflow: hidden;
  160. }
  161. .info-line {
  162. margin-bottom: 6px;
  163. font-size: 12px;
  164. color: #333;
  165. }
  166. .skill-description {
  167. display: -webkit-box;
  168. -webkit-line-clamp: 2;
  169. /* 限制两行 */
  170. -webkit-box-orient: vertical;
  171. overflow: hidden;
  172. text-overflow: ellipsis;
  173. line-height: 1.4;
  174. min-height: 2.8em;
  175. /* 两行高度 */
  176. }
  177. .item-right {
  178. width: 120px;
  179. display: flex;
  180. flex-direction: column;
  181. align-items: flex-end;
  182. }
  183. .rating {
  184. font-size: 13px;
  185. color: #f39c12;
  186. margin-bottom: 6px;
  187. }
  188. .status-tags {
  189. margin-bottom: 6px;
  190. }
  191. .Wrap-Btn {
  192. display: flex;
  193. gap: 8px;
  194. flex-wrap: wrap;
  195. justify-content: flex-end;
  196. }
  197. </style>