userItem.vue 7.5 KB

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