applyRefund.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. ref="uUpload"
  27. :action="action"></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. <u-mask :show="successPop" :zoom="true" :custom-style="{background: 'rgba(255, 255, 255, 0.8)'}">
  35. <view class="pop-warp">
  36. <view class="pop-warp-icon">
  37. <u-icon name="checkbox-mark" color="#fff" size="50"></u-icon>
  38. </view>
  39. <view class="pop-warp-tips">
  40. <text>提交成功!预计3-7个工作日内处理</text>
  41. </view>
  42. </view>
  43. </u-mask>
  44. <u-toast ref="uToast" />
  45. </view>
  46. </template>
  47. <script>
  48. import {mapState, mapMutations} from 'vuex';
  49. import { config } from '@/common/config.js'
  50. export default {
  51. data() {
  52. return {
  53. refundForm: {
  54. orderId: '',
  55. refundAmount: '',
  56. refundReason: '',
  57. images: []
  58. },
  59. action: config.baseUrl + '/file/tencent/upload',
  60. successPop: false
  61. }
  62. },
  63. computed: {
  64. ...mapState(['vuex_token'])
  65. },
  66. onLoad(page) {
  67. this.refundForm.orderId = page.orderId
  68. this.refundForm.refundAmount = Number(page.payAmount)
  69. },
  70. methods: {
  71. submit() {
  72. let files = [];
  73. this.$refs.uUpload.lists.forEach(item => {
  74. const url = item?.response?.data?.url
  75. if (url) {
  76. files.push(url)
  77. }
  78. })
  79. this.refundForm.images = files
  80. if (this.refundForm.refundReason && files.length > 0) {
  81. this.$u.api.updateOrderRefund(this.refundForm)
  82. .then(res => {
  83. console.log(res)
  84. this.successPop = true
  85. if (res.code === 200) {
  86. setTimeout(() => {
  87. this.$u.route('pages/applyRefundDetails/applyRefundDetails', {
  88. orderId: this.refundForm.orderId
  89. })
  90. }, 2000)
  91. } else {
  92. this.successPop = false
  93. this.$refs.uToast.show({
  94. title: res.msg,
  95. type: 'error'
  96. })
  97. }
  98. })
  99. .catch(err => {
  100. this.$refs.uToast.show({
  101. title: '操作失败!',
  102. type: 'error'
  103. })
  104. })
  105. } else if (this.refundForm.refundReason == '') {
  106. this.$refs.uToast.show({
  107. title: '请填写申请退款原因',
  108. type: 'warning'
  109. })
  110. } else if (files.length === 0) {
  111. this.$refs.uToast.show({
  112. title: '请至少选择一张图片',
  113. type: 'warning'
  114. })
  115. }
  116. }
  117. }
  118. }
  119. </script>
  120. <style lang="scss" scoped>
  121. @import './applyRefund.scss';
  122. </style>