Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
d672976b
提交
d672976b
authored
4月 17, 2019
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
后端:商品价格计算,接入促销活动
H5 前端:购物车接入促销
上级
355c53df
全部展开
显示空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
161 行增加
和
91 行删除
+161
-91
application.properties
...ice-impl/src/main/resources/config/application.properties
+0
-2
mybatis-config.xml
cart/cart-service-impl/src/main/resources/mybatis-config.xml
+0
-20
index.vue
mobile-web/src/page/cart/index.vue
+56
-16
detail.vue
mobile-web/src/page/product/detail.vue
+1
-1
UsersCartDetailVO.java
.../iocoder/mall/order/application/vo/UsersCartDetailVO.java
+36
-3
UsersOrderConfirmCreateVO.java
.../mall/order/application/vo/UsersOrderConfirmCreateVO.java
+11
-2
CalcOrderPriceBO.java
...n/java/cn/iocoder/mall/order/api/bo/CalcOrderPriceBO.java
+20
-0
CartBO.java
...pi/src/main/java/cn/iocoder/mall/order/api/bo/CartBO.java
+0
-24
FeeDetailBO.java
...c/main/java/cn/iocoder/mall/order/api/bo/FeeDetailBO.java
+0
-4
MerchantItemGroup.java
.../java/cn/iocoder/mall/order/api/bo/MerchantItemGroup.java
+0
-19
CartServiceImpl.java
...va/cn/iocoder/mall/order/biz/service/CartServiceImpl.java
+0
-0
PromotionActivityBO.java
...cn/iocoder/mall/promotion/api/bo/PromotionActivityBO.java
+4
-0
MeetTypeEnum.java
.../cn/iocoder/mall/promotion/api/constant/MeetTypeEnum.java
+33
-0
没有找到文件。
cart/cart-service-impl/src/main/resources/config/application.properties
deleted
100644 → 0
浏览文件 @
355c53df
#####################
业务模块
#####################
\ No newline at end of file
cart/cart-service-impl/src/main/resources/mybatis-config.xml
deleted
100644 → 0
浏览文件 @
355c53df
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<!-- 使用驼峰命名法转换字段。 -->
<setting
name=
"mapUnderscoreToCamelCase"
value=
"true"
/>
</settings>
<typeAliases>
<typeAlias
alias=
"Integer"
type=
"java.lang.Integer"
/>
<typeAlias
alias=
"Long"
type=
"java.lang.Long"
/>
<typeAlias
alias=
"HashMap"
type=
"java.util.HashMap"
/>
<typeAlias
alias=
"LinkedHashMap"
type=
"java.util.LinkedHashMap"
/>
<typeAlias
alias=
"ArrayList"
type=
"java.util.ArrayList"
/>
<typeAlias
alias=
"LinkedList"
type=
"java.util.LinkedList"
/>
</typeAliases>
</configuration>
\ No newline at end of file
mobile-web/src/page/cart/index.vue
浏览文件 @
d672976b
...
@@ -14,20 +14,19 @@
...
@@ -14,20 +14,19 @@
<!-- <van-checkbox :name="item.id" />-->
<!-- <van-checkbox :name="item.id" />-->
<!-- <product-card :product='item' :iscard='false' >-->
<!-- <product-card :product='item' :iscard='false' >-->
<!-- <template slot>-->
<!-- <van-cell value="修改" >-->
<!-- <template slot="title">-->
<!-- <van-tag type="danger">促销</van-tag>-->
<!-- <span class="van-cell-text" >满60元减5元</span>-->
<!-- </template>-->
<!-- </van-cell>-->
<!-- </template>-->
<!-- </product-card>-->
<!-- </product-card>-->
<!-- </div>-->
<!-- </div>-->
<div
v-for=
"(itemGroup, i) in itemGroups"
class=
"card-goods__item"
>
<div
v-for=
"(itemGroup, i) in itemGroups"
class=
"card-goods__item"
>
<van-cell
>
<
template
v-if=
"itemGroup.activity"
slot=
"title"
>
<van-tag
type=
"danger"
>
满减送
</van-tag>
<span
class=
"van-cell-text"
>
{{
formatFullPrivilegeText
(
itemGroup
.
activity
)
}}
</span>
</
template
>
</van-cell>
<div
class=
"card"
v-for=
"(item, j) in itemGroup.items"
:key=
"j"
>
<div
class=
"card"
v-for=
"(item, j) in itemGroup.items"
:key=
"j"
>
<van-checkbox
:key=
"item.id"
:name=
"item.id"
v-model=
"item.selected"
style=
"position: relative;"
/>
<van-checkbox
:key=
"item.id"
:name=
"item.id"
v-model=
"item.selected"
style=
"position: relative;
top: 40px;
"
/>
<product-card
:product=
'convertProduct(item)'
/>
<product-card
:product=
'convertProduct(item)'
/>
</div>
</div>
<div
style=
"height:15px;"
></div>
<div
style=
"height:15px;"
></div>
...
@@ -47,13 +46,14 @@
...
@@ -47,13 +46,14 @@
<div
style=
"height:50px;"
></div>
<div
style=
"height:50px;"
></div>
<van-submit-bar
<van-submit-bar
:tip=
"this.formatItemGroupDiscountPriceText()"
:price=
"fee.presentTotal"
:price=
"fee.presentTotal"
:disabled=
"!checkedItemIds || !checkedItemIds.length"
:disabled=
"!checkedItemIds || !checkedItemIds.length"
:button-text=
"submitBarText"
:button-text=
"submitBarText"
@
submit=
"onSubmit"
@
submit=
"onSubmit"
>
>
<
template
slot
>
<
template
slot
>
<van-checkbox
v-model=
"checkedAll"
@
c
hange
=
"onSelectAll"
>
全选
</van-checkbox>
<van-checkbox
v-model=
"checkedAll"
@
c
lick
=
"onSelectAll"
>
全选
</van-checkbox>
</
template
>
</
template
>
</van-submit-bar>
</van-submit-bar>
</div>
</div>
...
@@ -87,6 +87,39 @@ export default {
...
@@ -87,6 +87,39 @@ export default {
},
},
},
},
methods
:
{
methods
:
{
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
/
100.0
+
' 元,'
;
}
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
;
},
formatItemGroupDiscountPriceText
()
{
let
price
=
0
;
for
(
let
i
in
this
.
itemGroups
)
{
let
itemGroup
=
this
.
itemGroups
[
i
];
price
+=
itemGroup
.
fee
.
discountTotal
;
}
return
price
>
0
?
'立减 '
+
price
/
100.0
+
' 元'
:
''
;
},
calCheckedItemIds
()
{
calCheckedItemIds
()
{
// debugger;
// debugger;
let
itemIds
=
[];
let
itemIds
=
[];
...
@@ -122,11 +155,10 @@ export default {
...
@@ -122,11 +155,10 @@ export default {
// 计算 checkedItemIds + checkedAll
// 计算 checkedItemIds + checkedAll
this
.
calCheckedItemIds
();
this
.
calCheckedItemIds
();
},
},
onItemSelectedChange
(
newVal
)
{
onItemSelectedChange
(
newVal
)
{
// TODO 芋艿,后续研究下。这样的处理方式,很奇怪。
if
(
!
this
.
checkedItemIds
)
{
if
(
!
this
.
checkedItemIds
)
{
return
;
return
;
}
}
// debugger;
let
selected
;
let
selected
;
let
diffItemIds
;
let
diffItemIds
;
if
(
newVal
.
length
>
this
.
oldCheckedItemIds
.
length
)
{
// 新增
if
(
newVal
.
length
>
this
.
oldCheckedItemIds
.
length
)
{
// 新增
...
@@ -152,9 +184,17 @@ export default {
...
@@ -152,9 +184,17 @@ export default {
if
(
this
.
checkedAll
===
undefined
)
{
if
(
this
.
checkedAll
===
undefined
)
{
return
;
return
;
}
}
updateCartSelected
(
this
.
getItemIds
(),
newVal
).
then
(
data
=>
{
// debugger;
this
.
handleData
(
data
);
// updateCartSelected(this.getItemIds(), newVal).then(data => {
})
// this.handleData(data);
// })
if
(
newVal
)
{
this
.
onItemSelectedChange
(
this
.
getItemIds
());
}
else
{
// alert('有 bug ,后续修复');
// this.onItemSelectedChange(this.getItemIds());
// TODO 芋艿,暂时有 bug 。后续修复
}
},
},
onSubmit
()
{
onSubmit
()
{
this
.
$router
.
push
(
'/order?from=cart'
)
this
.
$router
.
push
(
'/order?from=cart'
)
...
@@ -164,7 +204,7 @@ export default {
...
@@ -164,7 +204,7 @@ export default {
return
{
return
{
...
item
.
spu
,
...
item
.
spu
,
quantity
:
item
.
buyQuantity
,
quantity
:
item
.
buyQuantity
,
price
:
item
.
price
,
price
:
item
.
discountPrice
||
item
.
price
,
sku
:
{
sku
:
{
...
item
,
...
item
,
spu
:
undefined
,
spu
:
undefined
,
...
...
mobile-web/src/page/product/detail.vue
浏览文件 @
d672976b
...
@@ -248,7 +248,7 @@
...
@@ -248,7 +248,7 @@
text
+=
'每'
;
text
+=
'每'
;
}
}
if
(
privilege
.
meetType
===
1
)
{
if
(
privilege
.
meetType
===
1
)
{
text
+=
'满 '
+
privilege
.
meetValue
+
' 元,'
;
text
+=
'满 '
+
privilege
.
meetValue
/
100.0
+
' 元,'
;
}
else
if
(
privilege
.
meetType
===
2
)
{
}
else
if
(
privilege
.
meetType
===
2
)
{
text
+=
'满 '
+
privilege
.
meetValue
+
' 件,'
;
text
+=
'满 '
+
privilege
.
meetValue
+
' 件,'
;
}
}
...
...
order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/UsersCartDetailVO.java
浏览文件 @
d672976b
package
cn
.
iocoder
.
mall
.
order
.
application
.
vo
;
package
cn
.
iocoder
.
mall
.
order
.
application
.
vo
;
import
cn.iocoder.mall.product.api.bo.ProductAttrAndValuePairBO
;
import
cn.iocoder.mall.product.api.bo.ProductAttrAndValuePairBO
;
import
cn.iocoder.mall.promotion.api.bo.PromotionActivityBO
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
...
@@ -30,12 +31,30 @@ public class UsersCartDetailVO {
...
@@ -30,12 +31,30 @@ public class UsersCartDetailVO {
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
public
static
class
ItemGroup
{
public
static
class
ItemGroup
{
// TODO 优惠活动
/**
private
Object
activity
;
* 优惠活动
*/
private
PromotionActivityBO
activity
;
// TODO 芋艿,偷懒
/**
* 优惠活动是否生效
*
* 多个商品,参与某个活动,因为并发达到条件,所以会存在未生效的情况。所以一共有三种情况
*
* 1. activity 非空,activityEffectEffective 为 true,参与活动,且生效
* 2. activity 非空,activityEffectEffective 为 false ,参与活动,并未生效
* 3. activity 为空,activityEffectEffective 为空,并未参与活动。
*/
private
Boolean
activityEffectEffective
;
/**
/**
* 商品数组
* 商品数组
*/
*/
private
List
<
Sku
>
items
;
private
List
<
Sku
>
items
;
/**
* 费用
*
* TODO 芋艿,这里先偷懒,postageTotal 字段用不到。
*/
private
Fee
fee
;
}
}
...
@@ -79,6 +98,20 @@ public class UsersCartDetailVO {
...
@@ -79,6 +98,20 @@ public class UsersCartDetailVO {
* 是否选中
* 是否选中
*/
*/
private
Boolean
selected
;
private
Boolean
selected
;
/**
* 优惠活动
*/
private
PromotionActivityBO
activity
;
/**
* 折扣价
*/
private
Integer
discountPrice
;
/**
* 费用
*
* TODO 芋艿,这里先偷懒,postageTotal 字段用不到。
*/
private
Fee
fee
;
}
}
...
@@ -151,7 +184,7 @@ public class UsersCartDetailVO {
...
@@ -151,7 +184,7 @@ public class UsersCartDetailVO {
}
}
/**
/**
* 邮费信息
* 邮费信息
TODO 芋艿,未完成
*/
*/
@Data
@Data
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
...
...
order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/UsersOrderConfirmCreateVO.java
浏览文件 @
d672976b
package
cn
.
iocoder
.
mall
.
order
.
application
.
vo
;
package
cn
.
iocoder
.
mall
.
order
.
application
.
vo
;
import
cn.iocoder.mall.product.api.bo.ProductAttrAndValuePairBO
;
import
cn.iocoder.mall.product.api.bo.ProductAttrAndValuePairBO
;
import
cn.iocoder.mall.promotion.api.bo.PromotionActivityBO
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
...
@@ -28,8 +29,12 @@ public class UsersOrderConfirmCreateVO {
...
@@ -28,8 +29,12 @@ public class UsersOrderConfirmCreateVO {
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
public
static
class
ItemGroup
{
public
static
class
ItemGroup
{
// TODO 优惠活动
/**
private
Object
activity
;
* 优惠活动
*/
// TODO 芋艿,目前只会有【满减送】的情况,未来有新的促销方式,可能需要改成数组
// TODO 芋艿,后面改成 VO
private
PromotionActivityBO
activity
;
/**
/**
* 商品数组
* 商品数组
*/
*/
...
@@ -73,6 +78,10 @@ public class UsersOrderConfirmCreateVO {
...
@@ -73,6 +78,10 @@ public class UsersOrderConfirmCreateVO {
* 购买数量
* 购买数量
*/
*/
private
Integer
buyQuantity
;
private
Integer
buyQuantity
;
/**
* 折扣价
*/
private
Integer
discountPrice
;
}
}
...
...
order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/CalcOrderPriceBO.java
浏览文件 @
d672976b
...
@@ -41,10 +41,26 @@ public class CalcOrderPriceBO {
...
@@ -41,10 +41,26 @@ public class CalcOrderPriceBO {
*/
*/
// TODO 芋艿,目前只会有【满减送】的情况,未来有新的促销方式,可能需要改成数组
// TODO 芋艿,目前只会有【满减送】的情况,未来有新的促销方式,可能需要改成数组
private
PromotionActivityBO
activity
;
private
PromotionActivityBO
activity
;
/**
* 优惠活动是否生效
*
* 多个商品,参与某个活动,因为并发达到条件,所以会存在未生效的情况。所以一共有三种情况
*
* 1. activity 非空,activityEffectEffective 为 true,参与活动,且生效
* 2. activity 非空,activityEffectEffective 为 false ,参与活动,并未生效
* 3. activity 为空,activityEffectEffective 为空,并未参与活动。
*/
private
Boolean
activityEffectEffective
;
/**
/**
* 商品数组
* 商品数组
*/
*/
private
List
<
Item
>
items
;
private
List
<
Item
>
items
;
/**
* 费用
*
* TODO 芋艿,这里先偷懒,postageTotal 字段用不到。
*/
private
Fee
fee
;
}
}
...
@@ -70,6 +86,10 @@ public class CalcOrderPriceBO {
...
@@ -70,6 +86,10 @@ public class CalcOrderPriceBO {
* TODO 芋艿,这里先偷懒,postageTotal 字段用不到。
* TODO 芋艿,这里先偷懒,postageTotal 字段用不到。
*/
*/
private
Fee
fee
;
private
Fee
fee
;
/**
* 折扣价
*/
private
Integer
discountPrice
;
}
}
...
...
order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/CartBO.java
deleted
100644 → 0
浏览文件 @
355c53df
package
cn
.
iocoder
.
mall
.
order
.
api
.
bo
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.util.List
;
/**
* 购物车明细 BO
*/
@Data
@Accessors
(
chain
=
true
)
public
class
CartBO
{
/**
* 商品分组数组
*/
private
List
<
CartItemGroupBO
>
itemGroups
;
/**
* 费用
*/
private
FeeMessageBO
fee
;
}
order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/FeeDetailBO.java
deleted
100644 → 0
浏览文件 @
355c53df
package
cn
.
iocoder
.
mall
.
order
.
api
.
bo
;
public
class
FeeDetailBO
{
}
order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/MerchantItemGroup.java
deleted
100644 → 0
浏览文件 @
355c53df
package
cn
.
iocoder
.
mall
.
order
.
api
.
bo
;
import
java.util.List
;
/**
* 商家商品分组
*/
public
class
MerchantItemGroup
{
/**
* 商品分组数组
*/
private
List
<
CartItemGroupBO
>
itemGroups
;
/**
* 运费详情
*/
private
PostageDetailBO
postageDetail
;
}
order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/CartServiceImpl.java
浏览文件 @
d672976b
差异被折叠。
点击展开。
promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/PromotionActivityBO.java
浏览文件 @
d672976b
...
@@ -128,6 +128,10 @@ public class PromotionActivityBO implements Serializable {
...
@@ -128,6 +128,10 @@ public class PromotionActivityBO implements Serializable {
* 指定可用商品列表
* 指定可用商品列表
*/
*/
private
List
<
Integer
>
rangeValues
;
private
List
<
Integer
>
rangeValues
;
/**
* 是否循环
*/
private
Boolean
cycled
;
/**
/**
* 优惠数组
* 优惠数组
*/
*/
...
...
promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/MeetTypeEnum.java
0 → 100644
浏览文件 @
d672976b
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
constant
;
/**
* 匹配类型枚举
*/
public
enum
MeetTypeEnum
{
PRICE
(
1
,
"金额"
),
QUANTITY
(
2
,
"数量"
),;
/**
* 值
*/
private
final
Integer
value
;
/**
* 名字
*/
private
final
String
name
;
MeetTypeEnum
(
Integer
value
,
String
name
)
{
this
.
value
=
value
;
this
.
name
=
name
;
}
public
Integer
getValue
()
{
return
value
;
}
public
String
getName
()
{
return
name
;
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论