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
提交
832e0ea8
提交
832e0ea8
编写于
6月 06, 2024
作者:
jingqi.liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改样式
上级
9c223d16
变更
1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
183 行增加
和
200 行删除
+183
-200
coupon-list.vue
src/views/coupon/coupon-list.vue
+183
-200
未找到文件。
src/views/coupon/coupon-list.vue
浏览文件 @
832e0ea8
...
...
@@ -3,22 +3,8 @@
class=
"coupon-list-wrapper"
:class=
"
{ 'no-pt': isWeb, 'pt-88': isWeb }"
>
<div
class=
"page-wrapper"
>
<!--
<common-header
:bg-color=
"bgColor"
title=
"我的优惠券"
:is-black=
"true"
:is-fixheader=
"true"
:is-hundred-height=
"true"
>
<div
slot=
"tabs"
class=
"tabs"
>
<tabs-comp
:tabs-detail=
"tabs"
:default-index=
"activeIndex"
@
changeTab=
"changeTab"
/>
</div>
</common-header>
-->
<h1>
优惠券列表
</h1>
<!--
<div
class=
"page-wrapper"
>
<div
class=
"page-content"
>
<CommonNavbar
:isWeb=
"isWeb"
...
...
@@ -53,199 +39,196 @@
</div>
</div>
<coupon-bottom
/>
</div>
</div>
-->
</section>
</
template
>
<
script
>
// https://dev-sc.yunqueyi.com/trade/coupon/swagger-ui.html#/app-coupon-controller/receiveCouponsUsingPOST
// https://bq2ptvur1gb.feishu.cn/wiki/DpUfwKfhxiVYE4kbK8Pcj0F6nvf
import
CoupoItem
from
"./components/coupon-item.vue"
;
import
TabsComp
from
"./components/tabs.vue"
;
import
CommonNavbar
from
"@/components/common/common-navbar"
;
// import CommonHeader from "@/components/common/header";
import
CouponBottom
from
"./components/coupon-bottom.vue"
;
import
empty
from
"./components/empty.vue"
;
import
{
getWebPageUrl
,
getHactiveUrl
}
from
"@/utils"
;
import
{
mapGetters
,
mapActions
}
from
"vuex"
;
import
{
Toast
}
from
"vant"
;
import
{
setCookie
,
getCookie
,
delCookie
}
from
"@/utils/index"
;
// import { getMyCouponsList } from '@/api/coupon.js';
export
default
{
components
:
{
CoupoItem
,
TabsComp
,
empty
,
CouponBottom
,
CommonNavbar
,
// CommonHeader,
},
data
()
{
return
{
bgColor
:
"#fff"
,
token
:
""
,
couponToken
:
""
,
shareUrl
:
""
,
isWeb
:
window
.
__isWeb
,
isShowNavbar
:
true
,
navTitle
:
"我的优惠券"
,
isFixNavbar
:
true
,
paddingbtm
:
0
,
isInMergeDetail
:
false
,
tabs
:
[
{
title
:
"已领取"
,
status
:
2
,
},
{
title
:
"已使用"
,
status
:
6
,
},
{
title
:
"已过期"
,
status
:
5
,
},
],
pageTitle
:
"我的优惠券"
,
currentIndex
:
0
,
couponList
:
[],
activeIndex
:
0
,
};
},
computed
:
{
...
mapGetters
([
"webUserInfo"
]),
},
created
()
{
let
_this
=
this
;
let
href
=
location
.
href
;
this
.
fromPage
=
this
.
$route
.
query
.
fromPage
||
""
;
this
.
couponToken
=
this
.
$route
.
query
.
couponToken
||
""
;
// import CoupoItem from "./components/coupon-item.vue";
// import TabsComp from "./components/tabs.vue";
// import CommonNavbar from "@/components/common/common-navbar";
// import CouponBottom from "./components/coupon-bottom.vue";
// import empty from "./components/empty.vue";
// import { getWebPageUrl, getHactiveUrl } from "@/utils";
// import { mapGetters, mapActions } from "vuex";
// import { Toast } from "vant";
// import { setCookie, getCookie, delCookie } from "@/utils/index";
// export default {
// components: {
// CoupoItem,
// TabsComp,
// empty,
// CouponBottom,
// CommonNavbar,
// },
// data() {
// return {
// bgColor: "#fff",
// token: "",
// couponToken: "",
// shareUrl: "",
// isWeb: window.__isWeb,
// isShowNavbar: true,
// navTitle: "我的优惠券",
// isFixNavbar: true,
// paddingbtm: 0,
// isInMergeDetail: false,
// tabs: [
// {
// title: "已领取",
// status: 2,
// },
// {
// title: "已使用",
// status: 6,
// },
// {
// title: "已过期",
// status: 5,
// },
// ],
// pageTitle: "我的优惠券",
// currentIndex: 0,
// couponList: [],
// activeIndex: 0,
// };
// },
// computed: {
// ...mapGetters(["webUserInfo"]),
// },
// created() {
// let _this = this;
// let href = location.href;
// this.fromPage = this.$route.query.fromPage || "";
// this.couponToken = this.$route.query.couponToken || "";
this
.
shareUrl
=
getWebPageUrl
(
`profexam/#/coupon-list`
);
if
(
href
.
indexOf
(
"singlemessage"
)
>=
0
||
href
.
indexOf
(
"wx_code"
)
>=
0
)
{
location
.
replace
(
this
.
shareUrl
);
}
localStorage
.
setItem
(
"returnUrl"
,
this
.
shareUrl
);
//
this.shareUrl = getWebPageUrl(`profexam/#/coupon-list`);
//
if (href.indexOf("singlemessage") >= 0 || href.indexOf("wx_code") >= 0) {
//
location.replace(this.shareUrl);
//
}
//
localStorage.setItem("returnUrl", this.shareUrl);
if
(
this
.
fromPage
)
{
this
.
$sendBuriedData
({
component_tag
:
`506#50601`
,
});
}
//
if (this.fromPage) {
//
this.$sendBuriedData({
//
component_tag: `506#50601`,
//
});
//
}
window
.
__getUserInfo4CouponList
=
function
(
param
)
{
console
.
log
(
"__getUserInfo4CouponList"
,
param
);
_this
.
token
=
param
.
userToken
;
_this
.
setUserInfo
(
param
);
_this
.
getMyCouponsList
();
};
//
window.__getUserInfo4CouponList = function (param) {
//
console.log("__getUserInfo4CouponList", param);
//
_this.token = param.userToken;
//
_this.setUserInfo(param);
//
_this.getMyCouponsList();
//
};
window
.
__refresh
=
function
()
{
_this
.
getUserInfo
();
};
},
mounted
()
{
// 如果在浏览器或微信里
if
(
this
.
isWeb
)
{
const
{
token
,
info
}
=
this
.
$store
.
state
.
user
;
this
.
token
=
token
||
this
.
couponToken
||
localStorage
.
getItem
(
"couponToken"
)
||
getCookie
(
"couponToken"
);
if
(
this
.
token
&&
!
info
.
id
)
{
console
.
log
(
"4444 this.token"
,
this
.
token
);
// this.$store.dispatch('setToken', this.token);
this
.
commonCheckToken
(()
=>
{
this
.
$store
.
dispatch
(
"setToken"
,
this
.
token
);
// this.$store.dispatch("getUserInfo");
});
}
// 从登陆页面过来的
this
.
getMyCouponsList
();
}
else
{
this
.
getUserInfo
();
}
},
methods
:
{
...
mapActions
([
"setUserInfo"
]),
//获取用户信息
getUserInfo
()
{
rocNative
.
getUserInfo
({
__funcName
:
"__getUserInfo4CouponList"
,
});
},
getMyCouponsList
()
{
this
.
commonCheckToken
(()
=>
{
this
.
GET
(
`trade/coupon/app/myCoupons?couponStatus=
${
this
.
tabs
[
this
.
activeIndex
].
status
}
`
,
{}
).
then
(({
code
,
data
})
=>
{
if
(
code
==
"000000"
)
{
this
.
$nextTick
((
res
)
=>
{
data
.
baseCouponModelList
.
forEach
((
item
)
=>
{
item
.
showTips
=
false
;
});
this
.
couponList
=
JSON
.
parse
(
JSON
.
stringify
(
data
.
baseCouponModelList
)
);
});
}
});
});
},
changeTab
(
index
)
{
console
.
log
(
index
);
this
.
activeIndex
=
index
;
this
.
getMyCouponsList
();
},
chooseCoupon
(
item
)
{
console
.
log
();
if
(
item
.
couponStatus
===
1
)
{
let
webUrl
=
getWebPageUrl
(
`consultationHome`
);
location
.
replace
(
webUrl
);
// uni.switchTab({
// url: '/pages/home/index',
// });
}
},
},
};
//
window.__refresh = function () {
//
_this.getUserInfo();
//
};
//
},
//
mounted() {
//
// 如果在浏览器或微信里
//
if (this.isWeb) {
//
const { token, info } = this.$store.state.user;
//
this.token =
//
token ||
//
this.couponToken ||
//
localStorage.getItem("couponToken") ||
//
getCookie("couponToken");
//
if (this.token && !info.id) {
//
console.log("4444 this.token", this.token);
//
// this.$store.dispatch('setToken', this.token);
//
this.commonCheckToken(() => {
//
this.$store.dispatch("setToken", this.token);
//
// this.$store.dispatch("getUserInfo");
//
});
//
}
//
// 从登陆页面过来的
//
this.getMyCouponsList();
//
} else {
//
this.getUserInfo();
//
}
//
},
//
methods: {
//
...mapActions(["setUserInfo"]),
//
//获取用户信息
//
getUserInfo() {
//
rocNative.getUserInfo({
//
__funcName: "__getUserInfo4CouponList",
//
});
//
},
//
getMyCouponsList() {
//
this.commonCheckToken(() => {
//
this.GET(
//
`trade/coupon/app/myCoupons?couponStatus=${
//
this.tabs[this.activeIndex].status
//
}`,
//
{}
//
).then(({ code, data }) => {
//
if (code == "000000") {
//
this.$nextTick((res) => {
//
data.baseCouponModelList.forEach((item) => {
//
item.showTips = false;
//
});
//
this.couponList = JSON.parse(
//
JSON.stringify(data.baseCouponModelList)
//
);
//
});
//
}
//
});
//
});
//
},
//
changeTab(index) {
//
console.log(index);
//
this.activeIndex = index;
//
this.getMyCouponsList();
//
},
//
chooseCoupon(item) {
//
console.log();
//
if (item.couponStatus === 1) {
//
let webUrl = getWebPageUrl(`consultationHome`);
//
location.replace(webUrl);
//
// uni.switchTab({
//
// url: '/pages/home/index',
//
// });
//
}
//
},
//
},
//
};
</
script
>
<
style
lang=
"less"
scoped
>
.pt-88 {
padding-top: 88px;
}
.coupon-list-wrapper {
min-height: 100vh;
background: #f8f9fa;
&.no-pt {
padding-top: 10px;
}
}
.page-wrapper {
padding-top: 134px;
height: 100vh;
background-color: #f5f6f8;
display: flex;
flex-direction: column;
.tabs {
margin-top: -1px;
}
/deep/ .nav-title {
border-bottom: 1px solid transparent !important;
position: relative !important;
}
.ios_safe_height {
background-color: #fff;
height: auto !important;
}
.page-content {
padding: 10px 12px 24px;
}
.list {
padding-bottom: 50px;
}
}
//
.pt-88 {
//
padding-top: 88px;
//
}
//
.coupon-list-wrapper {
//
min-height: 100vh;
//
background: #f8f9fa;
//
&.no-pt {
//
padding-top: 10px;
//
}
//
}
//
.page-wrapper {
//
padding-top: 134px;
//
height: 100vh;
//
background-color: #f5f6f8;
//
display: flex;
//
flex-direction: column;
//
.tabs {
//
margin-top: -1px;
//
}
//
/deep/ .nav-title {
//
border-bottom: 1px solid transparent !important;
//
position: relative !important;
//
}
//
.ios_safe_height {
//
background-color: #fff;
//
height: auto !important;
//
}
//
.page-content {
//
padding: 10px 12px 24px;
//
}
//
.list {
//
padding-bottom: 50px;
//
}
//
}
</
style
>
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录