orderlist.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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. const afterSaleStatusArr = ref([])
  95. // 用户/志愿者 识别标识
  96. const userOrWorker = uni.getStorageSync('storage_data').vuex_userOrWorker //读取本地存储
  97. const orderStatus = ref(0)
  98. const column2 = [
  99. {
  100. name: "全部",
  101. value: "",
  102. },
  103. {
  104. name: "待支付",
  105. value: "0",
  106. },
  107. {
  108. name: "待服务",
  109. value: "1",
  110. },
  111. {
  112. name: "进行中",
  113. value: "3",
  114. },
  115. {
  116. name: "已完成",
  117. value: "4",
  118. },
  119. {
  120. name: "售后",
  121. value: afterSaleStatusArr.value,
  122. }
  123. ]
  124. const props = defineProps({
  125. dataList: {
  126. typeof: Array,
  127. default: () => [],
  128. },
  129. dictSort: {
  130. type: Array,
  131. default: () => [], // 默认值
  132. },
  133. fetchData: Function, // 刷新数据的方法
  134. })
  135. const emits = defineEmits(['fetchData'])
  136. const dictSortMap = computed(() => {
  137. let mapObj = {}
  138. props.dictSort.forEach((item) => {
  139. mapObj[item.dictValue] = item.dictLabel
  140. })
  141. return mapObj
  142. })
  143. const handlClick = (item) => {
  144. const mainOrderId = item.mainOrderId // 获取详情id
  145. uni.navigateTo({
  146. url: `/pages_classify/pages/orderItem/orderdetails?mainOrderId=${mainOrderId}`,
  147. })
  148. }
  149. function onChange(tabItem) {
  150. emits('fetchData', tabItem.value)
  151. }
  152. //申请退款
  153. const handleRefund = (item) => {
  154. const mainOrderId = item.mainOrderId // 获取详情id
  155. uni.navigateTo({
  156. url: `/pages_classify/pages/requestaRefund/requestaRefund?mainOrderId=${mainOrderId}`,
  157. })
  158. }
  159. const wrapqx = {
  160. height: '50rpx',
  161. width: '100rpx',
  162. marginLeft: '8rpx',
  163. }
  164. // 取消订单
  165. const handleCancel = (item) => {
  166. const mainOrderId = item.mainOrderId
  167. uni.navigateTo({
  168. url: `/pages_classify/pages/cancelationOforder/cancelationOforder?mainOrderId=${mainOrderId}`,
  169. })
  170. }
  171. </script>
  172. <style scoped>
  173. .list-item {
  174. display: flex;
  175. padding: 24rpx;
  176. border-bottom: 1rpx solid #f5f5f5;
  177. }
  178. .item-image {
  179. width: 120rpx;
  180. height: 120rpx;
  181. border-radius: 16rpx;
  182. margin-right: 24rpx;
  183. }
  184. .item-info {
  185. flex: 1;
  186. margin-right: 24rpx;
  187. overflow: hidden;
  188. }
  189. .info-line {
  190. margin-bottom: 12rpx;
  191. font-size: 24rpx;
  192. color: #333;
  193. }
  194. .skill-description {
  195. display: -webkit-box;
  196. -webkit-line-clamp: 2;
  197. /* 限制两行 */
  198. -webkit-box-orient: vertical;
  199. overflow: hidden;
  200. text-overflow: ellipsis;
  201. line-height: 1.4;
  202. min-height: 2.8em;
  203. /* 两行高度 */
  204. }
  205. .item-right {
  206. width: 240rpx;
  207. display: flex;
  208. flex-direction: column;
  209. align-items: flex-end;
  210. }
  211. .rating {
  212. font-size: 26rpx;
  213. color: #f39c12;
  214. margin-bottom: 12rpx;
  215. }
  216. .status-tags {
  217. margin-bottom: 60rpx;
  218. font-size: 25rpx;
  219. }
  220. .Wrap-Btn {
  221. display: flex;
  222. flex-direction: row;
  223. justify-content: flex-end;
  224. align-items: center;
  225. gap: 16rpx;
  226. }
  227. </style>