applyRefund.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <view class="apply-refund">
  3. <view class="apply-refund-form">
  4. <view class="apply-refund-form-item">
  5. <view class="apply-refund-form-label">
  6. 退款金额:
  7. </view>
  8. <view class="apply-refund-form-content">
  9. <text class="money">{{Number(refundForm.refundAmount).toFixed(2)}}</text>元
  10. </view>
  11. </view>
  12. <view class="apply-refund-form-item">
  13. <view class="apply-refund-form-label">
  14. 退款原因:
  15. </view>
  16. <view class="apply-refund-form-content full-width">
  17. <textarea
  18. v-model="refundForm.refundReason"
  19. maxlength="200"
  20. placeholder="请填写申请退款原因"
  21. :data-maxnum="refundForm.refundReason.length+'/200'"/>
  22. <u-upload
  23. :header="{
  24. Authorization: 'Bearer ' + vuex_token
  25. }"
  26. max-count="3"
  27. ref="uUpload"
  28. :action="action"></u-upload>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="apply-refund-form-submit">
  33. <u-button type="primary" @click="submit">提交</u-button>
  34. </view>
  35. <view class="refund-tips" v-if="refundTipsContent">
  36. <u-parse :html="refundTipsContent"></u-parse>
  37. </view>
  38. <u-mask :show="successPop" :zoom="true" :custom-style="{background: 'rgba(255, 255, 255, 0.8)'}">
  39. <view class="pop-warp">
  40. <view class="pop-warp-icon">
  41. <u-icon name="checkbox-mark" color="#fff" size="50"></u-icon>
  42. </view>
  43. <view class="pop-warp-tips">
  44. <text>提交成功!预计3-7个工作日内处理</text>
  45. </view>
  46. </view>
  47. </u-mask>
  48. <u-toast ref="uToast" />
  49. </view>
  50. </template>
  51. <script>
  52. import {mapState, mapMutations} from 'vuex';
  53. import { config } from '@/common/config.js'
  54. export default {
  55. data() {
  56. return {
  57. refundForm: {
  58. orderId: '',
  59. refundAmount: '',
  60. refundReason: '',
  61. images: []
  62. },
  63. action: config.baseUrl + '/file/tencent/upload',
  64. successPop: false,
  65. // 退款温馨提示
  66. refundTipsContent: ''
  67. }
  68. },
  69. computed: {
  70. ...mapState(['vuex_token'])
  71. },
  72. onLoad(page) {
  73. this.refundForm.orderId = page.orderId
  74. this.refundForm.refundAmount = Number(page.payAmount)
  75. this.getSysterms(4)
  76. },
  77. methods: {
  78. submit() {
  79. let files = [];
  80. // 是否有未完成上传的图片标识
  81. let isHas = false
  82. this.$refs.uUpload.lists.forEach(item => {
  83. if (item.progress === 100 && item.response) {
  84. const url = item?.response?.data?.url
  85. if (url) {
  86. files.push(url)
  87. }
  88. } else {
  89. isHas = true
  90. }
  91. })
  92. this.refundForm.images = files
  93. if (this.refundForm.refundReason && !isHas) {
  94. this.$u.api.updateOrderRefund(this.refundForm)
  95. .then(res => {
  96. this.successPop = true
  97. if (res.code === 200) {
  98. setTimeout(() => {
  99. this.$u.route('pages/applyRefundDetails/applyRefundDetails', {
  100. orderId: this.refundForm.orderId
  101. })
  102. }, 2000)
  103. } else {
  104. this.successPop = false
  105. this.$refs.uToast.show({
  106. title: res.msg,
  107. type: 'error'
  108. })
  109. }
  110. })
  111. .catch(err => {
  112. this.$refs.uToast.show({
  113. title: '操作失败!',
  114. type: 'error'
  115. })
  116. })
  117. } else if (this.refundForm.refundReason == '') {
  118. this.$refs.uToast.show({
  119. title: '请填写申请退款原因',
  120. type: 'warning'
  121. })
  122. } else if (isHas) {
  123. this.$refs.uToast.show({
  124. title: '还有图片未完成上传,请稍等!',
  125. type: 'warning'
  126. })
  127. }
  128. },
  129. /**
  130. * 获取收费标准
  131. * */
  132. getSysterms(termsType) {
  133. this.$u.api.getSysterms({
  134. termsType: Number(termsType)
  135. })
  136. .then(res => {
  137. if (res.code === 200) {
  138. this.refundTipsContent = res.data?.content
  139. } else {
  140. this.$refs.uToast.show({
  141. title: res.msg,
  142. type: 'error',
  143. })
  144. }
  145. })
  146. .catch(err => {
  147. this.$refs.uToast.show({
  148. title: '系统错误!',
  149. type: 'error',
  150. })
  151. })
  152. }
  153. }
  154. }
  155. </script>
  156. <style lang="scss" scoped>
  157. @import './applyRefund.scss';
  158. </style>