orderdetails.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. <template>
  2. <view>
  3. <view class="address-container">
  4. <view class="address-header">
  5. <!-- 左侧默认标签-->
  6. <!-- 中间收货人信息 -->
  7. <view class="contact-info">
  8. {{ listData.cityName }}
  9. {{ listData.telephone }}
  10. </view>
  11. <!-- 右侧图标 -->
  12. <up-icon name="arrow-right" class="arrow-icon"></up-icon>
  13. </view>
  14. <!-- 下方地址信息 -->
  15. <view class="address-detail">
  16. {{ listData.provinceName }} {{ listData.cityName }}
  17. {{ listData.districtName }} {{ listData.address }}
  18. </view>
  19. </view>
  20. <view>
  21. <up-card title="服务信息" :head-style="{ height: '80rpx', padding: '20rpx' }">
  22. <template #body>
  23. <view class="card-container">
  24. <image class="card-image" :src="listData.volunteerPicture" mode="aspectFill">
  25. </image>
  26. <view class="card-info">
  27. <view class="info-item">服务类别:{{ listData.businessManagementName }}</view>
  28. <view class="info-item">服务时长:{{ listData.serviceDuration }}分钟</view>
  29. <view class="info-item">服务价格:{{ listData.serviceOnePrice }}</view>
  30. <view class="info-item">服务数量:{{ listData.singleQuantity}}{{ listData.businessUnit }}</view>
  31. <view class="info-itemIform">服务描述:{{ listData.businessDescribe }}</view>
  32. </view>
  33. <view class="card-rating">4.5 评分</view>
  34. </view>
  35. </template>
  36. </up-card>
  37. <up-card title="志愿者介绍" :head-style="{ height: '80rpx', padding: '20rpx' }">
  38. <template #body>
  39. <view class="card-container">
  40. <image class="card-image" :src="listData.volunteerPicture" mode="aspectFill">
  41. </image>
  42. <view class="card-info">
  43. <view class="info-item">{{ listData.volunteerName }}</view>
  44. <view class="info-item">年龄:{{ listData.age }}</view>
  45. <view class="Telephone">电话:{{ listData.phonenumber }}</view>
  46. <view class="info-item">住址:{{ listData.address }}</view>
  47. </view>
  48. <view class="card-rating">4.5 评分</view>
  49. </view>
  50. </template>
  51. </up-card>
  52. <up-card title="个人简介" :head-style="{ height: '80rpx', padding: '20rpx' }">
  53. <template #body>
  54. {{ listData.skillDescribe }}
  55. </template>
  56. </up-card>
  57. <up-card title="证书" :head-style="{ height: '80rpx', padding: '20rpx' }">
  58. <template #body>
  59. <view class="certificate-container" v-if="certificationPictures.length > 0">
  60. <image v-for="(image, index) in certificationPictures" :key="index" :src="image" mode="widthFix"
  61. class="certificate-img" @click="previewImage(image, certificationPictures)"></image>
  62. </view>
  63. <view v-else class="no-certificate">暂无证书</view>
  64. </template>
  65. </up-card>
  66. </view>
  67. <up-card v-for="(item, index) in listData.secondOrderList" :key="index" :title="'订单号'">
  68. <template #head>
  69. <view class="custom-order-title">
  70. <text>订单号:</text>
  71. <text class="order-number">{{ item.secondOutTradeNo }}</text>
  72. </view>
  73. </template>
  74. <template #body>
  75. <view class="list-item">
  76. <image :src="listData.volunteerPicture" mode="aspectFill" class="item-image">
  77. </image>
  78. <view class="item-info">
  79. <view class="info-line">
  80. 服务类别:{{ listData.businessManagementName }}
  81. </view>
  82. <text>服务价格:<text style="color: red">¥{{ item.serviceTotalPrice }}</text></text>
  83. <view class="info-item">服务数量:{{ listData.singleQuantity
  84. }}{{ listData.businessUnit }}</view>
  85. <text>服务状态:{{
  86. dictSortMap[item.orderStatus] || item.orderStatus
  87. }}</text>
  88. <view class="info-line">
  89. 预计开始服务日期:{{ item.workDate }}
  90. </view>
  91. <view class="info-line">
  92. 预计开始服务时间:{{ item.workStartTime }}
  93. </view>
  94. <view class="info-line">
  95. 预计结束服务时间:{{ item.workEndTime }}
  96. </view>
  97. </view>
  98. <view class="right-corner-container" v-if="item.orderStatus !== '1'">
  99. <up-button type="error" :text="item.score ? '查看评论' : '评论'" size="mini" @click="handlButClick(item)"
  100. :customStyle="hadlClickError"></up-button>
  101. </view>
  102. </view>
  103. </template>
  104. </up-card>
  105. </view>
  106. </template>
  107. <script setup>
  108. import { onLoad } from '@dcloudio/uni-app'
  109. import { ref, computed, onMounted } from 'vue'
  110. import { orderInfomainOrderId } from '@/api/userList.js'
  111. import { systemDictdaTalist } from '@/api/userList.js'
  112. const listData = ref({}) //志愿者详情数据
  113. const dataList = ref([])
  114. const orderStatus = ref(0)
  115. const score = ref(null)
  116. const mainOrderId = ref('') //志愿者ID
  117. const certificationPictures = computed(() => {
  118. if (listData.value.certificationPicture) {
  119. return listData.value.certificationPicture.split(',')
  120. }
  121. return []
  122. })
  123. const dictSortMap = computed(() => {
  124. let mapObj = {}
  125. dataList.value.forEach((item) => {
  126. mapObj[item.dictValue] = item.dictLabel
  127. })
  128. return mapObj
  129. })
  130. //获取用户订单列表状态
  131. async function getData() {
  132. try {
  133. const res = await systemDictdaTalist().catch((err) => {
  134. console.error('接口请求失败:', err)
  135. throw err // 重新抛出以进入 catch 块
  136. })
  137. dataList.value = res.rows
  138. } catch (e) {
  139. console.error('获取数据异常:', e) // 确保这里打印错误
  140. }
  141. }
  142. const handlButClick = (item) => {
  143. console.log(item, '》》》》》》 获取传递的 item');
  144. // 直接跳转到userComment页面并传递必要数据
  145. uni.navigateTo({
  146. url: `/pages_classify/pages/orderItem/userComment?secondOrderId=${item.secondOrderId}`
  147. });
  148. // 在跳转前存储必要数据
  149. uni.setStorage({
  150. key: 'orderDetailsData',
  151. data: {
  152. volunteerPicture: listData.value.volunteerPicture,
  153. businessManagementName: listData.value.businessManagementName,
  154. volunteerName: listData.value.volunteerName,
  155. volunteerInfoId: listData.value.volunteerInfoId,
  156. secondOrderId: item.secondOrderId
  157. },
  158. fail: (err) => {
  159. console.error('保存订单数据失败', err);
  160. }
  161. });
  162. }
  163. // 获取传递的参数
  164. onLoad(async (options) => {
  165. mainOrderId.value = options.mainOrderId
  166. const res = await orderInfomainOrderId(mainOrderId.value)
  167. // console.log('API Response:', res)
  168. listData.value = res.data
  169. // console.log('listData:', listData.value)
  170. })
  171. const hadlClickError = {
  172. width: '150rpx',
  173. height: '50rpx',
  174. marginTop: '70rpx',
  175. }
  176. // 预览图片
  177. const previewImage = (current, urls) => {
  178. uni.previewImage({
  179. current,
  180. urls,
  181. })
  182. }
  183. onMounted(() => {
  184. getData()
  185. })
  186. </script>
  187. <style scoped>
  188. .address-container {
  189. padding: 20rpx;
  190. border: 1rpx solid #eee;
  191. border-radius: 10rpx;
  192. }
  193. .address-header {
  194. display: flex;
  195. align-items: center;
  196. margin-bottom: 10rpx;
  197. }
  198. .contact-info {
  199. flex: 1;
  200. /* 占据剩余空间 */
  201. font-size: 28rpx;
  202. margin-left: 25rpx;
  203. }
  204. .arrow-icon {
  205. margin-left: auto;
  206. /* 将图标推到最右侧 */
  207. }
  208. .address-detail {
  209. font-size: 26rpx;
  210. color: #666;
  211. }
  212. .card-container {
  213. display: flex;
  214. position: relative;
  215. padding: 20rpx;
  216. align-items: flex-start;
  217. background-color: #fff;
  218. border-radius: 12rpx;
  219. }
  220. /* 左侧图片 */
  221. .card-image {
  222. width: 240rpx;
  223. height: 340rpx;
  224. border-radius: 12rpx;
  225. margin-right: 30rpx;
  226. flex-shrink: 0;
  227. }
  228. /* 中间信息区域 */
  229. .card-info {
  230. flex: 1;
  231. padding-right: 100rpx;
  232. }
  233. /* 中间信息区域 */
  234. .card-info {
  235. flex: 1;
  236. padding-right: 100rpx;
  237. }
  238. .Telephone {
  239. white-space: nowrap;
  240. margin-bottom: 24rpx;
  241. font-size: 28rpx;
  242. line-height: 1.6;
  243. color: #333;
  244. }
  245. .info-item {
  246. margin-bottom: 15rpx;
  247. font-size: 28rpx;
  248. line-height: 1.6;
  249. color: #333;
  250. }
  251. .info-itemIform{
  252. display: -webkit-box;
  253. -webkit-line-clamp: 3;
  254. -webkit-box-orient: vertical;
  255. overflow: hidden;
  256. text-overflow: ellipsis;
  257. margin-bottom: 15rpx;
  258. font-size: 28rpx;
  259. line-height: 1.6;
  260. color: #333;
  261. }
  262. /* 右上角评分 */
  263. .card-rating {
  264. position: absolute;
  265. top: 20rpx;
  266. right: 40rpx;
  267. background-color: #f8f8f8;
  268. padding: 6rpx 16rpx;
  269. border-radius: 20rpx;
  270. font-size: 24rpx;
  271. color: #ff9900;
  272. font-weight: bold;
  273. }
  274. /* 上课时间 */
  275. .Wrap-top {
  276. display: flex;
  277. justify-content: space-between;
  278. align-items: center;
  279. padding: 24rpx 20rpx 0rpx 24rpx;
  280. }
  281. .list-item {
  282. display: flex;
  283. padding: 24rpx;
  284. align-items: flex-start;
  285. gap: 24rpx;
  286. position: relative;
  287. }
  288. .item-image {
  289. width: 160rpx;
  290. height: 180rpx;
  291. border-radius: 16rpx;
  292. object-fit: cover;
  293. }
  294. .item-info {
  295. flex: 1;
  296. display: flex;
  297. flex-direction: column;
  298. gap: 14rpx;
  299. }
  300. .info-line {
  301. font-size: 28rpx;
  302. color: #333;
  303. line-height: 1.6;
  304. }
  305. .right-corner-container {
  306. display: flex;
  307. flex-direction: column;
  308. align-items: flex-end;
  309. }
  310. .certificate-container {
  311. display: flex;
  312. flex-wrap: wrap;
  313. gap: 20rpx;
  314. padding: 10rpx;
  315. }
  316. .certificate-img {
  317. width: 220rpx;
  318. height: 220rpx;
  319. border-radius: 8rpx;
  320. object-fit: cover;
  321. }
  322. .no-certificate {
  323. text-align: center;
  324. color: #999;
  325. padding: 30rpx;
  326. }
  327. .custom-order-title {
  328. display: flex;
  329. align-items: center;
  330. font-size: 28rpx;
  331. color: #303133;
  332. width: 100%;
  333. padding: 10rpx 0;
  334. }
  335. .order-number {
  336. word-break: break-all;
  337. flex: 1;
  338. }
  339. </style>