applyRefund.vue 3.9 KB

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