Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica-professional-exam
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
com.pica.cloud.education.frontend
pica-professional-exam
提交
d80f67c2
提交
d80f67c2
编写于
10月 31, 2020
作者:
guangjun.yang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
解决加减商品时,传的优惠券不对的问题
上级
cde8b6cc
变更
3
展开全部
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
2282 行增加
和
42 行删除
+2282
-42
goods-detail copy 1131.vue
src/views/goods-detail copy 1131.vue
+1092
-0
goods-detail copy.vue
src/views/goods-detail copy.vue
+1132
-0
goods-detail.vue
src/views/goods-detail.vue
+58
-42
未找到文件。
src/views/goods-detail copy 1131.vue
0 → 100644
浏览文件 @
d80f67c2
此差异已折叠。
点击以展开。
src/views/goods-detail copy.vue
0 → 100644
浏览文件 @
d80f67c2
此差异已折叠。
点击以展开。
src/views/goods-detail.vue
浏览文件 @
d80f67c2
...
...
@@ -304,6 +304,7 @@ export default {
);
},
// 处理数据,并且先排序,再将不可用的放在最后
handlerCouponList
(
couponList
,
goodsPrice
)
{
if
(
!
couponList
.
length
)
return
[];
...
...
@@ -313,9 +314,47 @@ export default {
firstCanCouponIndex
=
0
,
item
=
{},
count
=
0
;
couponList
.
sort
(
(
a
,
b
)
=>
{
return
b
.
discountAmount
-
a
.
discountAmount
;
});
// couponList.sort( (a, b) => {
// return b.discountAmount - a.discountAmount;
// });
for
(
let
i
=
0
;
i
<
couponList
.
length
;
i
++
)
{
item
=
couponList
[
i
];
// couponList.forEach(item => {
// 要根据商品价格及券适用类型来计算
// item.disabled = !this.isCanSelect(item, goodsPrice);
item
.
disabled
=
!
item
.
enableFlag
;
if
(
!
item
.
disabled
)
{
count
++
;
}
// 是否已经选择
item
.
isChecked
=
!!
item
.
checkFlag
;
// console.log('firstCanCoupon, item.disabled', firstCanCoupon, item.disabled);
if
(
!
firstCanCoupon
&&
item
.
isChecked
)
{
firstCanCoupon
=
item
;
firstCanCouponIndex
=
i
;
}
newList
.
push
(
item
);
}
this
.
setCurrentCoupon
(
JSON
.
parse
(
JSON
.
stringify
(
firstCanCoupon
))
||
{});
// this.setSelectCouponList(newList.concat(sortArray));
this
.
setSelectCouponList
(
newList
);
this
.
goodsInfo4Coupon
.
count
=
count
;
this
.
setGoodsInfo4Coupon
(
this
.
goodsInfo4Coupon
);
},
// 处理数据,并且先排序,再将不可用的放在最后
handlerCouponListOld
(
couponList
,
goodsPrice
)
{
if
(
!
couponList
.
length
)
return
[];
let
newList
=
[],
obj
=
{},
firstCanCoupon
=
null
,
firstCanCouponIndex
=
0
,
item
=
{},
count
=
0
;
// couponList.sort( (a, b) => {
// return b.discountAmount - a.discountAmount;
// });
for
(
let
i
=
0
;
i
<
couponList
.
length
;
i
++
)
{
item
=
couponList
[
i
];
// couponList.forEach(item => {
...
...
@@ -459,8 +498,8 @@ export default {
this
.
isShowCoupon
=
false
;
this
.
needSortAndSelect
=
false
;
// 要重新调用计算价格接口
this
.
countTotalPrice
();
//
this.getTotalPrice(currentCoupon);
//
this.countTotalPrice();
this
.
getTotalPrice
(
currentCoupon
);
},
// tab切换
...
...
@@ -555,12 +594,13 @@ export default {
// 多件商品的价格
// TODO,要多传优惠券id参数
getTotalPrice
(
coupon
)
{
console
.
log
(
'coupon'
,
coupon
);
getTotalPrice
(
currentCoupon
)
{
const
num
=
this
.
curtGoodsNum
;
// this.GET(`trade/goods/getPrice/${this.goodsId}/${num}/${couponId}`, {}).then(res => {
const
couponId
=
this
.
currentCoupon
.
couponId
||
-
1
;
this
.
GET
(
`trade/goods/getPrice/
${
this
.
goodsId
}
/
${
num
}
/
${
couponId
}
`
,
{}).
then
(
res
=>
{
let
couponId
=
0
;
if
(
currentCoupon
)
{
couponId
=
currentCoupon
.
couponId
;
}
this
.
GET
(
`trade/goods/getPrice/
${
this
.
goodsId
}
/
${
num
}
/
${
couponId
}
`
,
{}).
then
(
res
=>
{
if
(
res
.
code
==
"000000"
)
{
const
{
couponPrice
,
...
...
@@ -580,7 +620,8 @@ export default {
this
.
setGoodsInfo4Coupon
(
this
.
goodsInfo4Coupon
);
this
.
goodsNum
=
num
;
if
(
this
.
needSortAndSelect
)
{
this
.
handlerCouponList
(
this
.
selectCouponList
,
preferentialPrice
||
costPrice
);
this
.
getCanUseCoupons
(
this
.
goodsInfo4Coupon
);
// this.handlerCouponList(this.selectCouponList, preferentialPrice || costPrice);
}
this
.
needSortAndSelect
=
true
;
}
else
if
(
res
.
code
===
"200006"
)
{
...
...
@@ -589,34 +630,6 @@ export default {
});
},
// 多件商品的价格
getTotalPriceOld
()
{
const
num
=
this
.
curtGoodsNum
;
this
.
GET
(
`trade/goods/getPrice/
${
this
.
goodsId
}
/
${
num
}
`
,
{}).
then
(
res
=>
{
if
(
res
.
code
==
"000000"
)
{
const
{
couponPrice
,
preferentialPrice
,
costPrice
,
savePrice
}
=
res
.
data
;
let
price
=
couponPrice
||
preferentialPrice
||
costPrice
;
this
.
totalPrice
=
{
...
this
.
formatPrice
(
price
),
preferentialPrice
,
costPrice
:
costPrice
,
costPriceText
:
(
costPrice
/
100
).
toFixed
(
2
),
savePrice
:
savePrice
?
(
savePrice
/
100
).
toFixed
(
2
)
:
0
};
this
.
goodsInfo4Coupon
.
price
=
price
;
this
.
setGoodsInfo4Coupon
(
this
.
goodsInfo4Coupon
);
this
.
goodsNum
=
num
;
}
else
if
(
res
.
code
===
"200006"
)
{
this
.
$store
.
dispatch
(
"logout"
);
}
});
},
// 价格转成元、分
formatPrice
(
price
)
{
let
yuan
=
(
price
/
100
).
toFixed
(
0
);
...
...
@@ -627,6 +640,7 @@ export default {
fen
};
},
// 获取切换标签宽度
getTabW
()
{
if
(
this
.
tabs
.
length
===
0
)
{
...
...
@@ -639,10 +653,12 @@ export default {
this
.
tabW
=
width
;
});
},
// 轮播切换
onSwiperChange
(
index
)
{
this
.
swiperCurtIndex
=
index
;
},
// 数量增
onPlus
()
{
this
.
$sendBuriedData
({
...
...
@@ -666,6 +682,7 @@ export default {
this
.
curtGoodsNum
=
num
+
1
;
this
.
countTotalPrice
();
},
// 数量减
onReduce
()
{
this
.
$sendBuriedData
({
...
...
@@ -680,15 +697,14 @@ export default {
this
.
curtGoodsNum
=
num
-
1
;
this
.
countTotalPrice
();
},
// goLogin() {
// this.$store.dispatch('goLogin');
// },
handlerAction
(
type
)
{
if
(
type
===
2
)
{
wxOauth
();
}
this
.
isShowDialog
=
false
;
},
// 创建订单
createOrder
()
{
this
.
$sendBuriedData
({
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录