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
提交
bd29225d
提交
bd29225d
编写于
10月 28, 2020
作者:
guangjun.yang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
请选择优惠券
上级
90e54c92
变更
4
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
56 行增加
和
19 行删除
+56
-19
component-list.vue
src/components/coupon/component-list.vue
+4
-1
component-select-list.vue
src/components/coupon/component-select-list.vue
+3
-3
coupon-list.vue
src/views/coupon/coupon-list.vue
+5
-3
goods-detail.vue
src/views/goods-detail.vue
+44
-12
未找到文件。
src/components/coupon/com
-coupon
-list.vue
→
src/components/coupon/com
ponent
-list.vue
浏览文件 @
bd29225d
...
...
@@ -5,7 +5,10 @@
<div
class=
"left"
>
<p
class=
"name"
:class=
"
{'status': !item.showStatus}">
{{
item
.
couponName
}}
</p>
<div
class=
"other"
>
<p
v-if=
"item.validTimeType == 2"
class=
"time-end"
:class=
"
{'status': !item.showStatus}">距离到期仅剩
<span
class=
"coupon-pc"
>
{{
item
.
validTimeSpan
}}
</span>
天
</p>
<p
v-if=
"item.validTimeType == 2"
class=
"time-end"
:class=
"
{'status': !item.showStatus}">
<span
v-if=
"item.couponStatus == 0"
>
领取后
<span
class=
"coupon-pc"
>
{{
item
.
validTimeSpan
}}
</span>
天内有效
</span>
<span
v-else
>
距离到期仅剩
<span
class=
"coupon-pc"
>
{{
item
.
validTimeSpan
}}
</span>
天
</span>
</p>
<p
v-else
class=
"time-end"
:class=
"
{'status': !item.showStatus}">
{{
parseTime
(
item
.
startTime
)
}}
至
{{
parseTime
(
item
.
expireTime
)
}}
</p>
<p
v-show=
"!item.isAll"
class=
"rules"
>
<span
:class=
"
{'status': !item.showStatus}" @click="toggleRules(item)">使用规则
</span>
...
...
src/components/coupon/com
-coupon
-select-list.vue
→
src/components/coupon/com
ponent
-select-list.vue
浏览文件 @
bd29225d
...
...
@@ -5,8 +5,8 @@
<span>
优惠券
</span>
<img
@
click=
"cancle"
src=
"../../images/cme/close.png"
/>
</article>
<article
v-if=
"
true
"
class=
"list-wrapper"
>
<p
v-if=
"currentCoupon.couponId
|| goodsInfo4Coupon.count
"
>
<article
v-if=
"
selectCouponList.length
"
class=
"list-wrapper"
>
<p
v-if=
"currentCoupon.couponId"
>
已选择1张优惠券,共抵扣
<span
class=
"sc thin"
>
¥
{{
yuan
(
currentCoupon
.
discountAmount
)
}}
</span>
</p>
...
...
@@ -52,7 +52,7 @@
</article>
<no-coupon
v-else
></no-coupon>
<article
class=
"bottom"
>
<article
v-if=
"selectCouponList.length"
class=
"bottom"
>
<van-button
@
click=
"confirm"
size=
"large"
round
color=
"#449284"
>
确定使用
</van-button>
</article>
</section>
...
...
src/views/coupon/coupon-list.vue
浏览文件 @
bd29225d
...
...
@@ -15,7 +15,7 @@
</
template
>
<
script
>
import
CommonNavbar
from
"@/components/common/common-navbar"
;
import
CouponList
from
"@/components/coupon/com
-coupon
-list"
;
import
CouponList
from
"@/components/coupon/com
ponent
-list"
;
import
NoCoupon
from
"@/components/coupon/no-coupon"
;
import
{
getWebPageUrl
,
getHactiveUrl
}
from
"@/utils"
;
import
{
mapGetters
,
mapActions
}
from
"vuex"
;
...
...
@@ -93,7 +93,9 @@ export default {
return
;
}
if
(
token
&&
!
info
.
id
)
{
this
.
$store
.
dispatch
(
"getUserInfo"
);
this
.
commonCheckToken
(()
=>
{
this
.
$store
.
dispatch
(
"getUserInfo"
);
});
return
;
}
// 从登陆页面过来的
...
...
@@ -210,7 +212,7 @@ export default {
if
(
item
.
couponStatus
==
1
)
{
let
pageUrl
=
""
;
if
(
item
.
couponMappingModelList
.
length
>
1
)
{
pageUrl
=
getHactiveUrl
(
`/message_push/#/study-card`
);
pageUrl
=
getHactiveUrl
(
`/message_push/#/study-card
?origin=1
`
);
this
.
jumpForCoupon
(
pageUrl
);
}
else
{
item
.
couponMappingModelList
.
length
&&
this
.
getCardInfoByProvinceId
(
item
.
couponMappingModelList
[
0
],
item
);
...
...
src/views/goods-detail.vue
浏览文件 @
bd29225d
...
...
@@ -101,7 +101,7 @@
import
{
Swipe
,
SwipeItem
}
from
"vant"
;
import
Loading
from
"@/components/common/common-loading"
;
import
CourseDialog
from
"@/components/course/course-dialog"
;
import
CouponSelectList
from
"@/components/coupon/com
-coupon
-select-list"
;
import
CouponSelectList
from
"@/components/coupon/com
ponent
-select-list"
;
import
{
wxConfig
,
chooseWXPay
}
from
"@/utils/wxShare"
;
import
{
...
...
@@ -143,7 +143,8 @@ export default {
showLoading
:
false
,
isShowDialog
:
false
,
isShowCoupon
:
false
,
//是否展示激活弹框,
courseUrl
:
""
courseUrl
:
""
,
defaultCouponId
:
""
,
};
},
computed
:
{
...
...
@@ -194,7 +195,7 @@ export default {
this
.
projectId
=
this
.
$route
.
query
.
projectId
;
this
.
goodsId
=
this
.
$route
.
query
.
goodsId
||
74
;
this
.
courseUrl
=
this
.
$route
.
query
.
courseUrl
||
""
;
//
// this.couponIdFromG
L
= this.$route.query.couponId || ""; //
// this.couponIdFromG
oodsList
= this.$route.query.couponId || ""; //
this
.
shareUrl
=
getWebPageUrl
(
`profexam/#/goods-detail?goodsId=
${
this
.
goodsId
}
`
);
...
...
@@ -244,7 +245,9 @@ export default {
if
(
this
.
isWeb
)
{
const
{
token
,
info
}
=
this
.
$store
.
state
.
user
;
if
(
token
&&
!
info
.
id
)
{
this
.
$store
.
dispatch
(
"getUserInfo"
);
this
.
commonCheckToken
(()
=>
{
this
.
$store
.
dispatch
(
"getUserInfo"
);
});
return
;
}
// 从登陆页面过来时
...
...
@@ -285,23 +288,29 @@ export default {
this
.
GET
(
`trade/coupon/app/goodsCoupons`
,
{
goodsType
,
cardType
}).
then
(
res
=>
{
if
(
res
.
code
==
"000000"
)
{
this
.
handlerCouponList
(
res
.
data
||
[],
params
.
price
,
!!
this
.
couponId
);
// 设置优惠券个数
params
.
count
=
(
res
.
data
||
[]).
length
;
this
.
setGoodsInfo4Coupon
(
params
);
this
.
handlerCouponList
(
res
.
data
||
[],
params
.
price
);
// 设置优惠券个数
}
else
{
params
.
count
=
0
;
this
.
setGoodsInfo4Coupon
(
params
);
this
.
setCurrentCoupon
({});
this
.
setSelectCouponList
([]);
}
}
);
},
// 处理数据,并且先排序,再将不可用的放在最后
handlerCouponList
(
couponList
,
goodsPrice
,
isFromGoodsList
)
{
handlerCouponList
(
couponList
,
goodsPrice
)
{
if
(
!
couponList
.
length
)
return
[];
let
newList
=
[],
obj
=
{},
firstCanCoupon
=
null
,
firstCanCouponIndex
=
0
,
item
=
{};
item
=
{},
count
=
0
;
couponList
.
sort
(
(
a
,
b
)
=>
{
return
b
.
discountAmount
-
a
.
discountAmount
;
});
...
...
@@ -310,6 +319,9 @@ export default {
// couponList.forEach(item => {
// 要根据商品价格及券适用类型来计算
item
.
disabled
=
!
this
.
isCanSelect
(
item
,
goodsPrice
);
if
(
!
item
.
disabled
)
{
count
++
;
}
// 是否已经选择
item
.
isChecked
=
false
;
// console.log('firstCanCoupon, item.disabled', firstCanCoupon, item.disabled);
...
...
@@ -337,6 +349,20 @@ export default {
// }
// }
// 商品详情接口已经选择了一张, 则使用默认的
if
(
this
.
defaultCouponId
)
{
let
cCoupon
=
couponList
.
find
(
item
=>
{
return
item
.
couponId
==
this
.
defaultCouponId
;
});
if
(
cCoupon
&&
cCoupon
.
isChecked
)
{
firstCanCoupon
=
cCoupon
;
}
else
{
firstCanCoupon
=
{};
couponList
[
firstCanCouponIndex
].
isChecked
=
false
;
}
}
// 将不可用的放在最后
let
sortArray
=
[],
c
=
{};
for
(
let
i
=
0
;
i
<
newList
.
length
;
i
++
)
{
...
...
@@ -348,8 +374,10 @@ export default {
}
}
this
.
setCurrentCoupon
(
firstCanCoupon
||
{});
this
.
setCurrentCoupon
(
JSON
.
parse
(
JSON
.
stringify
(
firstCanCoupon
))
||
{});
this
.
setSelectCouponList
(
newList
.
concat
(
sortArray
));
this
.
goodsInfo4Coupon
.
count
=
count
;
this
.
setGoodsInfo4Coupon
(
this
.
goodsInfo4Coupon
);
return
newList
;
},
...
...
@@ -415,7 +443,9 @@ export default {
// 显示优惠券弹框
showCouponPopup
()
{
this
.
isShowCoupon
=
true
;
this
.
commonCheckToken
(()
=>
{
this
.
isShowCoupon
=
true
;
})
},
// 设置当前选中的优惠券
...
...
@@ -425,7 +455,7 @@ export default {
this
.
getCPText
();
this
.
isShowCoupon
=
false
;
// 要重新调用计算价格接口
this
.
getTotalPrice
(
currentCoupon
);
//
this.getTotalPrice(currentCoupon);
},
// tab切换
...
...
@@ -447,6 +477,7 @@ export default {
let
price
=
goods
.
couponPrice
||
goods
.
preferentialPrice
||
goods
.
costPrice
;
this
.
goods
=
goods
;
this
.
defaultCouponId
=
goods
.
couponId
;
// 获取到商品后,再获取优惠券
this
.
getCanUseCoupons
({
goodsType
:
goods
.
goodsType
,
...
...
@@ -520,7 +551,7 @@ export default {
// TODO,要多传优惠券id参数
getTotalPrice
(
coupon
)
{
console
.
log
(
'coupon'
,
coupon
);
const
couponId
=
this
.
currentCoupon
.
couponId
||
0
;
//
const couponId = this.currentCoupon.couponId || 0;
const
num
=
this
.
curtGoodsNum
;
// this.GET(`trade/goods/getPrice/${this.goodsId}/${num}/${couponId}`, {}).then(res => {
this
.
GET
(
`trade/goods/getPrice/
${
this
.
goodsId
}
/
${
num
}
`
,
{}).
then
(
res
=>
{
...
...
@@ -672,6 +703,7 @@ export default {
return
;
}
const
orderData
=
{
// couponId: couponDTO ? couponDTO.couponId : 0,
couponId
:
couponDTO
?
couponDTO
.
couponId
:
0
,
goodsId
:
id
,
goodsQuantity
:
this
.
goodsNum
,
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录