feat:订单管理-增加强制退租
This commit is contained in:
@@ -130,3 +130,14 @@ export async function batteryChange(data){
|
|||||||
}
|
}
|
||||||
return Promise.reject(new Error(res.data.message));
|
return Promise.reject(new Error(res.data.message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 强制退租
|
||||||
|
*/
|
||||||
|
export async function rentingOut(data:Order){
|
||||||
|
const res = await request.post<ApiResult<unknown>>('/open/equipment/rentingOut', data);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|||||||
@@ -78,6 +78,8 @@ export interface Order {
|
|||||||
idCode?: string;
|
idCode?: string;
|
||||||
// 身份证地址
|
// 身份证地址
|
||||||
address?: string;
|
address?: string;
|
||||||
|
//是否申请退租,1为申请,2为取消
|
||||||
|
isRefund?:number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
114
src/views/yunxinwei/order/components/order-refund.vue
Normal file
114
src/views/yunxinwei/order/components/order-refund.vue
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
<!-- 服务编辑弹窗 -->
|
||||||
|
<template >
|
||||||
|
<ele-modal
|
||||||
|
:width="400"
|
||||||
|
:visible="visible"
|
||||||
|
:confirm-loading="loading"
|
||||||
|
:title="'确定强制退租吗?'"
|
||||||
|
:body-style="{ paddingBottom: '8px' }"
|
||||||
|
@update:visible="updateVisible"
|
||||||
|
@ok="save"
|
||||||
|
>
|
||||||
|
<span>订单编号:{{ data.orderNo }}</span>
|
||||||
|
<a-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules">
|
||||||
|
</a-form>
|
||||||
|
</ele-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, watch } from 'vue';
|
||||||
|
import { Form, message } from 'ant-design-vue';
|
||||||
|
import type { FormInstance, Rule } from 'ant-design-vue/es/form';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
|
import useFormData from '@/utils/use-form-data';
|
||||||
|
import type { Order } from '@/api/order/model';
|
||||||
|
import { rentingOut } from "@/api/order";
|
||||||
|
import {assignObject} from "ele-admin-pro";
|
||||||
|
|
||||||
|
// 是否开启响应式布局
|
||||||
|
const themeStore = useThemeStore();
|
||||||
|
const { styleResponsive } = storeToRefs(themeStore);
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'done'): void;
|
||||||
|
(e: 'update:visible', visible: boolean): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
// 弹窗是否打开
|
||||||
|
visible: boolean;
|
||||||
|
// 修改回显的数据
|
||||||
|
data?: Order | null;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
//
|
||||||
|
const formRef = ref<FormInstance | null>(null);
|
||||||
|
|
||||||
|
// 提交状态
|
||||||
|
const loading = ref(false);
|
||||||
|
|
||||||
|
// 表单数据
|
||||||
|
const { form } = useFormData<Order>();
|
||||||
|
|
||||||
|
const equipmentCode = ref('')
|
||||||
|
|
||||||
|
// 表单验证规则
|
||||||
|
const rules = reactive<Record<string, Rule[]>>({
|
||||||
|
equipmentCode: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入新电池编号',
|
||||||
|
type: 'string',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
/* 保存编辑 */
|
||||||
|
const save = () => {
|
||||||
|
if (!formRef.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log("===",props.data)
|
||||||
|
formRef.value.validate()
|
||||||
|
.then(() => {
|
||||||
|
loading.value = true
|
||||||
|
props.data.isRefund = 3;//强制退租
|
||||||
|
rentingOut(props.data)
|
||||||
|
.then((msg) => {
|
||||||
|
loading.value = false
|
||||||
|
message.success("退租成功!");
|
||||||
|
emit('done');
|
||||||
|
loading.value = false;
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.error("退租失败!" + e);
|
||||||
|
}).finally(()=>{
|
||||||
|
updateVisible(false);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateVisible = (value: boolean) => {
|
||||||
|
emit('update:visible', value);
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
(visible) => {
|
||||||
|
if (visible) {
|
||||||
|
if (props.data) {
|
||||||
|
assignObject(form, props.data);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
formRef.value?.clearValidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
@@ -174,6 +174,9 @@
|
|||||||
<view v-if="record.deliveryStatus == 40">
|
<view v-if="record.deliveryStatus == 40">
|
||||||
<a-divider type="vertical" />
|
<a-divider type="vertical" />
|
||||||
<a-button class="ele-text-danger" @click="openChange(record)">换电</a-button>
|
<a-button class="ele-text-danger" @click="openChange(record)">换电</a-button>
|
||||||
|
<view v-if="record.receiptStatus === 20">
|
||||||
|
<a-button class="ele-text-danger" @click="openOrderRefund(record)">退租</a-button>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
@@ -182,6 +185,8 @@
|
|||||||
</a-card>
|
</a-card>
|
||||||
</div>
|
</div>
|
||||||
<battery-change v-model:visible="showChange" :data="current" @done="reload"/>
|
<battery-change v-model:visible="showChange" :data="current" @done="reload"/>
|
||||||
|
<order-refund v-model:visible="showOrderRefund" :data="current" @done="reload"/>
|
||||||
|
|
||||||
<!-- 编辑弹窗 -->
|
<!-- 编辑弹窗 -->
|
||||||
<Delivery v-model:visible="deliveryEdit" :data="current" @done="reload" />
|
<Delivery v-model:visible="deliveryEdit" :data="current" @done="reload" />
|
||||||
<Markdown
|
<Markdown
|
||||||
@@ -228,6 +233,7 @@
|
|||||||
import Field from './components/field.vue';
|
import Field from './components/field.vue';
|
||||||
import OrderInfo from './components/order-info.vue';
|
import OrderInfo from './components/order-info.vue';
|
||||||
import BatteryChange from './components/battery-change.vue';
|
import BatteryChange from './components/battery-change.vue';
|
||||||
|
import OrderRefund from './components/order-refund.vue';
|
||||||
import { pageOrder, removeOrder, removeBatchOrder } from '@/api/order';
|
import { pageOrder, removeOrder, removeBatchOrder } from '@/api/order';
|
||||||
import { alipayQuery } from '@/api/system/payment';
|
import { alipayQuery } from '@/api/system/payment';
|
||||||
import type { Order, OrderParam } from '@/api/order/model';
|
import type { Order, OrderParam } from '@/api/order/model';
|
||||||
@@ -429,6 +435,7 @@
|
|||||||
const showEdit = ref(false);
|
const showEdit = ref(false);
|
||||||
// 是否显示换电弹窗
|
// 是否显示换电弹窗
|
||||||
const showChange = ref(false);
|
const showChange = ref(false);
|
||||||
|
const showOrderRefund = ref(false);
|
||||||
const markdown = ref('请输入备注内容');
|
const markdown = ref('请输入备注内容');
|
||||||
const content = ref('请输入要修改的内容');
|
const content = ref('请输入要修改的内容');
|
||||||
const showMarkdown = ref(false);
|
const showMarkdown = ref(false);
|
||||||
@@ -513,6 +520,12 @@
|
|||||||
showChange.value = true;
|
showChange.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* 退租 */
|
||||||
|
const openOrderRefund = (row?: Order) => {
|
||||||
|
current.value = row ?? null;
|
||||||
|
showOrderRefund.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
/* 打开高级搜索 */
|
/* 打开高级搜索 */
|
||||||
const openAdvanced = () => {
|
const openAdvanced = () => {
|
||||||
showAdvancedSearch.value = !showAdvancedSearch.value;
|
showAdvancedSearch.value = !showAdvancedSearch.value;
|
||||||
|
|||||||
Reference in New Issue
Block a user