第一次提交
This commit is contained in:
186
src/views/yunxinwei/order/components/delivery.vue
Normal file
186
src/views/yunxinwei/order/components/delivery.vue
Normal 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>
|
||||
118
src/views/yunxinwei/order/components/field.vue
Normal file
118
src/views/yunxinwei/order/components/field.vue
Normal file
@@ -0,0 +1,118 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
width="500px"
|
||||
:visible="visible"
|
||||
:confirm-loading="loading"
|
||||
:title="`修改价格`"
|
||||
:body-style="{ paddingBottom: '8px' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
>
|
||||
<a-form layout="horizontal">
|
||||
<a-form-item>
|
||||
<a-input-number :min="0" style="width: 200px" v-model:value="content" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import { assignObject } from 'ele-admin-pro';
|
||||
import { updateOrder } from '@/api/order';
|
||||
import { Order } from '@/api/order/model';
|
||||
import { createOrderNo } from "@/utils/common";
|
||||
// import { reloadPageTab } from '@/utils/page-tab-util';
|
||||
|
||||
const useForm = Form.useForm;
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
data?: Order | null;
|
||||
// 修改回显的数据
|
||||
field?: string | null;
|
||||
orderId?: number | 0;
|
||||
content?: number | 0;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
const content = ref<number>(0);
|
||||
const placeholder = ref('请输入订单金额');
|
||||
// 用户信息
|
||||
const form = reactive<Order>({
|
||||
orderId: 0,
|
||||
comments: '',
|
||||
payPrice: undefined
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
const { resetFields, validate } = useForm(form);
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
// 判断更新字段
|
||||
form.orderId = props.orderId;
|
||||
if (props.field === 'payPrice') {
|
||||
form.payPrice = Number(content.value);
|
||||
form.totalPrice = Number(content.value);
|
||||
form.orderNo = createOrderNo();
|
||||
}
|
||||
updateOrder(form)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
if (props.orderId) {
|
||||
loading.value = false;
|
||||
content.value = props.content;
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
|
||||
if (props.field == 'tenantCode') {
|
||||
placeholder.value = '请输入要绑定的主体编号';
|
||||
content.value = undefined;
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<style lang="less">
|
||||
.tab-pane {
|
||||
min-height: 300px;
|
||||
}
|
||||
</style>
|
||||
139
src/views/yunxinwei/order/components/markdown.vue
Normal file
139
src/views/yunxinwei/order/components/markdown.vue
Normal file
@@ -0,0 +1,139 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
width="600px"
|
||||
:visible="visible"
|
||||
:confirm-loading="loading"
|
||||
:title="`修改内容`"
|
||||
:body-style="{ paddingBottom: '8px' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
>
|
||||
<!-- 编辑器 -->
|
||||
<byte-md-editor
|
||||
v-model:value="content"
|
||||
:locale="zh_Hans"
|
||||
:plugins="plugins"
|
||||
uploadImages
|
||||
height="300px"
|
||||
:editorConfig="{ lineNumbers: true }"
|
||||
/>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import { assignObject } from 'ele-admin-pro';
|
||||
import { updateOrder } from '@/api/order';
|
||||
import { Order } from '@/api/order/model';
|
||||
// import { reloadPageTab } from '@/utils/page-tab-util';
|
||||
import 'bytemd/dist/index.min.css';
|
||||
import 'github-markdown-css/github-markdown-light.css';
|
||||
// import TinymceEditor from '@/components/TinymceEditor/index.vue';
|
||||
import ByteMdEditor from '@/components/ByteMdEditor/index.vue';
|
||||
import highlight from '@bytemd/plugin-highlight';
|
||||
// 中文语言文件
|
||||
import zh_Hans from 'bytemd/locales/zh_Hans.json';
|
||||
// // 链接、删除线、复选框、表格等的插件
|
||||
import gfm from '@bytemd/plugin-gfm';
|
||||
// // 插件的中文语言文件
|
||||
import zh_HansGfm from '@bytemd/plugin-gfm/locales/zh_Hans.json';
|
||||
// // 预览界面的样式,这里用的 github 的 markdown 主题
|
||||
import 'github-markdown-css/github-markdown-light.css';
|
||||
|
||||
const useForm = Form.useForm;
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
data?: Order | null;
|
||||
// 修改回显的数据
|
||||
field?: string | null;
|
||||
content?: string;
|
||||
orderId?: number;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 插件
|
||||
const plugins = ref([
|
||||
gfm({
|
||||
locale: zh_HansGfm
|
||||
}),
|
||||
highlight()
|
||||
]);
|
||||
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
const content = ref('');
|
||||
// 用户信息
|
||||
const form = reactive<Order>({
|
||||
orderId: 0,
|
||||
comments: ''
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
const { resetFields, validate } = useForm(form);
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
// 判断更新字段
|
||||
form.orderId = props.orderId;
|
||||
if (props.field === 'content') {
|
||||
form.comments = content.value;
|
||||
}
|
||||
if (props.field === 'comments') {
|
||||
form.comments = content.value;
|
||||
}
|
||||
updateOrder(form)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
content.value = String(props.content);
|
||||
console.log(visible);
|
||||
if (visible) {
|
||||
if (props.data) {
|
||||
loading.value = false;
|
||||
content.value = String(props.content);
|
||||
assignObject(form, props.data);
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<style lang="less">
|
||||
.tab-pane {
|
||||
min-height: 300px;
|
||||
}
|
||||
</style>
|
||||
289
src/views/yunxinwei/order/components/order-edit.vue
Normal file
289
src/views/yunxinwei/order/components/order-edit.vue
Normal file
@@ -0,0 +1,289 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="680"
|
||||
:visible="visible"
|
||||
:confirm-loading="loading"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
:title="isUpdate ? '编辑订单' : '添加订单'"
|
||||
:body-style="{ paddingBottom: '8px' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
>
|
||||
<a-space>
|
||||
<a-form
|
||||
:label-col="{ md: { span: 7 }, sm: { span: 4 }, xs: { span: 24 } }"
|
||||
:wrapper-col="{ md: { span: 17 }, sm: { span: 20 }, xs: { span: 24 } }"
|
||||
>
|
||||
<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-form-item label="订单标识" v-bind="validateInfos.customerCode">
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="20"
|
||||
placeholder="请输入用户账号"
|
||||
v-model:value="form.customerCode"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="跟进状态" v-bind="validateInfos.progress">
|
||||
<progress-select
|
||||
v-model:value="form.progress"
|
||||
@blur="
|
||||
validate('progress', { trigger: 'blur' }).catch(() => {})
|
||||
"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="订单类型" v-bind="validateInfos.customerType">
|
||||
<type-select
|
||||
v-model:value="form.customerType"
|
||||
@blur="
|
||||
validate('customerType', { trigger: 'blur' }).catch(() => {})
|
||||
"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="订单来源" v-bind="validateInfos.customerSource">
|
||||
<source-select
|
||||
v-model:value="form.customerSource"
|
||||
@blur="
|
||||
validate('customerSource', { trigger: 'blur' }).catch(() => {})
|
||||
"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="头像" v-bind="validateInfos.customerAvatar">
|
||||
<ele-image-upload
|
||||
v-model:value="images"
|
||||
:item-style="{ width: '90px', height: '90px' }"
|
||||
:limit="1"
|
||||
@upload="onUpload"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :md="12" :sm="24" :xs="24">
|
||||
<a-form-item label="联系人" v-bind="validateInfos.customerContacts">
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="20"
|
||||
placeholder="请填写联系人"
|
||||
v-model:value="form.customerContacts"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="手机号码" v-bind="validateInfos.customerMobile">
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="20"
|
||||
placeholder="请填写联系人手机号码"
|
||||
v-model:value="form.customerMobile"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
label="联系地址"
|
||||
v-bind="validateInfos.customerAddress"
|
||||
>
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请填写联系地址"
|
||||
v-model:value="form.customerAddress"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="公司座机" v-bind="validateInfos.customerPhone">
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="20"
|
||||
placeholder="请填写公司座机电话"
|
||||
v-model:value="form.customerPhone"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="排序" v-bind="validateInfos.sortNumber">
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="20"
|
||||
placeholder="排序"
|
||||
v-model:value="form.sortNumber"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="备注" v-bind="validateInfos.comments">
|
||||
<a-textarea
|
||||
:rows="4"
|
||||
:maxlength="200"
|
||||
placeholder="请输入备注"
|
||||
v-model:value="form.comments"
|
||||
/>
|
||||
</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 { addCustomer, updateCustomer } from '@/api/oa/customer';
|
||||
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';
|
||||
|
||||
const userStore = useUserStore();
|
||||
// 当前用户信息
|
||||
const loginUser = computed(() => userStore.info ?? {});
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const useForm = Form.useForm;
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: Customer | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
// 是否显示最大化切换按钮
|
||||
const maxable = ref(true);
|
||||
|
||||
// 用户信息
|
||||
const form = reactive<Customer>({
|
||||
customerCode: '',
|
||||
customerName: '',
|
||||
customerType: undefined,
|
||||
progress: undefined,
|
||||
customerMobile: '',
|
||||
customerAvatar: '',
|
||||
customerPhone: '',
|
||||
customerContacts: '',
|
||||
customerAddress: '',
|
||||
comments: '',
|
||||
status: '0',
|
||||
sortNumber: 100,
|
||||
customerId: 0,
|
||||
userId: '',
|
||||
});
|
||||
|
||||
// 已上传数据, 可赋初始值用于回显
|
||||
const images = ref(<any>[]);
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
customerName: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请输入订单名称',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
customerCode: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请输入合法的IP地址',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
progress: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请选择跟进状态',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const { resetFields, validate, validateInfos } = useForm(form, rules);
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
// 去除空格
|
||||
form.customerName = form.customerName?.replace(/\s*/g, '');
|
||||
if(isUpdate.value == false) {
|
||||
form.userId = loginUser.value.userId;
|
||||
}
|
||||
const data = {
|
||||
...form
|
||||
};
|
||||
// 转字符串
|
||||
const saveOrUpdate = isUpdate.value ? updateCustomer : addCustomer;
|
||||
saveOrUpdate(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>
|
||||
715
src/views/yunxinwei/order/components/order-info.vue
Normal file
715
src/views/yunxinwei/order/components/order-info.vue
Normal file
@@ -0,0 +1,715 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="`80%`"
|
||||
:visible="visible"
|
||||
:confirm-loading="loading"
|
||||
:maxable="maxAble"
|
||||
:title="isUpdate ? '编辑订单' : '订单详情'"
|
||||
:body-style="{ paddingBottom: '8px', background: '#f3f3f3' }"
|
||||
@update:visible="updateVisible"
|
||||
:maskClosable="false"
|
||||
:footer="null"
|
||||
@ok="save"
|
||||
>
|
||||
<a-card class="order-card" :bordered="false">
|
||||
<a-steps
|
||||
:current="active"
|
||||
direction="horizontal"
|
||||
:responsive="styleResponsive"
|
||||
>
|
||||
<template v-for="(item, index) in steps" :key="index">
|
||||
<a-step
|
||||
:title="item.title"
|
||||
:description="timeAgo(item.description)"
|
||||
/>
|
||||
</template>
|
||||
</a-steps>
|
||||
</a-card>
|
||||
<a-card title="订单操作" class="order-card">
|
||||
<a-space>
|
||||
<a-button>发货</a-button>
|
||||
<a-button>商家备注</a-button>
|
||||
<a-button>打印小票</a-button>
|
||||
</a-space>
|
||||
<a-row :gutter="16" style="margin-top: 34px">
|
||||
<a-col
|
||||
v-bind="
|
||||
styleResponsive
|
||||
? { xl: 8, lg: 12, md: 12, sm: 24, xs: 24 }
|
||||
: { span: 8 }
|
||||
"
|
||||
>
|
||||
<a-form-item label="订单编号" name="orderNo">
|
||||
<span>{{ data.orderNo }}</span>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col
|
||||
v-bind="
|
||||
styleResponsive
|
||||
? { xl: 8, lg: 12, md: 12, sm: 24, xs: 24 }
|
||||
: { span: 8 }
|
||||
"
|
||||
>
|
||||
<a-form-item label="实付款金额" name="payPrice">
|
||||
<span class="ele-text-warning">¥{{ formatNumber(data.payPrice) }}</span>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col
|
||||
v-bind="
|
||||
styleResponsive
|
||||
? { xl: 8, lg: 12, md: 12, sm: 24, xs: 24 }
|
||||
: { span: 8 }
|
||||
"
|
||||
>
|
||||
<a-form-item label="支付方式" name="payMethod">
|
||||
<Tag dict-code="payMethod" v-model:value="data.payMethod" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col
|
||||
v-bind="
|
||||
styleResponsive
|
||||
? { xl: 8, lg: 12, md: 12, sm: 24, xs: 24 }
|
||||
: { span: 8 }
|
||||
"
|
||||
>
|
||||
<a-form-item label="配送方式" name="deliveryType">
|
||||
<Tag dict-code="deliveryType" v-model:value="data.deliveryType" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col
|
||||
v-bind="
|
||||
styleResponsive
|
||||
? { xl: 8, lg: 12, md: 12, sm: 24, xs: 24 }
|
||||
: { span: 8 }
|
||||
"
|
||||
>
|
||||
<a-form-item label="运费金额" name="deliveryType">
|
||||
<span>¥{{ formatNumber(data.expressPrice) }}</span>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col
|
||||
v-bind="
|
||||
styleResponsive
|
||||
? { xl: 8, lg: 12, md: 12, sm: 24, xs: 24 }
|
||||
: { span: 8 }
|
||||
"
|
||||
>
|
||||
<a-form-item label="订单状态" name="orderStatus">
|
||||
<Tag dict-code="orderStatus" v-model:value="data.orderStatus" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col
|
||||
v-bind="
|
||||
styleResponsive
|
||||
? { xl: 8, lg: 12, md: 12, sm: 24, xs: 24 }
|
||||
: { span: 8 }
|
||||
"
|
||||
>
|
||||
<a-form-item label="买家信息" name="deliveryType">
|
||||
<router-link :to="'/system/user/details?id=' + data.userId">
|
||||
<span class="ele-text-primary">{{ data.nickname }}</span>
|
||||
</router-link>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col
|
||||
v-bind="
|
||||
styleResponsive
|
||||
? { xl: 8, lg: 12, md: 12, sm: 24, xs: 24 }
|
||||
: { span: 8 }
|
||||
"
|
||||
>
|
||||
<a-form-item label="第三方交易号" name="tradeId">
|
||||
<span>{{ data.tradeId }}</span>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col
|
||||
v-bind="
|
||||
styleResponsive
|
||||
? { xl: 8, lg: 12, md: 12, sm: 24, xs: 24 }
|
||||
: { span: 8 }
|
||||
"
|
||||
>
|
||||
<a-form-item label="设备编号" name="equipmentCode">
|
||||
<span>
|
||||
{{ bindEquipmentCode }}
|
||||
<copy-outlined
|
||||
style="padding-left: 4px"
|
||||
@click="copyText(bindEquipmentCode)"
|
||||
/>
|
||||
</span>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col
|
||||
v-bind="
|
||||
styleResponsive
|
||||
? { xl: 8, lg: 12, md: 12, sm: 24, xs: 24 }
|
||||
: { span: 8 }
|
||||
"
|
||||
>
|
||||
<a-form-item label="下单时间" name="createTime">
|
||||
{{ data.createTime }}
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col
|
||||
v-bind="
|
||||
styleResponsive
|
||||
? { xl: 8, lg: 12, md: 12, sm: 24, xs: 24 }
|
||||
: { span: 8 }
|
||||
"
|
||||
>
|
||||
<a-form-item label="到期时间" name="expirationTime">
|
||||
{{ data.expirationTime }}
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col
|
||||
v-bind="
|
||||
styleResponsive
|
||||
? { xl: 8, lg: 12, md: 12, sm: 24, xs: 24 }
|
||||
: { span: 8 }
|
||||
"
|
||||
>
|
||||
<a-form-item label="买家留言" name="buyerRemark">
|
||||
<span>{{ data.buyerRemark }}</span>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col
|
||||
v-bind="
|
||||
styleResponsive
|
||||
? { xl: 8, lg: 12, md: 12, sm: 24, xs: 24 }
|
||||
: { span: 8 }
|
||||
"
|
||||
>
|
||||
<a-form-item label="订单备注" name="comments">
|
||||
<span>{{ data.comments }}</span>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
<a-card title="订单商品" class="order-card">
|
||||
<a-spin :spinning="loading">
|
||||
<a-table
|
||||
:data-source="EquipmentOrderGoodsList"
|
||||
:columns="columns"
|
||||
:pagination="false"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'goodsName'">
|
||||
<a-image
|
||||
v-if="record.image"
|
||||
:src="record.image"
|
||||
:preview="false"
|
||||
:width="50"
|
||||
/>
|
||||
<span>{{ record.goodsName }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'batteryRent'">
|
||||
<div>电池租金:¥{{ record.batteryRent }}</div>
|
||||
<div>电池押金:¥{{ record.batteryDeposit }}</div>
|
||||
<div>电池保险:¥{{ record.batteryInsurance }}</div>
|
||||
</template>
|
||||
<template v-if="column.key === 'equipmentCategory'">
|
||||
<a-tag
|
||||
v-if="Number(record.equipmentCategory) === 10"
|
||||
color="success"
|
||||
>销售</a-tag
|
||||
>
|
||||
<a-tag v-if="Number(record.equipmentCategory) === 20" color="red"
|
||||
>分期</a-tag
|
||||
>
|
||||
<a-tag
|
||||
v-if="Number(record.equipmentCategory) === 30"
|
||||
color="orange"
|
||||
>以租代购</a-tag
|
||||
>
|
||||
<a-tag v-if="Number(record.equipmentCategory) === 40" color="blue"
|
||||
>租赁</a-tag
|
||||
>
|
||||
</template>
|
||||
<template v-if="column.key === 'more'">
|
||||
<div v-if="record.periodsType > 0">
|
||||
<span class="ele-text-placeholder">分期方式:</span>
|
||||
{{ record.periodsType === 0 ? '周' : '月' }}
|
||||
</div>
|
||||
<div v-if="record.periods > 0">
|
||||
<span class="ele-text-placeholder">分期期数:</span>
|
||||
{{ record.periods }}
|
||||
</div>
|
||||
<div v-if="record.downPayment">
|
||||
<span class="ele-text-placeholder">首付款:</span>
|
||||
{{ record.downPayment }}
|
||||
</div>
|
||||
<div v-if="record.repayment > 0">
|
||||
<span class="ele-text-placeholder">每期还款:</span>
|
||||
{{ record.repayment }}
|
||||
</div>
|
||||
<div v-if="record.serviceCharges > 0">
|
||||
<span class="ele-text-placeholder">手续费:</span>
|
||||
{{ record.serviceCharges }}
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-spin>
|
||||
</a-card>
|
||||
<a-card title="换电记录" class="order-card">
|
||||
<a-spin :spinning="loading">
|
||||
<a-table
|
||||
:data-source="equipmentRecordList"
|
||||
:columns="columns3"
|
||||
ref="tableRef3"
|
||||
:pagination="false"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'batteryModel'">
|
||||
<div>电池租金:¥{{ record.batteryDeposit }}</div>
|
||||
<div>电池押金:¥{{ record.batteryDeposit }}</div>
|
||||
<div>电池保险:¥{{ record.batteryInsurance }}</div>
|
||||
</template>
|
||||
<template v-if="column.key === 'expirationDay'">
|
||||
<span class="ele-text-danger">{{ expirationDay(record) }}</span>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-spin>
|
||||
</a-card>
|
||||
<a-card title="续费订单" class="order-card">
|
||||
<a-spin :spinning="loading">
|
||||
<a-table
|
||||
:data-source="renewOrderList"
|
||||
:columns="columns2"
|
||||
ref="tableRef2"
|
||||
:pagination="false"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'batteryModel'">
|
||||
<div>电池租金:¥{{ record.batteryDeposit }}</div>
|
||||
<div>电池押金:¥{{ record.batteryDeposit }}</div>
|
||||
<div>电池保险:¥{{ record.batteryInsurance }}</div>
|
||||
</template>
|
||||
<template v-if="column.key === 'expirationTime'">
|
||||
<div>{{ record.startTime }}</div>
|
||||
<div>{{ record.expirationTime}}</div>
|
||||
</template>
|
||||
<template v-if="column.key === 'expirationDay'">
|
||||
<span class="ele-text-danger">{{ expirationDay(record) }}</span>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-spin>
|
||||
</a-card>
|
||||
<a-card title="订单附件" class="order-card">
|
||||
<a-spin :spinning="loading">
|
||||
<ele-image-upload
|
||||
v-model:value="files"
|
||||
disabled
|
||||
:item-style="{ width: '150px', height: '99px' }"
|
||||
/>
|
||||
</a-spin>
|
||||
</a-card>
|
||||
<a-card title="买家收货地址" class="order-card">
|
||||
<a-row :gutter="16">
|
||||
<a-col
|
||||
v-bind="
|
||||
styleResponsive
|
||||
? { xl: 8, lg: 12, md: 12, sm: 24, xs: 24 }
|
||||
: { span: 8 }
|
||||
"
|
||||
>
|
||||
<a-form-item label="收货人姓名" name="orderNo">
|
||||
<router-link :to="'/system/user/details?id=' + data.userId">
|
||||
<span class="ele-text-primary">{{ data.nickname }}</span>
|
||||
</router-link>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col
|
||||
v-bind="
|
||||
styleResponsive
|
||||
? { xl: 8, lg: 12, md: 12, sm: 24, xs: 24 }
|
||||
: { span: 8 }
|
||||
"
|
||||
>
|
||||
<a-form-item label="联系电话" name="payPrice" />
|
||||
</a-col>
|
||||
<a-col
|
||||
v-bind="
|
||||
styleResponsive
|
||||
? { xl: 8, lg: 12, md: 12, sm: 24, xs: 24 }
|
||||
: { span: 8 }
|
||||
"
|
||||
>
|
||||
<a-form-item label="所在地区" name="payMethod" />
|
||||
</a-col>
|
||||
<a-col
|
||||
v-bind="
|
||||
styleResponsive
|
||||
? { xl: 8, lg: 12, md: 12, sm: 24, xs: 24 }
|
||||
: { span: 8 }
|
||||
"
|
||||
>
|
||||
<a-form-item label="详细地址" name="payMethod" />
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Form } from 'ant-design-vue';
|
||||
import { assignObject, EleProTable, timeAgo } from 'ele-admin-pro';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { formatNumber } from 'ele-admin-pro/es';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { copyText } from '@/utils/common';
|
||||
import { Order } from '@/api/order/model';
|
||||
import { listEquipmentOrderGoods } from '@/api/apps/equipment/order/goods';
|
||||
import { EquipmentOrderGoods } from '@/api/apps/equipment/order/goods/model';
|
||||
import * as EquipmentApi from '@/api/apps/equipment';
|
||||
import * as EquipmentRecordApi from '@/api/apps/equipment/record';
|
||||
import { ColumnItem } from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import { listOrder } from '@/api/order';
|
||||
import { CopyOutlined } from '@ant-design/icons-vue';
|
||||
import { EquipmentRecord } from '@/api/apps/equipment/record/model';
|
||||
|
||||
const useForm = Form.useForm;
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: Order | null;
|
||||
}>();
|
||||
|
||||
export interface step {
|
||||
title?: String | undefined;
|
||||
subTitle?: String | undefined;
|
||||
description?: String | undefined;
|
||||
}
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
// 是否显示最大化切换按钮
|
||||
const maxAble = ref(true);
|
||||
const EquipmentOrderGoodsList = ref<EquipmentOrderGoods[]>([]);
|
||||
const renewOrderList = ref<Order[]>([]);
|
||||
const equipmentRecordList = ref<EquipmentRecord[]>([]);
|
||||
const bindEquipmentCode = ref<string>();
|
||||
const files = ref<any[]>();
|
||||
|
||||
// 步骤条
|
||||
const steps = ref<step[]>([
|
||||
{
|
||||
title: '下单',
|
||||
description: undefined
|
||||
},
|
||||
{
|
||||
title: '付款',
|
||||
description: undefined
|
||||
},
|
||||
{
|
||||
title: '发货',
|
||||
description: undefined
|
||||
},
|
||||
{
|
||||
title: '收货',
|
||||
description: undefined
|
||||
},
|
||||
{
|
||||
title: '完成',
|
||||
description: undefined
|
||||
}
|
||||
]);
|
||||
const active = ref(2);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 订单信息
|
||||
const order = reactive<Order>({
|
||||
orderId: undefined,
|
||||
orderNo: '',
|
||||
userId: undefined,
|
||||
orderSourceData: ''
|
||||
});
|
||||
|
||||
// 请求状态
|
||||
const loading = ref(true);
|
||||
|
||||
const { resetFields } = useForm(order);
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
const columns = ref<ColumnItem[]>([
|
||||
// {
|
||||
// title: '商品ID',
|
||||
// dataIndex: 'goodsId'
|
||||
// },
|
||||
{
|
||||
title: '商品信息',
|
||||
dataIndex: 'goodsName',
|
||||
key: 'goodsName'
|
||||
},
|
||||
{
|
||||
title: '下单方式',
|
||||
dataIndex: 'equipmentCategory',
|
||||
key: 'equipmentCategory'
|
||||
},
|
||||
{
|
||||
title: '电池型号',
|
||||
dataIndex: 'batteryModel',
|
||||
key: 'batteryModel'
|
||||
},
|
||||
{
|
||||
title: '电池价格',
|
||||
dataIndex: 'batteryPrice',
|
||||
key: 'batteryPrice',
|
||||
customRender: ({ text }) => '¥' + text
|
||||
},
|
||||
{
|
||||
title: '电池租金',
|
||||
dataIndex: 'batteryRent',
|
||||
key: 'batteryRent',
|
||||
customRender: ({ text }) => '¥' + text
|
||||
},
|
||||
{
|
||||
title: '分期方案',
|
||||
dataIndex: 'more',
|
||||
key: 'more'
|
||||
},
|
||||
{
|
||||
title: '购买数量',
|
||||
dataIndex: 'num',
|
||||
key: 'num',
|
||||
customRender: ({}) => 1
|
||||
}
|
||||
]);
|
||||
|
||||
// 表格实例
|
||||
const tableRef2 = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
const columns2 = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '当前期数',
|
||||
dataIndex: 'index',
|
||||
key: 'index',
|
||||
customRender: ({ index }) => {
|
||||
return '第' + (index + 1) + '期';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '订单金额',
|
||||
dataIndex: 'orderPrice',
|
||||
key: 'orderPrice',
|
||||
customRender: ({ text }) => '¥' + text
|
||||
},
|
||||
{
|
||||
title: '设备租金',
|
||||
dataIndex: 'batteryModel',
|
||||
key: 'batteryModel'
|
||||
},
|
||||
{
|
||||
title: '有效期限',
|
||||
dataIndex: 'expirationTime',
|
||||
key: 'expirationTime'
|
||||
},
|
||||
{
|
||||
title: '付款时间',
|
||||
dataIndex: 'payTime',
|
||||
key: 'payTime'
|
||||
},
|
||||
{
|
||||
title: '逾期状态',
|
||||
dataIndex: 'expirationDay',
|
||||
key: 'expirationDay'
|
||||
}
|
||||
]);
|
||||
const columns3 = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '设备编号',
|
||||
dataIndex: 'equipmentCode',
|
||||
key: 'equipmentCode'
|
||||
},
|
||||
{
|
||||
title: '所属门店',
|
||||
dataIndex: 'merchantName',
|
||||
key: 'merchantName'
|
||||
},
|
||||
{
|
||||
title: '事件类型',
|
||||
dataIndex: 'eventType',
|
||||
key: 'eventType'
|
||||
},
|
||||
{
|
||||
title: '使用电池',
|
||||
dataIndex: 'use'
|
||||
},
|
||||
{
|
||||
title: '操作人',
|
||||
dataIndex: 'nickname',
|
||||
key: 'nickname'
|
||||
},
|
||||
{
|
||||
title: '操作时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime'
|
||||
}
|
||||
]);
|
||||
|
||||
/* 制作步骤条 */
|
||||
const loadSteps = (order) => {
|
||||
steps.value = [];
|
||||
steps.value.push({
|
||||
title: '下单'
|
||||
});
|
||||
steps.value.push({
|
||||
title: '付款'
|
||||
});
|
||||
steps.value.push({
|
||||
title: '发货'
|
||||
});
|
||||
steps.value.push({
|
||||
title: '收货'
|
||||
});
|
||||
steps.value.push({
|
||||
title: '完成'
|
||||
});
|
||||
|
||||
// 下单
|
||||
if (order.payStatus == 10) {
|
||||
active.value = 0;
|
||||
steps.value[0].description = order.createTime;
|
||||
}
|
||||
// 付款
|
||||
if (order.payStatus == 20) {
|
||||
active.value = 1;
|
||||
steps.value[0].description = order.createTime;
|
||||
steps.value[1].description = order.payTime;
|
||||
}
|
||||
// 发货
|
||||
if (order.payStatus == 20 && order.deliveryStatus == 20) {
|
||||
active.value = 2;
|
||||
steps.value[0].description = order.createTime;
|
||||
steps.value[1].description = order.payTime;
|
||||
steps.value[2].description = order.deliveryTime;
|
||||
}
|
||||
// 收货
|
||||
if (order.payStatus == 20 && order.receiptStatus == 20) {
|
||||
active.value = 3;
|
||||
steps.value[0].description = order.createTime;
|
||||
steps.value[1].description = order.payTime;
|
||||
steps.value[2].description = order.deliveryTime;
|
||||
steps.value[3].description = order.receiptTime;
|
||||
}
|
||||
// 完成
|
||||
if (order.payStatus == 20 && order.orderStatus == 30) {
|
||||
active.value = 4;
|
||||
steps.value[0].description = order.createTime;
|
||||
steps.value[1].description = order.payTime;
|
||||
steps.value[2].description = order.deliveryTime;
|
||||
steps.value[3].description = order.receiptTime;
|
||||
}
|
||||
// 已取消
|
||||
if (order.orderStatus == 20) {
|
||||
active.value = 4;
|
||||
}
|
||||
};
|
||||
|
||||
const getEquipmentOrderGoods = () => {
|
||||
const orderId = props.data?.orderId;
|
||||
const goodsId = props.data?.goodsId;
|
||||
listEquipmentOrderGoods({ orderId,goodsId }).then((data) => {
|
||||
EquipmentOrderGoodsList.value = data;
|
||||
});
|
||||
};
|
||||
|
||||
const getEquipment = () => {
|
||||
EquipmentApi.listEquipment({ orderId: order.orderId }).then((data) => {
|
||||
if (data.length > 0) {
|
||||
bindEquipmentCode.value = data[0].equipmentCode;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const getRenewOrder = () => {
|
||||
loading.value = true;
|
||||
listOrder({
|
||||
rentOrderId: order.orderId,
|
||||
payStatus: 20
|
||||
}).then((data) => {
|
||||
renewOrderList.value = data;
|
||||
loading.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
const getEquipmentRecordList = () => {
|
||||
EquipmentRecordApi.listEquipmentRecord({
|
||||
orderId: order.orderId,
|
||||
userId: order.userId
|
||||
}).then((data) => {
|
||||
equipmentRecordList.value = data;
|
||||
});
|
||||
};
|
||||
|
||||
const expirationDay = (order) => {
|
||||
const setTime = new Date(order.expirationTime);
|
||||
const nowTime = new Date(order.payTime);
|
||||
const restSec = setTime.getTime() - nowTime.getTime();
|
||||
// 剩余天数
|
||||
const day = parseInt(String(restSec / (60 * 60 * 24 * 1000)));
|
||||
if (day < 0) {
|
||||
return '逾期' + Math.abs(day) + '天';
|
||||
}
|
||||
};
|
||||
|
||||
const getFiles = () => {
|
||||
if (order.orderSourceData != '') {
|
||||
const array = JSON.parse(<string>order.orderSourceData);
|
||||
files.value = array.map((url, id) => {
|
||||
return {
|
||||
id: id,
|
||||
url: url,
|
||||
status: 'done'
|
||||
};
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
if (props.data) {
|
||||
loading.value = false;
|
||||
assignObject(order, props.data);
|
||||
loadSteps(props.data);
|
||||
getFiles();
|
||||
getEquipmentOrderGoods();
|
||||
getRenewOrder();
|
||||
getEquipment();
|
||||
getEquipmentRecordList();
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.order-card {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.ant-form-item {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
</style>
|
||||
159
src/views/yunxinwei/order/components/search.vue
Normal file
159
src/views/yunxinwei/order/components/search.vue
Normal file
@@ -0,0 +1,159 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<a-space :size="10" style="flex-wrap: wrap">
|
||||
<a-radio-group v-model:value="listType" @change="handleTabs">
|
||||
<a-radio-button :value="0">全部订单</a-radio-button>
|
||||
<a-radio-button :value="1">待发货</a-radio-button>
|
||||
<a-radio-button :value="2">待收货</a-radio-button>
|
||||
<a-radio-button :value="3">待付款</a-radio-button>
|
||||
<a-radio-button :value="4">已完成</a-radio-button>
|
||||
<a-radio-button :value="5">已取消</a-radio-button>
|
||||
</a-radio-group>
|
||||
<a-button
|
||||
danger
|
||||
type="primary"
|
||||
class="ele-btn-icon"
|
||||
:disabled="selection.length === 0"
|
||||
@click="removeBatch"
|
||||
>
|
||||
<template #icon>
|
||||
<delete-outlined />
|
||||
</template>
|
||||
<span>批量删除</span>
|
||||
</a-button>
|
||||
<a-range-picker
|
||||
v-model:value="dateRange"
|
||||
value-format="YYYY-MM-DD"
|
||||
class="ele-fluid"
|
||||
/>
|
||||
<a-input-search
|
||||
allow-clear
|
||||
placeholder="请输入关键词"
|
||||
v-model:value="searchText"
|
||||
@pressEnter="search"
|
||||
@search="search"
|
||||
>
|
||||
<template #addonBefore>
|
||||
<a-select v-model:value="type" style="width: 100px; margin: -5px -12px">
|
||||
<a-select-option value="keywords">模糊搜索</a-select-option>
|
||||
<a-select-option value="orderNo">订单号</a-select-option>
|
||||
<a-select-option value="merchantCode">商户编号</a-select-option>
|
||||
<a-select-option value="userId">用户ID</a-select-option>
|
||||
</a-select>
|
||||
</template>
|
||||
</a-input-search>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import useSearch from '@/utils/use-search';
|
||||
import { ref, watch } from 'vue';
|
||||
import { OrderParam } from '@/api/order/model';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: OrderParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'advanced'): void;
|
||||
}>();
|
||||
|
||||
// 表单数据
|
||||
const { where, resetFields } = useSearch<OrderParam>({
|
||||
orderNo: undefined,
|
||||
userId: undefined,
|
||||
payStatus: undefined,
|
||||
deliveryStatus: undefined,
|
||||
orderStatus: undefined
|
||||
});
|
||||
// 下来选项
|
||||
const type = ref('keywords');
|
||||
// 搜索内容
|
||||
const searchText = ref('');
|
||||
// 日期范围选择
|
||||
const dateRange = ref<[string, string]>(['', '']);
|
||||
const listType = ref<number>(0);
|
||||
|
||||
/* 搜索 */
|
||||
const search = () => {
|
||||
const [d1, d2] = dateRange.value ?? [];
|
||||
if (type.value == 'orderNo') {
|
||||
where.orderNo = searchText.value;
|
||||
where.userId = undefined;
|
||||
}
|
||||
if (type.value == 'userId') {
|
||||
where.userId = searchText.value;
|
||||
where.orderNo = undefined;
|
||||
}
|
||||
if (type.value == 'merchantCode') {
|
||||
where.merchantCode = searchText.value;
|
||||
where.orderNo = undefined;
|
||||
}
|
||||
if (type.value == 'keywords') {
|
||||
where.keywords = searchText.value;
|
||||
}
|
||||
emit('search', {
|
||||
...where,
|
||||
createTimeStart: d1 ? d1 + ' 00:00:00' : '',
|
||||
createTimeEnd: d2 ? d2 + ' 23:59:59' : ''
|
||||
});
|
||||
};
|
||||
|
||||
// 批量删除
|
||||
const removeBatch = () => {
|
||||
emit('remove');
|
||||
};
|
||||
|
||||
const handleTabs = (e) => {
|
||||
resetFields();
|
||||
const listType = Number(e.target.value);
|
||||
// 全部订单
|
||||
if (listType == 0) {
|
||||
console.log('全部订单');
|
||||
}
|
||||
// 待发货
|
||||
if (listType == 1) {
|
||||
console.log('待发货');
|
||||
where.payStatus = 20;
|
||||
where.deliveryStatus = 10;
|
||||
}
|
||||
// 待收货
|
||||
if (listType == 2) {
|
||||
console.log('待发货');
|
||||
where.payStatus = 20;
|
||||
where.deliveryStatus = 20;
|
||||
where.receiptStatus = 10;
|
||||
}
|
||||
// 待付款
|
||||
if (listType == 3) {
|
||||
console.log('待付款');
|
||||
where.payStatus = 10;
|
||||
}
|
||||
// 已完成
|
||||
if (listType == 4) {
|
||||
console.log('已完成');
|
||||
where.payStatus = 20;
|
||||
where.orderStatus = 30;
|
||||
}
|
||||
// 已取消
|
||||
if (listType == 5) {
|
||||
console.log('已取消');
|
||||
where.orderStatus = 20;
|
||||
}
|
||||
emit('search', {
|
||||
...where
|
||||
});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
</script>
|
||||
545
src/views/yunxinwei/order/index.vue
Normal file
545
src/views/yunxinwei/order/index.vue
Normal file
@@ -0,0 +1,545 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<div class="ele-body">
|
||||
<a-card :bordered="false">
|
||||
<!-- 表格 -->
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="orderId"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
v-model:selection="selection"
|
||||
:customRow="customRow"
|
||||
tool-class="ele-toolbar-form"
|
||||
:scroll="{ x: 1200 }"
|
||||
class="sys-org-table"
|
||||
:striped="true"
|
||||
>
|
||||
<template #toolbar>
|
||||
<search
|
||||
@search="reload"
|
||||
:selection="selection"
|
||||
@add="openEdit"
|
||||
@remove="removeBatch"
|
||||
@advanced="openAdvanced"
|
||||
/>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'merchantName'">
|
||||
<div style="display: flex; flex-direction: column">
|
||||
<span>{{ record.merchantName }}</span>
|
||||
<span class="ele-text-placeholder">
|
||||
{{ record.merchantCode }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="column.key === 'totalPrice'">
|
||||
<p>
|
||||
<span class="ele-text-warning price-edit">
|
||||
¥{{ record.totalPrice }}
|
||||
</span>
|
||||
<form-outlined
|
||||
v-if="record.payStatus === 10"
|
||||
@click="onEdit('totalPrice', record.totalPrice, record)"
|
||||
/></p>
|
||||
<p class="ele-text-placeholder"
|
||||
>(含运费:¥{{ record.expressPrice }})</p
|
||||
>
|
||||
</template>
|
||||
<template v-if="column.key === 'goods'">
|
||||
<template v-if="record.equipment">
|
||||
<p class="ele-text">{{ record.equipment.equipmentName }}</p>
|
||||
<p class="ele-text">{{ record.equipment.batteryModel }}</p>
|
||||
<p class="ele-text">{{ record.equipment.equipmentCode }}</p>
|
||||
</template>
|
||||
</template>
|
||||
<template v-if="column.key === 'payMethod'">
|
||||
<a-tag v-if="record.payMethod === '10'" color="orange"
|
||||
>余额支付</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payMethod === '20'" color="green"
|
||||
>微信支付</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payMethod === '30'" color="blue"
|
||||
>支付宝</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payMethod === '40'" color="purple"
|
||||
>通联支付</a-tag
|
||||
>
|
||||
</template>
|
||||
<template v-if="column.key === 'deliveryType'">
|
||||
<span v-if="record.deliveryType === 10">快递配送</span>
|
||||
<span v-if="record.deliveryType === 20">门店自提</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'payStatus'">
|
||||
<div class="ele-text-placeholder">
|
||||
付款状态:
|
||||
<a-tag
|
||||
v-if="record.payStatus === 10"
|
||||
@click="onAlipayQuery(record.orderId)"
|
||||
>未付款</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payStatus === 20" color="green"
|
||||
>已付款</a-tag
|
||||
>
|
||||
</div>
|
||||
<div class="ele-text-placeholder">
|
||||
发货状态:
|
||||
<a-tag v-if="record.deliveryStatus === 10">未发货</a-tag>
|
||||
<a-tag v-if="record.deliveryStatus === 20" color="success"
|
||||
>已发货</a-tag
|
||||
>
|
||||
</div>
|
||||
<div class="ele-text-placeholder">
|
||||
收货状态:
|
||||
<a-tag v-if="record.receiptStatus === 10">未收货</a-tag>
|
||||
<a-tag v-if="record.receiptStatus === 20" color="success"
|
||||
>已收货</a-tag
|
||||
>
|
||||
<a-tag v-if="record.receiptStatus === 30" color="error"
|
||||
>已退租</a-tag
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="column.key === 'comments'">
|
||||
<FormOutlined
|
||||
@click="onEditContent('comments', record.comments, record)"
|
||||
/>
|
||||
<a-popover placement="topLeft">
|
||||
<template #content>
|
||||
<div class="comments">{{ record.comments }}</div>
|
||||
</template>
|
||||
{{ record.comments }}
|
||||
</a-popover>
|
||||
</template>
|
||||
<template v-if="column.key === 'orderSourceData'">
|
||||
<a-image-preview-group v-if="record.orderSourceData">
|
||||
<a-image
|
||||
:width="45"
|
||||
v-for="(item, index) in JSON.parse(record.orderSourceData)"
|
||||
:key="index"
|
||||
:src="item"
|
||||
/>
|
||||
</a-image-preview-group>
|
||||
<!-- <a-image-->
|
||||
<!-- v-if="record.orderSourceData"-->
|
||||
<!-- :src="JSON.parse(record.orderSourceData)"-->
|
||||
<!-- :width="45"-->
|
||||
<!-- />-->
|
||||
</template>
|
||||
<template v-if="column.key === 'status'">
|
||||
<a-tag v-if="record.status === '0'" color="green">正常</a-tag>
|
||||
<a-tag v-if="record.status === '1'" color="red">禁用</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'orderSource'">
|
||||
<a-tag v-if="Number(record.orderSource) === 10" color="success"
|
||||
>销售</a-tag
|
||||
>
|
||||
<a-tag v-if="Number(record.orderSource) === 20" color="red"
|
||||
>分期</a-tag
|
||||
>
|
||||
<a-tag v-if="Number(record.orderSource) === 30" color="orange"
|
||||
>以租代购</a-tag
|
||||
>
|
||||
<a-tag v-if="Number(record.orderSource) === 40" color="blue"
|
||||
>租赁</a-tag
|
||||
>
|
||||
<a-tag v-if="Number(record.orderSource) === 50" color="success"
|
||||
>续租</a-tag
|
||||
>
|
||||
</template>
|
||||
<template v-if="column.key === 'nickname'">
|
||||
<User :record="record" />
|
||||
</template>
|
||||
<template v-if="column.key === 'createTime'">
|
||||
{{ record.createTime }}
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a-button @click="openInfo(record)">详情</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</a-card>
|
||||
</div>
|
||||
<!-- 编辑弹窗 -->
|
||||
<Delivery v-model:visible="deliveryEdit" :data="current" @done="reload" />
|
||||
<Markdown
|
||||
v-model:visible="showMarkdown"
|
||||
:data="data"
|
||||
:field="field"
|
||||
:orderId="orderId"
|
||||
:content="markdown"
|
||||
@done="reload"
|
||||
/>
|
||||
<Field
|
||||
v-model:visible="showEdit"
|
||||
:data="data"
|
||||
:field="field"
|
||||
:orderId="orderId"
|
||||
:content="content"
|
||||
@done="reload"
|
||||
/>
|
||||
<!-- 编辑弹窗 -->
|
||||
<!-- <order-edit v-model:visible="showEdit" :data="current" @done="reload" />-->
|
||||
<!-- 用户详情 -->
|
||||
<order-info v-model:visible="showInfo" :data="current" @done="reload" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import {
|
||||
// PlusOutlined,
|
||||
// DeleteOutlined,
|
||||
FormOutlined,
|
||||
ExclamationCircleOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
import type { EleProTable } from 'ele-admin-pro';
|
||||
import type {
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import { toDateString } from 'ele-admin-pro';
|
||||
import Search from './components/search.vue';
|
||||
import Delivery from './components/delivery.vue';
|
||||
import Markdown from './components/markdown.vue';
|
||||
import Field from './components/field.vue';
|
||||
import OrderInfo from './components/order-info.vue';
|
||||
import { pageOrder, removeOrder, removeBatchOrder } from '@/api/order';
|
||||
import { alipayQuery } from '@/api/system/payment';
|
||||
import type { Order, OrderParam } from '@/api/order/model';
|
||||
import { getDictionaryOptions } from '@/utils/common';
|
||||
|
||||
// 当前用户信息
|
||||
// const userStore = useUserStore();
|
||||
// const loginUser = computed(() => userStore.info ?? {});
|
||||
// const orderType = localStorage.getItem('orderType');
|
||||
defineProps<{
|
||||
activeKey?: boolean;
|
||||
data?: any;
|
||||
}>();
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
/* 获取字典数据 */
|
||||
const orderSource = getDictionaryOptions('equipmentCategory');
|
||||
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
key: 'index',
|
||||
width: 48,
|
||||
align: 'center',
|
||||
fixed: 'left',
|
||||
hideInSetting: true,
|
||||
hideInTable: true,
|
||||
customRender: ({ index }) => index + (tableRef.value?.tableIndex ?? 0)
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 100,
|
||||
align: 'center',
|
||||
fixed: 'left',
|
||||
hideInSetting: true
|
||||
},
|
||||
{
|
||||
title: '订单号',
|
||||
dataIndex: 'orderId',
|
||||
key: 'orderId',
|
||||
sorter: true
|
||||
},
|
||||
{
|
||||
title: '商品编号',
|
||||
dataIndex: 'goodsId',
|
||||
key: 'goodsId'
|
||||
},
|
||||
{
|
||||
title: '所属商户',
|
||||
dataIndex: 'merchantName',
|
||||
key: 'merchantName',
|
||||
sorter: true
|
||||
},
|
||||
{
|
||||
title: '下单方式',
|
||||
key: 'orderSource',
|
||||
dataIndex: 'orderSource',
|
||||
filters: orderSource,
|
||||
filterMultiple: false
|
||||
},
|
||||
{
|
||||
title: '买家',
|
||||
dataIndex: 'nickname',
|
||||
key: 'nickname',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '订单金额(元)',
|
||||
dataIndex: 'totalPrice',
|
||||
key: 'totalPrice',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '支付方式',
|
||||
key: 'payMethod',
|
||||
dataIndex: 'payMethod',
|
||||
filters: [
|
||||
{
|
||||
text: '余额支付',
|
||||
value: 10
|
||||
},
|
||||
{
|
||||
text: '微信支付',
|
||||
value: 20
|
||||
},
|
||||
{
|
||||
text: '支付宝',
|
||||
value: 30
|
||||
},
|
||||
{
|
||||
text: '通联支付',
|
||||
value: 40
|
||||
}
|
||||
],
|
||||
filterMultiple: false
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
dataIndex: 'comments',
|
||||
key: 'comments',
|
||||
ellipsis: true
|
||||
},
|
||||
// {
|
||||
// title: '订单附件',
|
||||
// dataIndex: 'orderSourceData',
|
||||
// key: 'orderSourceData'
|
||||
// },
|
||||
{
|
||||
title: '配送方式',
|
||||
key: 'deliveryType',
|
||||
dataIndex: 'deliveryType',
|
||||
hideInTable: true,
|
||||
filters: [
|
||||
{
|
||||
text: '快递配送',
|
||||
value: 10
|
||||
},
|
||||
{
|
||||
text: '门店自提',
|
||||
value: 20
|
||||
}
|
||||
],
|
||||
filterMultiple: false
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
sorter: true,
|
||||
customRender: ({ text }) => toDateString(text)
|
||||
},
|
||||
{
|
||||
title: '交易状态',
|
||||
key: 'payStatus',
|
||||
dataIndex: 'payStatus',
|
||||
fixed: 'right',
|
||||
align: 'center',
|
||||
filters: [
|
||||
{
|
||||
text: '未付款',
|
||||
value: 10
|
||||
},
|
||||
{
|
||||
text: '已付款',
|
||||
value: 20
|
||||
}
|
||||
],
|
||||
filterMultiple: false
|
||||
}
|
||||
]);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<Order[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<Order | null>(null);
|
||||
// 是否显示资产详情
|
||||
const showInfo = ref(false);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
const markdown = ref('请输入备注内容');
|
||||
const content = ref('请输入要修改的内容');
|
||||
const showMarkdown = ref(false);
|
||||
const deliveryEdit = ref(false);
|
||||
const field = ref('comments');
|
||||
const orderId = ref(undefined);
|
||||
// 是否显示高级搜索
|
||||
const showAdvancedSearch = ref(false);
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
page,
|
||||
limit,
|
||||
where,
|
||||
orders,
|
||||
filters
|
||||
}) => {
|
||||
// 搜索条件
|
||||
if (filters.payMethod) {
|
||||
where.payMethod = filters.payMethod;
|
||||
}
|
||||
if (filters.deliveryType) {
|
||||
where.deliveryType = filters.deliveryType;
|
||||
}
|
||||
if (filters.payStatus) {
|
||||
where.payStatus = filters.payStatus;
|
||||
}
|
||||
if (filters.orderSource) {
|
||||
where.orderSource = filters.orderSource;
|
||||
}
|
||||
where.tenantId = localStorage.getItem('tenantId');
|
||||
where.isRenew = 0;
|
||||
return pageOrder({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: OrderParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
const onEdit = (name, text, item) => {
|
||||
orderId.value = item.orderId;
|
||||
field.value = name;
|
||||
content.value = text;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
const onEditContent = (name, text, item) => {
|
||||
orderId.value = item.orderId;
|
||||
field.value = name;
|
||||
markdown.value = text;
|
||||
showMarkdown.value = true;
|
||||
};
|
||||
|
||||
const openDelivery = (row?: Order) => {
|
||||
current.value = row ?? null;
|
||||
deliveryEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: Order) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开用户详情弹窗 */
|
||||
const openInfo = (row?: Order) => {
|
||||
current.value = row ?? null;
|
||||
showInfo.value = true;
|
||||
};
|
||||
|
||||
/* 打开高级搜索 */
|
||||
const openAdvanced = () => {
|
||||
showAdvancedSearch.value = !showAdvancedSearch.value;
|
||||
};
|
||||
|
||||
/* 支付宝统一收单交易查询 */
|
||||
const onAlipayQuery = (orderNo) => {
|
||||
alipayQuery(orderNo).then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: Order) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeOrder(row.orderId)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
/* 批量删除 */
|
||||
const removeBatch = () => {
|
||||
console.log(selection.value);
|
||||
if (!selection.value.length) {
|
||||
message.error('请至少选择一条数据');
|
||||
return;
|
||||
}
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要删除选中的记录吗?',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
maskClosable: true,
|
||||
onOk: () => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeBatchOrder(selection.value.map((d) => d.orderId))
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* 自定义行属性 */
|
||||
const customRow = (record: Order) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openInfo(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'ShopOrderIndex'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
p {
|
||||
line-height: 0.8;
|
||||
}
|
||||
.sys-org-table :deep(.ant-table-body) {
|
||||
overflow: auto !important;
|
||||
overflow: overlay !important;
|
||||
}
|
||||
|
||||
.sys-org-table :deep(.ant-table-pagination.ant-pagination) {
|
||||
padding: 0 4px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.price-edit {
|
||||
padding-right: 5px;
|
||||
}
|
||||
.comments {
|
||||
max-width: 200px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user