feat:【代码优化】减少部分模块的 import * 的 API
This commit is contained in:
@@ -3,7 +3,7 @@ import { computed, onMounted, ref } from 'vue';
|
||||
|
||||
import { handleTree } from '@vben/utils';
|
||||
|
||||
import * as ProductCategoryApi from '#/api/mall/product/category';
|
||||
import { getCategoryList } from '#/api/mall/product/category';
|
||||
|
||||
/** 商品分类选择组件 */
|
||||
defineOptions({ name: 'ProductCategorySelect' });
|
||||
@@ -43,7 +43,7 @@ const selectCategoryId = computed({
|
||||
const categoryList = ref<any[]>([]); // 分类树
|
||||
onMounted(async () => {
|
||||
// 获得分类树
|
||||
const data = await ProductCategoryApi.getCategoryList({
|
||||
const data = await getCategoryList({
|
||||
parentId: props.parentId,
|
||||
});
|
||||
categoryList.value = handleTree(data, 'id', 'parentId');
|
||||
|
||||
@@ -6,7 +6,10 @@ import { useRoute } from 'vue-router';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import * as DiyPageApi from '#/api/mall/promotion/diy/page';
|
||||
import {
|
||||
getDiyPageProperty,
|
||||
updateDiyPageProperty,
|
||||
} from '#/api/mall/promotion/diy/page';
|
||||
import { DiyEditor, PAGE_LIBS } from '#/views/mall/promotion/components';
|
||||
|
||||
/** 装修页面表单 */
|
||||
@@ -23,7 +26,7 @@ async function getPageDetail(id: any) {
|
||||
duration: 0,
|
||||
});
|
||||
try {
|
||||
formData.value = await DiyPageApi.getDiyPageProperty(id);
|
||||
formData.value = await getDiyPageProperty(id);
|
||||
} finally {
|
||||
hideLoading();
|
||||
}
|
||||
@@ -36,7 +39,7 @@ async function submitForm() {
|
||||
duration: 0,
|
||||
});
|
||||
try {
|
||||
await DiyPageApi.updateDiyPageProperty(unref(formData)!);
|
||||
await updateDiyPageProperty(unref(formData)!);
|
||||
message.success('保存成功');
|
||||
} finally {
|
||||
hideLoading();
|
||||
|
||||
@@ -13,8 +13,11 @@ import { isEmpty } from '@vben/utils';
|
||||
|
||||
import { message, Radio, RadioGroup, Tooltip } from 'ant-design-vue';
|
||||
|
||||
import * as DiyPageApi from '#/api/mall/promotion/diy/page';
|
||||
import * as DiyTemplateApi from '#/api/mall/promotion/diy/template';
|
||||
import { updateDiyPageProperty } from '#/api/mall/promotion/diy/page';
|
||||
import {
|
||||
getDiyTemplateProperty,
|
||||
updateDiyTemplateProperty,
|
||||
} from '#/api/mall/promotion/diy/template';
|
||||
import { DiyEditor, PAGE_LIBS } from '#/views/mall/promotion/components';
|
||||
|
||||
/** 装修模板表单 */
|
||||
@@ -54,7 +57,7 @@ async function getPageDetail(id: any) {
|
||||
duration: 0,
|
||||
});
|
||||
try {
|
||||
formData.value = await DiyTemplateApi.getDiyTemplateProperty(id);
|
||||
formData.value = await getDiyTemplateProperty(id);
|
||||
|
||||
// 拼接手机预览链接
|
||||
const domain = import.meta.env.VITE_MALL_H5_DOMAIN;
|
||||
@@ -112,20 +115,18 @@ async function submitForm() {
|
||||
// 情况一:基础设置
|
||||
if (i === 0) {
|
||||
// 提交模板属性
|
||||
await DiyTemplateApi.updateDiyTemplateProperty(
|
||||
isEmpty(data) ? formData.value! : data,
|
||||
);
|
||||
await updateDiyTemplateProperty(isEmpty(data) ? formData.value! : data);
|
||||
continue;
|
||||
}
|
||||
// 提交页面属性
|
||||
// 情况二:提交当前正在编辑的页面
|
||||
if (currentFormData.value?.name.includes(templateItem.name)) {
|
||||
await DiyPageApi.updateDiyPageProperty(currentFormData.value!);
|
||||
await updateDiyPageProperty(currentFormData.value!);
|
||||
continue;
|
||||
}
|
||||
// 情况三:提交页面编辑缓存
|
||||
if (!isEmpty(data)) {
|
||||
await DiyPageApi.updateDiyPageProperty(data!);
|
||||
await updateDiyPageProperty(data!);
|
||||
}
|
||||
}
|
||||
message.success('保存成功');
|
||||
|
||||
@@ -11,7 +11,7 @@ import { formatDateTime } from '@vben/utils';
|
||||
import { Card } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import * as ProductStatisticsApi from '#/api/mall/statistics/product';
|
||||
import { getProductStatisticsRankPage } from '#/api/mall/statistics/product';
|
||||
import ShortcutDateRangePicker from '#/components/shortcut-date-range-picker/shortcut-date-range-picker.vue';
|
||||
|
||||
/** 商品排行 */
|
||||
@@ -104,7 +104,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page, sorts }) => {
|
||||
return await ProductStatisticsApi.getProductStatisticsRankPage({
|
||||
return await getProductStatisticsRankPage({
|
||||
pageNo: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
times: searchTimes.value.length > 0 ? searchTimes.value : undefined,
|
||||
|
||||
@@ -9,7 +9,7 @@ import { $t } from '@vben/locales';
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import * as AfterSaleApi from '#/api/mall/trade/afterSale/index';
|
||||
import { disagreeAfterSale } from '#/api/mall/trade/afterSale';
|
||||
|
||||
import { useDisagreeFormSchema } from '../data';
|
||||
|
||||
@@ -40,7 +40,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
try {
|
||||
const data =
|
||||
(await formApi.getValues()) as MallAfterSaleApi.DisagreeRequest;
|
||||
await AfterSaleApi.disagreeAfterSale(data);
|
||||
await disagreeAfterSale(data);
|
||||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
|
||||
@@ -18,9 +18,13 @@ import { useTabs } from '@vben/hooks';
|
||||
import { Card, message, Tag } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import * as DeliveryExpressApi from '#/api/mall/trade/delivery/express';
|
||||
import * as DeliveryPickUpStoreApi from '#/api/mall/trade/delivery/pickUpStore';
|
||||
import * as TradeOrderApi from '#/api/mall/trade/order';
|
||||
import { getSimpleDeliveryExpressList } from '#/api/mall/trade/delivery/express';
|
||||
import { getDeliveryPickUpStore } from '#/api/mall/trade/delivery/pickUpStore';
|
||||
import {
|
||||
getExpressTrackList,
|
||||
getOrder,
|
||||
pickUpOrder,
|
||||
} from '#/api/mall/trade/order';
|
||||
import { useDescription } from '#/components/description';
|
||||
import { DictTag } from '#/components/dict-tag';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
@@ -157,7 +161,7 @@ const [PriceFormModal, priceFormModalApi] = useVbenModal({
|
||||
async function getDetail() {
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await TradeOrderApi.getOrder(orderId.value);
|
||||
const res = await getOrder(orderId.value);
|
||||
if (res === null) {
|
||||
message.error('交易订单不存在');
|
||||
handleBack();
|
||||
@@ -169,12 +173,9 @@ async function getDetail() {
|
||||
|
||||
// 如果配送方式为快递,则查询物流公司
|
||||
if (res.deliveryType === DeliveryTypeEnum.EXPRESS.type) {
|
||||
deliveryExpressList.value =
|
||||
await DeliveryExpressApi.getSimpleDeliveryExpressList();
|
||||
deliveryExpressList.value = await getSimpleDeliveryExpressList();
|
||||
if (res.logisticsId) {
|
||||
expressTrackList.value = await TradeOrderApi.getExpressTrackList(
|
||||
res.id!,
|
||||
);
|
||||
expressTrackList.value = await getExpressTrackList(res.id!);
|
||||
expressTrackGridApi.setGridOptions({
|
||||
data: expressTrackList.value || [],
|
||||
});
|
||||
@@ -183,9 +184,7 @@ async function getDetail() {
|
||||
res.deliveryType === DeliveryTypeEnum.PICK_UP.type &&
|
||||
res.pickUpStoreId
|
||||
) {
|
||||
pickUpStore.value = await DeliveryPickUpStoreApi.getDeliveryPickUpStore(
|
||||
res.pickUpStoreId,
|
||||
);
|
||||
pickUpStore.value = await getDeliveryPickUpStore(res.pickUpStoreId);
|
||||
}
|
||||
} finally {
|
||||
loading.value = false;
|
||||
@@ -217,7 +216,7 @@ const handlePickUp = async () => {
|
||||
duration: 0,
|
||||
});
|
||||
try {
|
||||
await TradeOrderApi.pickUpOrder(order.value.id!);
|
||||
await pickUpOrder(order.value.id!);
|
||||
message.success('核销成功');
|
||||
await getDetail();
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user