|
@@ -29,7 +29,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="apply-refund-form-submit">
|
|
|
- <u-button type="primary" @click="submit">提交</u-button>
|
|
|
+ <u-button type="primary" :loading="loading" @click="submitForm">提交</u-button>
|
|
|
</view>
|
|
|
<view class="refund-tips" v-if="refundTipsContent">
|
|
|
<u-parse :html="refundTipsContent"></u-parse>
|
|
@@ -49,7 +49,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { mapState, mapMutations } from 'vuex';
|
|
|
+import { mapState } from 'vuex';
|
|
|
import { config } from '@/common/config.js';
|
|
|
export default {
|
|
|
data() {
|
|
@@ -63,19 +63,28 @@ export default {
|
|
|
action: config.baseUrl + '/file/tencent/upload',
|
|
|
successPop: false,
|
|
|
// 退款温馨提示
|
|
|
- refundTipsContent: ''
|
|
|
+ refundTipsContent: '',
|
|
|
+ orderType: 'road',
|
|
|
+ loading: false
|
|
|
};
|
|
|
},
|
|
|
- computed: {
|
|
|
- ...mapState(['vuex_token'])
|
|
|
- },
|
|
|
- onLoad(page) {
|
|
|
- this.refundForm.orderId = page.orderId;
|
|
|
- this.refundForm.refundAmount = Number(page.payAmount);
|
|
|
- this.getSysterms(4);
|
|
|
+ // computed: {
|
|
|
+ // ...mapState(['vuex_token'])
|
|
|
+ // },
|
|
|
+ onLoad(options) {
|
|
|
+ const { orderId, payAmount, tabCur } = options;
|
|
|
+ this.refundForm.orderId = orderId;
|
|
|
+ this.refundForm.refundAmount = Number(payAmount);
|
|
|
+ this.orderType = tabCur;
|
|
|
+ this.getSystems(4);
|
|
|
+ console.log(this.vuex_token);
|
|
|
},
|
|
|
methods: {
|
|
|
- submit() {
|
|
|
+ /**
|
|
|
+ * @description: 提交
|
|
|
+ * @return {*}
|
|
|
+ */
|
|
|
+ submitForm() {
|
|
|
let files = [];
|
|
|
// 是否有未完成上传的图片标识
|
|
|
let isHas = false;
|
|
@@ -91,30 +100,15 @@ export default {
|
|
|
});
|
|
|
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'
|
|
|
- });
|
|
|
- });
|
|
|
+ const submitObj = {
|
|
|
+ road: () => {
|
|
|
+ this.roadRefundSubmit();
|
|
|
+ },
|
|
|
+ park: () => {
|
|
|
+ this.parkRefundSubmit();
|
|
|
+ }
|
|
|
+ };
|
|
|
+ submitObj[this.orderType]();
|
|
|
} else if (this.refundForm.refundReason == '') {
|
|
|
this.$refs.uToast.show({
|
|
|
title: '请填写申请退款原因',
|
|
@@ -128,29 +122,59 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
|
- * 获取收费标准
|
|
|
- * */
|
|
|
- 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'
|
|
|
+ * @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
|
|
|
});
|
|
|
- }
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- this.$refs.uToast.show({
|
|
|
- title: '系统错误!',
|
|
|
- type: 'error'
|
|
|
- });
|
|
|
- });
|
|
|
+ }, 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;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
};
|