Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
cocaCola-h5
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lihongqiang
cocaCola-h5
Commits
4f854c7b
Commit
4f854c7b
authored
Sep 27, 2019
by
lihongqiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial commit
parents
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
880 additions
and
0 deletions
+880
-0
couponGetSuccess.css
src/coupon/couponGetSuccess.css
+96
-0
couponGetSuccess.html
src/coupon/couponGetSuccess.html
+216
-0
couponList.css
src/coupon/couponList.css
+197
-0
couponList.html
src/coupon/couponList.html
+371
-0
No files found.
src/coupon/couponGetSuccess.css
0 → 100644
View file @
4f854c7b
.text_overflow
{
white-space
:
nowrap
;
text-overflow
:
ellipsis
;
overflow
:
hidden
;
}
.over_two_lines
{
display
:
-webkit-box
;
word-break
:
break-all
;
text-overflow
:
ellipsis
;
overflow
:
hidden
;
white-space
:
pre-line
;
-webkit-box-orient
:
vertical
;
-webkit-line-clamp
:
2
;
}
div
{
word-wrap
:
break-word
;
word-break
:
normal
;
}
/* 换行^ */
.page-wrapper
{
width
:
100%
;
/*height: 100%;*/
background-color
:
#f7f7f7
;
}
.page-wrapper
.gettitle
{
width
:
100%
;
height
:
1.7837837837837838rem
;
display
:
flex
;
flex-direction
:
row
;
justify-content
:
center
;
align-items
:
center
;
}
.page-wrapper
.gettitle
.img
{
width
:
0.7567567567567568rem
;
height
:
0.7567567567567568rem
;
background-size
:
100%
;
margin-right
:
0.21621621621621623rem
;
}
.page-wrapper
.gettitle
div
{
font-size
:
0.43243243243243246rem
;
font-weight
:
400
;
color
:
rgba
(
102
,
102
,
102
,
1
);
line-height
:
0.5405405405405406rem
;
}
.page-wrapper
.detail
{
margin
:
0
0.6216216216216216rem
;
}
.page-wrapper
.card
{
width
:
100%
;
background
:
#ffffff
;
border-radius
:
0.2702702702702703rem
;
height
:
8.64864864864865rem
;
text-align
:
center
;
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
}
.page-wrapper
.card
.title
{
width
:
5.405405405405405rem
;
font-size
:
0.43243243243243246rem
;
line-height
:
0.5945945945945946rem
;
color
:
#666
;
padding-top
:
0.7027027027027027rem
;
}
.page-wrapper
.card
.con
{
width
:
6.324324324324325rem
;
font-size
:
0.32432432432432434rem
;
line-height
:
0.43243243243243246rem
;
color
:
#666
;
margin
:
0.2702702702702703rem
0
;
}
.page-wrapper
.card
img
{
background-size
:
100%
;
width
:
3.7837837837837838rem
;
height
:
3.7837837837837838rem
;
}
.page-wrapper
.card
.time
{
width
:
4.324324324324325rem
;
font-size
:
0.32432432432432434rem
;
line-height
:
0.3783783783783784rem
;
color
:
#666
;
margin
:
0.5405405405405406rem
0
0
0
;
}
.getgift
{
width
:
8.756756756756756rem
;
height
:
1.3513513513513513rem
;
background
:
rgba
(
87
,
189
,
106
,
1
);
border-radius
:
0.16216216216216217rem
;
color
:
#ffffff
;
font-size
:
0.43243243243243246rem
;
line-height
:
1.3513513513513513rem
;
text-align
:
center
;
margin
:
0.7567567567567568rem
auto
0
;
}
src/coupon/couponGetSuccess.html
0 → 100644
View file @
4f854c7b
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<!--<meta content="yes" name="apple-mobile-web-app-capable">-->
<!--<meta content="yes" name="apple-touch-fullscreen">-->
<!--<meta content="telephone=no,email=no" name="format-detection">-->
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"
/>
<script
src=
"../../lib/rem.js"
></script>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"../../lib/base.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"couponGetSuccess.css"
>
<link
href=
"https://cdn.bootcss.com/weui/2.0.1/style/weui.min.css"
rel=
"stylesheet"
>
<title>
兑换成功
</title>
</head>
<body>
<div
class=
"page-wrapper"
>
<div
class=
"gettitle"
>
<img
src=
"https://hh-oss-html.miyapay.com/hhops/picture/156689535460602adc0700023"
class=
"img"
>
<div>
兑换成功,请点击领取
</div>
</div>
<div
class=
"detail"
>
<div
class=
"card"
>
<div
class=
"title text_overflow"
></div>
<div
class=
"con over_two_lines"
></div>
<img
src=
""
>
<div
class=
"time"
>
兑换时间:
</div>
</div>
</div>
<div
class=
"getgift"
>
立即领取
</div>
</div>
<!-- 弹窗 -->
<div
class=
"js_dialog"
id=
"iosDialog1"
style=
" display: none;"
>
<div
class=
"weui-mask"
></div>
<div
class=
"weui-dialog"
>
<div
class=
"weui-dialog__hd"
><strong
class=
"weui-dialog__title"
>
title
</strong></div>
<div
class=
"weui-dialog__bd"
></div>
<div
class=
"weui-dialog__ft"
>
<!--<a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_default">辅助操作</a>-->
<a
href=
"javascript:;"
id=
"iosDialog1primary"
class=
"weui-dialog__btn weui-dialog__btn_primary"
>
确定
</a>
</div>
</div>
</div>
<script
src=
"https://cdn.bootcss.com/jquery/1.11.0/jquery.min.js"
></script>
<script
src=
"https://res.wx.qq.com/open/js/jweixin-1.3.2.js"
></script>
<!-- 引入小程序api -->
<script>
// 弹出弹窗
function
DialogAlert
(
title
,
con
,
primary
)
{
$
(
'#iosDialog1'
).
show
()
$
(
'.weui-dialog__title'
).
html
(
title
)
$
(
'.weui-dialog__bd'
).
html
(
con
)
$
(
'#iosDialog1Close'
).
html
(
primary
)
}
// 关闭
$
(
'#iosDialog1primary'
).
on
(
'click'
,
function
()
{
$
(
'#iosDialog1'
).
hide
()
})
$
(
function
()
{
// 设置背景图最小高度,铺满全屏
$
(
'.page-wrapper'
).
css
(
'min-height'
,
window
.
screen
.
height
+
'px'
)
// 公共参数
// var apiUrl = 'http://192.168.3.33:8100' // url api
// var apiUrl = 'https://saas-zuultest.miyapay.com' // url api
var
apiUrl
=
''
var
token
=
''
var
hhForm
=
'cocaCola'
var
hhCI
=
'saas-wechat-app'
var
nickName
=
''
// 用户名/手机号
var
status
=
''
// 0已处理 1未处理可领取
var
cardId
=
''
// id
var
orderId
=
''
// 订单id
// 获取url参数
function
GetQueryString
(
name
){
var
reg
=
new
RegExp
(
"(^|&)"
+
name
+
"=([^&]*)(&|$)"
);
var
r
=
window
.
location
.
search
.
substr
(
1
).
match
(
reg
);
if
(
r
!=
null
)
return
unescape
(
r
[
2
]);
return
null
;
}
var
code
=
GetQueryString
(
"code"
)
var
state
=
GetQueryString
(
"state"
).
split
(
'.'
)
token
=
state
[
0
]
nickName
=
state
[
1
]
status
=
state
[
2
]
// 0已处理 1未处理可领取
if
(
status
==
'1'
){
$
(
'.getgift'
).
html
(
'已领取'
).
css
(
'background'
,
'#cccccc'
)
}
cardId
=
state
[
3
]
// id
orderId
=
state
[
4
]
// 订单id
// 定义data
var
openid
=
''
// 获取openid
$
.
ajax
({
type
:
"get"
,
beforeSend
:
function
(
xhr
)
{
xhr
.
setRequestHeader
(
"content-type"
,
"application/json"
)
xhr
.
setRequestHeader
(
"Authorization"
,
"bearer "
+
token
)
xhr
.
setRequestHeader
(
"hh-from"
,
hhForm
)
xhr
.
setRequestHeader
(
"HH-CI"
,
hhCI
)
},
url
:
apiUrl
+
"/sapi/message/openid?code="
+
openid
,
success
:
function
(
res
)
{
if
(
res
.
code
==
'200'
){
if
(
res
.
data
.
code
==
'200'
){
openid
=
res
.
data
.
data
}
else
{
DialogAlert
(
'提示'
,
res
.
data
.
msg
)
}
}
else
{
DialogAlert
(
'提示'
,
res
.
data
.
msg
)
}
},
error
:
function
(
err
)
{
}
})
// 券详情
$
.
ajax
({
type
:
"post"
,
beforeSend
:
function
(
xhr
)
{
xhr
.
setRequestHeader
(
"content-type"
,
"application/json"
)
xhr
.
setRequestHeader
(
"Authorization"
,
"bearer "
+
token
)
xhr
.
setRequestHeader
(
"hh-from"
,
hhForm
)
xhr
.
setRequestHeader
(
"HH-CI"
,
hhCI
)
},
url
:
apiUrl
+
"/sapi/card/detail"
,
data
:
JSON
.
stringify
({
id
:
cardId
}),
success
:
function
(
res
)
{
if
(
res
.
code
==
'200'
){
console
.
log
(
res
.
data
)
$
(
'.card .title'
).
html
(
res
.
data
.
coupon_name
)
$
(
'.card .con'
).
html
(
res
.
data
.
desc
)
$
(
'.card img'
).
attr
(
'src'
,
res
.
data
.
img
)
$
(
'.card .time'
).
html
(
'兑换时间:'
+
res
.
data
.
begin_time
+
'至'
+
res
.
data
.
end_time
)
}
else
{
DialogAlert
(
'提示'
,
res
.
msg
)
}
},
error
:
function
(
err
)
{
}
})
// 点击领券
$
(
'.getgift'
).
on
(
'click'
,
function
()
{
if
(
status
==
'1'
){
// 已经领取了
return
}
var
that
=
$
(
this
)
$
.
ajax
({
type
:
"post"
,
beforeSend
:
function
(
xhr
)
{
xhr
.
setRequestHeader
(
"content-type"
,
"application/json"
)
xhr
.
setRequestHeader
(
"Authorization"
,
"bearer "
+
token
)
xhr
.
setRequestHeader
(
"hh-from"
,
hhForm
)
xhr
.
setRequestHeader
(
"HH-CI"
,
hhCI
)
},
url
:
apiUrl
+
"/sapi/card/send/coupon"
,
data
:
JSON
.
stringify
({
id
:
cardId
,
nickName
:
nickName
,
openid
:
openid
}),
success
:
function
(
res
)
{
if
(
res
.
code
==
'200'
){
var
status
=
res
.
data
.
status
if
(
status
==
'200'
||
status
==
'204'
){
// 204为已领取
DialogAlert
(
status
==
'200'
?
'领取成功'
:
'领取失败'
,
status
==
'200'
?
'恭喜您领取成功,可在我的卡包中查看~'
:
res
.
data
.
msg
)
if
(
status
==
'200'
){
$
.
ajax
({
type
:
"post"
,
beforeSend
:
function
(
xhr
)
{
xhr
.
setRequestHeader
(
"content-type"
,
"application/json"
)
xhr
.
setRequestHeader
(
"Authorization"
,
"bearer "
+
token
)
xhr
.
setRequestHeader
(
"hh-from"
,
hhForm
)
xhr
.
setRequestHeader
(
"HH-CI"
,
hhCI
)
},
url
:
apiUrl
+
"/sapi/order/update/status"
,
data
:
JSON
.
stringify
({
id
:
orderId
,
status
:
1
}),
success
:
function
(
res
)
{
if
(
res
.
code
==
'200'
){
}
else
{
DialogAlert
(
'提示'
,
res
.
msg
)
}
},
error
:
function
(
err
)
{
}
})
// 跳转回积分商城
wx
.
miniProgram
.
switchTab
({
url
:
'/pages/brand/brand_mall/index'
})
}
}
else
{
DialogAlert
(
'领取失败'
,
res
.
data
.
msg
)
}
}
else
{
DialogAlert
(
'提示'
,
res
.
msg
)
}
},
error
:
function
(
err
)
{
}
})
})
})
</script>
</body>
</html>
\ No newline at end of file
src/coupon/couponList.css
0 → 100644
View file @
4f854c7b
.text_overflow
{
white-space
:
nowrap
;
text-overflow
:
ellipsis
;
overflow
:
hidden
;
}
.over_two_lines
{
display
:
-webkit-box
;
word-break
:
break-all
;
text-overflow
:
ellipsis
;
overflow
:
hidden
;
white-space
:
pre-line
;
-webkit-box-orient
:
vertical
;
-webkit-line-clamp
:
2
;
}
div
{
box-sizing
:
border-box
;
}
/* 公用^ */
.page-wrapper
{
width
:
100%
;
/*height: 71.89189189189189rem;*/
background-size
:
100%
;
background-repeat
:
no-repeat
;
}
.page-wrapper
.list
{
width
:
100%
;
box-sizing
:
border-box
;
padding
:
8.45945945945946rem
0.5945945945945946rem
0
;
margin
:
0
auto
0
;
}
.page-wrapper
.list
.item
{
width
:
100%
;
height
:
2.4324324324324325rem
;
background-color
:
white
;
border-radius
:
0.2702702702702703rem
;
margin-bottom
:
0.2702702702702703rem
;
box-shadow
:
0rem
0.05405405405405406rem
0.2702702702702703rem
0rem
rgba
(
0
,
0
,
0
,
0.1
);
display
:
flex
;
flex-direction
:
row
;
justify-content
:
space-between
;
align-items
:
center
;
padding
:
0.43243243243243246rem
;
}
.page-wrapper
.list
.item
.item_img
{
width
:
1.2432432432432432rem
;
height
:
1.2432432432432432rem
;
background-size
:
100%
;
}
.page-wrapper
.list
.item
.item_title
{
width
:
4.324324324324325rem
;
font-size
:
0.3783783783783784rem
;
color
:
#666
;
line-height
:
0.5405405405405406rem
;
}
.page-wrapper
.list
.item
.item_title
.con
{
font-size
:
0.32432432432432434rem
;
line-height
:
0.43243243243243246rem
;
margin-top
:
0.13513513513513514rem
;
}
.page-wrapper
.list
.item
.item_button
{
width
:
1.8918918918918919rem
;
height
:
0.8108108108108109rem
;
border-radius
:
0.40540540540540543rem
;
background-color
:
#cccccc
;
font-size
:
0.32432432432432434rem
;
color
:
#ffffff
;
line-height
:
0.8108108108108109rem
;
text-align
:
center
;
position
:
relative
;
}
.explain
{
font-size
:
0.32432432432432434rem
;
line-height
:
0.4864864864864865rem
;
color
:
#ffffff
;
text-align
:
center
;
padding-bottom
:
1.2972972972972974rem
;
}
.explain
.top_explain
{
margin-top
:
0.40540540540540543rem
;
}
.explain
.top_explain
span
{
display
:
inline-block
;
}
.explain
.bottom_explain
{
padding
:
0.2702702702702703rem
;
width
:
6.756756756756757rem
;
margin
:
0
auto
;
}
/*底部浮窗提示*/
.bottomTip
{
width
:
8.108108108108109rem
;
height
:
1.3513513513513513rem
;
background
:
linear-gradient
(
360deg
,
rgba
(
239
,
239
,
239
,
1
)
0%
,
rgba
(
255
,
255
,
255
,
1
)
100%
);
box-shadow
:
0rem
0.05405405405405406rem
0.2702702702702703rem
0rem
rgba
(
0
,
0
,
0
,
0.5
);
border-radius
:
0.6756756756756757rem
;
margin
:
1.0810810810810811rem
auto
0.43243243243243246rem
;
display
:
flex
;
flex-direction
:
row
;
justify-content
:
center
;
align-items
:
center
;
}
.bottomTip
.left
{
width
:
0.6756756756756757rem
;
height
:
0.6756756756756757rem
;
border-radius
:
50%
;
border
:
0.08108108108108109rem
solid
#FEF18A
;
background-color
:
#FDB120
;
text-align
:
center
;
color
:
#ffffff
;
font-size
:
0.32432432432432434rem
;
line-height
:
0.5405405405405406rem
;
}
.bottomTip
.right
{
width
:
5.88rem
;
font-size
:
0.32432432432432434rem
;
color
:
rgba
(
153
,
153
,
153
,
1
);
line-height
:
0.4594594594594595rem
;
margin-left
:
0.17rem
;
}
.bottomTip
.right
span
{
color
:
#E64340
;
}
/* 暂无活动 */
.noactivity
{
position
:
absolute
;
top
:
50%
;
left
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
}
.noactivity
.shopImage
{
width
:
4.054054054054054rem
;
height
:
4.054054054054054rem
;
}
.noactivity
div
{
font-size
:
0.32432432432432434rem
;
color
:
#999999
;
padding-top
:
0.5405405405405406rem
;
}
/* 活动弹窗 */
.popup
{
position
:
absolute
;
top
:
0
;
left
:
0
;
bottom
:
0
;
right
:
0
;
}
.popup
.mask
{
position
:
absolute
;
top
:
0
;
left
:
0
;
bottom
:
0
;
right
:
0
;
background-color
:
rgba
(
0
,
0
,
0
,
0.4
);
}
.popup
.dialog
{
position
:
absolute
;
left
:
50%
;
top
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
width
:
80vw
;
}
.popup
.dialog
.container
{
background-color
:
#ffffff
;
border-radius
:
0.21621621621621623rem
;
padding-bottom
:
0.5405405405405406rem
;
}
.popup
.dialog
.header
{
width
:
100%
;
padding
:
0.5405405405405406rem
0.9459459459459459rem
;
font-size
:
0.43243243243243246rem
;
line-height
:
0.5945945945945946rem
;
text-align
:
center
;
font-weight
:
500
;
}
.popup
.dialog
.content
{
width
:
100%
;
max-height
:
45vh
;
box-sizing
:
border-box
;
padding
:
0
0.9459459459459459rem
0.9459459459459459rem
;
overflow
:
auto
;
}
.popup
.dialog
.content
.contentcontent
{
width
:
100%
;
font-size
:
0.32432432432432434rem
;
line-height
:
0.4864864864864865rem
;
color
:
#333
;
word-wrap
:
break-word
;
word-break
:
normal
;
}
.popup
.dialog
.closeexplain
{
margin
:
0.40540540540540543rem
auto
0
;
width
:
1.0810810810810811rem
;
height
:
1.0810810810810811rem
;
background-image
:
url("https://hh-oss-html.miyapay.com/hhops/picture/15662902569090e349c454c80")
;
background-size
:
100%
;
}
\ No newline at end of file
src/coupon/couponList.html
0 → 100644
View file @
4f854c7b
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<!--<meta content="yes" name="apple-mobile-web-app-capable">-->
<!--<meta content="yes" name="apple-touch-fullscreen">-->
<!--<meta content="telephone=no,email=no" name="format-detection">-->
<meta
name=
"viewport"
content=
"width=device-width,minimum-scale=1,maximum-scale=1,user-scalable=no"
/>
<script
src=
"../../lib/rem.js"
></script>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"../../lib/base.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"couponList.css"
>
<link
href=
"https://cdn.bootcss.com/weui/2.0.1/style/weui.min.css"
rel=
"stylesheet"
>
<title>
暂无活动
</title>
</head>
<body>
<div
class=
"page-wrapper"
>
<div
class=
"yesactivity"
>
<div
class=
"list"
>
<!--<div class="item">-->
<!--<img src="http://hh-oss-picture.miyapay.com/20190829221857ee8d32764.png" class="item_img">-->
<!--<div class="item_title">-->
<!--<div class="text_overflow">asdasdadasdadsa</div>-->
<!--<div class="con over_two_lines">哈哈哈哈哈哈哈哈</div>-->
<!--</div>-->
<!--<div class="item_button">领券</div>-->
<!--</div>-->
</div>
<div
class=
"explain"
>
<div
class=
"top_explain"
>
<span
id=
"huodong"
>
活动说明
</span>
<span
style=
"margin: 0 5px"
>
|
</span>
<span
id=
"shangpin"
>
活动商品
</span>
</div>
<div
class=
"bottom_explain"
></div>
<div
class=
"bottomTip"
style=
"display: none"
>
<div
class=
"left"
>
积
</div>
</div>
</div>
</div>
</div>
<div
class=
"noactivity"
style=
"display: none"
>
<img
class=
"shopImage"
src=
"https://hh-oss-html.miyapay.com/hhops/picture/1567564340589632abf7d610f"
>
<div>
当前没有正在进行的活动哦~
</div>
</div>
<!-- 活动弹窗 -->
<div
class=
"popup"
style=
"display: none"
>
<div
class=
"mask"
></div>
<div
class=
"dialog"
>
<div
class=
"container"
>
<div
class=
"header"
>
<div
class=
"title_top"
>
活动说明
</div>
</div>
<div
class=
"content"
>
<div
class=
"contentcontent"
>
111
</div>
</div>
</div>
<div
class=
"closeexplain"
></div>
</div>
</div>
<!-- 弹窗 -->
<div
class=
"js_dialog"
id=
"iosDialog1"
style=
" display: none;"
>
<div
class=
"weui-mask"
></div>
<div
class=
"weui-dialog"
>
<div
class=
"weui-dialog__hd"
><strong
class=
"weui-dialog__title"
id=
"weui-dialog__title"
>
title
</strong></div>
<div
class=
"weui-dialog__bd"
id=
"weui-dialog__bd"
></div>
<div
class=
"weui-dialog__ft"
>
<!--<a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_default">辅助操作</a>-->
<a
href=
"javascript:;"
id=
"iosDialog1primary"
class=
"weui-dialog__btn weui-dialog__btn_primary"
>
确定
</a>
</div>
</div>
</div>
<!-- 授权弹窗 -->
<div
class=
"js_dialog"
id=
"iosDialog2"
style=
" display: none;"
>
<div
class=
"weui-mask"
></div>
<div
class=
"weui-dialog"
>
<div
class=
"weui-dialog__hd"
><strong
class=
"weui-dialog__title"
>
登录提示
</strong></div>
<div
class=
"weui-dialog__bd"
>
小程序需要你的授权才能提供更好的服务
</div>
<div
class=
"weui-dialog__ft"
>
<a
href=
"javascript:;"
class=
"weui-dialog__btn weui-dialog__btn_default"
>
取消
</a>
<a
href=
"javascript:;"
id=
"iosDialog1primary2"
class=
"weui-dialog__btn weui-dialog__btn_primary"
>
确定
</a>
</div>
</div>
</div>
<script
src=
"https://cdn.bootcss.com/jquery/1.11.0/jquery.min.js"
></script>
<script
src=
"https://res.wx.qq.com/open/js/jweixin-1.3.2.js"
></script>
<!-- 引入小程序api -->
<script>
// 同意授权弹窗
$
(
'#iosDialog1primary2'
).
click
(
function
()
{
wx
.
miniProgram
.
navigateTo
({
url
:
'/pages/authLogin/index'
})
})
// 弹出弹窗
function
DialogAlert
(
title
,
con
,
primary
)
{
$
(
'#iosDialog1'
).
show
()
$
(
'#weui-dialog__title'
).
html
(
title
)
$
(
'#weui-dialog__bd'
).
html
(
con
)
$
(
'#iosDialog1Close'
).
html
(
primary
)
}
// 关闭
$
(
'#iosDialog1primary'
).
on
(
'click'
,
function
()
{
$
(
'#iosDialog1'
).
hide
()
})
// 关闭活动弹窗
$
(
'.closeexplain'
).
click
(
function
()
{
$
(
'.popup'
).
hide
()
})
$
(
function
()
{
// 设置背景图最小高度,铺满全屏
$
(
'.page-wrapper'
).
css
(
'min-height'
,
window
.
screen
.
height
+
'px'
)
// 公共参数
// var apiUrl = 'http://192.168.3.33:8013' // url api
// var apiUrl = 'https://saas-zuultest.miyapay.com' // url api
var
apiUrl
=
''
var
token
=
''
var
hhForm
=
'cocaCola'
var
hhCI
=
'saas-wechat-app'
var
nickName
=
''
// 用户名/手机号
// 获取url参数
function
GetQueryString
(
name
){
var
reg
=
new
RegExp
(
"(^|&)"
+
name
+
"=([^&]*)(&|$)"
);
var
r
=
window
.
location
.
search
.
substr
(
1
).
match
(
reg
);
if
(
r
!=
null
)
return
unescape
(
r
[
2
]);
return
null
;
}
var
code
=
GetQueryString
(
"code"
)
var
state
=
GetQueryString
(
"state"
).
split
(
'.'
)
token
=
state
[
0
]
nickName
=
state
[
1
]
// 定义data
var
active_product
=
''
// 活动产品
var
active_statement
=
''
// 活动说明
var
copywriting
=
''
// 底部文案
var
buttonColor
=
''
// 按钮颜色
var
openid
=
''
// 获取openid
$
.
ajax
({
type
:
"get"
,
beforeSend
:
function
(
xhr
)
{
xhr
.
setRequestHeader
(
"content-type"
,
"application/json"
)
xhr
.
setRequestHeader
(
"Authorization"
,
"bearer "
+
token
)
xhr
.
setRequestHeader
(
"hh-from"
,
hhForm
)
xhr
.
setRequestHeader
(
"HH-CI"
,
hhCI
)
},
url
:
apiUrl
+
"/sapi/message/openid?code="
+
code
,
success
:
function
(
res
)
{
if
(
res
.
code
==
'200'
){
if
(
res
.
data
.
code
==
'200'
){
openid
=
res
.
data
.
data
}
else
{
DialogAlert
(
'提示'
,
res
.
data
.
msg
)
}
}
else
{
DialogAlert
(
'提示'
,
res
.
data
.
msg
)
}
},
error
:
function
(
err
)
{
}
})
// 获取页面配置
$
.
ajax
({
type
:
"post"
,
beforeSend
:
function
(
xhr
)
{
xhr
.
setRequestHeader
(
"content-type"
,
"application/json"
)
xhr
.
setRequestHeader
(
"Authorization"
,
"bearer "
+
token
)
xhr
.
setRequestHeader
(
"hh-from"
,
hhForm
)
xhr
.
setRequestHeader
(
"HH-CI"
,
hhCI
)
},
url
:
apiUrl
+
"/sapi/card/page/configure"
,
data
:
JSON
.
stringify
({
id
:
1
}),
success
:
function
(
res
)
{
if
(
res
.
code
==
'200'
){
var
obj
=
JSON
.
parse
(
res
.
data
[
0
].
configure
)
$
(
'.page-wrapper'
).
css
(
'background-image'
,
'url('
+
obj
.
bottom_map
+
')'
)
buttonColor
=
obj
.
color_value
}
else
{
DialogAlert
(
'提示'
,
res
.
msg
)
}
},
error
:
function
(
err
)
{
}
})
// 体内券-领券货架信息接口
$
.
ajax
({
type
:
"post"
,
beforeSend
:
function
(
xhr
)
{
xhr
.
setRequestHeader
(
"content-type"
,
"application/json"
)
xhr
.
setRequestHeader
(
"Authorization"
,
"bearer "
+
token
)
xhr
.
setRequestHeader
(
"hh-from"
,
hhForm
)
xhr
.
setRequestHeader
(
"HH-CI"
,
hhCI
)
},
url
:
apiUrl
+
"/sapi/card/shelf/list"
,
data
:
JSON
.
stringify
({}),
success
:
function
(
res
)
{
if
(
res
.
code
==
'200'
){
if
(
res
.
data
){
document
.
title
=
res
.
data
.
page_title
// 修改页面title
active_product
=
res
.
data
.
active_product
active_statement
=
res
.
data
.
active_statement
copywriting
=
res
.
data
.
copywriting
$
(
'.bottom_explain'
).
html
(
copywriting
)
// 获取list
$
.
ajax
({
type
:
"post"
,
beforeSend
:
function
(
xhr
)
{
xhr
.
setRequestHeader
(
"content-type"
,
"application/json"
)
xhr
.
setRequestHeader
(
"Authorization"
,
"bearer "
+
token
)
xhr
.
setRequestHeader
(
"hh-from"
,
hhForm
)
xhr
.
setRequestHeader
(
"HH-CI"
,
hhCI
)
},
url
:
apiUrl
+
"/sapi/card/list"
,
data
:
JSON
.
stringify
({
id
:
res
.
data
.
id
}),
success
:
function
(
res
)
{
if
(
res
.
code
==
'200'
){
if
(
res
.
data
&&
res
.
data
.
length
>
0
){
// 有优惠券
var
html
=
''
for
(
var
i
=
0
;
i
<
res
.
data
.
length
;
i
++
){
html
+=
'<div class="item" data-id="'
+
res
.
data
[
i
].
cardId
+
'">'
+
'<img src='
+
res
.
data
[
i
].
img
+
' class="item_img">'
+
'<div class="item_title">'
+
'<div class="text_overflow">'
+
res
.
data
[
i
].
coupon_name
+
'</div>'
+
'<div class="con over_two_lines">'
+
res
.
data
[
i
].
desc
+
'</div></div>'
+
'<div data-id="'
+
res
.
data
[
i
].
cardId
+
'" class="item_button" style="background-color:'
+
buttonColor
+
' ">领取</div></div>'
}
$
(
'.list'
).
html
(
html
)
// 绑定领取事件
$
(
'.item_button'
).
on
(
'click'
,
function
(
event
)
{
event
.
stopPropagation
()
if
(
token
==
'0'
){
// 如果没有授权
$
(
"#iosDialog2"
).
show
()
return
}
var
that
=
$
(
this
)
var
cardid
=
$
(
this
).
attr
(
'data-id'
)
// 领券
$
.
ajax
({
type
:
"post"
,
beforeSend
:
function
(
xhr
)
{
xhr
.
setRequestHeader
(
"content-type"
,
"application/json"
)
xhr
.
setRequestHeader
(
"Authorization"
,
"bearer "
+
token
)
xhr
.
setRequestHeader
(
"hh-from"
,
hhForm
)
xhr
.
setRequestHeader
(
"HH-CI"
,
hhCI
)
},
url
:
apiUrl
+
"/sapi/card/send/coupon"
,
data
:
JSON
.
stringify
({
id
:
cardid
,
nickName
:
nickName
,
openid
:
openid
}),
success
:
function
(
res
)
{
if
(
res
.
code
==
'200'
){
var
status
=
res
.
data
.
status
if
(
status
==
'200'
||
status
==
'204'
){
// 204为已领取
DialogAlert
(
status
==
'200'
?
'领取成功'
:
'领取失败'
,
status
==
'200'
?
'直接出示微信付款码即可使用优惠券,要在适用范围内的门店使用哦~'
:
res
.
data
.
msg
)
// that.css('background-color','#cccccc').html('已领取')
}
else
{
DialogAlert
(
'领取失败'
,
res
.
data
.
msg
)
}
}
else
{
DialogAlert
(
'提示'
,
res
.
msg
)
}
},
error
:
function
(
err
)
{
}
})
})
// 跳转详情
$
(
'.item'
).
on
(
'click'
,
function
()
{
var
cardid
=
$
(
this
).
attr
(
'data-id'
)
wx
.
miniProgram
.
navigateTo
({
url
:
'/pages/brand/brand_couponDetail/index?id='
+
cardid
})
})
}
}
else
{
DialogAlert
(
'提示'
,
res
.
msg
)
}
},
error
:
function
(
err
)
{
}
})
}
else
{
// 无优惠券
$
(
'.noactivity'
).
show
()
$
(
'.page-wrapper'
).
hide
()
}
}
else
{
DialogAlert
(
'提示'
,
res
.
msg
)
}
},
error
:
function
(
err
)
{
}
})
if
(
token
!=
'0'
){
// 授权过才能请求
// 注册会员
$
.
ajax
({
type
:
"post"
,
beforeSend
:
function
(
xhr
)
{
xhr
.
setRequestHeader
(
"content-type"
,
"application/json"
)
xhr
.
setRequestHeader
(
"Authorization"
,
"bearer "
+
token
)
xhr
.
setRequestHeader
(
"hh-from"
,
hhForm
)
xhr
.
setRequestHeader
(
"HH-CI"
,
hhCI
)
},
url
:
apiUrl
+
"/sapi/member/add-coca"
,
data
:
JSON
.
stringify
({
phone
:
nickName
,
source
:
"1"
,
name
:
nickName
}),
success
:
function
(
res
)
{
},
error
:
function
(
err
)
{
}
})
// 是否有下方积分兑换提示
$
(
".bottomTip"
).
show
()
$
.
ajax
({
type
:
"post"
,
beforeSend
:
function
(
xhr
)
{
xhr
.
setRequestHeader
(
"content-type"
,
"application/json"
)
xhr
.
setRequestHeader
(
"Authorization"
,
"bearer "
+
token
)
xhr
.
setRequestHeader
(
"HH-from"
,
hhForm
)
xhr
.
setRequestHeader
(
"HH-CI"
,
hhCI
)
},
url
:
apiUrl
+
"/sapi/integral/cannot/exchange"
,
data
:
JSON
.
stringify
({}),
success
:
function
(
res
)
{
if
(
res
.
code
==
'200'
){
if
(
res
.
data
.
type
==
1
){
// type
$
(
'.bottomTip'
).
append
(
'<div class="right">还差<span>'
+
res
.
data
.
needIntegral
+
'</span>即可兑换<span>'
+
res
.
data
.
product
[
0
].
product_title
+
'</span></div>'
)
}
else
{
$
(
'.bottomTip'
).
append
(
'<div class="right">使用积分即可兑换<span>'
+
res
.
data
.
product
[
0
].
product_title
+
'</span></div>'
)
}
}
else
{
DialogAlert
(
'提示'
,
res
.
msg
)
}
},
error
:
function
(
err
)
{
}
})
}
// 点击活动说明
$
(
'#huodong'
).
on
(
'click'
,
function
()
{
$
(
'.popup'
).
show
()
$
(
'.title_top'
).
html
(
'活动说明'
)
$
(
'.contentcontent'
).
html
(
active_statement
)
})
// 点击活动商品
$
(
'#shangpin'
).
on
(
'click'
,
function
()
{
$
(
'.popup'
).
show
()
$
(
'.title_top'
).
html
(
'活动商品'
)
$
(
'.contentcontent'
).
html
(
active_product
)
})
})
</script>
</body>
</html>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment