orderdetails.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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.address.name}}
  10. {{listData.address.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.address.provinceName}}
  18. {{listData.address.cityName}}
  19. {{listData.address.districtName}}
  20. </view>
  21. </view>
  22. <view>
  23. <up-card title="志愿者介绍" :head-style="{ height: '80rpx', padding: '20rpx',}">
  24. <template #body>
  25. <view class="card-container">
  26. <image class="card-image" :src="listData.volunteerInfo.volunteerPicture" mode="aspectFill">
  27. </image>
  28. <view class="card-info">
  29. <view class="info-item">{{listData.volunteerInfo.name}}</view>
  30. <view class="info-item">类别:{{ listData.volunteerInfo.businessTierName }} </view>
  31. <view class="Telephone">电话:{{listData.volunteerInfo.phonenumber}}</view>
  32. <view class="info-item">住址:{{listData.volunteerInfo.city}}</view>
  33. </view>
  34. <view class="card-rating">4.5 评分</view>
  35. </view>
  36. </template>
  37. </up-card>
  38. <up-card title="技能介绍" :head-style="{ height: '80rpx', padding: '20rpx',}">
  39. <template #body>
  40. {{listData.volunteerInfo.skillDescribe}}
  41. </template>
  42. </up-card>
  43. <up-card title="证书" :head-style="{ height: '80rpx', padding: '20rpx',}">
  44. <template #body>
  45. <view class="certificate">
  46. <image v-for="item in certificationPictures" :key="item" :src="item" mode=""
  47. style="width: 100%;" class="certificate-img"></image>
  48. </view>
  49. </template>
  50. </up-card>
  51. </view>
  52. <view>
  53. <up-list @scrolltolower="scrolltolower">
  54. <up-list-item v-for="(item, index) in listData.secondOrderList" :key="index">
  55. <view class="Wrap-top">
  56. <text>第一节课</text>
  57. </view>
  58. <view class="list-item">
  59. <image :src="listData.volunteerInfo.volunteerPicture" mode="aspectFill" class="item-image">
  60. </image>
  61. <view class="item-info">
  62. <view class="info-line">
  63. 类别:{{ listData.volunteerInfo.projectName }}-{{ listData.volunteerInfo.serviceSubjectName }}
  64. </view>
  65. <text>开始日期:{{item.workDate}}</text>
  66. <text>开始时间: {{item.workStartTime}}</text>
  67. </view>
  68. <view class="right-corner-container">
  69. <text> {{dictSortMap[item.orderStatus]}}</text>
  70. <up-button type="error" text="评论" size="mini" @click="handlButClick"
  71. :customStyle="hadlClickError"></up-button>
  72. </view>
  73. </view>
  74. </up-list-item>
  75. </up-list>
  76. </view>
  77. </view>
  78. </template>
  79. <script setup>
  80. import {
  81. onLoad
  82. } from '@dcloudio/uni-app'
  83. import {
  84. ref,
  85. computed,
  86. onMounted
  87. } from "vue";
  88. import {
  89. orderInfomainOrderId
  90. } from "@/api/userList.js";
  91. import {
  92. systemDictdaTalist
  93. } from "@/api/userList.js"
  94. const listData = ref(); //志愿者详情数据
  95. const dataList = ref([])
  96. const orderStatus = ref(0)
  97. const score = ref(null)
  98. const mainOrderId = ref(''); //志愿者ID
  99. const certificationPictures = computed(() => {
  100. if (listData.value.volunteerInfo.certificationPicture) {
  101. return listData.value.volunteerInfo.certificationPicture.split(',')
  102. }
  103. return []
  104. })
  105. const dictSortMap = computed(() => {
  106. let mapObj = {}
  107. dataList.value.forEach((item => {
  108. mapObj[item.dictValue] = item.dictLabel
  109. }))
  110. return mapObj
  111. })
  112. //获取用户订单列表状态
  113. async function getData() {
  114. try {
  115. const res = await systemDictdaTalist().catch(err => {
  116. console.error('接口请求失败:', err);
  117. throw err; // 重新抛出以进入 catch 块
  118. });
  119. dataList.value = res.rows;
  120. } catch (e) {
  121. console.error('获取数据异常:', e); // 确保这里打印错误
  122. }
  123. }
  124. const handlButClick = (item) => {
  125. uni.navigateTo({
  126. url: `/pages_classify/pages/orderItem/userComment?mainOrderId=${mainOrderId.value}&data=${encodeURIComponent(JSON.stringify(listData.value))}`
  127. });
  128. }
  129. // 获取传递的参数
  130. onLoad(async (options) => {
  131. mainOrderId.value = options.mainOrderId;
  132. const res = await orderInfomainOrderId(mainOrderId.value)
  133. listData.value = res.data;
  134. });
  135. const hadlClickError = {
  136. width: '150rpx',
  137. height:'50rpx',
  138. marginTop: '70rpx'
  139. }
  140. onMounted(() => {
  141. getData()
  142. })
  143. </script>
  144. <style scoped>
  145. .address-container {
  146. padding: 20rpx;
  147. border: 1rpx solid #eee;
  148. border-radius: 10rpx;
  149. }
  150. .address-header {
  151. display: flex;
  152. align-items: center;
  153. margin-bottom: 10rpx;
  154. }
  155. .contact-info {
  156. flex: 1;
  157. /* 占据剩余空间 */
  158. font-size: 28rpx;
  159. margin-left: 25rpx;
  160. }
  161. .arrow-icon {
  162. margin-left: auto;
  163. /* 将图标推到最右侧 */
  164. }
  165. .address-detail {
  166. font-size: 26rpx;
  167. color: #666;
  168. }
  169. .card-container {
  170. display: flex;
  171. position: relative;
  172. padding: 20rpx;
  173. align-items: flex-start;
  174. background-color: #fff;
  175. border-radius: 12rpx;
  176. }
  177. /* 左侧图片 */
  178. .card-image {
  179. width: 240rpx;
  180. height: 340rpx;
  181. border-radius: 12rpx;
  182. margin-right: 30rpx;
  183. flex-shrink: 0;
  184. }
  185. /* 中间信息区域 */
  186. .card-info {
  187. flex: 1;
  188. padding-right: 100rpx;
  189. }
  190. /* 中间信息区域 */
  191. .card-info {
  192. flex: 1;
  193. padding-right: 100rpx;
  194. }
  195. .Telephone {
  196. white-space: nowrap;
  197. margin-bottom: 24rpx;
  198. font-size: 28rpx;
  199. line-height: 1.6;
  200. color: #333;
  201. }
  202. .info-item {
  203. margin-bottom: 24rpx;
  204. font-size: 28rpx;
  205. line-height: 1.6;
  206. color: #333;
  207. }
  208. /* 右上角评分 */
  209. .card-rating {
  210. position: absolute;
  211. top: 20rpx;
  212. right: 20rpx;
  213. background-color: #f8f8f8;
  214. padding: 6rpx 16rpx;
  215. border-radius: 20rpx;
  216. font-size: 24rpx;
  217. color: #ff9900;
  218. font-weight: bold;
  219. }
  220. /* 上课时间 */
  221. .Wrap-top {
  222. display: flex;
  223. justify-content: space-between;
  224. align-items: center;
  225. padding: 24rpx 20rpx 0rpx 24rpx;
  226. }
  227. .list-item {
  228. display: flex;
  229. padding: 24rpx;
  230. align-items: flex-start;
  231. gap: 24rpx;
  232. position: relative;
  233. }
  234. .item-image {
  235. width: 160rpx;
  236. height: 180rpx;
  237. border-radius: 16rpx;
  238. object-fit: cover;
  239. }
  240. .item-info {
  241. flex: 1;
  242. display: flex;
  243. flex-direction: column;
  244. gap: 14rpx;
  245. }
  246. .info-line {
  247. font-size: 28rpx;
  248. color: #333;
  249. line-height: 1.6;
  250. }
  251. .right-corner-container {
  252. display: flex;
  253. flex-direction: column;
  254. align-items: flex-end;
  255. position: absolute;
  256. right: 24rpx;
  257. top: 24rpx;
  258. gap: 10rpx;
  259. }
  260. </style>