feat:【代码优化】减少部分模块的 import * 的 API
This commit is contained in:
@@ -5,7 +5,7 @@ import type { MallCouponTemplateApi } from '#/api/mall/promotion/coupon/couponTe
|
||||
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
|
||||
import * as CouponTemplateApi from '#/api/mall/promotion/coupon/couponTemplate';
|
||||
|
||||
|
||||
import {
|
||||
CouponDiscount,
|
||||
@@ -23,7 +23,7 @@ watch(
|
||||
() => props.property.couponIds,
|
||||
async () => {
|
||||
if (props.property.couponIds?.length > 0) {
|
||||
couponList.value = await CouponTemplateApi.getCouponTemplateList(
|
||||
couponList.value = await getCouponTemplateList(
|
||||
props.property.couponIds,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import { fenToYuan } from '@vben/utils';
|
||||
|
||||
import { Image } from 'ant-design-vue';
|
||||
|
||||
import * as ProductSpuApi from '#/api/mall/product/spu';
|
||||
import { getSpuDetailList } from '#/api/mall/product/spu';
|
||||
|
||||
/** 商品卡片 */
|
||||
defineOptions({ name: 'ProductCard' });
|
||||
@@ -20,7 +20,7 @@ const spuList = ref<MallSpuApi.Spu[]>([]);
|
||||
watch(
|
||||
() => props.property.spuIds,
|
||||
async () => {
|
||||
spuList.value = await ProductSpuApi.getSpuDetailList(props.property.spuIds);
|
||||
spuList.value = await getSpuDetailList(props.property.spuIds);
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
|
||||
@@ -7,7 +7,7 @@ import { onMounted, ref, watch } from 'vue';
|
||||
|
||||
import { fenToYuan } from '@vben/utils';
|
||||
|
||||
import * as ProductSpuApi from '#/api/mall/product/spu';
|
||||
import { getSpuDetailList } from '#/api/mall/product/spu';
|
||||
|
||||
/** 商品栏 */
|
||||
defineOptions({ name: 'ProductList' });
|
||||
@@ -18,7 +18,7 @@ const spuList = ref<MallSpuApi.Spu[]>([]);
|
||||
watch(
|
||||
() => props.property.spuIds,
|
||||
async () => {
|
||||
spuList.value = await ProductSpuApi.getSpuDetailList(props.property.spuIds);
|
||||
spuList.value = await getSpuDetailList(props.property.spuIds);
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { MallArticleApi } from '#/api/mall/promotion/article';
|
||||
|
||||
import { ref, watch } from 'vue';
|
||||
|
||||
import * as ArticleApi from '#/api/mall/promotion/article/index';
|
||||
|
||||
|
||||
/** 营销文章 */
|
||||
defineOptions({ name: 'PromotionArticle' });
|
||||
@@ -18,7 +18,7 @@ watch(
|
||||
() => props.property.id,
|
||||
async () => {
|
||||
if (props.property.id) {
|
||||
article.value = await ArticleApi.getArticle(props.property.id);
|
||||
article.value = await getArticle(props.property.id);
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ import { useVModel } from '@vueuse/core';
|
||||
|
||||
import { Form, FormItem, Select } from 'ant-design-vue';
|
||||
|
||||
import * as ArticleApi from '#/api/mall/promotion/article/index';
|
||||
|
||||
|
||||
import ComponentContainerProperty from '../../component-container-property.vue';
|
||||
|
||||
@@ -27,7 +27,7 @@ const loading = ref(false);
|
||||
// 查询文章列表
|
||||
const queryArticleList = async (title?: string) => {
|
||||
loading.value = true;
|
||||
const { list } = await ArticleApi.getArticlePage({
|
||||
const { list } = await getArticlePage({
|
||||
title,
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
|
||||
@@ -10,8 +10,8 @@ import { fenToYuan } from '@vben/utils';
|
||||
|
||||
import { Image } from 'ant-design-vue';
|
||||
|
||||
import * as ProductSpuApi from '#/api/mall/product/spu';
|
||||
import * as CombinationActivityApi from '#/api/mall/promotion/combination/combinationActivity';
|
||||
import { getSpuDetailList } from '#/api/mall/product/spu';
|
||||
import { getCombinationActivityListByIds, getCombinationActivityPage } from '#/api/mall/promotion/combination/combinationActivity';
|
||||
|
||||
/** 拼团卡片 */
|
||||
defineOptions({ name: 'PromotionCombination' });
|
||||
@@ -34,7 +34,7 @@ watch(
|
||||
if (Array.isArray(activityIds) && activityIds.length > 0) {
|
||||
// 获取拼团活动详情列表
|
||||
combinationActivityList.value =
|
||||
await CombinationActivityApi.getCombinationActivityListByIds(
|
||||
await getCombinationActivityListByIds(
|
||||
activityIds,
|
||||
);
|
||||
|
||||
@@ -44,7 +44,7 @@ watch(
|
||||
.map((activity) => activity.spuId)
|
||||
.filter((spuId): spuId is number => typeof spuId === 'number');
|
||||
if (spuIdList.value.length > 0) {
|
||||
spuList.value = await ProductSpuApi.getSpuDetailList(spuIdList.value);
|
||||
spuList.value = await getSpuDetailList(spuIdList.value);
|
||||
}
|
||||
|
||||
// 更新 SPU 的最低价格
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
Tooltip,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import * as CombinationActivityApi from '#/api/mall/promotion/combination/combinationActivity';
|
||||
import { getCombinationActivityListByIds, getCombinationActivityPage } from '#/api/mall/promotion/combination/combinationActivity';
|
||||
import UploadImg from '#/components/upload/image-upload.vue';
|
||||
import CombinationShowcase from '#/views/mall/promotion/combination/components/combination-showcase.vue';
|
||||
import { ColorInput } from '#/views/mall/promotion/components';
|
||||
@@ -38,7 +38,7 @@ const formData = useVModel(props, 'modelValue', emit);
|
||||
// 活动列表
|
||||
const activityList = ref<MallCombinationActivityApi.CombinationActivity[]>([]);
|
||||
onMounted(async () => {
|
||||
const { list } = await CombinationActivityApi.getCombinationActivityPage({
|
||||
const { list } = await getCombinationActivityPage({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
status: CommonStatusEnum.ENABLE,
|
||||
|
||||
@@ -9,8 +9,8 @@ import { fenToYuan } from '@vben/utils';
|
||||
|
||||
import { Image } from 'ant-design-vue';
|
||||
|
||||
import * as ProductSpuApi from '#/api/mall/product/spu';
|
||||
import * as PointActivityApi from '#/api/mall/promotion/point';
|
||||
import { getSpuDetailList } from '#/api/mall/product/spu';
|
||||
|
||||
|
||||
/** 积分商城卡片 */
|
||||
defineOptions({ name: 'PromotionPoint' });
|
||||
@@ -31,7 +31,7 @@ watch(
|
||||
if (Array.isArray(activityIds) && activityIds.length > 0) {
|
||||
// 获取积分商城活动详情列表
|
||||
pointActivityList.value =
|
||||
await PointActivityApi.getPointActivityListByIds(activityIds);
|
||||
await getPointActivityListByIds(activityIds);
|
||||
|
||||
// 获取积分商城活动的 SPU 详情列表
|
||||
spuList.value = [];
|
||||
@@ -39,7 +39,7 @@ watch(
|
||||
(activity) => activity.spuId,
|
||||
);
|
||||
if (spuIdList.value.length > 0) {
|
||||
spuList.value = (await ProductSpuApi.getSpuDetailList(
|
||||
spuList.value = (await getSpuDetailList(
|
||||
spuIdList.value,
|
||||
)) as MallPointActivityApi.SpuExtensionWithPoint[];
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ import { fenToYuan } from '@vben/utils';
|
||||
|
||||
import { Image } from 'ant-design-vue';
|
||||
|
||||
import * as ProductSpuApi from '#/api/mall/product/spu';
|
||||
import * as SeckillActivityApi from '#/api/mall/promotion/seckill/seckillActivity';
|
||||
import { getSpuDetailList } from '#/api/mall/product/spu';
|
||||
import { getSeckillActivityListByIds } from '#/api/mall/promotion/seckill/seckillActivity';
|
||||
|
||||
/** 秒杀卡片 */
|
||||
defineOptions({ name: 'PromotionSeckill' });
|
||||
@@ -32,7 +32,7 @@ watch(
|
||||
if (Array.isArray(activityIds) && activityIds.length > 0) {
|
||||
// 获取秒杀活动详情列表
|
||||
seckillActivityList.value =
|
||||
await SeckillActivityApi.getSeckillActivityListByIds(activityIds);
|
||||
await getSeckillActivityListByIds(activityIds);
|
||||
|
||||
// 获取秒杀活动的 SPU 详情列表
|
||||
spuList.value = [];
|
||||
@@ -40,7 +40,7 @@ watch(
|
||||
.map((activity) => activity.spuId)
|
||||
.filter((spuId): spuId is number => typeof spuId === 'number');
|
||||
if (spuIdList.value.length > 0) {
|
||||
spuList.value = await ProductSpuApi.getSpuDetailList(spuIdList.value);
|
||||
spuList.value = await getSpuDetailList(spuIdList.value);
|
||||
}
|
||||
|
||||
// 更新 SPU 的最低价格
|
||||
|
||||
Reference in New Issue
Block a user