|
|
@@ -2,20 +2,47 @@
|
|
|
import type { VbenFormProps } from '@vben/common-ui';
|
|
|
|
|
|
import type { VxeGridListeners, VxeGridProps } from '#/adapter/vxe-table';
|
|
|
+import type { OrdersQueryParams } from '#/api/orders';
|
|
|
|
|
|
-import { h } from 'vue';
|
|
|
+import { h, onMounted, ref } from 'vue';
|
|
|
|
|
|
import { Page, useVbenModal } from '@vben/common-ui';
|
|
|
-import { MdiDelete, MdiDetail, MdiEdit } from '@vben/icons';
|
|
|
+import { MdiDelete, MdiDetail } from '@vben/icons';
|
|
|
|
|
|
import { ElMessage, ElMessageBox, ElTag } from 'element-plus';
|
|
|
|
|
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
|
|
import { deleteOrdersApi, getOrdersListApi } from '#/api/orders';
|
|
|
+import { getCustomerListApi } from '#/api/user';
|
|
|
import { $t } from '#/locales';
|
|
|
|
|
|
import OrdersForm from './form.vue';
|
|
|
|
|
|
+const dealerOptions = ref<Array<{ label: string; value: string }>>([]);
|
|
|
+
|
|
|
+const fetchDealerOptions = async () => {
|
|
|
+ try {
|
|
|
+ const result = await getCustomerListApi({
|
|
|
+ usersnature: '渠道',
|
|
|
+ pageindex: 1,
|
|
|
+ rows: 999,
|
|
|
+ });
|
|
|
+ if (result && result.Data) {
|
|
|
+ dealerOptions.value = result.Data.map((item: any) => ({
|
|
|
+ label: item.usersname,
|
|
|
+ value: item.usersid,
|
|
|
+ }));
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('Failed to fetch dealer options:', error);
|
|
|
+ dealerOptions.value = [];
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+onMounted(async () => {
|
|
|
+ await fetchDealerOptions();
|
|
|
+});
|
|
|
+
|
|
|
const formOptions: VbenFormProps = {
|
|
|
// 默认展开
|
|
|
collapsed: true,
|
|
|
@@ -33,6 +60,38 @@ const formOptions: VbenFormProps = {
|
|
|
allowClear: true,
|
|
|
},
|
|
|
},
|
|
|
+ {
|
|
|
+ component: 'Input',
|
|
|
+ fieldName: 'ordersproductname',
|
|
|
+ label: '产品名称',
|
|
|
+ componentProps: {
|
|
|
+ placeholder: $t('ui.placeholder.input'),
|
|
|
+ allowClear: true,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Select',
|
|
|
+ fieldName: 'ordersuserid1',
|
|
|
+ label: '经销商',
|
|
|
+ componentProps: {
|
|
|
+ options: dealerOptions,
|
|
|
+ placeholder: $t('ui.placeholder.select'),
|
|
|
+ allowClear: true,
|
|
|
+ filterable: true,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'DatePicker',
|
|
|
+ fieldName: 'orderDateRange',
|
|
|
+ label: '下单时间',
|
|
|
+ componentProps: {
|
|
|
+ type: 'daterange',
|
|
|
+ startPlaceholder: '开始日期',
|
|
|
+ endPlaceholder: '结束日期',
|
|
|
+ valueFormat: 'YYYY-MM-DD', // 根据后端接口调整日期格式
|
|
|
+ allowClear: true,
|
|
|
+ },
|
|
|
+ },
|
|
|
],
|
|
|
wrapperClass: 'grid-cols-1 md:grid-cols-3 lg:grid-cols-5',
|
|
|
};
|
|
|
@@ -60,25 +119,29 @@ const gridOptions: VxeGridProps<any> = {
|
|
|
},
|
|
|
ajax: {
|
|
|
query: async ({ page }, formValues) => {
|
|
|
- return await getOrdersListApi({
|
|
|
+ const params: Record<string, any> = {
|
|
|
pageindex: page.currentPage,
|
|
|
rows: page.pageSize,
|
|
|
...formValues,
|
|
|
- });
|
|
|
+ };
|
|
|
+
|
|
|
+ return await getOrdersListApi(params as OrdersQueryParams);
|
|
|
},
|
|
|
},
|
|
|
},
|
|
|
|
|
|
columns: [
|
|
|
{ title: '订单号', field: 'ordersnumber', sortable: true },
|
|
|
- { title: '订单关联用户id', field: 'ordersuserid', sortable: true },
|
|
|
- { title: '订单关联产品id', field: 'ordersproductid', sortable: true },
|
|
|
+ // { title: '订单关联用户id', field: 'ordersuserid', sortable: true },
|
|
|
+ // { title: '订单关联产品id', field: 'ordersproductid', sortable: true },
|
|
|
{ title: '产品名称', field: 'ordersproductname', sortable: true },
|
|
|
+ { title: '产品型号', field: 'productsmodel', sortable: true },
|
|
|
{ title: '产品sn', field: 'ordersproductsn', sortable: true },
|
|
|
{ title: '订单总金额', field: 'orderstotalprice', sortable: true },
|
|
|
{ title: '订单优惠后金额', field: 'ordersdiscountprice', sortable: true },
|
|
|
{ title: '优惠金额', field: 'ordersyhprice', sortable: true },
|
|
|
{ title: '优惠卷id', field: 'orderscouponid', sortable: true },
|
|
|
+ { title: '经销商', field: 'ordersuserid1', sortable: true },
|
|
|
{
|
|
|
title: '订单状态',
|
|
|
field: 'ordersorderstatus',
|
|
|
@@ -110,7 +173,7 @@ const gridOptions: VxeGridProps<any> = {
|
|
|
],
|
|
|
};
|
|
|
|
|
|
-const gridEvents: VxeGridListeners<RowType> = {
|
|
|
+const gridEvents: VxeGridListeners<any> = {
|
|
|
cellDblclick: ({ row }) => {
|
|
|
handleDetail(row);
|
|
|
},
|
|
|
@@ -136,10 +199,10 @@ function handleCreate() {
|
|
|
}
|
|
|
|
|
|
/* 编辑 */
|
|
|
-function handleEdit(row: any) {
|
|
|
- modalApi.setState({ showCancelButton: true });
|
|
|
- modalApi.setData({ formType: 'edit', row }).open();
|
|
|
-}
|
|
|
+// function handleEdit(row: any) {
|
|
|
+// modalApi.setState({ showCancelButton: true });
|
|
|
+// modalApi.setData({ formType: 'edit', row }).open();
|
|
|
+// }
|
|
|
|
|
|
/* 详情 */
|
|
|
function handleDetail(row: any) {
|
|
|
@@ -188,7 +251,7 @@ async function handleDelete(row: any) {
|
|
|
class="!p-2"
|
|
|
/>
|
|
|
</el-tooltip>
|
|
|
- <el-tooltip
|
|
|
+ <!-- <el-tooltip
|
|
|
class="box-item"
|
|
|
effect="dark"
|
|
|
content="编辑"
|
|
|
@@ -200,7 +263,7 @@ async function handleDelete(row: any) {
|
|
|
:icon="MdiEdit"
|
|
|
class="!p-2"
|
|
|
/>
|
|
|
- </el-tooltip>
|
|
|
+ </el-tooltip> -->
|
|
|
<el-tooltip
|
|
|
class="box-item"
|
|
|
effect="dark"
|