orderdetails.vue 8.8 KB

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