orderlist.vue 5.1 KB

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