cancelationOforder.vue 3.0 KB

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