orderdetails.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  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="item.score ? '查看评论' : '评论'" 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. console.log(item, '》》》》》》 获取传递的 item');
  146. // 直接跳转到userComment页面并传递必要数据
  147. uni.navigateTo({
  148. url: `/pages_classify/pages/orderItem/userComment?secondOrderId=${item.secondOrderId}`
  149. });
  150. // 在跳转前存储必要数据
  151. uni.setStorage({
  152. key: 'orderDetailsData',
  153. data: {
  154. volunteerPicture: listData.value.volunteerPicture,
  155. businessManagementName: listData.value.businessManagementName,
  156. volunteerName: listData.value.volunteerName,
  157. volunteerInfoId: listData.value.volunteerInfoId,
  158. secondOrderId: item.secondOrderId
  159. },
  160. fail: (err) => {
  161. console.error('保存订单数据失败', err);
  162. }
  163. });
  164. }
  165. // 获取传递的参数
  166. onLoad(async (options) => {
  167. mainOrderId.value = options.mainOrderId
  168. const res = await orderInfomainOrderId(mainOrderId.value)
  169. // console.log('API Response:', res)
  170. listData.value = res.data
  171. // console.log('listData:', listData.value)
  172. })
  173. const hadlClickError = {
  174. width: '150rpx',
  175. height: '50rpx',
  176. marginTop: '70rpx',
  177. }
  178. // 预览图片
  179. const previewImage = (current, urls) => {
  180. uni.previewImage({
  181. current,
  182. urls,
  183. })
  184. }
  185. onMounted(() => {
  186. getData()
  187. })
  188. </script>
  189. <style scoped>
  190. .address-container {
  191. padding: 20rpx;
  192. border: 1rpx solid #eee;
  193. border-radius: 10rpx;
  194. }
  195. .address-header {
  196. display: flex;
  197. align-items: center;
  198. margin-bottom: 10rpx;
  199. }
  200. .contact-info {
  201. flex: 1;
  202. /* 占据剩余空间 */
  203. font-size: 28rpx;
  204. margin-left: 25rpx;
  205. }
  206. .arrow-icon {
  207. margin-left: auto;
  208. /* 将图标推到最右侧 */
  209. }
  210. .address-detail {
  211. font-size: 26rpx;
  212. color: #666;
  213. }
  214. .card-container {
  215. display: flex;
  216. position: relative;
  217. padding: 20rpx;
  218. align-items: flex-start;
  219. background-color: #fff;
  220. border-radius: 12rpx;
  221. }
  222. /* 左侧图片 */
  223. .card-image {
  224. width: 240rpx;
  225. height: 340rpx;
  226. border-radius: 12rpx;
  227. margin-right: 30rpx;
  228. flex-shrink: 0;
  229. }
  230. /* 中间信息区域 */
  231. .card-info {
  232. flex: 1;
  233. padding-right: 100rpx;
  234. }
  235. /* 中间信息区域 */
  236. .card-info {
  237. flex: 1;
  238. padding-right: 100rpx;
  239. }
  240. .Telephone {
  241. white-space: nowrap;
  242. margin-bottom: 24rpx;
  243. font-size: 28rpx;
  244. line-height: 1.6;
  245. color: #333;
  246. }
  247. .info-item {
  248. margin-bottom: 15rpx;
  249. font-size: 28rpx;
  250. line-height: 1.6;
  251. color: #333;
  252. }
  253. .info-itemIform{
  254. display: -webkit-box;
  255. -webkit-line-clamp: 3;
  256. -webkit-box-orient: vertical;
  257. overflow: hidden;
  258. text-overflow: ellipsis;
  259. margin-bottom: 15rpx;
  260. font-size: 28rpx;
  261. line-height: 1.6;
  262. color: #333;
  263. }
  264. /* 右上角评分 */
  265. .card-rating {
  266. position: absolute;
  267. top: 20rpx;
  268. right: 40rpx;
  269. background-color: #f8f8f8;
  270. padding: 6rpx 16rpx;
  271. border-radius: 20rpx;
  272. font-size: 24rpx;
  273. color: #ff9900;
  274. font-weight: bold;
  275. }
  276. /* 上课时间 */
  277. .Wrap-top {
  278. display: flex;
  279. justify-content: space-between;
  280. align-items: center;
  281. padding: 24rpx 20rpx 0rpx 24rpx;
  282. }
  283. .list-item {
  284. display: flex;
  285. padding: 24rpx;
  286. align-items: flex-start;
  287. gap: 24rpx;
  288. position: relative;
  289. }
  290. .item-image {
  291. width: 160rpx;
  292. height: 180rpx;
  293. border-radius: 16rpx;
  294. object-fit: cover;
  295. }
  296. .item-info {
  297. flex: 1;
  298. display: flex;
  299. flex-direction: column;
  300. gap: 14rpx;
  301. }
  302. .info-line {
  303. font-size: 28rpx;
  304. color: #333;
  305. line-height: 1.6;
  306. }
  307. .right-corner-container {
  308. display: flex;
  309. flex-direction: column;
  310. align-items: flex-end;
  311. }
  312. .certificate-container {
  313. display: flex;
  314. flex-wrap: wrap;
  315. gap: 20rpx;
  316. padding: 10rpx;
  317. }
  318. .certificate-img {
  319. width: 220rpx;
  320. height: 220rpx;
  321. border-radius: 8rpx;
  322. object-fit: cover;
  323. }
  324. .no-certificate {
  325. text-align: center;
  326. color: #999;
  327. padding: 30rpx;
  328. }
  329. .custom-order-title {
  330. display: flex;
  331. align-items: center;
  332. font-size: 28rpx;
  333. color: #303133;
  334. width: 100%;
  335. padding: 10rpx 0;
  336. }
  337. .order-number {
  338. word-break: break-all;
  339. flex: 1;
  340. }
  341. </style>