@@ -5,7 +5,6 @@ App({ | |||
data: {}, | |||
onLaunch: function (options) { | |||
var that = this; | |||
console.log("onLuanch") | |||
that.globalData.sceneAddress = options.scene; | |||
/** | |||
* 用户登录 | |||
@@ -99,21 +98,6 @@ App({ | |||
} | |||
}) | |||
}, | |||
/** | |||
* 获取地址位置信息 | |||
*/ | |||
getLocation: function () { | |||
var that = this; | |||
wx.getLocation({ | |||
type: "wgs84", | |||
success: function (res) { | |||
that.globalData.locationInfo = res; | |||
}, | |||
fail: error => { | |||
console.log(error); | |||
} | |||
}); | |||
}, | |||
globalData: { | |||
// token | |||
token: null, | |||
@@ -134,7 +118,7 @@ App({ | |||
carLogin: false, | |||
// 当前商场信息 | |||
market: { | |||
name: "陕西大悦城" | |||
name: "" | |||
}, | |||
// websocket | |||
socketClient: null, | |||
@@ -281,7 +281,11 @@ var config = { | |||
/** | |||
* 会员积分记录 | |||
*/ | |||
integralList:'/credit/list' | |||
integralList:'/credit/list', | |||
/** | |||
* 用户更新位置信息 | |||
*/ | |||
updateLBS:"/user/updateLBS" | |||
}, | |||
weapp: { | |||
AppId: weappId | |||
@@ -45,7 +45,6 @@ | |||
.merchant-detail { | |||
width: 100%; | |||
padding: 30rpx 0 0; | |||
background: #fff; | |||
border-top-left-radius: 20rpx; | |||
border-top-right-radius: 20rpx; | |||
@@ -145,23 +145,23 @@ Page({ | |||
appId: config.weapp.AppId, | |||
} | |||
}) | |||
.then(res => { | |||
let weapNote = JSON.parse(res.data.weapNote); | |||
that.setData({ | |||
desc: weapNote.carpage.desc, | |||
title: weapNote.carpage.title | |||
}) | |||
}) | |||
.catch(err => { | |||
console.log(err); | |||
.then(res => { | |||
let weapNote = JSON.parse(res.data.weapNote); | |||
that.setData({ | |||
desc: weapNote.carpage.desc, | |||
title: weapNote.carpage.title | |||
}) | |||
}) | |||
.catch(err => { | |||
console.log(err); | |||
}) | |||
// 登录 | |||
var scene = decodeURIComponent(options.scene); | |||
that.setData({ | |||
scene: scene | |||
}); | |||
if (app.globalData.token) { } else { | |||
app.getLocation(); | |||
// app.getLocation(); | |||
that.userLogin() | |||
} | |||
}, | |||
@@ -19,7 +19,11 @@ | |||
<text style='display:inline-block;'>{{item.discount/10}}</text>折</view> | |||
<text class='tit'>{{item.merchantName}}</text> | |||
<view class='clearfix footer'> | |||
<text class='fl'>{{item.buildingName}}{{item.floorName}}</text> | |||
<view class='fl' style='margin-top:-30rpx;margin-left:10rpx;'> | |||
<view class='building' wx:for="{{item.shopVoList}}" wx:key="{{index}}" wx:for-item="list"> | |||
{{list.buildingName}}{{list.floorName}} | |||
</view> | |||
</view> | |||
<view class='fr' bindtap='phone' data-merchantLinkPhone='{{item.merchantLinkPhone}}'> | |||
<image class="fr" src='{{teliconUrl}}' mode='widthFix'></image> | |||
</view> | |||
@@ -1,125 +1,151 @@ | |||
@import "../../app.wxss"; | |||
Page{ | |||
Page { | |||
background: #fc5b24; | |||
} | |||
.none{ | |||
.none { | |||
font-size: 28rpx; | |||
text-align: center; | |||
margin-top: 30rpx; | |||
color: #fff; | |||
float:none!important; | |||
color: #fff; | |||
float: none !important; | |||
} | |||
.headerbg image{ | |||
.headerbg image { | |||
display: block; | |||
width: 100%; | |||
} | |||
.fl{ | |||
.fl { | |||
float: left; | |||
} | |||
.fr{ | |||
.fr { | |||
float: right; | |||
} | |||
.title{ | |||
.title { | |||
padding: 20rpx 40rpx 30rpx; | |||
color: #fff; | |||
text-align: center; | |||
font-size:26rpx; | |||
font-size: 26rpx; | |||
} | |||
.card{ | |||
.card { | |||
position: relative; | |||
width: 335rpx; | |||
margin: 0 auto 18rpx; | |||
border-radius:16rpx; | |||
border-radius: 16rpx; | |||
overflow: hidden; | |||
padding-bottom: 20rpx; | |||
background: #fff; | |||
background: #fff; | |||
height: 185rpx; | |||
} | |||
.txt01 text{ | |||
.txt01 text { | |||
display: block; | |||
text-align: center; | |||
} | |||
.cards{ | |||
.cards { | |||
padding: 0 33rpx; | |||
} | |||
.cards>view:nth-of-type(2n){ | |||
.cards>view:nth-of-type(2n) { | |||
float: right; | |||
} | |||
.cards>view:nth-of-type(2n+1){ | |||
.cards>view:nth-of-type(2n+1) { | |||
float: left; | |||
} | |||
.tit{ | |||
font-size:36rpx; | |||
color:rgba(51,51,51,1); | |||
.tit { | |||
font-size: 36rpx; | |||
color: rgba(51, 51, 51, 1); | |||
margin: -40rpx auto 0; | |||
white-space: nowrap; | |||
text-overflow: ellipsis; | |||
overflow: hidden; | |||
width:280rpx; | |||
width: 280rpx; | |||
text-align: center; | |||
} | |||
.cardtype{ | |||
.cardtype { | |||
position: absolute; | |||
right: 28rpx; | |||
top: 20rpx; | |||
font-size: 24rpx; | |||
color:rgba(99,188,230,1); | |||
font-size: 24rpx; | |||
color: rgba(99, 188, 230, 1); | |||
} | |||
.footer{ | |||
.footer { | |||
margin-top: 26rpx; | |||
font-size:26rpx; | |||
font-weight:500; | |||
color:rgba(153,153,153,1); | |||
font-size: 26rpx; | |||
font-weight: 500; | |||
color: rgba(153, 153, 153, 1); | |||
} | |||
.footer text{ | |||
.footer text { | |||
text-indent: 33rpx; | |||
} | |||
.footer image{ | |||
.footer image { | |||
width: 24rpx; | |||
margin-right: 33rpx; | |||
} | |||
.triangle { | |||
width: 0px; | |||
height: 0px; | |||
border-color: transparent #DAB055; | |||
border-width: 0 0 110rpx 110rpx; | |||
border-style: solid; | |||
} | |||
.discount{ | |||
position: absolute; | |||
right: 0rpx; | |||
bottom: 20rpx; | |||
} | |||
.triangle { | |||
width: 0px; | |||
height: 0px; | |||
border-color: transparent #dab055; | |||
border-width: 0 0 110rpx 110rpx; | |||
border-style: solid; | |||
} | |||
.discount { | |||
position: absolute; | |||
color: #fff; | |||
width: 110rpx; | |||
height: 100rpx; | |||
font-size: 20rpx; | |||
left:13rpx; | |||
top:-11rpx; | |||
left: 13rpx; | |||
top: -11rpx; | |||
z-index: 10; | |||
transform:rotate(315deg); | |||
transform: rotate(315deg); | |||
} | |||
.discount text{ | |||
.discount text { | |||
font-size: 28rpx; | |||
} | |||
.level{ | |||
.level { | |||
color: yellow; | |||
} | |||
#mycanvas2{ | |||
#mycanvas2 { | |||
height: 300rpx; | |||
width: 300rpx; | |||
margin: 40rpx auto 20rpx; | |||
} | |||
.goback{ | |||
.goback { | |||
position: fixed; | |||
right: 50rpx; | |||
bottom: 60rpx; | |||
width:100rpx!important; | |||
height:100rpx; | |||
width: 100rpx !important; | |||
height: 100rpx; | |||
z-index: 100; | |||
background:rgba(255,255,255,1); | |||
background: rgba(255, 255, 255, 1); | |||
line-height: 95rpx; | |||
border:1rpx solid rgba(227,227,227,1); | |||
border-radius:50%; | |||
border: 1rpx solid rgba(227, 227, 227, 1); | |||
border-radius: 50%; | |||
} | |||
.goback image{ | |||
.goback image { | |||
position: absolute; | |||
width: 60rpx; | |||
left: 0; | |||
@@ -128,26 +154,33 @@ Page{ | |||
bottom: 0; | |||
margin: auto; | |||
} | |||
.code{ | |||
.code { | |||
width: 684rpx; | |||
background: #fff; | |||
margin: 0 auto; | |||
border-radius:10rpx; | |||
border-radius: 10rpx; | |||
padding: 20rpx 0 40rpx; | |||
} | |||
.code text{ | |||
.code text { | |||
color: #666; | |||
display: block; | |||
text-align: center; | |||
font-size: 28rpx; | |||
} | |||
#barcode{ | |||
#barcode { | |||
width: 600rpx; | |||
height: 150rpx; | |||
margin: 0 auto 10rpx; | |||
} | |||
.code image{ | |||
.code image { | |||
display: block; | |||
width: 500rpx; | |||
margin: 0 auto; | |||
} | |||
.building{ | |||
display: inline-block; | |||
} |
@@ -24,24 +24,24 @@ Page({ | |||
wmspellgroup: imgurl.wmspellgroup.url, | |||
canIUse: wx.canIUse('official-account'), | |||
flag: 'hidden', | |||
score:'0', | |||
name:"", | |||
birthdate:"", | |||
sex:"", | |||
showEdit:false, | |||
ismember:false, | |||
showQrcode:false, | |||
score: '0', | |||
name: "", | |||
birthdate: "", | |||
sex: "", | |||
showEdit: false, | |||
ismember: false, | |||
showQrcode: false, | |||
canvasHidden: false, | |||
maskHidden: true, | |||
imagePath: '', | |||
appVersion:"", | |||
appVersion: "", | |||
showmemberqrcode: false, | |||
placeholder: '' | |||
}, | |||
/** | |||
* 跳转到成长值的页面 | |||
*/ | |||
gotograde:function(){ | |||
gotograde: function() { | |||
wx.navigateTo({ | |||
url: '/pages/czdetail/czdetail', | |||
}) | |||
@@ -57,16 +57,45 @@ Page({ | |||
*/ | |||
let that = this; | |||
if (that.data.flag == 'hidden') { | |||
that.setData({ | |||
that.setData({ | |||
flag: 'show' | |||
}); | |||
} | |||
}, | |||
gotoedit:function(){ | |||
gotoedit: function() { | |||
wx.navigateTo({ | |||
url: '/pages/edit/edit', | |||
}) | |||
}, | |||
onLoad() { | |||
this.getLocation(); | |||
}, | |||
/** | |||
* 获得经纬度 | |||
*/ | |||
getLocation() { | |||
let that = this; | |||
wx.getLocation({ | |||
type: "wgs84", | |||
success: function(res) { | |||
console.log(res) | |||
if (res && res.longitude && res.latitude) { | |||
Http.post({ | |||
url: config.api.updateLBS, | |||
data: { | |||
latitude: res.latitude, | |||
longitude: res.longitude | |||
} | |||
}).then(res => { | |||
console.log(res) | |||
}) | |||
} | |||
}, | |||
fail: error => { | |||
console.log(error); | |||
} | |||
}) | |||
}, | |||
/** | |||
* 生命周期函数--监听页面显示 | |||
*/ | |||
@@ -79,7 +108,7 @@ Page({ | |||
* couponNum | |||
* couponNum2 | |||
*/ | |||
let num = wx.getStorageSync('couponNum'); | |||
let num = wx.getStorageSync('couponNum'); | |||
let num1 = wx.getStorageSync('couponNum2'); | |||
wx.hideTabBarRedDot({ | |||
index: 3 | |||
@@ -115,46 +144,48 @@ Page({ | |||
}; | |||
Http.get({ | |||
url: config.api.getScore, | |||
data: {} | |||
}).then(res=>{ | |||
if (res.data.address && res.data.name && res.data.sex && res.data.birthdate){ | |||
url: config.api.getScore, | |||
data: {} | |||
}).then(res => { | |||
if (res.data.address && res.data.name && res.data.sex && res.data.birthdate) { | |||
that.setData({ | |||
showEdit: true | |||
}) | |||
} | |||
that.setData({ | |||
showEdit:true | |||
score: res.data.score, | |||
levelName: res.data.levelName, | |||
}) | |||
} | |||
that.setData({ | |||
score: res.data.score, | |||
levelName: res.data.levelName, | |||
if (res.data.nickName) { | |||
that.setData({ | |||
ismember: true, | |||
memberId: res.data.id | |||
}) | |||
var size = this.setCanvasSize(); | |||
var initUrl = JSON.stringify({ | |||
flagid: res.data.id | |||
}); | |||
that.createQrCode(initUrl, "mycanvas1", size.w, size.h); | |||
} | |||
}) | |||
if (res.data.nickName){ | |||
that.setData({ | |||
ismember:true, | |||
memberId: res.data.id | |||
.catch(err => { | |||
wx.showModal({ | |||
title: '提示', | |||
content: err.errMsg, | |||
showCancel: false | |||
}) | |||
var size = this.setCanvasSize(); | |||
var initUrl = JSON.stringify({flagid:res.data.id}); | |||
that.createQrCode(initUrl, "mycanvas1", size.w, size.h); | |||
} | |||
}) | |||
.catch(err => { | |||
wx.showModal({ | |||
title: '提示', | |||
content: err.errMsg, | |||
showCancel:false | |||
}) | |||
}) | |||
//暂时注释 | |||
// that.getrun(); | |||
}, | |||
hideQrcode:function(){ | |||
hideQrcode: function() { | |||
let that = this; | |||
that.setData({ | |||
showQrcode: false | |||
}) | |||
}, | |||
//适配不同屏幕大小的canvas | |||
setCanvasSize: function () { | |||
setCanvasSize: function() { | |||
var size = {}; | |||
try { | |||
var res = wx.getSystemInfoSync(); | |||
@@ -171,26 +202,26 @@ Page({ | |||
} | |||
return size; | |||
}, | |||
createQrCode: function (url, canvasId, cavW, cavH) { | |||
createQrCode: function(url, canvasId, cavW, cavH) { | |||
//调用插件中的draw方法,绘制二维码图片 | |||
QR.api.draw(url, canvasId, cavW, cavH); | |||
}, | |||
qrcode: function (e) { | |||
qrcode: function(e) { | |||
var that = this; | |||
that.setData({ | |||
showQrcode:true | |||
showQrcode: true | |||
}) | |||
wx.showToast({ | |||
title: '生成中...', | |||
icon: 'loading', | |||
duration: 2000 | |||
}); | |||
var st = setTimeout(function () { | |||
var st = setTimeout(function() { | |||
wx.hideToast() | |||
var size = that.setCanvasSize(); | |||
var url = JSON.stringify({ | |||
END:"C", | |||
TYPE:"memberCode", | |||
END: "C", | |||
TYPE: "memberCode", | |||
ID: that.data.memberId, | |||
}) | |||
that.createQrCode(url, "mycanvas1", size.w, size.h); | |||
@@ -201,9 +232,9 @@ Page({ | |||
}, 1000) | |||
}, | |||
close: function () { | |||
close: function() { | |||
this.setData({ | |||
showmemberqrcode: false, | |||
}) | |||
} | |||
}); | |||
}); |