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
提交
b7ecbe21
提交
b7ecbe21
编写于
10月 27, 2020
作者:
guangjun.yang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优惠券 我的
上级
bf9f22fd
变更
4
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
124 行增加
和
34 行删除
+124
-34
com-coupon-list.vue
src/components/coupon/com-coupon-list.vue
+2
-2
com-coupon-select-list.vue
src/components/coupon/com-coupon-select-list.vue
+5
-5
coupon-list.vue
src/views/coupon/coupon-list.vue
+71
-8
goods-detail.vue
src/views/goods-detail.vue
+46
-19
未找到文件。
src/components/coupon/coupon-list.vue
→
src/components/coupon/co
m-co
upon-list.vue
浏览文件 @
b7ecbe21
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<li
class=
"list"
v-for=
"(item, index) in dataList"
:key=
"index"
>
<li
class=
"list"
v-for=
"(item, index) in dataList"
:key=
"index"
>
<section
class=
"item"
>
<section
class=
"item"
>
<div
class=
"left"
>
<div
class=
"left"
>
<p
class=
"name"
:class=
"
{'status': !item.showStatus}">
商品名不超过二十字,字数不超,字数不超过两行
</p>
<p
class=
"name"
:class=
"
{'status': !item.showStatus}">
{{
item
.
couponName
}}
</p>
<div
class=
"other"
>
<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
class=
"coupon-pc"
>
{{
item
.
validTimeSpan
}}
</span>
天
</p>
<p
v-else
class=
"time-end"
:class=
"
{'status': !item.showStatus}">
{{
parseTime
(
item
.
startTime
)
}}
至
{{
parseTime
(
item
.
expireTime
)
}}
</p>
<p
v-else
class=
"time-end"
:class=
"
{'status': !item.showStatus}">
{{
parseTime
(
item
.
startTime
)
}}
至
{{
parseTime
(
item
.
expireTime
)
}}
</p>
...
@@ -138,7 +138,7 @@ export default {
...
@@ -138,7 +138,7 @@ export default {
}
}
.status-wrapper {
.status-wrapper {
position: absolute;
position: absolute;
top: -
4
0px;
top: -
6
0px;
left: 140px;
left: 140px;
img {
img {
width: 75px;
width: 75px;
...
...
src/components/coupon/coupon-select-list.vue
→
src/components/coupon/co
m-co
upon-select-list.vue
浏览文件 @
b7ecbe21
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<img
@
click=
"cancle"
src=
"../../images/cme/close.png"
/>
<img
@
click=
"cancle"
src=
"../../images/cme/close.png"
/>
</article>
</article>
<article
v-if=
"true"
class=
"list-wrapper"
>
<article
v-if=
"true"
class=
"list-wrapper"
>
<p>
<p
v-if=
"currentCoupon.couponId"
>
已选择1张优惠券,共抵扣
已选择1张优惠券,共抵扣
<span
class=
"sc thin"
>
¥
{{
yuan
(
currentCoupon
.
discountAmount
)
}}
</span>
<span
class=
"sc thin"
>
¥
{{
yuan
(
currentCoupon
.
discountAmount
)
}}
</span>
</p>
</p>
...
@@ -102,10 +102,10 @@ export default {
...
@@ -102,10 +102,10 @@ export default {
},
},
// 监听当前商品信息,如果价格改变,则要重新计算选择列表是否可用
// 监听当前商品信息,如果价格改变,则要重新计算选择列表是否可用
goodsInfo4Coupon
:
{
//
goodsInfo4Coupon: {
handler
(
goodsInfo
)
{},
//
handler(goodsInfo) {},
deep
:
true
//
deep: true
}
//
}
},
},
computed
:
{
computed
:
{
...
...
src/views/coupon/coupon-list.vue
浏览文件 @
b7ecbe21
...
@@ -15,9 +15,9 @@
...
@@ -15,9 +15,9 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
CommonNavbar
from
"@/components/common/common-navbar"
;
import
CommonNavbar
from
"@/components/common/common-navbar"
;
import
CouponList
from
"@/components/coupon/coupon-list"
;
import
CouponList
from
"@/components/coupon/co
m-co
upon-list"
;
import
NoCoupon
from
"@/components/coupon/no-coupon"
;
import
NoCoupon
from
"@/components/coupon/no-coupon"
;
import
{
getWebPageUrl
}
from
"@/utils"
;
import
{
getWebPageUrl
,
getHactiveUrl
}
from
"@/utils"
;
import
{
mapGetters
,
mapActions
}
from
"vuex"
;
import
{
mapGetters
,
mapActions
}
from
"vuex"
;
import
{
Toast
}
from
"vant"
;
import
{
Toast
}
from
"vant"
;
...
@@ -36,7 +36,9 @@ export default {
...
@@ -36,7 +36,9 @@ export default {
navTitle
:
"优惠券"
,
navTitle
:
"优惠券"
,
isFixNavbar
:
true
,
isFixNavbar
:
true
,
shareUrl
:
""
,
shareUrl
:
""
,
dataList
:
[]
dataList
:
[],
provinceId
:
""
,
fromPage
:
""
,
};
};
},
},
computed
:
{
computed
:
{
...
@@ -59,6 +61,8 @@ export default {
...
@@ -59,6 +61,8 @@ export default {
let
_this
=
this
;
let
_this
=
this
;
let
href
=
location
.
href
;
let
href
=
location
.
href
;
this
.
couponId
=
this
.
$route
.
query
.
couponId
||
""
;
this
.
couponId
=
this
.
$route
.
query
.
couponId
||
""
;
this
.
fromPage
=
this
.
$route
.
query
.
fromPage
||
""
;
this
.
navTitle
=
!
this
.
fromPage
?
"优惠券"
:
"我的优惠券"
;
this
.
shareUrl
=
getWebPageUrl
(
this
.
shareUrl
=
getWebPageUrl
(
`profexam/#/coupon-list?couponId=
${
this
.
couponId
}
`
`profexam/#/coupon-list?couponId=
${
this
.
couponId
}
`
);
);
...
@@ -111,9 +115,10 @@ export default {
...
@@ -111,9 +115,10 @@ export default {
this
.
commonCheckToken
(()
=>
{
this
.
commonCheckToken
(()
=>
{
this
.
GET
(
`trade/coupon/app/myCoupons`
,
{}).
then
(
res
=>
{
this
.
GET
(
`trade/coupon/app/myCoupons`
,
{}).
then
(
res
=>
{
if
(
res
.
code
==
"000000"
)
{
if
(
res
.
code
==
"000000"
)
{
this
.
dataList
=
this
.
handlerMyCouponList
(
this
.
provinceId
=
res
.
data
.
provinceId
;
res
.
data
.
searchCouponModelList
||
[]
this
.
dataList
=
this
.
handlerAllCouponList
(
);
res
.
data
.
baseCouponModelList
||
[]
);
}
}
});
});
});
});
...
@@ -171,8 +176,17 @@ export default {
...
@@ -171,8 +176,17 @@ export default {
});
});
},
},
//
查询所有优惠券列表
//
区分是否是我的优惠券
searchCoupons
()
{
searchCoupons
()
{
if
(
this
.
fromPage
)
{
this
.
getMyCoupons
();
}
else
{
this
.
searchCouponsAction
();
}
},
// 查询所有优惠券列表
searchCouponsAction
()
{
let
params
=
{
let
params
=
{
cardTypes
:
[],
cardTypes
:
[],
couponIds
:
[],
couponIds
:
[],
...
@@ -182,7 +196,7 @@ export default {
...
@@ -182,7 +196,7 @@ export default {
this
.
POST
(
`trade/coupon/app/searchCoupons`
,
params
).
then
(
res
=>
{
this
.
POST
(
`trade/coupon/app/searchCoupons`
,
params
).
then
(
res
=>
{
if
(
res
.
code
==
"000000"
)
{
if
(
res
.
code
==
"000000"
)
{
this
.
dataList
=
this
.
handlerAllCouponList
(
this
.
dataList
=
this
.
handlerAllCouponList
(
res
.
data
.
search
CouponModelList
||
[]
res
.
data
.
base
CouponModelList
||
[]
);
);
}
}
});
});
...
@@ -194,10 +208,59 @@ export default {
...
@@ -194,10 +208,59 @@ export default {
// 要根据用户信息,获取定位信息等,从而获取对应的商品
// 要根据用户信息,获取定位信息等,从而获取对应的商品
// TODO
// TODO
if
(
item
.
couponStatus
==
1
)
{
if
(
item
.
couponStatus
==
1
)
{
let
pageUrl
=
""
;
if
(
item
.
couponMappingModelList
.
length
>
1
)
{
pageUrl
=
getHactiveUrl
(
`/message_push/#/study-card`
);
this
.
jumpForCoupon
(
pageUrl
);
}
else
{
item
.
couponMappingModelList
.
length
&&
this
.
getCardInfoByProvinceId
(
item
.
couponMappingModelList
[
0
],
item
);
}
}
else
{
}
else
{
this
.
receiveCouponByid
(
item
.
couponId
);
this
.
receiveCouponByid
(
item
.
couponId
);
}
}
},
// 根据省ID,获取学习卡信息
getCardInfoByProvinceId
(
provinceId
,
item
)
{
let
coupon
=
item
.
couponMappingModelList
[
0
];
let
param
=
{
area
:
this
.
provinceId
+
""
,
cardType
:
coupon
.
cardType
||
3
,
cardTypeList
:
[
coupon
.
cardType
||
3
],
goodsType
:
coupon
.
goodsType
,
};
param
.
setEntry
=
true
;
this
.
POST
(
"trade/goods/cardList_v2"
,
param
).
then
(
res
=>
{
if
(
res
.
code
==
"000000"
)
{
let
good
=
(
res
.
data
&&
res
.
data
[
0
])
||
{
id
:
''
,
name
:
"职称考精讲课程卡"
};
let
pageUrl
=
getWebPageUrl
(
`profexam/#/goods-detail?goodsId=
${
good
.
id
}
`
);
this
.
jumpForCoupon
(
pageUrl
);
}
});
},
// 根据环境跳转
jumpForCoupon
(
pageUrl
)
{
if
(
this
.
isWeb
)
{
location
.
href
=
pageUrl
;
}
else
{
let
paramList
=
[
{
key
:
"pageUrl"
,
value
:
pageUrl
,
type
:
4
,
seqNo
:
1
}
];
rocNative
&&
rocNative
.
dispatchEventByModuleCode
({
modeCode
:
"M300"
,
jsonString
:
paramList
});
}
}
}
}
}
};
};
</
script
>
</
script
>
...
...
src/views/goods-detail.vue
浏览文件 @
b7ecbe21
...
@@ -101,7 +101,7 @@
...
@@ -101,7 +101,7 @@
import
{
Swipe
,
SwipeItem
}
from
"vant"
;
import
{
Swipe
,
SwipeItem
}
from
"vant"
;
import
Loading
from
"@/components/common/common-loading"
;
import
Loading
from
"@/components/common/common-loading"
;
import
CourseDialog
from
"@/components/course/course-dialog"
;
import
CourseDialog
from
"@/components/course/course-dialog"
;
import
CouponSelectList
from
"@/components/coupon/coupon-select-list"
;
import
CouponSelectList
from
"@/components/coupon/co
m-co
upon-select-list"
;
import
{
wxConfig
,
chooseWXPay
}
from
"@/utils/wxShare"
;
import
{
wxConfig
,
chooseWXPay
}
from
"@/utils/wxShare"
;
import
{
import
{
...
@@ -194,6 +194,10 @@ export default {
...
@@ -194,6 +194,10 @@ export default {
this
.
projectId
=
this
.
$route
.
query
.
projectId
;
this
.
projectId
=
this
.
$route
.
query
.
projectId
;
this
.
goodsId
=
this
.
$route
.
query
.
goodsId
||
74
;
this
.
goodsId
=
this
.
$route
.
query
.
goodsId
||
74
;
this
.
courseUrl
=
this
.
$route
.
query
.
courseUrl
||
""
;
//
this
.
courseUrl
=
this
.
$route
.
query
.
courseUrl
||
""
;
//
this
.
couponIdFromGL
=
this
.
$route
.
query
.
couponId
||
""
;
//
this
.
shareUrl
=
getWebPageUrl
(
`profexam/#/goods-detail?goodsId=
${
this
.
goodsId
}
`
);
if
(
href
.
indexOf
(
"singlemessage"
)
>=
0
||
href
.
indexOf
(
"wx_code"
)
>=
0
)
{
if
(
href
.
indexOf
(
"singlemessage"
)
>=
0
||
href
.
indexOf
(
"wx_code"
)
>=
0
)
{
if
(
this
.
projectId
)
{
if
(
this
.
projectId
)
{
this
.
shareUrl
=
getWebPageUrl
(
this
.
shareUrl
=
getWebPageUrl
(
...
@@ -224,10 +228,21 @@ export default {
...
@@ -224,10 +228,21 @@ export default {
_this
.
paycallback
(
params
);
_this
.
paycallback
(
params
);
};
};
},
},
mounted
()
{
mounted
()
{
this
.
getTabW
();
this
.
getTabW
();
console
.
log
(
"this.isWeb ... isWechat - 1"
,
this
.
isWeb
,
isWechat
);
console
.
log
(
"this.isWeb ... isWechat - 1"
,
this
.
isWeb
,
isWechat
);
// 数量加减
this
.
curtGoodsNum
=
this
.
goodsNum
;
this
.
countTotalPrice
=
debounce
(
this
.
getTotalPrice
,
300
);
// 记录参数,授权登录返回时重新赋值,在main.js
sessionStorage
.
setItem
(
"goodsDetailParams"
,
JSON
.
stringify
(
this
.
$route
.
query
)
);
if
(
this
.
isWeb
)
{
if
(
this
.
isWeb
)
{
const
{
token
,
info
}
=
this
.
$store
.
state
.
user
;
const
{
token
,
info
}
=
this
.
$store
.
state
.
user
;
if
(
token
&&
!
info
.
id
)
{
if
(
token
&&
!
info
.
id
)
{
...
@@ -240,14 +255,6 @@ export default {
...
@@ -240,14 +255,6 @@ export default {
this
.
getUserInfo
();
this
.
getUserInfo
();
}
}
// 数量加减
this
.
curtGoodsNum
=
this
.
goodsNum
;
this
.
countTotalPrice
=
debounce
(
this
.
getTotalPrice
,
300
);
// 记录参数,授权登录返回时重新赋值,在main.js
sessionStorage
.
setItem
(
"goodsDetailParams"
,
JSON
.
stringify
(
this
.
$route
.
query
)
);
},
},
methods
:
{
methods
:
{
...
mapActions
([
...
mapActions
([
...
@@ -257,12 +264,13 @@ export default {
...
@@ -257,12 +264,13 @@ export default {
"setSelectCouponList"
"setSelectCouponList"
]),
]),
// 优惠券选择按钮文案
getCPText
()
{
getCPText
()
{
// yuan(currentCoupon.discountAmount) -¥{{}}
// 如果没有选择优惠券
let
text
=
""
;
let
text
=
""
;
// 有且选择了优惠券,则直接显示优惠券的优惠价格
if
(
this
.
currentCoupon
.
couponId
)
{
if
(
this
.
currentCoupon
.
couponId
)
{
text
=
"-¥"
+
this
.
yuan
(
this
.
currentCoupon
.
discountAmount
);
text
=
"-¥"
+
this
.
yuan
(
this
.
currentCoupon
.
discountAmount
);
// 如果没有选择优惠券
}
else
{
}
else
{
if
(
this
.
goodsInfo4Coupon
.
count
)
{
if
(
this
.
goodsInfo4Coupon
.
count
)
{
text
=
this
.
goodsInfo4Coupon
.
count
+
"张优惠券"
;
text
=
this
.
goodsInfo4Coupon
.
count
+
"张优惠券"
;
...
@@ -275,7 +283,6 @@ export default {
...
@@ -275,7 +283,6 @@ export default {
// 查询我的可用优惠券
// 查询我的可用优惠券
getCanUseCoupons
(
params
)
{
getCanUseCoupons
(
params
)
{
// TODO params有问题
const
{
goodsType
,
cardType
}
=
params
;
const
{
goodsType
,
cardType
}
=
params
;
this
.
GET
(
`trade/coupon/app/goodsCoupons`
,
{
goodsType
,
cardType
}).
then
(
this
.
GET
(
`trade/coupon/app/goodsCoupons`
,
{
goodsType
,
cardType
}).
then
(
res
=>
{
res
=>
{
...
@@ -289,15 +296,18 @@ export default {
...
@@ -289,15 +296,18 @@ export default {
},
},
// 处理数据
// 处理数据
// 先排序,再将不可用的放在最后
handlerCouponList
(
couponList
,
goodsPrice
)
{
handlerCouponList
(
couponList
,
goodsPrice
)
{
if
(
!
couponList
.
length
)
return
[];
if
(
!
couponList
.
length
)
return
[];
let
newList
=
[],
let
newList
=
[],
obj
=
{},
obj
=
{},
firstCanCoupon
=
null
;
firstCanCoupon
=
null
;
couponList
.
sort
(
(
a
,
b
)
=>
{
return
b
.
discountAmount
-
a
.
discountAmount
;
});
couponList
.
forEach
(
item
=>
{
couponList
.
forEach
(
item
=>
{
// TODO 要根据商品价格及券适用类型来计算
// 要根据商品价格及券适用类型来计算
item
.
disabled
=
this
.
isCanSelect
(
item
,
goodsPrice
);
item
.
disabled
=
!
this
.
isCanSelect
(
item
,
goodsPrice
);
// item.disabled = !(item.couponStatus == 0 || item.couponStatus == 1);
// 是否已经选择
// 是否已经选择
item
.
isChecked
=
false
;
item
.
isChecked
=
false
;
console
.
log
(
'firstCanCoupon, item.disabled'
,
firstCanCoupon
,
item
.
disabled
);
console
.
log
(
'firstCanCoupon, item.disabled'
,
firstCanCoupon
,
item
.
disabled
);
...
@@ -308,8 +318,20 @@ export default {
...
@@ -308,8 +318,20 @@ export default {
}
}
newList
.
push
(
item
);
newList
.
push
(
item
);
});
});
// 将不可用的放在最后
let
sortArray
=
[],
c
=
{};
for
(
let
i
=
0
;
i
<
newList
.
length
;
i
++
)
{
c
=
newList
[
i
];
if
(
c
.
disabled
)
{
sortArray
.
push
(
c
);
newList
.
splice
(
i
,
1
);
i
--
;
}
}
this
.
setCurrentCoupon
(
firstCanCoupon
||
{});
this
.
setCurrentCoupon
(
firstCanCoupon
||
{});
this
.
setSelectCouponList
(
newList
);
this
.
setSelectCouponList
(
newList
.
concat
(
sortArray
)
);
return
newList
;
return
newList
;
},
},
...
@@ -385,7 +407,7 @@ export default {
...
@@ -385,7 +407,7 @@ export default {
this
.
getCPText
();
this
.
getCPText
();
this
.
isShowCoupon
=
false
;
this
.
isShowCoupon
=
false
;
// 要重新调用计算价格接口
// 要重新调用计算价格接口
//
this.getTotalPrice(currentCoupon);
this
.
getTotalPrice
(
currentCoupon
);
},
},
// tab切换
// tab切换
...
@@ -397,8 +419,10 @@ export default {
...
@@ -397,8 +419,10 @@ export default {
},
},
// 获取商品信息
// 获取商品信息
// TODO
getGoodsInfo
()
{
getGoodsInfo
()
{
this
.
GET
(
`trade/goods/goodInfo/
${
this
.
goodsId
}
`
,
{}).
then
(
res
=>
{
// this.GET(`trade/goods/goodInfo/${this.goodsId}`, {}).then(res => {
this
.
GET
(
`trade/goods/goodInfoV3/
${
this
.
goodsId
}
`
,
{}).
then
(
res
=>
{
if
(
res
.
code
==
"000000"
)
{
if
(
res
.
code
==
"000000"
)
{
const
goods
=
res
.
data
;
const
goods
=
res
.
data
;
const
tabs
=
[];
const
tabs
=
[];
...
@@ -477,7 +501,10 @@ export default {
...
@@ -477,7 +501,10 @@ export default {
// 多件商品的价格
// 多件商品的价格
// TODO,要多传优惠券id参数
// TODO,要多传优惠券id参数
getTotalPrice
(
coupon
)
{
getTotalPrice
(
coupon
)
{
console
.
log
(
'coupon'
,
coupon
);
const
couponId
=
this
.
currentCoupon
.
couponId
||
0
;
const
num
=
this
.
curtGoodsNum
;
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
=>
{
this
.
GET
(
`trade/goods/getPrice/
${
this
.
goodsId
}
/
${
num
}
`
,
{}).
then
(
res
=>
{
if
(
res
.
code
==
"000000"
)
{
if
(
res
.
code
==
"000000"
)
{
const
{
const
{
...
@@ -496,6 +523,7 @@ export default {
...
@@ -496,6 +523,7 @@ export default {
};
};
this
.
goodsInfo4Coupon
.
price
=
price
;
this
.
goodsInfo4Coupon
.
price
=
price
;
this
.
setGoodsInfo4Coupon
(
this
.
goodsInfo4Coupon
);
this
.
setGoodsInfo4Coupon
(
this
.
goodsInfo4Coupon
);
this
.
handlerCouponList
(
this
.
selectCouponList
,
price
);
this
.
goodsNum
=
num
;
this
.
goodsNum
=
num
;
}
else
if
(
res
.
code
===
"200006"
)
{
}
else
if
(
res
.
code
===
"200006"
)
{
this
.
$store
.
dispatch
(
"logout"
);
this
.
$store
.
dispatch
(
"logout"
);
...
@@ -625,7 +653,6 @@ export default {
...
@@ -625,7 +653,6 @@ export default {
if
(
!
id
||
isSale
!==
1
)
{
if
(
!
id
||
isSale
!==
1
)
{
return
;
return
;
}
}
// TODO 使用新的优惠券id
const
orderData
=
{
const
orderData
=
{
couponId
:
couponDTO
?
couponDTO
.
couponId
:
0
,
couponId
:
couponDTO
?
couponDTO
.
couponId
:
0
,
goodsId
:
id
,
goodsId
:
id
,
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录