Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
dev
/
marubi-wish-list-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
9e02268d
authored
2019-08-05 14:59:16 +0800
by
simon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1
1 parent
ada19efb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
95 additions
and
30 deletions
src/component/tips-nearby-store-comp/tips-nearby-store-comp.js
src/pages/coupon-detail/coupon-detail.js
src/pages/my-card/my-card.js
src/component/tips-nearby-store-comp/tips-nearby-store-comp.js
View file @
9e02268
...
...
@@ -34,9 +34,9 @@ Component({
provinceList
:
[],
cityList
:
[],
districtList
:
[],
provinceIndex
:
0
,
cityIndex
:
0
,
districtIndex
:
0
,
provinceIndex
:
-
1
,
cityIndex
:
-
1
,
districtIndex
:
-
1
,
addressList
:
[],
total
:
0
,
curAddress
:
null
,
...
...
@@ -135,7 +135,6 @@ Component({
*/
onShowLocHandler
(
evt
)
{
let
item
=
getBindtapData
(
evt
);
wx
.
openLocation
({
latitude
:
item
.
latitude
,
// 纬度,范围为-90~90,负数表示南纬
longitude
:
item
.
longitude
,
// 经度,范围为-180~180,负数表示西经
...
...
@@ -175,7 +174,7 @@ Component({
this
.
setData
({
provinceList
:
result
})
console
.
log
(
"getProvince result:"
,
result
);
//
console.log("getProvince result:", result);
})
});
},
...
...
src/pages/coupon-detail/coupon-detail.js
View file @
9e02268
import
{
wishbillGiftQuery
}
from
'../../const/custom-data'
;
import
{
getBindtapData
,
pxToRpx
pxToRpx
,
getLocalDistance
}
from
'../../utils/util'
;
import
Date
from
'../../utils/date'
;
import
QR
from
'../../utils/qrcode'
...
...
@@ -21,40 +20,67 @@ Page({
},
onShareAppMessage
()
{},
onLoad
(
options
)
{
// let wishInfo = options;
let
wishInfo
=
wishbillGiftQuery
.
order
;
let
couponInfo
=
wishInfo
.
coupon
;
// 设置起止时间
couponInfo
.
startDateStr
=
new
Date
(
couponInfo
.
startDate
).
toString
(
"yyyy.MM.dd"
);
couponInfo
.
endDateStr
=
new
Date
(
couponInfo
.
endDate
).
toString
(
"yyyy.MM.dd"
);
// 判断是否使用
// 自提券 使用状态(0=未使用 1=已过期,2=已使用)
let
used
=
couponInfo
.
state
!=
0
;
// used = true;
// let giftData = app.globalData.curCoupon;
// let wishInfo = giftData.order;
let
couponInfo
=
app
.
globalData
.
curCoupon
;
// 设置数据
this
.
setData
({
wishInfo
:
wishInfo
,
couponInfo
:
couponInfo
,
used
:
used
// wishInfo: wishInfo,
couponInfo
:
couponInfo
})
this
.
initData
();
},
initData
()
{
let
_this
=
this
;
app
.
queryIndex
().
then
((
result
)
=>
{
this
.
setData
({
userInfo
:
app
.
globalData
.
userInfo
})
// 设置二维码
let
wishInfo
=
this
.
data
.
wishInfo
;
let
couponInfo
=
this
.
data
.
couponInfo
;
// 设置二维码
let
qrSize
=
this
.
setCanvasSize
(
340
);
console
.
log
(
"couponInfo:"
,
couponInfo
);
let
codeContent
=
couponInfo
.
couponCode
||
''
;
this
.
createQrCode
(
codeContent
,
'qrcanvas'
,
qrSize
.
w
,
qrSize
.
h
);
// 判断是否使用
// 自提券 使用状态(0=未使用 1=已过期,2=已使用)
let
used
=
couponInfo
.
state
!=
0
;
// 设置起止时间
couponInfo
.
startDateStr
=
new
Date
(
couponInfo
.
startDate
).
toString
(
"yyyy.MM.dd"
);
couponInfo
.
endDateStr
=
new
Date
(
couponInfo
.
endDate
).
toString
(
"yyyy.MM.dd"
);
// 设置数据
this
.
setData
({
couponInfo
:
couponInfo
,
used
:
used
})
// 设置坐标
// wx.getLocation({
// type: 'gcj02',
// success(res) {
// let targetLocation = {
// latitude: wishInfo.latitude,
// longitude: wishInfo.longitude,
// }
// let distance = getLocalDistance(res, targetLocation).dis;
// wishInfo.distance = distance;
// console.log("distance:", distance);
// _this.setData({
// wishInfo: wishInfo
// })
// }
// })
})
},
/**
...
...
@@ -75,7 +101,7 @@ Page({
wxLocation
()
{
let
_this
=
this
;
wx
.
getLocation
({
type
:
'
wgs84
'
,
type
:
'
gcj02
'
,
success
(
res
)
{
_this
.
setData
({
location
:
res
...
...
@@ -122,6 +148,27 @@ Page({
}
})
},
/**
* 显示位置
* @param {*} e
*/
onShowLocHandler
(
evt
)
{
let
item
=
this
.
data
.
wishInfo
;
console
.
log
(
"item:"
,
item
);
wx
.
openLocation
({
latitude
:
item
.
latitude
,
// 纬度,范围为-90~90,负数表示南纬
longitude
:
item
.
longitude
,
// 经度,范围为-180~180,负数表示西经
scale
:
18
,
// 缩放比例
name
:
item
.
storeName
,
// 位置名
address
:
item
.
storeAddress
,
// 地址的详细说明
success
:
function
(
res
)
{
// success
}
})
},
createQrCode
(
content
,
canvasId
,
cavW
,
cavH
)
{
//调用插件中的draw方法,绘制二维码图片
QR
.
api
.
draw
(
content
,
canvasId
,
cavW
,
cavH
);
...
...
@@ -182,11 +229,29 @@ Page({
case
"_evt_submit_store_complete"
:
// 刷新状态
this
.
hideMask
();
wx
.
showModal
({
content
:
'预约成功'
,
showCancel
:
false
,
success
(
res
)
{}
});
app
.
post
({
url
:
app
.
api
.
wishbillGiftQuery
,
data
:
{
instanceCode
:
curData
.
instanceCode
}
}).
then
((
result
)
=>
{
// 重新拉取数据
let
giftData
=
result
;
let
wishInfo
=
giftData
.
order
;
let
couponInfo
=
wishInfo
.
coupon
;
this
.
setData
({
wishInfo
:
wishInfo
,
couponInfo
:
couponInfo
})
this
.
initData
();
wx
.
showModal
({
content
:
'预约成功'
,
showCancel
:
false
,
success
(
res
)
{}
});
})
break
;
default
:
...
...
src/pages/my-card/my-card.js
View file @
9e02268
...
...
@@ -31,6 +31,7 @@ Page({
onShowDetailHandler
(
evt
)
{
let
curData
=
getBindtapData
(
evt
);
app
.
globalData
.
curCoupon
=
curData
;
// app.globalData.giftData = curData;
app
.
router
.
push
({
path
:
"couponDetail"
})
...
...
Please
register
or
sign in
to post a comment