orderdetails.vue 9.4 KB

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