Merge remote-tracking branch 'yudao/dev' into dev
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import type { VxeTableGridOptions } from '@vben/plugins/vxe-table';
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { h } from 'vue';
|
||||
@@ -63,7 +64,7 @@ setupVbenVxeTable({
|
||||
round: true,
|
||||
showOverflow: true,
|
||||
size: 'small',
|
||||
},
|
||||
} as VxeTableGridOptions,
|
||||
});
|
||||
|
||||
// 表格配置项可以用 cellRender: { name: 'CellImage' },
|
||||
|
||||
@@ -35,6 +35,9 @@ export namespace MallDeliveryPickUpStoreApi {
|
||||
|
||||
/** 绑定自提店员请求 */
|
||||
export interface BindStaffRequest {
|
||||
id?: number;
|
||||
/** 门店名称 */
|
||||
name: string;
|
||||
/** 门店编号 */
|
||||
storeId: number;
|
||||
/** 用户编号列表 */
|
||||
|
||||
@@ -176,13 +176,13 @@ export namespace MallOrderApi {
|
||||
/** 交易订单统计 */
|
||||
export interface OrderSummary {
|
||||
/** 订单数量 */
|
||||
orderCount?: number;
|
||||
orderCount: number;
|
||||
/** 订单金额 */
|
||||
orderPayPrice?: string;
|
||||
orderPayPrice: number;
|
||||
/** 退款单数 */
|
||||
afterSaleCount?: number;
|
||||
afterSaleCount: number;
|
||||
/** 退款金额 */
|
||||
afterSalePrice?: string;
|
||||
afterSalePrice: number;
|
||||
}
|
||||
|
||||
/** 订单发货请求 */
|
||||
|
||||
2
apps/web-antd/src/components/summary-card/index.ts
Normal file
2
apps/web-antd/src/components/summary-card/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default as SummaryCard } from './summary-card.vue';
|
||||
export type { SummaryCardProps } from './typing';
|
||||
52
apps/web-antd/src/components/summary-card/summary-card.vue
Normal file
52
apps/web-antd/src/components/summary-card/summary-card.vue
Normal file
@@ -0,0 +1,52 @@
|
||||
<script lang="ts" setup>
|
||||
import type { SummaryCardProps } from './typing';
|
||||
|
||||
import { CountTo } from '@vben/common-ui';
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
|
||||
import { Tooltip } from 'ant-design-vue';
|
||||
|
||||
/** 统计卡片 */
|
||||
defineOptions({ name: 'SummaryCard' });
|
||||
|
||||
defineProps<SummaryCardProps>();
|
||||
</script>
|
||||
<template>
|
||||
<div
|
||||
class="flex flex-row items-center gap-3 rounded bg-[var(--el-bg-color-overlay)] p-4"
|
||||
>
|
||||
<div
|
||||
class="rounded-1 flex h-12 w-12 flex-shrink-0 items-center justify-center"
|
||||
:class="`${iconColor} ${iconBgColor}`"
|
||||
>
|
||||
<IconifyIcon v-if="icon" :icon="icon" class="!text-6" />
|
||||
</div>
|
||||
<div class="flex flex-col gap-1">
|
||||
<div class="flex items-center gap-1">
|
||||
<span class="text-3.5">{{ title }}</span>
|
||||
<Tooltip :content="tooltip" placement="topLeft" v-if="tooltip">
|
||||
<IconifyIcon icon="ep:warning" class="item-center !text-3 flex" />
|
||||
</Tooltip>
|
||||
</div>
|
||||
<div class="flex flex-row items-baseline gap-2">
|
||||
<div class="text-7">
|
||||
<CountTo
|
||||
:prefix="prefix"
|
||||
:end-val="value ?? 0"
|
||||
:decimals="decimals ?? 0"
|
||||
/>
|
||||
</div>
|
||||
<span
|
||||
v-if="percent !== undefined"
|
||||
:class="Number(percent) > 0 ? 'text-red-500' : 'text-green-500'"
|
||||
>
|
||||
<span class="text-sm">{{ Math.abs(Number(percent)) }}%</span>
|
||||
<IconifyIcon
|
||||
:icon="Number(percent) > 0 ? 'ep:caret-top' : 'ep:caret-bottom'"
|
||||
class="!text-3 ml-0.5"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
11
apps/web-antd/src/components/summary-card/typing.ts
Normal file
11
apps/web-antd/src/components/summary-card/typing.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export interface SummaryCardProps {
|
||||
title: string;
|
||||
tooltip?: string;
|
||||
icon?: string;
|
||||
iconColor?: string;
|
||||
iconBgColor?: string;
|
||||
prefix?: string;
|
||||
value?: number;
|
||||
decimals?: number;
|
||||
percent?: number | string;
|
||||
}
|
||||
@@ -30,7 +30,7 @@ export function useFormSchema(confType: LimitConfType): VbenFormSchema[] {
|
||||
label: 'nickname',
|
||||
value: 'id',
|
||||
},
|
||||
multiple: true,
|
||||
mode: 'tags',
|
||||
allowClear: true,
|
||||
},
|
||||
rules: 'required',
|
||||
|
||||
126
apps/web-antd/src/views/mall/trade/delivery/pickUpOrder/data.ts
Normal file
126
apps/web-antd/src/views/mall/trade/delivery/pickUpOrder/data.ts
Normal file
@@ -0,0 +1,126 @@
|
||||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeGridPropTypes } from '#/adapter/vxe-table';
|
||||
import type { MallDeliveryPickUpStoreApi } from '#/api/mall/trade/delivery/pickUpStore';
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { getSimpleDeliveryPickUpStoreList } from '#/api/mall/trade/delivery/pickUpStore';
|
||||
import {
|
||||
DeliveryTypeEnum,
|
||||
DICT_TYPE,
|
||||
getRangePickerDefaultProps,
|
||||
} from '#/utils';
|
||||
|
||||
const pickUpStoreList = ref<MallDeliveryPickUpStoreApi.PickUpStore[]>([]);
|
||||
|
||||
getSimpleDeliveryPickUpStoreList().then((res) => {
|
||||
pickUpStoreList.value = res;
|
||||
});
|
||||
|
||||
/** 列表的搜索表单 */
|
||||
export function useGridFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'createTime',
|
||||
label: '创建时间',
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
...getRangePickerDefaultProps(),
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'pickUpStoreId',
|
||||
label: '自提门店',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: getSimpleDeliveryPickUpStoreList,
|
||||
fieldNames: {
|
||||
label: 'name',
|
||||
value: 'id',
|
||||
},
|
||||
},
|
||||
dependencies: {
|
||||
triggerFields: ['deliveryType'],
|
||||
show: (values) => values.deliveryType === DeliveryTypeEnum.PICK_UP.type,
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 表格列配置 */
|
||||
export function useGridColumns(): VxeGridPropTypes.Columns {
|
||||
return [
|
||||
{
|
||||
field: 'no',
|
||||
title: '订单号',
|
||||
fixed: 'left',
|
||||
minWidth: 180,
|
||||
},
|
||||
{
|
||||
field: 'user.nickname',
|
||||
title: '用户信息',
|
||||
minWidth: 100,
|
||||
},
|
||||
{
|
||||
field: 'brokerageUser.nickname',
|
||||
title: '推荐人信息',
|
||||
minWidth: 100,
|
||||
},
|
||||
{
|
||||
field: 'spuName',
|
||||
title: '商品信息',
|
||||
minWidth: 100,
|
||||
formatter: ({ row }) => {
|
||||
if (row.items.length > 1) {
|
||||
return row.items.map((item: any) => item.spuName).join(',');
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'payPrice',
|
||||
title: '实付金额(元)',
|
||||
formatter: 'formatAmount2',
|
||||
minWidth: 180,
|
||||
},
|
||||
{
|
||||
field: 'storeStaffName',
|
||||
title: '核销员',
|
||||
minWidth: 160,
|
||||
},
|
||||
{
|
||||
field: 'pickUpStoreId',
|
||||
title: '核销门店',
|
||||
minWidth: 160,
|
||||
formatter: ({ row }) => {
|
||||
return pickUpStoreList.value.find(
|
||||
(item) => item.id === row.pickUpStoreId,
|
||||
)?.name;
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'payStatus',
|
||||
title: '支付状态',
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.INFRA_BOOLEAN_STRING },
|
||||
},
|
||||
minWidth: 80,
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '订单状态',
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.TRADE_ORDER_STATUS },
|
||||
},
|
||||
minWidth: 80,
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '下单时间',
|
||||
formatter: 'formatDateTime',
|
||||
minWidth: 160,
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -1,38 +1,106 @@
|
||||
<script lang="ts" setup>
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MallOrderApi } from '#/api/mall/trade/order';
|
||||
|
||||
import { onMounted, ref } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
|
||||
import { Button } from 'ant-design-vue';
|
||||
import { Card } from 'ant-design-vue';
|
||||
|
||||
import { DocAlert } from '#/components/doc-alert';
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { getOrderPage, getOrderSummary } from '#/api/mall/trade/order';
|
||||
import { SummaryCard } from '#/components/summary-card';
|
||||
import { DeliveryTypeEnum, fenToYuan } from '#/utils';
|
||||
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
|
||||
const summary = ref<MallOrderApi.OrderSummary>();
|
||||
|
||||
async function getOrderSum() {
|
||||
const query = await gridApi.formApi.getValues();
|
||||
query.deliveryType = DeliveryTypeEnum.PICK_UP.type;
|
||||
const res = await getOrderSummary(query as any);
|
||||
summary.value = res;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
schema: useGridFormSchema(),
|
||||
},
|
||||
gridOptions: {
|
||||
columns: useGridColumns(),
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getOrderPage({
|
||||
pageNo: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
deliveryType: DeliveryTypeEnum.PICK_UP.type,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<MallOrderApi.Order>,
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
getOrderSum();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page>
|
||||
<DocAlert
|
||||
title="【交易】交易订单"
|
||||
url="https://doc.iocoder.cn/mall/trade-order/"
|
||||
/>
|
||||
<DocAlert
|
||||
title="【交易】购物车"
|
||||
url="https://doc.iocoder.cn/mall/trade-cart/"
|
||||
/>
|
||||
<Button
|
||||
danger
|
||||
type="link"
|
||||
target="_blank"
|
||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
||||
>
|
||||
该功能支持 Vue3 + element-plus 版本!
|
||||
</Button>
|
||||
<br />
|
||||
<Button
|
||||
type="link"
|
||||
target="_blank"
|
||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/mall/trade/delivery/pickUpOrder/index"
|
||||
>
|
||||
可参考
|
||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/mall/trade/delivery/pickUpOrder/index
|
||||
代码,pull request 贡献给我们!
|
||||
</Button>
|
||||
<Page auto-content-height>
|
||||
<Card class="mb-4 h-[10%]">
|
||||
<template class="flex flex-row gap-4">
|
||||
<SummaryCard
|
||||
class="flex flex-1"
|
||||
title="订单数量"
|
||||
icon="icon-park-outline:transaction-order"
|
||||
icon-color="bg-blue-100"
|
||||
icon-bg-color="text-blue-500"
|
||||
:value="summary?.orderCount || 0"
|
||||
/>
|
||||
<SummaryCard
|
||||
class="flex flex-1"
|
||||
title="订单金额"
|
||||
icon="streamline:money-cash-file-dollar-common-money-currency-cash-file"
|
||||
icon-color="bg-purple-100"
|
||||
icon-bg-color="text-purple-500"
|
||||
prefix="¥"
|
||||
:decimals="2"
|
||||
:value="Number(fenToYuan(summary?.orderPayPrice || 0))"
|
||||
/>
|
||||
<SummaryCard
|
||||
class="flex flex-1"
|
||||
title="退款单数"
|
||||
icon="heroicons:receipt-refund"
|
||||
icon-color="bg-yellow-100"
|
||||
icon-bg-color="text-yellow-500"
|
||||
:value="summary?.afterSaleCount || 0"
|
||||
/>
|
||||
<SummaryCard
|
||||
class="flex flex-1"
|
||||
title="退款金额"
|
||||
icon="ri:refund-2-line"
|
||||
icon-color="bg-green-100"
|
||||
icon-bg-color="text-green-500"
|
||||
prefix="¥"
|
||||
:decimals="2"
|
||||
:value="Number(fenToYuan(summary?.afterSalePrice || 0))"
|
||||
/>
|
||||
</template>
|
||||
</Card>
|
||||
<Grid class="h-[80%]" table-title="核销订单" />
|
||||
</Page>
|
||||
</template>
|
||||
|
||||
248
apps/web-antd/src/views/mall/trade/delivery/pickUpStore/data.ts
Normal file
248
apps/web-antd/src/views/mall/trade/delivery/pickUpStore/data.ts
Normal file
@@ -0,0 +1,248 @@
|
||||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
|
||||
import { z } from '#/adapter/form';
|
||||
import { getAreaTree } from '#/api/system/area';
|
||||
import { getSimpleUserList } from '#/api/system/user';
|
||||
import {
|
||||
CommonStatusEnum,
|
||||
DICT_TYPE,
|
||||
getDictOptions,
|
||||
getRangePickerDefaultProps,
|
||||
} from '#/utils';
|
||||
|
||||
/** 新增/修改的表单 */
|
||||
export function useFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'id',
|
||||
dependencies: {
|
||||
triggerFields: [''],
|
||||
show: () => false,
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'ImageUpload',
|
||||
fieldName: 'logo',
|
||||
label: '门店logo',
|
||||
componentProps: {
|
||||
maxSize: 1,
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'name',
|
||||
label: '门店名称',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'phone',
|
||||
label: '门店手机',
|
||||
rules: 'mobileRequired',
|
||||
},
|
||||
{
|
||||
component: 'Textarea',
|
||||
fieldName: 'introduction',
|
||||
label: '门店简介',
|
||||
},
|
||||
{
|
||||
fieldName: 'areaId',
|
||||
label: '地址',
|
||||
component: 'ApiTreeSelect',
|
||||
componentProps: {
|
||||
api: () => getAreaTree(),
|
||||
fieldNames: { label: 'name', value: 'id', children: 'children' },
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'detailAddress',
|
||||
label: '详细地址',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'TimePicker',
|
||||
fieldName: 'openingTime',
|
||||
label: '营业开始时间',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'TimePicker',
|
||||
fieldName: 'closingTime',
|
||||
label: '营业结束时间',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'longitude',
|
||||
label: '经度',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'latitude',
|
||||
label: '纬度',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'getGeo',
|
||||
label: '获取经纬度',
|
||||
},
|
||||
{
|
||||
fieldName: 'status',
|
||||
label: '门店状态',
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
||||
buttonStyle: 'solid',
|
||||
optionType: 'button',
|
||||
},
|
||||
rules: z.number().default(CommonStatusEnum.ENABLE),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 绑定店员的表单 */
|
||||
export function useBindFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'id',
|
||||
dependencies: {
|
||||
triggerFields: [''],
|
||||
show: () => false,
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'name',
|
||||
label: '门店名称',
|
||||
dependencies: {
|
||||
triggerFields: ['id'],
|
||||
disabled: () => true,
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'ApiSelect',
|
||||
fieldName: 'verifyUserIds',
|
||||
label: '门店店员',
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
api: () => getSimpleUserList(),
|
||||
fieldNames: { label: 'nickname', value: 'id' },
|
||||
mode: 'tags',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
fieldName: 'verifyUsers',
|
||||
label: '店员列表',
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
options: [],
|
||||
mode: 'tags',
|
||||
},
|
||||
dependencies: {
|
||||
triggerFields: ['verifyUserIds'],
|
||||
trigger(values, form) {
|
||||
form.setFieldValue('verifyUsers', values.verifyUserIds);
|
||||
},
|
||||
disabled: () => true,
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的搜索表单 */
|
||||
export function useGridFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'phone',
|
||||
label: '门店手机',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
fieldName: 'name',
|
||||
label: '门店名称',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
fieldName: 'status',
|
||||
label: '门店状态',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'createTime',
|
||||
label: '创建时间',
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
...getRangePickerDefaultProps(),
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
{
|
||||
field: 'id',
|
||||
title: '编号',
|
||||
},
|
||||
{
|
||||
field: 'logo',
|
||||
title: '门店logo',
|
||||
cellRender: {
|
||||
name: 'CellImage',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
title: '门店名称',
|
||||
},
|
||||
{
|
||||
field: 'phone',
|
||||
title: '门店手机',
|
||||
},
|
||||
{
|
||||
field: 'detailAddress',
|
||||
title: '地址',
|
||||
},
|
||||
{
|
||||
field: 'openingTime',
|
||||
title: '营业时间',
|
||||
formatter: ({ row }) => {
|
||||
return `${row.openingTime} ~ ${row.closingTime}`;
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '开启状态',
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.COMMON_STATUS },
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 200,
|
||||
fixed: 'right',
|
||||
slots: { default: 'actions' },
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -1,34 +1,149 @@
|
||||
<script lang="ts" setup>
|
||||
import { Page } from '@vben/common-ui';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MallDeliveryPickUpStoreApi } from '#/api/mall/trade/delivery/pickUpStore';
|
||||
|
||||
import { Button } from 'ant-design-vue';
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { DocAlert } from '#/components/doc-alert';
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
deleteDeliveryPickUpStore,
|
||||
getDeliveryPickUpStorePage,
|
||||
} from '#/api/mall/trade/delivery/pickUpStore';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
import BindForm from './modules/bind-form.vue';
|
||||
import Form from './modules/form.vue';
|
||||
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: Form,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
|
||||
const [BindFormModal, bindFormModalApi] = useVbenModal({
|
||||
connectedComponent: BindForm,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
|
||||
/** 刷新表格 */
|
||||
function onRefresh() {
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
/** 创建门店 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData(null).open();
|
||||
}
|
||||
|
||||
/** 编辑门店 */
|
||||
function handleEdit(row: MallDeliveryPickUpStoreApi.PickUpStore) {
|
||||
formModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 绑定店员 */
|
||||
function handleBind(row: MallDeliveryPickUpStoreApi.PickUpStore) {
|
||||
bindFormModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 删除门店 */
|
||||
async function handleDelete(row: MallDeliveryPickUpStoreApi.PickUpStore) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||
key: 'action_key_msg',
|
||||
});
|
||||
try {
|
||||
await deleteDeliveryPickUpStore(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||
key: 'action_key_msg',
|
||||
});
|
||||
onRefresh();
|
||||
} finally {
|
||||
hideLoading();
|
||||
}
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
schema: useGridFormSchema(),
|
||||
},
|
||||
gridOptions: {
|
||||
columns: useGridColumns(),
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getDeliveryPickUpStorePage({
|
||||
pageNo: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<MallDeliveryPickUpStoreApi.PickUpStore>,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page>
|
||||
<DocAlert
|
||||
title="【交易】快递发货"
|
||||
url="https://doc.iocoder.cn/mall/trade-delivery-express/"
|
||||
/>
|
||||
<Button
|
||||
danger
|
||||
type="link"
|
||||
target="_blank"
|
||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
||||
>
|
||||
该功能支持 Vue3 + element-plus 版本!
|
||||
</Button>
|
||||
<br />
|
||||
<Button
|
||||
type="link"
|
||||
target="_blank"
|
||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/mall/trade/delivery/pickUpStore/index"
|
||||
>
|
||||
可参考
|
||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/mall/trade/delivery/pickUpStore/index
|
||||
代码,pull request 贡献给我们!
|
||||
</Button>
|
||||
<Page auto-content-height>
|
||||
<FormModal @success="onRefresh" />
|
||||
<BindFormModal />
|
||||
<Grid table-title="门店列表">
|
||||
<template #toolbar-tools>
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('ui.actionTitle.create', ['门店']),
|
||||
type: 'primary',
|
||||
icon: ACTION_ICON.ADD,
|
||||
auth: ['trade:delivery:pick-up-store:create'],
|
||||
onClick: handleCreate,
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
<template #actions="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('common.edit'),
|
||||
type: 'link',
|
||||
icon: ACTION_ICON.EDIT,
|
||||
auth: ['trade:delivery:pick-up-store:update'],
|
||||
onClick: handleEdit.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: '绑定店员',
|
||||
type: 'link',
|
||||
icon: ACTION_ICON.ADD,
|
||||
auth: ['trade:delivery:pick-up-store:update'],
|
||||
onClick: handleBind.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('common.delete'),
|
||||
type: 'link',
|
||||
danger: true,
|
||||
icon: ACTION_ICON.DELETE,
|
||||
auth: ['trade:delivery:pick-up-store:delete'],
|
||||
popConfirm: {
|
||||
title: $t('ui.actionMessage.deleteConfirm', [row.name]),
|
||||
confirm: handleDelete.bind(null, row),
|
||||
},
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
<script lang="ts" setup>
|
||||
import type { MallDeliveryPickUpStoreApi } from '#/api/mall/trade/delivery/pickUpStore';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import {
|
||||
bindStoreStaffId,
|
||||
getDeliveryPickUpStore,
|
||||
} from '#/api/mall/trade/delivery/pickUpStore';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useBindFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<MallDeliveryPickUpStoreApi.PickUpStore>();
|
||||
const getTitle = computed(() => {
|
||||
return formData.value?.id
|
||||
? $t('ui.actionTitle.edit', ['绑定店员'])
|
||||
: $t('ui.actionTitle.create', ['绑定店员']);
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
},
|
||||
formItemClass: 'col-span-2',
|
||||
labelWidth: 120,
|
||||
},
|
||||
layout: 'horizontal',
|
||||
schema: useBindFormSchema(),
|
||||
showDefaultActions: false,
|
||||
});
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
async onConfirm() {
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data =
|
||||
(await formApi.getValues()) as MallDeliveryPickUpStoreApi.BindStaffRequest;
|
||||
try {
|
||||
await bindStoreStaffId(data);
|
||||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
formData.value = undefined;
|
||||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data =
|
||||
modalApi.getData<MallDeliveryPickUpStoreApi.BindStaffRequest>();
|
||||
if (!data || !data.id) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
try {
|
||||
formData.value = await getDeliveryPickUpStore(data.id as number);
|
||||
// 设置到 values
|
||||
await formApi.setValues(formData.value);
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal class="w-[40%]" :title="getTitle">
|
||||
<Form class="mx-4" />
|
||||
</Modal>
|
||||
</template>
|
||||
@@ -0,0 +1,89 @@
|
||||
<script lang="ts" setup>
|
||||
import type { MallDeliveryPickUpStoreApi } from '#/api/mall/trade/delivery/pickUpStore';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import {
|
||||
createDeliveryPickUpStore,
|
||||
getDeliveryPickUpStore,
|
||||
updateDeliveryPickUpStore,
|
||||
} from '#/api/mall/trade/delivery/pickUpStore';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<MallDeliveryPickUpStoreApi.PickUpStore>();
|
||||
const getTitle = computed(() => {
|
||||
return formData.value?.id
|
||||
? $t('ui.actionTitle.edit', ['自提订单'])
|
||||
: $t('ui.actionTitle.create', ['自提订单']);
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
},
|
||||
formItemClass: 'col-span-2',
|
||||
labelWidth: 120,
|
||||
},
|
||||
layout: 'horizontal',
|
||||
schema: useFormSchema(),
|
||||
showDefaultActions: false,
|
||||
});
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
async onConfirm() {
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data =
|
||||
(await formApi.getValues()) as MallDeliveryPickUpStoreApi.PickUpStore;
|
||||
try {
|
||||
await (formData.value?.id
|
||||
? updateDeliveryPickUpStore(data)
|
||||
: createDeliveryPickUpStore(data));
|
||||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
formData.value = undefined;
|
||||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<MallDeliveryPickUpStoreApi.PickUpStore>();
|
||||
if (!data || !data.id) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
try {
|
||||
formData.value = await getDeliveryPickUpStore(data.id as number);
|
||||
// 设置到 values
|
||||
await formApi.setValues(formData.value);
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal class="w-[40%]" :title="getTitle">
|
||||
<Form class="mx-4" />
|
||||
</Modal>
|
||||
</template>
|
||||
@@ -135,12 +135,12 @@ function getAllNodeIds(nodes: any[], ids: number[] = []): number[] {
|
||||
<Modal title="数据权限" class="w-[40%]">
|
||||
<Form class="mx-4">
|
||||
<template #dataScopeDeptIds="slotProps">
|
||||
<!-- <Spin :spinning="deptLoading"> -->
|
||||
<!-- TODO @芋艿:可优化,使用 antd 的 tree?原因是,更原生 -->
|
||||
<VbenTree
|
||||
:tree-data="deptTree"
|
||||
multiple
|
||||
bordered
|
||||
:spinning="deptLoading"
|
||||
:expanded="expandedKeys"
|
||||
v-bind="slotProps"
|
||||
value-field="id"
|
||||
@@ -148,7 +148,6 @@ function getAllNodeIds(nodes: any[], ids: number[] = []): number[] {
|
||||
:auto-check-parent="false"
|
||||
:check-strictly="!isCheckStrictly"
|
||||
/>
|
||||
<!-- </Spin> -->
|
||||
</template>
|
||||
</Form>
|
||||
<template #prepend-footer>
|
||||
|
||||
@@ -127,9 +127,9 @@ function getAllNodeIds(nodes: any[], ids: number[] = []): number[] {
|
||||
<Modal title="数据权限" class="w-[40%]">
|
||||
<Form class="mx-4">
|
||||
<template #menuIds="slotProps">
|
||||
<!-- <Spin :spinning="menuLoading" class="w-full"> -->
|
||||
<!-- TODO @芋艿:可优化,使用 antd 的 tree?原因是,更原生 -->
|
||||
<VbenTree
|
||||
:spinning="menuLoading"
|
||||
:tree-data="menuTree"
|
||||
multiple
|
||||
bordered
|
||||
@@ -138,7 +138,6 @@ function getAllNodeIds(nodes: any[], ids: number[] = []): number[] {
|
||||
value-field="id"
|
||||
label-field="name"
|
||||
/>
|
||||
<!-- </Spin> -->
|
||||
</template>
|
||||
</Form>
|
||||
<template #prepend-footer>
|
||||
|
||||
@@ -6,7 +6,7 @@ import { onMounted, ref } from 'vue';
|
||||
import { Search } from '@vben/icons';
|
||||
import { handleTree } from '@vben/utils';
|
||||
|
||||
import { Input, Spin, Tree } from 'ant-design-vue';
|
||||
import { Input, Tree } from 'ant-design-vue';
|
||||
|
||||
import { getSimpleDeptList } from '#/api/system/dept';
|
||||
|
||||
@@ -66,18 +66,17 @@ onMounted(async () => {
|
||||
</template>
|
||||
</Input>
|
||||
</div>
|
||||
<Spin :spinning="loading">
|
||||
<Tree
|
||||
class="pt-2"
|
||||
v-if="deptTree.length > 0"
|
||||
:tree-data="deptTree"
|
||||
:field-names="{ title: 'name', key: 'id', children: 'children' }"
|
||||
@select="handleSelect"
|
||||
:default-expand-all="true"
|
||||
/>
|
||||
<div v-else-if="!loading" class="py-4 text-center text-gray-500">
|
||||
暂无数据
|
||||
</div>
|
||||
</Spin>
|
||||
<Tree
|
||||
:spinning="loading"
|
||||
class="pt-2"
|
||||
v-if="deptTree.length > 0"
|
||||
:tree-data="deptTree"
|
||||
:field-names="{ title: 'name', key: 'id', children: 'children' }"
|
||||
@select="handleSelect"
|
||||
:default-expand-all="true"
|
||||
/>
|
||||
<div v-else-if="!loading" class="py-4 text-center text-gray-500">
|
||||
暂无数据
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { VxeTableGridOptions } from '@vben/plugins/vxe-table';
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { h } from 'vue';
|
||||
@@ -63,7 +64,7 @@ setupVbenVxeTable({
|
||||
round: true,
|
||||
showOverflow: true,
|
||||
size: 'small',
|
||||
},
|
||||
} as VxeTableGridOptions,
|
||||
});
|
||||
|
||||
// 表格配置项可以用 cellRender: { name: 'CellImage' },
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { VxeTableGridOptions } from '@vben/plugins/vxe-table';
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { h } from 'vue';
|
||||
@@ -57,7 +58,7 @@ setupVbenVxeTable({
|
||||
round: true,
|
||||
showOverflow: true,
|
||||
size: 'small',
|
||||
},
|
||||
} as VxeTableGridOptions,
|
||||
});
|
||||
|
||||
// 表格配置项可以用 cellRender: { name: 'CellImage' },
|
||||
|
||||
Reference in New Issue
Block a user