orderlist.vue 5.5 KB

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