123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- <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" :loading="loading" @click="submitForm">提交</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 { config } from '@/common/config.js';
- export default {
- data() {
- return {
- refundForm: {
- orderId: '',
- refundAmount: '',
- refundReason: '',
- images: []
- },
- action: config.baseUrl + '/file/tencent/upload',
- successPop: false,
- // 退款温馨提示
- refundTipsContent: '',
- orderType: 'road',
- loading: false
- };
- },
- onLoad(options) {
- const { orderId, payAmount, tabCur } = options;
- this.refundForm.orderId = orderId;
- this.refundForm.refundAmount = Number(payAmount);
- this.orderType = tabCur;
- this.getSystems(4);
- },
- methods: {
- /**
- * @description: 提交
- * @return {*}
- */
- submitForm() {
- 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) {
- const submitObj = {
- road: () => {
- this.roadRefundSubmit();
- },
- park: () => {
- this.parkRefundSubmit();
- }
- };
- submitObj[this.orderType]();
- } else if (this.refundForm.refundReason == '') {
- this.$refs.uToast.show({
- title: '请填写申请退款原因',
- type: 'warning'
- });
- } else if (isHas) {
- this.$refs.uToast.show({
- title: '还有图片未完成上传,请稍等!',
- type: 'warning'
- });
- }
- },
- /**
- * @description: 路段退款提交
- * @return {*}
- */
- async roadRefundSubmit() {
- try {
- this.loading = true;
- const { code } = await this.$u.api.updateOrderRefund({ ...this.refundForm });
- if (code === 200) {
- this.successPop = true;
- setTimeout(() => {
- this.successPop = false;
- this.$u.route('pages/applyRefundDetails/applyRefundDetails', {
- orderId: this.refundForm.orderId
- });
- }, 2000);
- }
- } catch (error) {
- } finally {
- this.loading = false;
- }
- },
- /**
- * @description: 停车退款提交
- * @return {*}
- */
- async parkRefundSubmit() {
- try {
- this.loading = true;
- const { code } = await this.$u.api.updateParkingOrderRefund({ ...this.refundForm });
- if (code === 200) {
- this.successPop = true;
- setTimeout(() => {
- this.successPop = false;
- this.$u.route('pages/applyRefundDetails/applyRefundDetails', {
- orderId: this.refundForm.orderId
- });
- }, 2000);
- }
- } catch (error) {
- } finally {
- this.loading = false;
- }
- },
- /**
- * @description: 获取收费标准
- * @param {*} termsType
- * @return {*}
- */
- async getSystems(termsType) {
- const { code, data } = await this.$u.api.getSystems({ termsType: Number(termsType) });
- if (code === 200) {
- this.refundTipsContent = data.content;
- }
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- @import './applyRefund.scss';
- </style>
|