Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica-annual-summary
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
com.pica.cloud.education.frontend
pica-annual-summary
提交
90e54c92
提交
90e54c92
编写于
10月 28, 2020
作者:
guangjun.yang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
请选择优惠券
上级
b7ecbe21
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
41 行增加
和
20 行删除
+41
-20
com-coupon-select-list.vue
src/components/coupon/com-coupon-select-list.vue
+5
-2
goods-detail.vue
src/views/goods-detail.vue
+36
-18
未找到文件。
src/components/coupon/com-coupon-select-list.vue
浏览文件 @
90e54c92
...
...
@@ -6,10 +6,13 @@
<img
@
click=
"cancle"
src=
"../../images/cme/close.png"
/>
</article>
<article
v-if=
"true"
class=
"list-wrapper"
>
<p
v-if=
"currentCoupon.couponId"
>
<p
v-if=
"currentCoupon.couponId
|| goodsInfo4Coupon.count
"
>
已选择1张优惠券,共抵扣
<span
class=
"sc thin"
>
¥
{{
yuan
(
currentCoupon
.
discountAmount
)
}}
</span>
</p>
<p
v-else-if=
"goodsInfo4Coupon.count"
>
请选择优惠券
</p>
<div
class=
"item"
@
click=
"toggleChecked(item)"
...
...
@@ -139,8 +142,8 @@ export default {
this
.
selectCouponList
.
forEach
((
cItem
,
index
)
=>
{
cItem
.
isChecked
=
false
;
});
this
.
currentCouponInfo
=
JSON
.
parse
(
JSON
.
stringify
(
item
));
item
.
isChecked
=
true
;
this
.
currentCouponInfo
=
JSON
.
parse
(
JSON
.
stringify
(
item
));
}
else
{
this
.
currentCouponInfo
=
{};
item
.
isChecked
=
false
;
...
...
src/views/goods-detail.vue
浏览文件 @
90e54c92
...
...
@@ -177,13 +177,13 @@ export default {
deep
:
true
},
// 监听当前商品信息
goodsInfo4Coupon
:
{
handler
(
goodsInfo
)
{
this
.
setSelectCouponList
(
this
.
selectCouponList
);
},
deep
:
true
}
//
//
监听当前商品信息
//
goodsInfo4Coupon: {
//
handler(goodsInfo) {
//
this.setSelectCouponList(this.selectCouponList);
//
},
//
deep: true
//
}
},
created
()
{
...
...
@@ -194,7 +194,7 @@ export default {
this
.
projectId
=
this
.
$route
.
query
.
projectId
;
this
.
goodsId
=
this
.
$route
.
query
.
goodsId
||
74
;
this
.
courseUrl
=
this
.
$route
.
query
.
courseUrl
||
""
;
//
this
.
couponIdFromGL
=
this
.
$route
.
query
.
couponId
||
""
;
//
//
this.couponIdFromGL = this.$route.query.couponId || ""; //
this
.
shareUrl
=
getWebPageUrl
(
`profexam/#/goods-detail?goodsId=
${
this
.
goodsId
}
`
);
...
...
@@ -213,7 +213,6 @@ export default {
localStorage
.
setItem
(
"returnUrl"
,
this
.
shareUrl
);
window
.
__getUserInfo4GD
=
function
(
param
)
{
// appVersion 安卓 3.2.2 iOS
console
.
log
(
"__getUserInfo4GD"
,
param
);
_this
.
token
=
param
.
userToken
;
_this
.
setUserInfo
(
param
);
...
...
@@ -229,7 +228,6 @@ export default {
};
},
mounted
()
{
this
.
getTabW
();
console
.
log
(
"this.isWeb ... isWechat - 1"
,
this
.
isWeb
,
isWechat
);
...
...
@@ -287,7 +285,8 @@ export default {
this
.
GET
(
`trade/coupon/app/goodsCoupons`
,
{
goodsType
,
cardType
}).
then
(
res
=>
{
if
(
res
.
code
==
"000000"
)
{
this
.
handlerCouponList
(
res
.
data
||
[],
params
.
price
);
this
.
handlerCouponList
(
res
.
data
||
[],
params
.
price
,
!!
this
.
couponId
);
// 设置优惠券个数
params
.
count
=
(
res
.
data
||
[]).
length
;
this
.
setGoodsInfo4Coupon
(
params
);
}
...
...
@@ -295,29 +294,48 @@ export default {
);
},
// 处理数据
// 先排序,再将不可用的放在最后
handlerCouponList
(
couponList
,
goodsPrice
)
{
// 处理数据,并且先排序,再将不可用的放在最后
handlerCouponList
(
couponList
,
goodsPrice
,
isFromGoodsList
)
{
if
(
!
couponList
.
length
)
return
[];
let
newList
=
[],
obj
=
{},
firstCanCoupon
=
null
;
firstCanCoupon
=
null
,
firstCanCouponIndex
=
0
,
item
=
{};
couponList
.
sort
(
(
a
,
b
)
=>
{
return
b
.
discountAmount
-
a
.
discountAmount
;
});
couponList
.
forEach
(
item
=>
{
for
(
let
i
=
0
;
i
<
couponList
.
length
;
i
++
)
{
item
=
couponList
[
i
];
// couponList.forEach(item => {
// 要根据商品价格及券适用类型来计算
item
.
disabled
=
!
this
.
isCanSelect
(
item
,
goodsPrice
);
// 是否已经选择
item
.
isChecked
=
false
;
console
.
log
(
'firstCanCoupon, item.disabled'
,
firstCanCoupon
,
item
.
disabled
);
//
console.log('firstCanCoupon, item.disabled', firstCanCoupon, item.disabled);
if
(
!
firstCanCoupon
&&
!
item
.
disabled
)
{
console
.
log
(
'!firstCanCoupon'
);
item
.
isChecked
=
true
;
firstCanCoupon
=
item
;
firstCanCouponIndex
=
i
;
}
newList
.
push
(
item
);
});
}
// 如果是从商品列表选择过来的,则要选中这个优惠券
// 如果优惠券不可用
// if(isFromGoodsList) {
// let cCoupon = couponList.find( item => {
// return item.couponId == this.couponId;
// });
// if(cCoupon.isChecked) {
// firstCanCoupon = cCoupon;
// } else {
// firstCanCoupon = {};
// couponList[firstCanCouponIndex].isChecked = false;
// }
// }
// 将不可用的放在最后
let
sortArray
=
[],
c
=
{};
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录