applyRefund.vue 4.5 KB

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