userItem.vue 7.7 KB

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