From 49477169837c87c5590ee4c31945d285792a7375 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Sun, 6 Aug 2023 18:12:07 +0800 Subject: [PATCH 1/7] =?UTF-8?q?feat:=20=E5=AE=8C=E5=96=84=E7=A0=8D?= =?UTF-8?q?=E4=BB=B7=E6=B4=BB=E5=8A=A8=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mall/promotion/bargain/bargainActivity.ts | 62 +++++ .../promotion/bargain/BargainActivityForm.vue | 220 ++++++++++++++++++ .../promotion/bargain/bargainActivity.data.ts | 165 +++++++++++++ src/views/mall/promotion/bargain/index.vue | 117 ++++++++++ 4 files changed, 564 insertions(+) create mode 100644 src/api/mall/promotion/bargain/bargainActivity.ts create mode 100644 src/views/mall/promotion/bargain/BargainActivityForm.vue create mode 100644 src/views/mall/promotion/bargain/bargainActivity.data.ts create mode 100644 src/views/mall/promotion/bargain/index.vue diff --git a/src/api/mall/promotion/bargain/bargainActivity.ts b/src/api/mall/promotion/bargain/bargainActivity.ts new file mode 100644 index 00000000..a23477d9 --- /dev/null +++ b/src/api/mall/promotion/bargain/bargainActivity.ts @@ -0,0 +1,62 @@ +import request from '@/config/axios' +import { Sku, Spu } from '@/api/mall/product/spu' + +export interface BargainActivityVO { + id?: number + name?: string + startTime?: Date + endTime?: Date + status?: number + spuId?: number + userSize?: number // 达到该人数,才能砍到低价 + bargainCount?: number // 最大帮砍次数 + totalLimitCount?: number // 最大购买次数 + stock?: number // 活动总库存 + randomMinPrice?: number // 用户每次砍价的最小金额,单位:分 + randomMaxPrice?: number // 用户每次砍价的最大金额,单位:分 + successCount?: number // 砍价成功数量 + products?: BargainProductVO[] +} + +// 砍价活动所需属性 +export interface BargainProductVO { + spuId: number + skuId: number + bargainFirstPrice: number // 砍价起始价格,单位分 + bargainPrice: number // 砍价底价 + stock: number // 活动库存 +} + +// 扩展 Sku 配置 +export type SkuExtension = Sku & { + productConfig: BargainProductVO +} + +export interface SpuExtension extends Spu { + skus: SkuExtension[] // 重写类型 +} + +// 查询砍价活动列表 +export const getBargainActivityPage = async (params: any) => { + return await request.get({ url: '/promotion/bargain-activity/page', params }) +} + +// 查询砍价活动详情 +export const getBargainActivity = async (id: number) => { + return await request.get({ url: '/promotion/bargain-activity/get?id=' + id }) +} + +// 新增砍价活动 +export const createBargainActivity = async (data: BargainActivityVO) => { + return await request.post({ url: '/promotion/bargain-activity/create', data }) +} + +// 修改砍价活动 +export const updateBargainActivity = async (data: BargainActivityVO) => { + return await request.put({ url: '/promotion/bargain-activity/update', data }) +} + +// 删除砍价活动 +export const deleteBargainActivity = async (id: number) => { + return await request.delete({ url: '/promotion/bargain-activity/delete?id=' + id }) +} diff --git a/src/views/mall/promotion/bargain/BargainActivityForm.vue b/src/views/mall/promotion/bargain/BargainActivityForm.vue new file mode 100644 index 00000000..91bb52d0 --- /dev/null +++ b/src/views/mall/promotion/bargain/BargainActivityForm.vue @@ -0,0 +1,220 @@ + + diff --git a/src/views/mall/promotion/bargain/bargainActivity.data.ts b/src/views/mall/promotion/bargain/bargainActivity.data.ts new file mode 100644 index 00000000..209fb468 --- /dev/null +++ b/src/views/mall/promotion/bargain/bargainActivity.data.ts @@ -0,0 +1,165 @@ +import type { CrudSchema } from '@/hooks/web/useCrudSchemas' +import { dateFormatter2 } from '@/utils/formatTime' + +// 表单校验 +export const rules = reactive({ + name: [required], + startTime: [required], + endTime: [required], + userSize: [required], + bargainCount: [required], + singleLimitCount: [required] +}) + +// CrudSchema https://doc.iocoder.cn/vue3/crud-schema/ +const crudSchemas = reactive([ + { + label: '砍价活动名称', + field: 'name', + isSearch: true, + isTable: false, + form: { + colProps: { + span: 24 + } + } + }, + { + label: '活动开始时间', + field: 'startTime', + formatter: dateFormatter2, + isSearch: true, + search: { + component: 'DatePicker', + componentProps: { + valueFormat: 'YYYY-MM-DD', + type: 'daterange' + } + }, + form: { + component: 'DatePicker', + componentProps: { + type: 'date', + valueFormat: 'x' + } + }, + table: { + width: 120 + } + }, + { + label: '活动结束时间', + field: 'endTime', + formatter: dateFormatter2, + isSearch: true, + search: { + component: 'DatePicker', + componentProps: { + valueFormat: 'YYYY-MM-DD', + type: 'daterange' + } + }, + form: { + component: 'DatePicker', + componentProps: { + type: 'date', + valueFormat: 'x' + } + }, + table: { + width: 120 + } + }, + { + label: '砍价人数', + field: 'userSize', + isSearch: false, + form: { + component: 'InputNumber', + labelMessage: '参与人数不能少于两人', + value: 2 + } + }, + { + label: '最大帮砍次数', + field: 'bargainCount', + isSearch: false, + form: { + component: 'InputNumber', + labelMessage: '参与人数不能少于两人', + value: 2 + } + }, + { + label: '总限购数量', + field: 'totalLimitCount', + isSearch: false, + form: { + component: 'InputNumber', + labelMessage: '用户最大能发起砍价的次数', + value: 0 + } + }, + { + label: '砍价的最小金额', + field: 'randomMinPrice', + isSearch: false, + isTable: false, + form: { + component: 'InputNumber', + componentProps: { + min: 0, + precision: 2, + step: 0.1 + }, + labelMessage: '用户每次砍价的最小金额', + value: 0 + } + }, + { + label: '砍价的最大金额', + field: 'randomMaxPrice', + isSearch: false, + isTable: false, + form: { + component: 'InputNumber', + componentProps: { + min: 0, + precision: 2, + step: 0.1 + }, + labelMessage: '用户每次砍价的最大金额', + value: 0 + } + }, + { + label: '砍价成功数量', + field: 'successCount', + isSearch: false, + isForm: false + }, + { + label: '活动状态', + field: 'status', + dictType: DICT_TYPE.COMMON_STATUS, + dictClass: 'number', + isSearch: true, + isForm: false + }, + { + label: '拼团商品', + field: 'spuId', + isSearch: false, + form: { + colProps: { + span: 24 + } + } + }, + { + label: '操作', + field: 'action', + isForm: false + } +]) +export const { allSchemas } = useCrudSchemas(crudSchemas) diff --git a/src/views/mall/promotion/bargain/index.vue b/src/views/mall/promotion/bargain/index.vue new file mode 100644 index 00000000..42222f45 --- /dev/null +++ b/src/views/mall/promotion/bargain/index.vue @@ -0,0 +1,117 @@ + + From 98477ef4338fda996825f3ec93f5e7121436e657 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 12 Aug 2023 10:13:32 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=A3=80=E7=B4=A2=EF=BC=8Cvalue=20format=20=E9=94=99=E8=AF=AF?= =?UTF-8?q?=EF=BC=8C=E5=AF=BC=E8=87=B4=E6=97=A0=E6=B3=95=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/bpm/group/index.vue | 2 +- src/views/infra/apiAccessLog/index.vue | 2 +- src/views/infra/apiErrorLog/index.vue | 2 +- src/views/infra/codegen/index.vue | 2 +- .../mall/promotion/couponTemplate/index.vue | 30 ++++++++++++------- src/views/mp/message/index.vue | 2 +- src/views/pay/notify/index.vue | 2 +- src/views/system/dict/index.vue | 2 +- 8 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/views/bpm/group/index.vue b/src/views/bpm/group/index.vue index ee8c2e65..957ffc89 100644 --- a/src/views/bpm/group/index.vue +++ b/src/views/bpm/group/index.vue @@ -30,7 +30,7 @@ diff --git a/src/views/mall/promotion/couponTemplate/index.vue b/src/views/mall/promotion/couponTemplate/index.vue index 4f645a46..9161014b 100755 --- a/src/views/mall/promotion/couponTemplate/index.vue +++ b/src/views/mall/promotion/couponTemplate/index.vue @@ -4,22 +4,28 @@ - + - + @@ -283,7 +293,7 @@ @@ -377,8 +387,6 @@ const message = useMessage() // 遮罩层 const loading = ref(true) -// 显示搜索条件 -const showSearch = ref(true) // 总条数 const total = ref(0) // 优惠劵列表 diff --git a/src/views/mp/message/index.vue b/src/views/mp/message/index.vue index 255a8ee8..adceec56 100644 --- a/src/views/mp/message/index.vue +++ b/src/views/mp/message/index.vue @@ -34,7 +34,7 @@ From 815897ca8b94f7b72b93286c6d5ba36c3933b9a1 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 12 Aug 2023 11:09:12 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E5=95=86=E5=9F=8E=EF=BC=9A=E4=BC=98?= =?UTF-8?q?=E6=83=A0=E5=8A=B5=E7=9A=84=E5=89=8D=E7=AB=AF=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/mall/promotion/coupon/index.vue | 74 ++- .../couponTemplate/CouponTemplateForm.vue | 348 ++++++++++++++ .../mall/promotion/couponTemplate/index.vue | 431 +++--------------- 3 files changed, 436 insertions(+), 417 deletions(-) create mode 100644 src/views/mall/promotion/couponTemplate/CouponTemplateForm.vue diff --git a/src/views/mall/promotion/coupon/index.vue b/src/views/mall/promotion/coupon/index.vue index bf296e9a..51369ed9 100755 --- a/src/views/mall/promotion/coupon/index.vue +++ b/src/views/mall/promotion/coupon/index.vue @@ -1,12 +1,19 @@ - From 9984de0dc7251779434a5bf95c3aa9aab3c4cd65 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 12 Aug 2023 11:39:29 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E5=95=86=E5=9F=8E=EF=BC=9A=201.=20?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BC=98=E6=83=A0=E5=8A=B5=E7=9A=84=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=202.=20=E7=AE=80=E5=8C=96=E7=A7=92=E6=9D=80=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/mall/promotion/{ => coupon}/coupon.ts | 0 .../promotion/{ => coupon}/couponTemplate.ts | 0 .../mall/promotion/seckill/seckillConfig.ts | 2 +- src/views/mall/promotion/coupon/index.vue | 6 ++--- .../template}/CouponTemplateForm.vue | 2 +- .../template}/index.vue | 6 ++--- .../mall/promotion/seckill/activity/index.vue | 4 ++-- .../seckill/activity/seckillActivity.data.ts | 4 ++-- .../seckill/config/SeckillConfigForm.vue | 20 +++++++++------- .../mall/promotion/seckill/config/index.vue | 24 +++++++------------ 10 files changed, 29 insertions(+), 39 deletions(-) rename src/api/mall/promotion/{ => coupon}/coupon.ts (100%) rename src/api/mall/promotion/{ => coupon}/couponTemplate.ts (100%) rename src/views/mall/promotion/{couponTemplate => coupon/template}/CouponTemplateForm.vue (99%) rename src/views/mall/promotion/{couponTemplate => coupon/template}/index.vue (97%) diff --git a/src/api/mall/promotion/coupon.ts b/src/api/mall/promotion/coupon/coupon.ts similarity index 100% rename from src/api/mall/promotion/coupon.ts rename to src/api/mall/promotion/coupon/coupon.ts diff --git a/src/api/mall/promotion/couponTemplate.ts b/src/api/mall/promotion/coupon/couponTemplate.ts similarity index 100% rename from src/api/mall/promotion/couponTemplate.ts rename to src/api/mall/promotion/coupon/couponTemplate.ts diff --git a/src/api/mall/promotion/seckill/seckillConfig.ts b/src/api/mall/promotion/seckill/seckillConfig.ts index eee82115..23ad15ca 100644 --- a/src/api/mall/promotion/seckill/seckillConfig.ts +++ b/src/api/mall/promotion/seckill/seckillConfig.ts @@ -20,7 +20,7 @@ export const getSeckillConfig = async (id: number) => { } // 获得所有开启状态的秒杀时段精简列表 -export const getListAllSimple = async () => { +export const getSimpleSeckillConfigList = async () => { return await request.get({ url: '/promotion/seckill-config/list-all-simple' }) } diff --git a/src/views/mall/promotion/coupon/index.vue b/src/views/mall/promotion/coupon/index.vue index 51369ed9..acfccece 100755 --- a/src/views/mall/promotion/coupon/index.vue +++ b/src/views/mall/promotion/coupon/index.vue @@ -31,9 +31,7 @@ /> - - 搜索 - + 搜索 重置 @@ -108,7 +106,7 @@ diff --git a/src/views/mall/promotion/seckill/activity/seckillActivity.data.ts b/src/views/mall/promotion/seckill/activity/seckillActivity.data.ts index 70766d49..9341c3e3 100644 --- a/src/views/mall/promotion/seckill/activity/seckillActivity.data.ts +++ b/src/views/mall/promotion/seckill/activity/seckillActivity.data.ts @@ -1,6 +1,6 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter, dateFormatter2 } from '@/utils/formatTime' -import { getListAllSimple } from '@/api/mall/promotion/seckill/seckillConfig' +import { getSimpleSeckillConfigList } from '@/api/mall/promotion/seckill/seckillConfig' // 表单校验 export const rules = reactive({ @@ -88,7 +88,7 @@ const crudSchemas = reactive([ valueField: 'id' } }, - api: getListAllSimple + api: getSimpleSeckillConfigList }, table: { width: 300 diff --git a/src/views/mall/promotion/seckill/config/SeckillConfigForm.vue b/src/views/mall/promotion/seckill/config/SeckillConfigForm.vue index 22b07d3a..d7f07e92 100644 --- a/src/views/mall/promotion/seckill/config/SeckillConfigForm.vue +++ b/src/views/mall/promotion/seckill/config/SeckillConfigForm.vue @@ -10,7 +10,6 @@