Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
dev
/
zhiliang-light-mp
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
cee15072
authored
2019-08-14 17:38:32 +0800
by
simon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
版本提交
1 parent
758584ce
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
325 additions
and
51 deletions
src/app.js
src/app.json
src/http/api.js
src/image/index/index-c1.png
src/pages/authorize/authorize.wxml
src/pages/index/index.js
src/pages/index/index.json
src/pages/index/index.wxml
src/pages/integral-detail/integral-detail.js
src/pages/integral-detail/integral-detail.scss
src/pages/integral-detail/integral-detail.wxml
src/pages/my-qrcode/my-qrcode.js
src/pages/my-qrcode/my-qrcode.wxml
src/pages/rank-gift/rank-gift.js
src/pages/scan-result/scan-result.js
src/pages/scan-result/scan-result.wxml
src/pages/user-center/user-center.wxml
src/app.js
View file @
cee1507
...
...
@@ -17,7 +17,8 @@ App({
config
:
config
,
router
:
router
,
store
:
store
,
onLaunch
:
function
()
{
onLaunch
(
options
)
{
console
.
log
(
"options:"
,
options
);
this
.
share
()
},
globalData
:
{
...
...
@@ -45,7 +46,7 @@ App({
view
.
onShareAppMessage
=
function
(
res
)
{
//分享配置
return
{
title
:
'
志亮·
深士照明'
,
title
:
'深士照明'
,
path
:
'pages/index/index'
};
};
...
...
src/app.json
View file @
cee1507
{
"pages"
:
[
"pages/index/index"
,
"pages/scan-result/scan-result"
,
"pages/user-center/user-center"
,
"pages/gift-shop/gift-shop"
,
"pages/gift-detail/gift-detail"
,
"pages/scan-result/scan-result"
,
"pages/contact/contact"
,
"pages/contact-table/contact-table"
,
"pages/authorize/authorize"
,
...
...
src/http/api.js
View file @
cee1507
...
...
@@ -4,6 +4,7 @@ module.exports = {
product
:
'/product'
,
// post 首页商品概览
bannerList
:
'/banner/list'
,
// post 轮播图列表
pointsOverview
:
'/points/overview'
,
// post 查看积分概览
points
:
'/points'
,
// post 类型积分值
commodityList
:
'/commodity/list'
,
// post 积分商城浏览 商品列表
commodityVeridcation
:
'/commodity/veridcation'
,
// post 兑换礼物 红包和实物兑换礼物接口 , 实物会返回地址信息,红包校验通过会直接兑换
commodityExchange
:
'/commodity/exchange'
,
// post 兑换礼物2 实物兑换,需要带上地址的唯一标识uuid
...
...
src/image/index/index-c1.png
View file @
cee1507
40.5 KB
|
W:
|
H:
38.6 KB
|
W:
|
H:
2-up
Swipe
Onion skin
src/pages/authorize/authorize.wxml
View file @
cee1507
...
...
@@ -6,7 +6,7 @@
<view class="top-space"></view>
<view class="login">
<image class="login-logo" src="../../image/logo.png" mode="aspectFit" />
<view class="login-name">
志亮·
深士照明</view>
<view class="login-name">深士照明</view>
<view class="login-line"></view>
<view class="login-title">完整体验小程序功能,需要您的微信授权</view>
<view class="login-tips">· 获取您的公开信息(昵称、头像等)</view>
...
...
src/pages/index/index.js
View file @
cee1507
...
...
@@ -12,7 +12,10 @@ Page({
page
:
1
,
size
:
10
,
productList
:
[],
// 产品列表
curProductDetail
:
{}
// 选中的产品详情
curProductDetail
:
{},
// 选中的产品详情
qrCodeCode
:
""
,
userInfo
:
{},
//用户信息
code
:
""
,
// 手输入码
},
onShareAppMessage
()
{},
showAuth
()
{
...
...
@@ -21,9 +24,33 @@ Page({
})
},
onLoad
(
options
)
{
this
.
queryProduct
();
this
.
queryBanner
();
let
scene
=
decodeURIComponent
(
options
.
scene
)
||
""
;
// scene = "ab4cbd54dcf04d29a6c23d00a900b332"
if
(
scene
)
{
this
.
setData
({
scene
})
}
this
.
initData
();
},
initData
()
{
let
{
scene
}
=
this
.
data
;
if
(
scene
)
{
// 可能要拉授权
this
.
queryMember
().
then
((
result
)
=>
{
this
.
queryScanPersonQrcode
().
then
((
result
)
=>
{}).
catch
((
err
)
=>
{});
});
}
},
// 到达底部
onReachBottom
()
{
if
(
this
.
data
.
productList
.
length
<
this
.
data
.
total
)
{
...
...
@@ -82,6 +109,47 @@ Page({
},
/**
* 获取会员信息
*/
queryMember
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
app
.
post
({
url
:
app
.
api
.
member
,
data
:
{}
}).
then
((
result
)
=>
{
this
.
setData
({
userInfo
:
result
})
resolve
();
})
});
},
/**
* 扫个人码
*/
queryScanPersonQrcode
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
let
{
scene
}
=
this
.
data
;
if
(
scene
)
{
app
.
post
({
toast
:
false
,
url
:
app
.
api
.
scanPersonQrcode
,
data
:
{
memberCode
:
scene
}
}).
then
((
result
)
=>
{
this
.
setData
({
prizeInfo
:
result
})
})
}
});
},
/**
* 点击详情
*/
onProductItemHandler
(
evt
)
{
...
...
@@ -104,10 +172,6 @@ Page({
qrCodeCode
,
memberCode
}
=
result
;
// wx.showToast({
// title: "res:" + res.result,
// icon: "none"
// })
},
fail
(
err
)
{
console
.
log
(
"err:"
,
err
);
...
...
@@ -115,12 +179,32 @@ Page({
})
},
//
/**
* 点击搜索
*/
onSearchHandler
()
{
app
.
router
.
push
({
path
:
"scanResult"
,
query
:
{
code
:
this
.
data
.
code
}
})
},
/**
* 绑定手输code
* @param {*} e
*/
bindCodeInput
(
e
)
{
this
.
setData
({
code
:
e
.
detail
.
value
})
},
hideMask
()
{
this
.
setData
({
productDetailVisible
:
false
productDetailVisible
:
false
,
authorizeVisible
:
false
,
})
},
// 子组件事件
...
...
@@ -135,6 +219,12 @@ Page({
this
.
hideMask
();
break
;
// 授权完毕
case
"_evt_auth_complete"
:
this
.
initData
();
this
.
hideMask
();
break
;
default
:
break
;
}
...
...
src/pages/index/index.json
View file @
cee1507
{
"navigationBarTitleText"
:
"
志亮
照明"
,
"navigationBarTitleText"
:
"
深士
照明"
,
"usingComponents"
:
{
"product-detail-comp"
:
"../../component/product-detail-comp/product-detail-comp"
,
"van-popup"
:
"../../ui/vant-weapp/popup/index"
...
...
src/pages/index/index.wxml
View file @
cee1507
...
...
@@ -8,15 +8,16 @@
<view class="space1"></view>
<view class="search">
<view class="search-ipt-wrap">
<input class="ipt" placeholder="请输入串码" />
<input
value="{{code}}" bindinput="bindCodeInput"
class="ipt" placeholder="请输入串码" />
</view>
<view class="search-scan">
<view
bindtap="onSearchHandler"
class="search-scan">
<image class="icon" mode="aspectFit" src="../../image/icon/icon-search.png" />
</view>
<view class="search-line"></view>
<!-- 隐藏扫描二维码 -->
<!-- <view class="search-line"></view>
<view bindtap="onScanHandler" class="search-scan">
<image class="icon" mode="aspectFit" src="../../image/icon/icon-scan.png" />
</view>
</view>
-->
</view>
</view>
<view class="top-space"></view>
...
...
src/pages/integral-detail/integral-detail.js
View file @
cee1507
import
{
getBindtapData
getBindtapData
,
getObjByListKeyValue
}
from
'../../utils/util'
;
let
Date
=
require
(
'../../utils/date.js'
);
...
...
@@ -21,31 +22,43 @@ Page({
t1
:
"全部"
,
t2
:
""
,
index
:
"0"
,
pointsType
:
""
,
type
:
""
,
},
{
t1
:
"
300
"
,
t1
:
""
,
t2
:
"购买积分"
,
index
:
"1"
,
pointsType
:
"buy"
,
type
:
"buyNum"
,
},
{
t1
:
"
200
"
,
t1
:
""
,
t2
:
"推广积分"
,
index
:
"2"
,
pointsType
:
"promotion"
,
type
:
"promotionNum"
,
},
{
t1
:
"
50
"
,
t1
:
""
,
t2
:
"签到积分"
,
index
:
"3"
,
pointsType
:
"sign"
,
type
:
"signNum"
,
},
{
t1
:
"
300
"
,
t1
:
""
,
t2
:
"奖励积分"
,
index
:
"4"
,
pointsType
:
"award"
,
type
:
"awardNum"
,
},
{
t1
:
"
300
"
,
t1
:
""
,
t2
:
"兑换积分"
,
index
:
"5"
,
pointsType
:
"exchange"
,
type
:
"exchangeNum"
,
},
],
},
...
...
@@ -64,7 +77,10 @@ Page({
dateEnd
,
dateStr
})
this
.
queryPoints
().
then
((
result
)
=>
{
this
.
refreshStatus
();
});
this
.
initData
();
},
...
...
@@ -78,7 +94,7 @@ Page({
this
.
setData
({
page
:
this
.
data
.
page
+
1
});
this
.
query
Order
();
this
.
query
PointsOverview
();
}
},
...
...
@@ -108,6 +124,34 @@ Page({
},
/**
* 积分值类型
*/
queryPoints
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
app
.
post
({
url
:
app
.
api
.
points
,
data
:
{}
}).
then
((
result
)
=>
{
console
.
log
(
"queryPoints result:"
,
result
);
let
navList
=
this
.
data
.
navList
;
navList
.
forEach
((
element
,
index
)
=>
{
if
(
index
==
0
)
{
element
.
t1
=
"全部"
}
else
{
element
.
t1
=
result
[
element
.
type
]
+
""
}
});
this
.
setData
({
navList
:
navList
})
resolve
();
})
});
},
/**
* 积分概览
*/
queryPointsOverview
()
{
...
...
@@ -124,11 +168,12 @@ Page({
month
:
month
,
}
}).
then
((
result
)
=>
{
console
.
log
(
"result:"
,
result
)
;
let
navList
=
this
.
data
.
navList
;
let
dataList
=
result
.
list
;
dataList
=
this
.
data
.
dataList
.
concat
(
dataList
);
dataList
.
forEach
(
element
=>
{
element
.
time
=
new
Date
(
element
.
createTime
).
toString
(
"yyyy.MM.dd"
)
element
.
time
=
new
Date
(
element
.
createTime
).
toString
(
"yyyy.MM.dd"
);
element
.
words
=
getObjByListKeyValue
(
element
.
pointsType
,
"pointsType"
,
navList
).
t2
;
});
this
.
setData
({
dataList
:
dataList
,
...
...
src/pages/integral-detail/integral-detail.scss
View file @
cee1507
...
...
@@ -36,7 +36,7 @@ $contentWidth:690px;
color
:
#333333
;
.t1
{
font-size
:
72
px
;
font-size
:
64
px
;
color
:
#3680EB
;
}
}
...
...
@@ -56,7 +56,7 @@ $contentWidth:690px;
margin
:
8px
;
}
.d1
{
.d1
{
margin-left
:
8px
;
}
}
...
...
@@ -139,11 +139,15 @@ $contentWidth:690px;
.t1
{
font-size
:
28px
;
width
:
100%
;
text-align
:
center
;
}
.t2
{
font-size
:
20px
;
margin-top
:
-32px
;
width
:
100%
;
text-align
:
center
;
}
}
...
...
src/pages/integral-detail/integral-detail.wxml
View file @
cee1507
...
...
@@ -57,7 +57,7 @@
<!-- 标题 -->
<view class="tit">
<view class="tt t1">时间</view>
<view class="tt t2">
获取方式
</view>
<view class="tt t2">
积分类型
</view>
<view class="tt t3">名称</view>
<view class="tt t4 minus">积分</view>
</view>
...
...
@@ -65,8 +65,8 @@
<view class="integral">
<view wx:for="{{dataList}}" wx:key="{{item}}" class="integral-item">
<view class="tt t1">{{item.time}}</view>
<view class="tt t2">{{item.
subTitle
}}</view>
<view class="tt t3">
产品名称
</view>
<view class="tt t2">{{item.
words
}}</view>
<view class="tt t3">
{{item.subTitle}}
</view>
<view class="tt t4 {{item.pointsIp == 0 ? 'minus':''}}">
{{item.pointsIp == 1 ? '+':'-'}} {{item.pointsNum}}
</view>
...
...
src/pages/my-qrcode/my-qrcode.js
View file @
cee1507
...
...
@@ -32,14 +32,15 @@ Page({
}).
then
((
result
)
=>
{
let
userInfo
=
result
this
.
setData
({
userInfo
userInfo
:
userInfo
,
qrImagePath
:
userInfo
.
memberUrl
,
})
let
tlMemberCode
=
userInfo
.
memberCode
;
//
设置二维码
let
qrSize
=
this
.
setCanvasSize
(
440
);
let
codeContent
=
`tlMemberCode=
${
tlMemberCode
}
`
this
.
createQrCode
(
codeContent
,
'qrcanvas'
,
qrSize
.
w
,
qrSize
.
h
);
// 生成个人二维码
//
let tlMemberCode = userInfo.memberCode;
//
let qrSize = this.setCanvasSize(440);
//
let codeContent = `tlMemberCode=${tlMemberCode}`
//
this.createQrCode(codeContent, 'qrcanvas', qrSize.w, qrSize.h);
resolve
();
})
...
...
src/pages/my-qrcode/my-qrcode.wxml
View file @
cee1507
...
...
@@ -7,9 +7,9 @@
<view class="card">
<image class="avatar" mode="widthFix" src="{{userInfo.avatar}}" />
<view class="nickname">{{userInfo.nickname}}</view>
<
!-- <image class="qrcode" mode="widthFix" src="../../image/icon/icon-default-qrcode.png" /> --
>
<image wx:if="{{qrImagePath}}" class="qrcode" mode="widthFix" src="{{qrImagePath}}" />
<canvas wx:else class="qrcode" style="visibility: hidden;" canvas-id="qrcanvas" />
<
image class="qrcode" mode="widthFix" src="{{qrImagePath}}" /
>
<
!-- <
image wx:if="{{qrImagePath}}" class="qrcode" mode="widthFix" src="{{qrImagePath}}" />
<canvas wx:else class="qrcode" style="visibility: hidden;" canvas-id="qrcanvas" />
-->
<view class="t1">深士照明</view>
<view class="t1 t2">扫码即获专属积分,兑换超值奖品</view>
</view>
...
...
src/pages/rank-gift/rank-gift.js
View file @
cee1507
...
...
@@ -33,7 +33,7 @@ Page({
this
.
setData
({
page
:
this
.
data
.
page
+
1
});
this
.
query
Order
();
this
.
query
ActivityPrize
();
}
},
...
...
src/pages/scan-result/scan-result.js
View file @
cee1507
...
...
@@ -2,6 +2,9 @@ let app = getApp();
Page
({
data
:
{
authorizeVisible
:
false
,
qrCodeCode
:
""
,
prizeInfo
:
null
,
//扫码结果
userInfo
:
{},
//用户信息
},
onShareAppMessage
()
{},
showAuth
()
{
...
...
@@ -9,5 +12,127 @@ Page({
authorizeVisible
:
true
})
},
onLoad
(
options
)
{}
onLoad
(
options
)
{
// 扫小程序码进入
let
scene
=
decodeURIComponent
(
options
.
scene
)
||
""
;
// scene = "02llmPvYl1CFN2bc"
if
(
scene
)
{
this
.
setData
({
scene
})
}
// 手输码
let
code
=
options
.
code
||
""
;
console
.
log
(
"code:"
,
code
);
if
(
code
)
{
this
.
setData
({
scene
:
code
})
}
this
.
initData
();
},
initData
()
{
// 可能要拉授权
this
.
queryMember
().
then
((
result
)
=>
{
this
.
queryScanIntegralQrcode
().
then
((
result
)
=>
{}).
catch
((
err
)
=>
{});
});
},
/**
* 获取会员信息
*/
queryMember
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
app
.
post
({
url
:
app
.
api
.
member
,
data
:
{}
}).
then
((
result
)
=>
{
this
.
setData
({
userInfo
:
result
})
resolve
();
})
});
},
/**
* 扫积分码功能 扫积分码
*/
queryScanIntegralQrcode
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
let
{
scene
}
=
this
.
data
;
if
(
scene
)
{
app
.
post
({
url
:
app
.
api
.
scanIntegralQrcode
,
data
:
{
qrCodeCode
:
scene
}
}).
then
((
result
)
=>
{
this
.
setData
({
prizeInfo
:
result
})
if
(
result
.
qrCodeStatus
!=
1
)
{
wx
.
setNavigationBarTitle
({
title
:
'积分获取失败'
})
}
}).
catch
((
err
)
=>
{
this
.
setData
({
prizeInfo
:
{}
})
wx
.
setNavigationBarTitle
({
title
:
'积分获取失败'
})
});
}
else
{
this
.
setData
({
prizeInfo
:
{}
})
wx
.
setNavigationBarTitle
({
title
:
'积分获取失败'
})
}
});
},
/**
* 查看我的积分
*/
onMyIntegralHandler
(
evt
)
{
app
.
router
.
push
({
openType
:
"reLaunch"
,
path
:
"userCenter"
})
},
// 隐藏蒙层
hideMask
()
{
this
.
setData
({
authorizeVisible
:
false
,
})
},
// 子组件事件
evtcomp
(
evt
)
{
let
{
name
,
data
}
=
evt
.
detail
;
switch
(
name
)
{
// 授权完毕
case
"_evt_auth_complete"
:
this
.
initData
();
this
.
hideMask
();
break
;
default
:
break
;
}
},
})
...
...
src/pages/scan-result/scan-result.wxml
View file @
cee1507
...
...
@@ -4,24 +4,30 @@
<view class="app__content main">
<view class="top-space"></view>
<view class="content">
<view class="border scan">
<view wx:if="{{
1>0
}}" class="result success">
<text class="tips tips1">恭喜获得
10
积分!</text>
<view
wx:if="{{prizeInfo}}"
class="border scan">
<view wx:if="{{
prizeInfo.qrCodeStatus == 1
}}" class="result success">
<text class="tips tips1">恭喜获得
{{prizeInfo.pointNum}}
积分!</text>
<view class="tips tips2">
账户共有
<span class="t1">
350
</span>
<span class="t1">
{{prizeInfo.memberPoints}}
</span>
积分
</view>
<view class="btn-wrap">
<
view class="btn">再扫一次</view
>
<view class="btn btn2">查看我的积分</view>
<
!-- <view class="btn">再扫一次</view> --
>
<view
bindtap="onMyIntegralHandler"
class="btn btn2">查看我的积分</view>
</view>
</view>
<view wx:else class="result fail">
<text class="tips tips1">此产品码已被扫过!\n若有异常,请联系客服</text>
<!-- 码已经被使用 -->
<text wx:if="{{prizeInfo.qrCodeStatus == 2}}" class="tips tips1">
此产品码已被扫过!\n若有异常,请联系客服
</text>
<!-- 其他异常 -->
<text wx:else class="tips tips1">此产品码已被扫过!\n若有异常,请联系客服</text>
<view class="btn-wrap">
<view class="btn">再扫一次</view>
<view class="btn btn2">联系客服</view>
<!-- <view class="btn">再扫一次</view> -->
<view bindtap="onMyIntegralHandler" class="btn btn2">查看我的积分</view>
<!-- <view class="btn btn2">联系客服</view> -->
</view>
</view>
</view>
...
...
src/pages/user-center/user-center.wxml
View file @
cee1507
...
...
@@ -27,7 +27,7 @@
<view class="t2">我的积分</view>
</view>
<view class="line"></view>
<view class="wrap">
<view
bindtap="onIntegralDetailHandler"
class="wrap">
<view class="t1">{{userInfo.promotionNum}}</view>
<view class="t2">推广数据</view>
</view>
...
...
Please
register
or
sign in
to post a comment