cancelationOforder.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <view>
  3. <!-- 志愿者信息 -->
  4. <view class="volunteer-info">
  5. <image :src="dataList.volunteerPicture" class="volunteer-image"></image>
  6. <view class="volunteer-details">
  7. <view
  8. style="display: flex; justify-content: space-between; width: 100%"
  9. >
  10. <view>
  11. <view>{{ dataList.volunteerName }}</view>
  12. <view>{{ dataList.businessTierName }}</view>
  13. </view>
  14. <view>可退:{{ dataList.refundAmount }}</view>
  15. </view>
  16. </view>
  17. </view>
  18. <!-- 申请类型 -->
  19. <view class="application-type"> 申请类型:取消订单 </view>
  20. <!-- 展开全部按钮 -->
  21. <view class="expand-all">
  22. <text @click="toggleExpand">展开全部</text>
  23. <image
  24. :src="expanded ? '/path/to/up-icon.png' : '/path/to/down-icon.png'"
  25. class="expand-icon"
  26. ></image>
  27. </view>
  28. <!-- 申请说明 -->
  29. <view class="application-note">
  30. <up-textarea
  31. v-model="refundReason"
  32. placeholder="请详细填写申请申请说明"
  33. ></up-textarea>
  34. </view>
  35. <!-- 提交申请按钮 -->
  36. <view class="submit-button">
  37. <up-button type="error" text="提交申请" @click="handlClick"></up-button>
  38. </view>
  39. </view>
  40. </template>
  41. <script setup>
  42. import { onMounted, ref } from 'vue'
  43. import { onLoad } from '@dcloudio/uni-app'
  44. import { userdictOrderInfo, refunDnewOrderRefund } from '@/api/userList.js'
  45. const dataList = ref([])
  46. const mainOrderId = ref('') //志愿者ID
  47. const refundReason = ref('')
  48. const expanded = ref(false)
  49. onLoad(async (options) => {
  50. mainOrderId.value = options.mainOrderId
  51. const res = await userdictOrderInfo(mainOrderId.value)
  52. dataList.value = res.data
  53. })
  54. const toggleExpand = () => {
  55. expanded.value = !expanded.value
  56. }
  57. const handlClick = async () => {
  58. const params = {
  59. mainOrderId: mainOrderId.value,
  60. volunteerPicture: dataList.value.volunteerPicture,
  61. refundReason: refundReason.value,
  62. }
  63. const res = await refunDnewOrderRefund(params)
  64. if (res.status === 200) {
  65. uni.showToast({
  66. title: '退款成功',
  67. icon: 'success', // 或者 'none'
  68. duration: 1500, // 显示时间,单位毫秒,默认1500
  69. mask: true, // 是否显示透明蒙层,防止触摸穿透,默认false
  70. })
  71. uni.navigateBack({
  72. delta: 1,
  73. })
  74. }
  75. }
  76. </script>
  77. <style scoped>
  78. .volunteer-info {
  79. display: flex;
  80. align-items: center;
  81. border-bottom: 1rpx solid #ccc;
  82. padding: 20rpx;
  83. }
  84. .volunteer-image {
  85. width: 80rpx;
  86. height: 120rpx;
  87. margin-right: 20rpx;
  88. border-radius: 8rpx;
  89. }
  90. .volunteer-details {
  91. flex: 1;
  92. }
  93. .application-type {
  94. padding: 20rpx;
  95. border-bottom: 1rpx solid #ccc;
  96. }
  97. .volunteer-detail-section {
  98. padding: 20rpx;
  99. border-bottom: 1rpx solid #ccc;
  100. }
  101. .volunteer-detail {
  102. display: flex;
  103. align-items: center;
  104. }
  105. .volunteer-data {
  106. flex: 1;
  107. margin-left: 20rpx;
  108. }
  109. .refund-amount {
  110. color: red;
  111. font-weight: bold;
  112. }
  113. .expand-all {
  114. display: flex;
  115. align-items: center;
  116. justify-content: center;
  117. padding: 20rpx;
  118. cursor: pointer;
  119. }
  120. .expand-icon {
  121. width: 40rpx;
  122. height: 40rpx;
  123. margin-left: 10rpx;
  124. }
  125. .application-note {
  126. padding: 20rpx;
  127. }
  128. .submit-button {
  129. padding: 20rpx;
  130. text-align: center;
  131. }
  132. </style>