Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
355c53df
提交
355c53df
authored
4月 16, 2019
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
H5 前端:商品详情页,接入促销活动
上级
3909a954
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
66 行增加
和
8 行删除
+66
-8
detail.vue
mobile-web/src/page/product/detail.vue
+60
-7
CartServiceImpl.java
...va/cn/iocoder/mall/order/biz/service/CartServiceImpl.java
+1
-1
PromotionActivityServiceImpl.java
...l/promotion/biz/service/PromotionActivityServiceImpl.java
+5
-0
没有找到文件。
mobile-web/src/page/product/detail.vue
浏览文件 @
355c53df
...
...
@@ -9,8 +9,14 @@
<!-- TODO 这里需要优化下,芋艿 -->
<van-cell-group>
<van-cell>
<div
v-if=
"calSkuPriceResult.originalPrice && calSkuPriceResult.originalPrice !== calSkuPriceResult.presentPrice"
>
<span
class=
"goods-price"
>
{{
formatPrice
(
calSkuPriceResult
.
presentPrice
)
}}
</span>
<span
class=
"goods-market-price"
>
{{
formatPrice
(
calSkuPriceResult
.
originalPrice
)
}}
</span>
</div>
<div
v-else
>
<span
class=
"goods-price"
>
{{
formatPrice
(
initialSku
.
price
)
}}
</span>
<!--
<span
class=
"goods-market-price"
>
{{
formatPrice
(
goods
.
market_price
)
}}
</span>
-->
</div>
<div
class=
"goods-title"
>
{{
spu
.
name
}}
</div>
<div
class=
"goods-subtit"
>
{{
spu
.
sellPoint
}}
</div>
</van-cell>
...
...
@@ -45,6 +51,7 @@
<!--</template>-->
<!--</van-cell>-->
<!---->
<!--<van-cell is-link @click="showPromotion" >-->
<!--<template slot="title">-->
<!--<span style="margin-right: 10px;">促销</span>-->
...
...
@@ -71,16 +78,17 @@
<!-- <span> 满2件,总价打9折</span>-->
<!-- </template>-->
<!-- </van-cell>-->
<van-cell
is-link
@
click=
"sorry"
>
<!-- TODO 芋艿,后续【限时折扣】需要改下样式 -->
<van-cell
v-if=
"calSkuPriceResult.timeLimitedDiscount"
is-link
@
click=
"sorry"
>
<
template
slot=
"title"
>
<van-tag
type=
"danger"
>
满减
</van-tag>
<span>
满100元减50元
</span>
<van-tag
type=
"danger"
>
限时折扣
</van-tag>
<span>
{{
formatTimeLimitedDiscountText
(
calSkuPriceResult
.
timeLimitedDiscount
)
}}
</span>
</
template
>
</van-cell>
<van-cell
is-link
@
click=
"sorry"
>
<van-cell
v-if=
"calSkuPriceResult.fullPrivilege"
is-link
@
click=
"sorry"
>
<
template
slot=
"title"
>
<van-tag
type=
"danger"
>
限购
</van-tag>
<span>
购买不超过5件时享受单件价¥8.00,超出数量以结算价为准
</span>
<van-tag
type=
"danger"
>
满减送
</van-tag>
<span>
{{
formatFullPrivilegeText
(
calSkuPriceResult
.
fullPrivilege
)
}}
</span>
</
template
>
</van-cell>
...
...
@@ -215,6 +223,43 @@
text
=
text
+
'x '
+
data
.
quantity
+
' 件'
;
return
text
;
},
formatTimeLimitedDiscountText
(
activity
)
{
let
text
=
''
;
let
timeLimitedDiscount
=
activity
.
timeLimitedDiscount
.
items
[
0
];
if
(
timeLimitedDiscount
.
preferentialType
===
1
)
{
text
+=
'减 '
+
timeLimitedDiscount
.
preferentialValue
/
100.0
+
' 元'
;
}
else
if
(
timeLimitedDiscount
.
preferentialType
===
2
)
{
text
+=
'打 '
+
timeLimitedDiscount
.
preferentialValue
/
10.0
+
' 折'
;
}
if
(
activity
.
timeLimitedDiscount
.
quota
>
0
)
{
text
+=
'【限购 '
+
activity
.
timeLimitedDiscount
.
quota
+
' 件】'
;
}
return
text
;
},
formatFullPrivilegeText
(
activity
)
{
let
text
=
''
;
let
fullPrivilege
=
activity
.
fullPrivilege
;
for
(
let
i
in
fullPrivilege
.
privileges
)
{
let
privilege
=
fullPrivilege
.
privileges
[
i
];
if
(
i
>
0
)
{
text
+=
';'
;
}
if
(
fullPrivilege
.
cycled
)
{
text
+=
'每'
;
}
if
(
privilege
.
meetType
===
1
)
{
text
+=
'满 '
+
privilege
.
meetValue
+
' 元,'
;
}
else
if
(
privilege
.
meetType
===
2
)
{
text
+=
'满 '
+
privilege
.
meetValue
+
' 件,'
;
}
if
(
privilege
.
preferentialType
===
1
)
{
text
+=
'减 '
+
privilege
.
preferentialValue
/
100.0
+
' 元'
;
}
else
if
(
privilege
.
preferentialType
===
2
)
{
text
+=
'打 '
+
privilege
.
preferentialValue
/
10.0
+
' 折'
;
}
}
return
text
;
},
stepperChange
(
value
)
{
// 选择 sku 数量时
this
.
initialSku
.
quantity
=
value
;
...
...
@@ -234,6 +279,14 @@
doCalcSkuPrice
(
skuId
)
{
getCartCalcSkuPrice
(
skuId
).
then
(
data
=>
{
this
.
calSkuPriceResult
=
data
;
// 修改 vanSku.list 里匹配的 sku 的价格(目的,将优惠价赋值到其上)
for
(
let
i
in
this
.
vanSku
.
list
)
{
let
sku
=
this
.
vanSku
.
list
[
i
];
if
(
sku
.
id
===
skuId
)
{
sku
.
price
=
data
.
presentPrice
;
break
;
}
}
});
},
onClickCart
()
{
...
...
order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/CartServiceImpl.java
浏览文件 @
355c53df
...
...
@@ -244,7 +244,7 @@ public class CartServiceImpl implements CartService {
return
presentPrice
>=
0
?
presentPrice
:
sku
.
getPrice
();
// 如果计算优惠价格小于 0 ,则说明无法使用优惠。
}
if
(
PreferentialTypeEnum
.
DISCOUNT
.
getValue
().
equals
(
item
.
getPreferentialType
()))
{
// 打折
return
sku
.
getPrice
()
*
item
.
getPreferentialValue
()
/
10
0
;
return
sku
.
getPrice
()
*
item
.
getPreferentialValue
()
/
10
;
}
throw
new
IllegalArgumentException
(
String
.
format
(
"折扣活动(%s) 的优惠类型不正确"
,
timeLimitedDiscount
.
toString
()));
}
...
...
promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/PromotionActivityServiceImpl.java
浏览文件 @
355c53df
...
...
@@ -56,6 +56,11 @@ public class PromotionActivityServiceImpl implements PromotionActivityService {
// 不匹配,则进行移除
if
(!
matched
)
{
iterator
.
remove
();
}
else
{
// 匹配,则做一些后续的处理
// 如果是限时折扣,移除不在 spuId 数组中的折扣规则
if
(
PromotionActivityTypeEnum
.
TIME_LIMITED_DISCOUNT
.
getValue
().
equals
(
activity
.
getActivityType
()))
{
activity
.
getTimeLimitedDiscount
().
getItems
().
removeIf
(
item
->
!
spuIds
.
contains
(
item
.
getSpuId
()));
}
}
}
// 返回最终结果
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论