From 343b1fd5f6e16f59f57b4bc8ccb407c570bf7da2 Mon Sep 17 00:00:00 2001 From: owen Date: Sat, 25 Nov 2023 15:53:06 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E8=90=A5=E9=94=80=EF=BC=9A=E9=80=82?= =?UTF-8?q?=E9=85=8D=E5=95=86=E5=9F=8E=E8=A3=85=E4=BF=AE=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E3=80=90=E8=90=A5=E9=94=80=E6=96=87=E7=AB=A0=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sheep/api/promotion/article.js | 12 ++++++++++++ sheep/components/s-block-item/s-block-item.vue | 4 ++-- .../components/s-richtext-block/s-richtext-block.vue | 8 +++----- 3 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 sheep/api/promotion/article.js diff --git a/sheep/api/promotion/article.js b/sheep/api/promotion/article.js new file mode 100644 index 00000000..36b037d0 --- /dev/null +++ b/sheep/api/promotion/article.js @@ -0,0 +1,12 @@ +import request from '@/sheep/request'; + +export default { + // 获得文章详情 + getArticle: (id) => { + return request({ + url: '/app-api/promotion/article/get', + method: 'GET', + params: { id } + }); + } +} diff --git a/sheep/components/s-block-item/s-block-item.vue b/sheep/components/s-block-item/s-block-item.vue index 21fe32da..45228c0a 100644 --- a/sheep/components/s-block-item/s-block-item.vue +++ b/sheep/components/s-block-item/s-block-item.vue @@ -23,8 +23,6 @@ - - @@ -43,6 +41,8 @@ + + diff --git a/sheep/components/s-richtext-block/s-richtext-block.vue b/sheep/components/s-richtext-block/s-richtext-block.vue index dfba649b..86f801db 100644 --- a/sheep/components/s-richtext-block/s-richtext-block.vue +++ b/sheep/components/s-richtext-block/s-richtext-block.vue @@ -15,7 +15,7 @@ From cfc04d9c820f6b5c6593ad189589ab1ed8b14289 Mon Sep 17 00:00:00 2001 From: owen Date: Fri, 1 Dec 2023 20:24:54 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E8=90=A5=E9=94=80=EF=BC=9A=E9=80=82?= =?UTF-8?q?=E9=85=8D=E5=95=86=E5=9F=8E=E8=A3=85=E4=BF=AE=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E3=80=90=E7=A7=92=E6=9D=80=E3=80=91=EF=BC=88=E5=BE=85=E9=87=8D?= =?UTF-8?q?=E5=86=99=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sheep/api/product/spu.js | 3 +- sheep/api/promotion/seckill.js | 33 ++++ .../components/s-block-item/s-block-item.vue | 10 +- .../components/s-goods-card/s-goods-card.vue | 39 ++--- .../s-goods-column/s-goods-column.vue | 43 +++-- .../s-goods-shelves/s-goods-shelves.vue | 40 ++--- .../s-seckill-block/s-seckill-block.vue | 64 +++---- sheep/hooks/useGoods.js | 163 ++++++++++-------- 8 files changed, 214 insertions(+), 181 deletions(-) create mode 100644 sheep/api/promotion/seckill.js diff --git a/sheep/api/product/spu.js b/sheep/api/product/spu.js index 83766668..87bf1fa5 100644 --- a/sheep/api/product/spu.js +++ b/sheep/api/product/spu.js @@ -1,6 +1,6 @@ import request from '@/sheep/request'; -export default { +const SpuApi = { // 获得商品 SPU 列表 getSpuList: (recommendType) => { return request({ @@ -34,3 +34,4 @@ export default { }); } }; +export default SpuApi; diff --git a/sheep/api/promotion/seckill.js b/sheep/api/promotion/seckill.js new file mode 100644 index 00000000..ecbb4c1f --- /dev/null +++ b/sheep/api/promotion/seckill.js @@ -0,0 +1,33 @@ +import request2 from "@/sheep/request2"; + +const SeckillApi = { + // 获得秒杀时间段列表 + getSeckillConfigList: () => { + return request2({ url: 'promotion/seckill-config/list', method: 'GET' }); + }, + + // 获得当前秒杀活动 + getNowSeckillActivity: () => { + return request2({ url: 'promotion/seckill-activity/get-now', method: 'GET' }); + }, + + // 获得秒杀活动分页 + getSeckillActivityPage: () => { + return request2({ url: 'promotion/seckill-activity/page', method: 'GET' }); + }, + + /** + * 获得秒杀活动明细 + * @param {number} id 秒杀活动编号 + * @return {*} + */ + getSeckillActivity: (id) => { + return request2({ + url: 'promotion/seckill-activity/get-detail', + method: 'GET', + params: { id } + }); + } +} + +export default SeckillApi; diff --git a/sheep/components/s-block-item/s-block-item.vue b/sheep/components/s-block-item/s-block-item.vue index 45228c0a..b39337b3 100644 --- a/sheep/components/s-block-item/s-block-item.vue +++ b/sheep/components/s-block-item/s-block-item.vue @@ -34,11 +34,11 @@ - - - - - + + + + + diff --git a/sheep/components/s-goods-card/s-goods-card.vue b/sheep/components/s-goods-card/s-goods-card.vue index 91441647..b51706f7 100644 --- a/sheep/components/s-goods-card/s-goods-card.vue +++ b/sheep/components/s-goods-card/s-goods-card.vue @@ -12,8 +12,8 @@ { - return { - title: props.data.fields.name, - subtitle: props.data.fields.introduction, - price: props.data.fields.price, - original_price: props.data.fields.marketPrice, - stock: props.data.fields.stock, - salesCount: props.data.fields.salesCount, - } - }) - - // 角标,todo @owen 规范命名,这里先转换,后期重构时再修改 - const badge = computed(() => { - return { - show: props.data.badge.show, - src: props.data.badge.imgUrl, - } - }) - //region 商品瀑布流布局 // 下一个要处理的商品索引 let count = 0; diff --git a/sheep/components/s-goods-column/s-goods-column.vue b/sheep/components/s-goods-column/s-goods-column.vue index e82b870d..40a9cec9 100644 --- a/sheep/components/s-goods-column/s-goods-column.vue +++ b/sheep/components/s-goods-column/s-goods-column.vue @@ -9,15 +9,15 @@ @tap="onClick" > - + @@ -37,16 +37,16 @@ - + - + {{ data.title || data.name }} - + {{ data.title || data.name }} @@ -135,7 +135,7 @@ @tap="onClick" > - + 秒杀 @@ -145,14 +145,14 @@ {{ data.title || data.name }} @@ -201,7 +201,7 @@ - + @@ -209,14 +209,14 @@ {{ data.title || data.name }} @@ -307,12 +307,25 @@ type: [Array, Object], default() { return { + // 商品名称(旧) title: { show: true }, + // 商品介绍(旧) subtitle: { show: true }, + // 商品价格 price: { show: true }, + // 市场价(旧) original_price: { show: true }, + // 销量(旧) sales: { show: true }, + // 库存 stock: { show: true }, + // 商品名称(新) + name: { show: true }, + // 商品介绍(新) + introduction: { show: true }, + // 市场价(新) + marketPrice: { show: true }, + // 销量(新) salesCount: { show: true }, }; }, diff --git a/sheep/components/s-goods-shelves/s-goods-shelves.vue b/sheep/components/s-goods-shelves/s-goods-shelves.vue index 2992807a..01129a33 100644 --- a/sheep/components/s-goods-shelves/s-goods-shelves.vue +++ b/sheep/components/s-goods-shelves/s-goods-shelves.vue @@ -19,10 +19,10 @@ @@ -105,7 +105,7 @@ default() {}, }, }); - const { layoutType, tagStyle, spuIds } = props.data; + const { layoutType, spuIds } = props.data; let { marginLeft, marginRight } = props.styles; const goodsList = ref([]); onMounted(async () => { @@ -114,26 +114,6 @@ goodsList.value = data; } }); - - // 商品字段配置,todo @owen 字段名称与服务端对齐,这里先转换,后期重构时再修改 - const productFields = computed(() => { - return { - title: props.data.fields.name, - subtitle: props.data.fields.introduction, - price: props.data.fields.price, - original_price: props.data.fields.marketPrice, - stock: props.data.fields.stock, - salesCount: props.data.fields.salesCount, - } - }) - - // 角标,todo @owen 规范命名,这里先转换,后期重构时再修改 - const badge = computed(() => { - return { - show: props.data.badge.show, - src: props.data.badge.imgUrl, - } - }) +