123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- <template>
- <view class="apply-refund">
- <view class="apply-refund-form">
- <view class="apply-refund-form-item">
- <view class="apply-refund-form-label">
- 退款金额:
- </view>
- <view class="apply-refund-form-content">
- <text class="money">{{Number(refundForm.refundAmount).toFixed(2)}}</text>元
- </view>
- </view>
- <view class="apply-refund-form-item">
- <view class="apply-refund-form-label">
- 退款原因:
- </view>
- <view class="apply-refund-form-content full-width">
- <textarea
- v-model="refundForm.refundReason"
- maxlength="200"
- placeholder="请填写申请退款原因"
- :data-maxnum="refundForm.refundReason.length+'/200'"/>
- <u-upload
- :header="{
- Authorization: 'Bearer ' + vuex_token
- }"
- max-count="3"
- ref="uUpload"
- :action="action"></u-upload>
- </view>
- </view>
- </view>
- <view class="apply-refund-form-submit">
- <u-button type="primary" @click="submit">提交</u-button>
- </view>
- <view class="refund-tips" v-if="refundTipsContent">
- <u-parse :html="refundTipsContent"></u-parse>
- </view>
- <u-mask :show="successPop" :zoom="true" :custom-style="{background: 'rgba(255, 255, 255, 0.8)'}">
- <view class="pop-warp">
- <view class="pop-warp-icon">
- <u-icon name="checkbox-mark" color="#fff" size="50"></u-icon>
- </view>
- <view class="pop-warp-tips">
- <text>提交成功!预计3-7个工作日内处理</text>
- </view>
- </view>
- </u-mask>
- <u-toast ref="uToast" />
- </view>
- </template>
- <script>
- import {mapState, mapMutations} from 'vuex';
- import { config } from '@/common/config.js'
- export default {
- data() {
- return {
- refundForm: {
- orderId: '',
- refundAmount: '',
- refundReason: '',
- images: []
- },
- action: config.baseUrl + '/file/tencent/upload',
- successPop: false,
- // 退款温馨提示
- refundTipsContent: ''
- }
- },
- computed: {
- ...mapState(['vuex_token'])
- },
- onLoad(page) {
- this.refundForm.orderId = page.orderId
- this.refundForm.refundAmount = Number(page.payAmount)
- this.getSysterms(4)
- },
- methods: {
- submit() {
- let files = [];
- // 是否有未完成上传的图片标识
- let isHas = false
- this.$refs.uUpload.lists.forEach(item => {
- if (item.progress === 100 && item.response) {
- const url = item?.response?.data?.url
- if (url) {
- files.push(url)
- }
- } else {
- isHas = true
- }
- })
- this.refundForm.images = files
- if (this.refundForm.refundReason && !isHas) {
- this.$u.api.updateOrderRefund(this.refundForm)
- .then(res => {
- this.successPop = true
- if (res.code === 200) {
- setTimeout(() => {
- this.$u.route('pages/applyRefundDetails/applyRefundDetails', {
- orderId: this.refundForm.orderId
- })
- }, 2000)
- } else {
- this.successPop = false
- this.$refs.uToast.show({
- title: res.msg,
- type: 'error'
- })
- }
- })
- .catch(err => {
- this.$refs.uToast.show({
- title: '操作失败!',
- type: 'error'
- })
- })
- } else if (this.refundForm.refundReason == '') {
- this.$refs.uToast.show({
- title: '请填写申请退款原因',
- type: 'warning'
- })
- } else if (isHas) {
- this.$refs.uToast.show({
- title: '还有图片未完成上传,请稍等!',
- type: 'warning'
- })
- }
- },
- /**
- * 获取收费标准
- * */
- getSysterms(termsType) {
- this.$u.api.getSysterms({
- termsType: Number(termsType)
- })
- .then(res => {
- if (res.code === 200) {
- this.refundTipsContent = res.data?.content
- } else {
- this.$refs.uToast.show({
- title: res.msg,
- type: 'error',
- })
- }
- })
- .catch(err => {
- this.$refs.uToast.show({
- title: '系统错误!',
- type: 'error',
- })
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import './applyRefund.scss';
- </style>
|