This commit is contained in:
messi
2024-08-21 12:55:18 +08:00
parent b5e5a19b69
commit 26a8ce42ab
10 changed files with 934 additions and 63 deletions

View File

@@ -304,7 +304,18 @@
<template v-if="column.key === 'expirationDay'">
<span class="ele-text-danger">{{ expirationDay(record) }}</span>
</template>
<template v-if="column.key === 'action'">
<view >
<a-button
class="ele-text-danger"
@click="openOrderOnline(record)"
>退租</a-button>
</view>
</template>
</template>
</a-table>
</a-spin>
</a-card>
@@ -403,6 +414,11 @@
</a-col>
</a-row>
</a-card>
<order-online
v-model:visible="showOrderOnline"
/>
</ele-modal>
</template>
@@ -415,6 +431,7 @@ import {formatNumber} from 'ele-admin-pro/es';
import {storeToRefs} from 'pinia';
import {copyText} from '@/utils/common';
import {Order} from '@/api/order/model';
import OrderOnline from '../components/order-online.vue';
import {listEquipmentOrderGoods} from '@/api/apps/equipment/order/goods';
import {EquipmentOrderGoods} from '@/api/apps/equipment/order/goods/model';
import * as EquipmentApi from '@/api/apps/equipment';
@@ -423,12 +440,17 @@ import {ColumnItem, DatasourceFunction} from 'ele-admin-pro/es/ele-pro-table/typ
import {listOrder, listOrderPay} from '@/api/order';
import {CopyOutlined} from '@ant-design/icons-vue';
import {EquipmentRecord} from '@/api/apps/equipment/record/model';
import OrderRefund from "@/views/yunxinwei/order/components/order-refund.vue";
const useForm = Form.useForm;
// 是否开启响应式布局
const themeStore = useThemeStore();
const {styleResponsive} = storeToRefs(themeStore);
const showOrderOnline = ref(false);
// 当前编辑数据
const current = ref<Order | null>(null);
const props = defineProps<{
// 弹窗是否打开
visible: boolean;
@@ -600,7 +622,15 @@ const columns2 = ref<ColumnItem[]>([
title: '逾期状态',
dataIndex: 'expirationDay',
key: 'expirationDay'
}
},
{
title: '操作',
key: 'action',
width: 100,
align: 'center',
fixed: 'left',
hideInSetting: true
},
]);
const columns3 = ref<ColumnItem[]>([
{
@@ -702,6 +732,13 @@ const getEquipmentOrderGoods = () => {
});
};
/* 线下缴费 */
const openOrderOnline = (row?: Order) => {
current.value = row ?? null;
showOrderOnline.value = true;
};
const getEquipment = () => {
EquipmentApi.listEquipment({orderId: order.orderId}).then((data) => {
if (data.length > 0) {

View File

@@ -0,0 +1,186 @@
<!-- 用户编辑弹窗 -->
<template>
<ele-modal
:width="500"
:visible="visible"
:confirm-loading="loading"
:maskClosable="false"
:maxable="maxable"
:title="isUpdate ? '发货' : '发货'"
:body-style="{ paddingBottom: '8px' }"
@update:visible="updateVisible"
@ok="save"
>
<a-space>
<a-form>
<a-form-item label="设备编码" v-bind="validateInfos.equipmentCode">
<a-input
allow-clear
:maxlength="30"
placeholder="请输入设备编码"
v-model:value="form.equipmentCode"
@blur="
validate('equipmentCode', { trigger: 'blur' }).catch(() => {})
"
/>
</a-form-item>
<!-- <a-row :gutter="16">-->
<!-- <a-col :md="12" :sm="24" :xs="24">-->
<!-- <a-form-item label="选择设备" v-bind="validateInfos.customerName">-->
<!-- <a-input-->
<!-- allow-clear-->
<!-- :maxlength="30"-->
<!-- placeholder="请选择设备"-->
<!-- v-model:value="form.customerName"-->
<!-- @blur="-->
<!-- validate('customerName', { trigger: 'blur' }).catch(() => {})-->
<!-- "-->
<!-- />-->
<!-- </a-form-item>-->
<!-- </a-col>-->
<!-- <a-col :md="12" :sm="24" :xs="24">-->
<!-- <a-form-item label="手机号码" v-bind="validateInfos.customerMobile">-->
<!-- <a-input-->
<!-- allow-clear-->
<!-- :maxlength="20"-->
<!-- placeholder="请填写联系人手机号码"-->
<!-- v-model:value="form.customerMobile"-->
<!-- />-->
<!-- </a-form-item>-->
<!-- </a-col>-->
<!-- </a-row>-->
</a-form>
</a-space>
</ele-modal>
</template>
<script lang="ts" setup>
import {ref, reactive, watch, computed} from 'vue';
import { Form, message } from 'ant-design-vue';
import { assignObject } from 'ele-admin-pro';
import TypeSelect from './customer-edit/type-select.vue';
import ProgressSelect from './customer-edit/progress-select.vue';
import SourceSelect from './customer-edit/source-select.vue';
import { bindEquipment } from '@/api/apps/equipment';
import type { Customer } from '@/api/oa/customer/model';
import { createCode } from '@/utils/common';
import { uploadFile } from '@/api/system/file';
import type { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
import { FILE_SERVER } from '@/config/setting';
import { useUserStore } from '@/store/modules/user';
import { Equipment } from "@/api/apps/equipment/model";
import { Order } from "@/api/order/model";
const userStore = useUserStore();
// 当前用户信息
const loginUser = computed(() => userStore.info ?? {});
// 是否是修改
const isUpdate = ref(false);
const useForm = Form.useForm;
const props = defineProps<{
// 弹窗是否打开
visible: boolean;
// 修改回显的数据
data?: Order | null;
}>();
const emit = defineEmits<{
(e: 'done'): void;
(e: 'update:visible', visible: boolean): void;
}>();
// 提交状态
const loading = ref(false);
// 是否显示最大化切换按钮
const maxable = ref(true);
// 表单数据
const form = reactive<Equipment>({
equipmentCode: '',
orderId: undefined
});
// 已上传数据, 可赋初始值用于回显
const images = ref(<any>[]);
/* 更新visible */
const updateVisible = (value: boolean) => {
emit('update:visible', value);
};
// 表单验证规则
const rules = reactive({
equipmentCode: [
{
required: true,
type: 'string',
message: '请输入设备编码',
trigger: 'blur'
}
]
});
const { resetFields, validate, validateInfos } = useForm(form, rules);
/* 保存编辑 */
const save = () => {
validate()
.then(() => {
loading.value = true;
// 去除空格
const data = {
...form,
orderId: props.data?.orderId,
userId: props.data?.userId
};
// 转字符串
bindEquipment(data)
.then((msg) => {
loading.value = false;
message.success(msg);
updateVisible(false);
emit('done');
})
.catch((e) => {
loading.value = false;
message.error(e.message);
});
})
.catch(() => {});
};
const onUpload = (d: ItemType) => {
uploadFile(<File>d.file)
.then((result) => {
form.customerAvatar = result.path;
message.success('上传成功');
})
.catch((e) => {
message.error(e.message);
});
};
watch(
() => props.visible,
(visible) => {
if (visible) {
if (props.data) {
loading.value = false;
// 头像赋值
images.value = [];
if(props.data.customerAvatar){
images.value.push({ uid:1, url: FILE_SERVER + props.data.customerAvatar, status: '' });
}
assignObject(form, props.data);
isUpdate.value = true;
} else {
form.customerCode = createCode();
isUpdate.value = false;
}
} else {
resetFields();
}
}
);
</script>
<style lang="less"></style>