userItem.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <template>
  2. <view class="item">
  3. <view class="item-img">
  4. <image :show-loading="true" :src="data.volunteerPicture"></image>
  5. </view>
  6. <view class="item-info">
  7. <view class="item-serviceTotalPrice">¥{{ data.serviceTotalPrice }}</view>
  8. <view class="item-title-box">
  9. <view class="item-title">
  10. <view class="item-name">
  11. {{ data.name }}
  12. </view>
  13. </view>
  14. <view class="item-de">
  15. 服务类别:{{ data.businessTierName }}
  16. </view>
  17. <view class="item-de">
  18. 下单日期:{{ data.createTime }}
  19. </view>
  20. <view class="item-time">
  21. 服务描述:{{ data.businessDescribe }}
  22. </view>
  23. <view class="item-status-box">
  24. <!-- <image src="/static/img/矩形 413@1x.png" class="item-status-img"></image> -->
  25. <!-- class="item-status" -->
  26. <dict-tag :options="order_status" :value="String(data.orderStatus)" />
  27. </view>
  28. </view>
  29. <view class="item-box">
  30. <view class="item-btns">
  31. <view v-for="item in btns" :key="item.name">
  32. <view :class="['btn-m', (item.name === '取消' || item.name === '退款') ? 'btn-cancel-refund' : '']" v-if="item.show ? item.show(data) : true" :type="item.type" text="取消"
  33. @click="onClick(item,data) ">
  34. <image v-if="item.name === '查看'" src="/static/img/组 14145@1x.png" class="btn-icon"></image>
  35. <image v-if="item.name === '沟通'" src="/static/img/容器 165@1x.png" class="btn-icon"></image>
  36. {{ item.name }}
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </template>
  44. <script setup>
  45. import { inject } from 'vue';
  46. import DictTag from '@/components/DictTag/index.vue'
  47. import { userdictOrderInfo } from '@/api/userList.js'
  48. const props = defineProps({
  49. data: {
  50. type: Object,
  51. default: () => {
  52. return {}
  53. }
  54. },
  55. });
  56. const order_status = inject('order_status');
  57. //防抖处理
  58. const onClick =(record,data)=>{
  59. uni.$u.debounce(()=>{
  60. record.onClick(data)
  61. }, 300)
  62. }
  63. const btns = [
  64. {
  65. name: '沟通',
  66. onClick: (e) => {
  67. uni.navigateTo({
  68. url: `/pages_orderuser/pages/talk/pages/index/index?orderId=${e.mainOrderId}&conversationType=2`
  69. });
  70. },
  71. type: 'primary'
  72. },
  73. {
  74. name: '退款',
  75. onClick: (e) => handleRefund(e),
  76. show: (item) => ['3'].includes(item.orderStatus),
  77. type: 'error'
  78. },
  79. {
  80. name: '取消',
  81. onClick: (e) => handleCancel(e),
  82. show: (item) => ['1'].includes(item.orderStatus),
  83. type: 'warning'
  84. },
  85. {
  86. name: '查看',
  87. onClick: (e) => handlClick(e),
  88. // show: (item) => item.orderStatus !== '1',
  89. type: 'info'
  90. },
  91. ]
  92. //申请退款
  93. const handleRefund = async (item) => {
  94. const mainOrderId = item.mainOrderId; // 获取详情id
  95. const res = await userdictOrderInfo(mainOrderId);
  96. if (res.code === 200) {
  97. // 成功直接跳转
  98. uni.navigateTo({
  99. url: `/pages_classify/pages/requestaRefund/requestaRefund?mainOrderId=${mainOrderId}`
  100. });
  101. } else if (res.code === 500) {
  102. // 显示后端返回的错误信息
  103. uni.showToast({
  104. title: res.msg,
  105. icon: 'none',
  106. duration: 2000
  107. });
  108. }
  109. };
  110. // 取消订单
  111. const handleCancel = (item) => {
  112. const mainOrderId = item.mainOrderId;
  113. uni.navigateTo({
  114. url: `/pages_classify/pages/cancelationOforder/cancelationOforder?mainOrderId=${mainOrderId}`
  115. });
  116. };
  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. </script>
  125. <style lang="scss" scoped>
  126. .item {
  127. display: flex;
  128. flex-direction: row;
  129. justify-content: space-between;
  130. align-items: center;
  131. width: 702rpx;
  132. height: 347rpx;
  133. // background: red;
  134. border-radius: 18rpx;
  135. background: #FFFFFF;
  136. box-shadow: 0rpx 4rpx 10rpx 0rpx rgba(0, 0, 0, 0.04);
  137. margin-bottom: 25rpx;
  138. .item-img {
  139. width: 130rpx;
  140. height: 122rpx;
  141. display: flex;
  142. justify-content: center;
  143. align-items: center;
  144. margin-left: 10rpx;
  145. image {
  146. width: 100%;
  147. height: 100%;
  148. border-radius: 122rpx;
  149. }
  150. }
  151. .item-info {
  152. display: flex;
  153. flex-direction: column;
  154. justify-content: space-between;
  155. height: 100%;
  156. padding: 20rpx;
  157. box-sizing: border-box;
  158. position: relative;
  159. // 价格
  160. .item-serviceTotalPrice {
  161. position: absolute;
  162. top: 20rpx;
  163. right: 61rpx;
  164. width: 96rpx;
  165. height: 42rpx;
  166. font-family: PingFang SC;
  167. font-size: 32rpx;
  168. font-weight: 600;
  169. line-height: 42rpx;
  170. letter-spacing: normal;
  171. color: rgba(0, 0, 0, 0.8);
  172. }
  173. // 志愿者姓名
  174. .item-name {
  175. width: 374rpx;
  176. height: 42rpx;
  177. font-family: PingFang SC;
  178. font-size: 32rpx;
  179. font-weight: 600;
  180. line-height: 42rpx;
  181. letter-spacing: normal;
  182. color: rgba(0, 0, 0, 0.8);
  183. margin-bottom: 10rpx;
  184. }
  185. .item-title-box {
  186. margin-top: 60rpx;
  187. }
  188. // 服务类别/下单日期
  189. .item-de {
  190. width: 532rpx;
  191. height: 34rpx;
  192. font-family: PingFang SC;
  193. font-size: 28rpx;
  194. font-weight: normal;
  195. line-height: 34rpx;
  196. letter-spacing: normal;
  197. color: rgba(0, 0, 0, 0.5);
  198. margin-bottom: 10rpx;
  199. }
  200. // 服务描述
  201. .item-time {
  202. width: 280rpx;
  203. /* Approximately 8 Chinese characters */
  204. height: 34rpx;
  205. font-family: PingFang SC;
  206. font-size: 28rpx;
  207. font-weight: normal;
  208. line-height: 34rpx;
  209. letter-spacing: normal;
  210. color: rgba(0, 0, 0, 0.5);
  211. overflow: hidden;
  212. text-overflow: ellipsis;
  213. white-space: nowrap;
  214. // max-width: 100%;
  215. margin-bottom: 10rpx;
  216. }
  217. .item-status-box {
  218. background: linear-gradient(90deg, #FED593 0%, #FDC58C 100%);
  219. // width: 130rpx;
  220. height: 47rpx;
  221. position: absolute;
  222. left: -134rpx;
  223. top: 2rpx;
  224. border-top-left-radius: 16rpx;
  225. border-bottom-right-radius: 16rpx;
  226. font-size: 24rpx;
  227. font-weight: 500;
  228. line-height: 44rpx;
  229. letter-spacing: normal;
  230. color: #843816;
  231. padding: 0 21rpx;
  232. // .item-status-img {
  233. // width: 130rpx;
  234. // height: 47rpx;
  235. // position: absolute;
  236. // top: 0rpx;
  237. // left: -135rpx;
  238. // }
  239. // .item-status {
  240. // width: 100rpx;
  241. // height: 46rpx;
  242. // font-family: PingFang SC;
  243. // font-size: 24rpx;
  244. // font-weight: 500;
  245. // line-height: 44rpx;
  246. // letter-spacing: normal;
  247. // color: #843816;
  248. // position: absolute;
  249. // left: -116rpx;
  250. // top: 2rpx;
  251. // }
  252. }
  253. }
  254. .item-box {
  255. display: flex;
  256. justify-content: flex-end;
  257. align-items: center;
  258. .item-btns {
  259. display: flex;
  260. justify-content: flex-end;
  261. align-items: center;
  262. gap: 20rpx;
  263. .btn-m {
  264. width: 140rpx;
  265. height: 60rpx;
  266. font-family: PingFang SC;
  267. font-size: 24rpx;
  268. font-weight: 500;
  269. line-height: 60rpx;
  270. text-align: center;
  271. letter-spacing: normal;
  272. color: #FFFFFF;
  273. background: #D94342;
  274. border-radius: 36rpx;
  275. padding: 0;
  276. display: flex;
  277. justify-content: center;
  278. align-items: center;
  279. .btn-icon {
  280. width: 24rpx;
  281. height: 24rpx;
  282. margin-right: 8rpx;
  283. }
  284. }
  285. .btn-cancel-refund {
  286. background: #E9E9E9;
  287. color: #333333;
  288. }
  289. }
  290. }
  291. }
  292. </style>