// logs.unshift(Date.now()) | // logs.unshift(Date.now()) | ||||
// wx.setStorageSync('logs', logs) | // wx.setStorageSync('logs', logs) | ||||
var openid = wx.getStorageSync('openid') || ""; | var openid = wx.getStorageSync('openid') || ""; | ||||
wx.setStorageSync('state',-1); | |||||
wx.setStorageSync('state', -1); | |||||
// 登录 | // 登录 | ||||
if (!openid){ | if (!openid){ | ||||
wx.login({ | wx.login({ | ||||
console.log(e) | console.log(e) | ||||
if(e.code==201){//未注册跳到注册页面 | if(e.code==201){//未注册跳到注册页面 | ||||
wx.setStorageSync('state', 0); | wx.setStorageSync('state', 0); | ||||
wx.setStorageSync("noUser", 0) | |||||
} else if (e.code == 202) {//已注册 | } else if (e.code == 202) {//已注册 | ||||
wx.setStorageSync('state', 1); | wx.setStorageSync('state', 1); | ||||
this.globalData.userInfo = e.data; | this.globalData.userInfo = e.data; | ||||
e.data.avatarUrl = e.data.headimgurl; | |||||
e.data.nickName = e.data.nickname; | |||||
wx.setStorageSync('user_phone', e.data.user_phone); | |||||
wx.setStorageSync("userInfo", e.data) | |||||
if (e.data.item_state == 1) { | |||||
wx.setStorageSync("noUser", 0) | |||||
} else { | |||||
wx.setStorageSync("noUser", 1) | |||||
} | |||||
} | } | ||||
if(this.globalData.userInfoBackFn){ | if(this.globalData.userInfoBackFn){ | ||||
this.globalData.userInfoBackFn(wx.getStorageSync('state')); | this.globalData.userInfoBackFn(wx.getStorageSync('state')); | ||||
} | } | ||||
},this) | },this) | ||||
}, | }, | ||||
globalData: { | globalData: { | ||||
openidSuccessFuc: null,//方法回调 | openidSuccessFuc: null,//方法回调 | ||||
userInfoSuccessFuc: null,//方法回调 | userInfoSuccessFuc: null,//方法回调 |
"text": "个人中心" | "text": "个人中心" | ||||
} | } | ||||
] | ] | ||||
}, | |||||
"permission": { | |||||
"scope.userLocation": { | |||||
"desc": "你的位置信息将用于小程序位置接口的效果展示" | |||||
} | |||||
} | } | ||||
} | } |
app.globalData.openidSuccessFuc = this.getTicketUser; | app.globalData.openidSuccessFuc = this.getTicketUser; | ||||
app.globalData.openidSuccessFuc = this.getCodeFn; | app.globalData.openidSuccessFuc = this.getCodeFn; | ||||
} | } | ||||
if (state == 1) {//已注册 | |||||
} else if (state == 0) {//未注册 | |||||
wx.navigateTo({ | |||||
url: '/pages/register/register', | |||||
}) | |||||
} else if (state == -1) { | |||||
app.globalData.userInfoBackFn = res => {//等待结果 | |||||
console.log(res) | |||||
if (res) { | |||||
} else { | |||||
wx.navigateTo({ | |||||
url: '/pages/register/register', | |||||
}) | |||||
} | |||||
} | |||||
} | |||||
}, | }, | ||||
getTicketUser: function () {//获取优惠券信息 | getTicketUser: function () {//获取优惠券信息 | ||||
app.wxRequest(app.globalData.httpUrl + 'couponsell/detail', { coupon_sell_id: this.data.id, from: 1}, e => { | app.wxRequest(app.globalData.httpUrl + 'couponsell/detail', { coupon_sell_id: this.data.id, from: 1}, e => { | ||||
onShareAppMessage: function () { | onShareAppMessage: function () { | ||||
return { | return { | ||||
title: "老门框爆肚会员", | title: "老门框爆肚会员", | ||||
path: "/pages/register/register", | |||||
success: res => { | success: res => { | ||||
console.log(res, "转发成功") | console.log(res, "转发成功") | ||||
}, | }, |
</view> | </view> | ||||
<view class="buyNum"> | <view class="buyNum"> | ||||
<view class="circleLeft"></view> | <view class="circleLeft"></view> | ||||
<view class="ticketName">{{ticketUser.coupon_type}}</view> | |||||
<view class="ticketName">{{ticketUser.coupon_name}}{{ticketUser.type_name}}</view> | |||||
<view class="line"></view> | <view class="line"></view> | ||||
<view class="lineRig"> | <view class="lineRig"> | ||||
<text class="bigWord">{{ticketUser.num}}</text> | <text class="bigWord">{{ticketUser.num}}</text> |
} else { | } else { | ||||
app.globalData.openidSuccessFuc = this.getTicketUser; | app.globalData.openidSuccessFuc = this.getTicketUser; | ||||
} | } | ||||
}, | }, | ||||
getTicketUser:function(){//获取优惠券信息 | getTicketUser:function(){//获取优惠券信息 | ||||
onShareAppMessage: function () { | onShareAppMessage: function () { | ||||
return { | return { | ||||
title: "老门框爆肚会员", | title: "老门框爆肚会员", | ||||
path: "/pages/register/register", | |||||
success: res => { | success: res => { | ||||
console.log(res, "转发成功") | console.log(res, "转发成功") | ||||
}, | }, | ||||
wx.showToast({ | wx.showToast({ | ||||
title: e.message, | title: e.message, | ||||
icon:"none", | icon:"none", | ||||
duration:500 | |||||
duration:2000 | |||||
}) | }) | ||||
} | } | ||||
}, this,"POST") | }, this,"POST") | ||||
app.wxRequest(app.globalData.httpUrl + 'order/paid', { sign_num: this.data.sign_num}, e => { | app.wxRequest(app.globalData.httpUrl + 'order/paid', { sign_num: this.data.sign_num}, e => { | ||||
console.log(e) | console.log(e) | ||||
if (e.code == 200) { | if (e.code == 200) { | ||||
wx.reLaunch({ | |||||
wx.switchTab({ | |||||
url: '/pages/personalCenter/personalCenter' | url: '/pages/personalCenter/personalCenter' | ||||
}) | }) | ||||
} | } |
</view> | </view> | ||||
<view class="buyNum"> | <view class="buyNum"> | ||||
<view class="circleLeft"></view> | <view class="circleLeft"></view> | ||||
<view class="ticketName">{{ticketUser.coupon_type}}</view> | |||||
<view class="ticketName">{{ticketUser.coupon_name}}{{ticketUser.type_name}}</view> | |||||
<view class="line"></view> | <view class="line"></view> | ||||
<view class="chooseNum"> | <view class="chooseNum"> | ||||
<view bindtap="subtractFn" class="subtractView"> | <view bindtap="subtractFn" class="subtractView"> |
background: #ffffff; | background: #ffffff; | ||||
} | } | ||||
.ticketName{ | .ticketName{ | ||||
font-size:36rpx; | |||||
font-size:30rpx; | |||||
font-family:SourceHanSansCN; | font-family:SourceHanSansCN; | ||||
font-weight:bold; | font-weight:bold; | ||||
color:rgba(51,51,51,1); | color:rgba(51,51,51,1); |
} else { | } else { | ||||
app.globalData.openidSuccessFuc = this.getTicketUser; | app.globalData.openidSuccessFuc = this.getTicketUser; | ||||
} | } | ||||
}, | }, | ||||
getTicketUser: function () {//获取优惠券信息 | getTicketUser: function () {//获取优惠券信息 | ||||
app.wxRequest(app.globalData.httpUrl + 'couponsell/detail', { coupon_sell_id: this.data.sellId, from: 2 }, e => { | app.wxRequest(app.globalData.httpUrl + 'couponsell/detail', { coupon_sell_id: this.data.sellId, from: 2 }, e => { | ||||
var shareImg = "";//分享图 | var shareImg = "";//分享图 | ||||
if (options.from === "button"){ | if (options.from === "button"){ | ||||
shareUrl = '/pages/receiveTicket/receiveTicket?shareId=' + this.data.shareId + "&number=" + this.data.buyNumber | shareUrl = '/pages/receiveTicket/receiveTicket?shareId=' + this.data.shareId + "&number=" + this.data.buyNumber | ||||
titleWord = "赠送给好友" | |||||
shareImg = this.data.ticketUser.coupon_img_small; | |||||
titleWord = "您的好友分享给您一张老门框爆肚涮肉的代金券,请您查收" | |||||
shareImg = "../images/shareImg.png"; | |||||
}else{ | }else{ | ||||
shareUrl = "/pages/register/register"; | |||||
shareUrl = ""; | |||||
titleWord = "老门框爆肚会员" | titleWord = "老门框爆肚会员" | ||||
shareImg = ""; | shareImg = ""; | ||||
} | } |
</view> | </view> | ||||
<view class="buyNum"> | <view class="buyNum"> | ||||
<view class="circleLeft"></view> | <view class="circleLeft"></view> | ||||
<view class="ticketName">{{ticketUser.coupon_type}}</view> | |||||
<view class="ticketName">{{ticketUser.coupon_name}}{{ticketUser.type_name}}</view> | |||||
<view class="line"></view> | <view class="line"></view> | ||||
<view class="lineRig"> | <view class="lineRig"> | ||||
<text class="surplus">剩余</text> | <text class="surplus">剩余</text> |
}else{ | }else{ | ||||
app.globalData.openidSuccessFuc = this.getDataList; | app.globalData.openidSuccessFuc = this.getDataList; | ||||
} | } | ||||
}, | }, | ||||
getDataList:function(){ | getDataList:function(){ | ||||
app.wxRequest(app.globalData.httpUrl + 'couponsell/list', {}, e => { | app.wxRequest(app.globalData.httpUrl + 'couponsell/list', {}, e => { | ||||
onShareAppMessage: function () { | onShareAppMessage: function () { | ||||
return { | return { | ||||
title: "老门框爆肚会员", | title: "老门框爆肚会员", | ||||
path: "/pages/register/register", | |||||
success: res => { | success: res => { | ||||
console.log(res, "转发成功") | console.log(res, "转发成功") | ||||
}, | }, |
display: block; | display: block; | ||||
} | } | ||||
.nameText{ | .nameText{ | ||||
font-size:60rpx; | |||||
font-size:50rpx; | |||||
font-family:DINPro; | font-family:DINPro; | ||||
font-weight:bold; | font-weight:bold; | ||||
color:rgba(106,10,14,1); | color:rgba(106,10,14,1); |
* 页面的初始数据 | * 页面的初始数据 | ||||
*/ | */ | ||||
data: { | data: { | ||||
myTicketArrows: false, | |||||
myTicketArrows: true, | |||||
historyTicketArrows: false, | historyTicketArrows: false, | ||||
getUser:false, | getUser:false, | ||||
getUserArr: [],//用户信息 | getUserArr: [],//用户信息 | ||||
userChuan:[], | userChuan:[], | ||||
userPhone:"",//用户手机号 | userPhone:"",//用户手机号 | ||||
mydeg: -90, | |||||
mydeg: 0, | |||||
historydeg: -90, | historydeg: -90, | ||||
pageNum:1, | pageNum:1, | ||||
pageCount:5, | pageCount:5, | ||||
myTicketArr: [],//我的优惠券列表 | myTicketArr: [],//我的优惠券列表 | ||||
headerImg:"../images/headerImg.png",//默认头像 | headerImg:"../images/headerImg.png",//默认头像 | ||||
userName:"",//昵称 | userName:"",//昵称 | ||||
noUser:false, | |||||
topNum:0, | |||||
}, | }, | ||||
/** | /** | ||||
onLoad: function (options) { | onLoad: function (options) { | ||||
}, | }, | ||||
getToRsgisterFn:function(){//未注册点击跳到注册页 | getToRsgisterFn:function(){//未注册点击跳到注册页 | ||||
wx.navigateTo({ | wx.navigateTo({ | ||||
historyArr: this.data.getHistoryArr, | historyArr: this.data.getHistoryArr, | ||||
}) | }) | ||||
} | } | ||||
console.log(this.data.getHistoryArr) | |||||
}, this) | }, this) | ||||
}, | }, | ||||
lower:function(){//检测上拉是否到底 | lower:function(){//检测上拉是否到底 | ||||
* 生命周期函数--监听页面显示 | * 生命周期函数--监听页面显示 | ||||
*/ | */ | ||||
onShow: function () { | onShow: function () { | ||||
this.setData({ | |||||
topNum:0 | |||||
}) | |||||
this.data.pageNum = 1; | |||||
this.data.getHistoryArr = []; | |||||
if (app.globalData.openId) { | |||||
this.myTicket(); | |||||
this.historyTicket(); | |||||
} else { | |||||
app.globalData.openidSuccessFuc = this.myTicket; | |||||
app.globalData.openidSuccessFuc = this.historyTicket; | |||||
} | |||||
if (!this.data.getUser) { | if (!this.data.getUser) { | ||||
var state = wx.getStorageSync('state'); | var state = wx.getStorageSync('state'); | ||||
if (state == 1) {//已注册 | if (state == 1) {//已注册 | ||||
var userInfo = wx.getStorageSync('userInfo'); | var userInfo = wx.getStorageSync('userInfo'); | ||||
var state = wx.getStorageSync('state'); | |||||
if (app.globalData.openId) { | |||||
this.myTicket(); | |||||
this.historyTicket(); | |||||
} else { | |||||
app.globalData.openidSuccessFuc = this.myTicket; | |||||
app.globalData.openidSuccessFuc = this.historyTicket; | |||||
} | |||||
console.log(app.globalData.userInfo) | |||||
var userInfo = wx.getStorageSync('userInfo'); | |||||
var phone = wx.getStorageSync('user_phone'); | var phone = wx.getStorageSync('user_phone'); | ||||
this.setData({ | |||||
headerImg: userInfo.avatarUrl, | |||||
userName: userInfo.nickName, | |||||
userPhone: phone, | |||||
getUser: true | |||||
}) | |||||
if (!userInfo.avatarUrl){ | |||||
this.setData({ | |||||
headerImg: "../images/headerImg.png", | |||||
userName: userInfo.nickName, | |||||
userPhone: phone, | |||||
getUser: true | |||||
}) | |||||
}else{ | |||||
this.setData({ | |||||
headerImg: userInfo.avatarUrl, | |||||
userName: userInfo.nickName, | |||||
userPhone: phone, | |||||
getUser: true | |||||
}) | |||||
} | |||||
console.log(wx.getStorageSync('noUser')) | |||||
if (wx.getStorageSync('noUser')==0) { | |||||
this.setData({ | |||||
noUser: true | |||||
}) | |||||
} else if (wx.getStorageSync('noUser') == 1) { | |||||
this.setData({ | |||||
noUser: false | |||||
}) | |||||
} | |||||
} else if (state == 0) {//未注册 | } else if (state == 0) {//未注册 | ||||
console.log(app.globalData.noUser) | |||||
this.setData({ | this.setData({ | ||||
getUser: false | |||||
getUser: false, | |||||
noUser: false | |||||
}) | }) | ||||
} else if (state == -1) { | } else if (state == -1) { | ||||
app.globalData.userInfoBackFn = res => {//等待结果 | app.globalData.userInfoBackFn = res => {//等待结果 | ||||
console.log(res) | console.log(res) | ||||
if (res) { | if (res) { | ||||
if (app.globalData.openId) { | |||||
this.myTicket(); | |||||
this.historyTicket(); | |||||
} else { | |||||
app.globalData.openidSuccessFuc = this.myTicket; | |||||
app.globalData.openidSuccessFuc = this.historyTicket; | |||||
} | |||||
var userInfo = wx.getStorageSync('userInfo'); | var userInfo = wx.getStorageSync('userInfo'); | ||||
var phone = wx.getStorageSync('user_phone'); | var phone = wx.getStorageSync('user_phone'); | ||||
this.setData({ | |||||
headerImg: userInfo.avatarUrl, | |||||
userName: userInfo.nickName, | |||||
userPhone: phone, | |||||
getUser: true | |||||
}) | |||||
if (!userInfo.avatarUrl) { | |||||
this.setData({ | |||||
headerImg: "../images/headerImg.png", | |||||
userName: userInfo.nickName, | |||||
userPhone: phone, | |||||
getUser: true | |||||
}) | |||||
} else { | |||||
this.setData({ | |||||
headerImg: userInfo.avatarUrl, | |||||
userName: userInfo.nickName, | |||||
userPhone: phone, | |||||
getUser: true | |||||
}) | |||||
} | |||||
if (wx.getStorageSync('noUser') == 0) { | |||||
this.setData({ | |||||
noUser: true | |||||
}) | |||||
} else if (wx.getStorageSync('noUser') == 1) { | |||||
this.setData({ | |||||
noUser: false | |||||
}) | |||||
} | |||||
} else { | } else { | ||||
this.setData({ | this.setData({ | ||||
getUser: false | |||||
getUser: false, | |||||
noUser: false | |||||
}) | }) | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
}, | }, | ||||
/** | /** | ||||
onShareAppMessage: function () { | onShareAppMessage: function () { | ||||
return { | return { | ||||
title: "老门框爆肚会员", | title: "老门框爆肚会员", | ||||
path: "/pages/register/register", | |||||
success: res => { | success: res => { | ||||
console.log(res, "转发成功") | console.log(res, "转发成功") | ||||
}, | }, | ||||
url: '../givePage/givePage?id=' + id, | url: '../givePage/givePage?id=' + id, | ||||
}) | }) | ||||
}, | }, | ||||
// getUser:function(e){//点击登陆获取用户信息 | |||||
// console.log(e) | |||||
// wx.setStorageSync('userInfo', e.detail.userInfo); | |||||
// var phone = wx.getStorageSync('user_phone'); | |||||
// var userArr = []; | |||||
// userArr.push(e.detail.userInfo.avatarUrl); | |||||
// userArr.push(e.detail.userInfo.nickName); | |||||
// // phone = app.globalData.user_phone | |||||
// console.log(phone) | |||||
// this.data.userChuan = e.detail.userInfo; | |||||
// this.setData({ | |||||
// headerImg: userArr, | |||||
// getUser: true, | |||||
// userPhone: phone | |||||
// }) | |||||
// this.submitUser(); | |||||
// console.log(this.data.getUserArr) | |||||
// }, | |||||
getUser:function(e){//点击登陆获取用户信息 | |||||
console.log(e) | |||||
if (e.detail.userInfo) { | |||||
this.data.userChuan = e.detail.userInfo; | |||||
wx.setStorageSync('noUser', 1); | |||||
wx.setStorageSync("userInfo", e.detail.userInfo) | |||||
this.setData({ | |||||
headerImg: e.detail.userInfo.avatarUrl, | |||||
userName: e.detail.userInfo.nickName, | |||||
getUser: true, | |||||
noUser: false | |||||
}) | |||||
this.submitUser(); | |||||
} | |||||
}, | |||||
submitUser: function () {//提交用户信息 | |||||
if (this.data.userChuan) { | |||||
var params = { | |||||
"province": this.data.userChuan.province, | |||||
"language": this.data.userChuan.language, | |||||
"city": this.data.userChuan.city, | |||||
"gender": this.data.userChuan.gender, | |||||
"nickname": this.data.userChuan.nickName, | |||||
"headimgurl": this.data.userChuan.avatarUrl, | |||||
} | |||||
app.wxRequest(app.globalData.httpUrl + 'submit', params, e => { | |||||
console.log(e) | |||||
if (e.code == 200) { | |||||
} | |||||
}, this, "POST") | |||||
} | |||||
}, | |||||
}) | }) |
<view class="userMess"> | <view class="userMess"> | ||||
<image class="userCircle" src="../images/userCircle.png"></image> | <image class="userCircle" src="../images/userCircle.png"></image> | ||||
<view class="userAll"> | <view class="userAll"> | ||||
<view class="userHeader"> | |||||
<view wx:if="{{!noUser}}" class="userHeader" bindtap="getToRsgisterFn"> | |||||
<image class="userImg" src="{{headerImg}}"></image> | <image class="userImg" src="{{headerImg}}"></image> | ||||
</view> | </view> | ||||
<!-- <button wx:if="{{!getUser}}" plain="true" size="mini" class="getUser" open-type="getUserInfo" bindgetuserinfo="getUser">登陆</button> --> | |||||
<image wx:if="{{!getUser}}" bindtap="getToRsgisterFn" class="getToRsgister" src="../images/getToRsgister.png"></image> | |||||
<button wx:if="{{noUser}}" class="userHeaderBtn" open-type="getUserInfo" bindgetuserinfo="getUser"> | |||||
<image class="userImg" src="{{headerImg}}"></image> | |||||
</button> | |||||
<button wx:if="{{noUser}}" class="noUserBtn" open-type="getUserInfo" bindgetuserinfo="getUser"> | |||||
<image class="getHeader" src="../images/getHeader.png"></image> | |||||
</button> | |||||
<image wx:if="{{!getUser}}" bindtap="getToRsgisterFn" class="getToRsgister" src="../images/getHeader.png"></image> | |||||
<view wx:if="{{getUser}}" class="userName">{{userName}}</view> | <view wx:if="{{getUser}}" class="userName">{{userName}}</view> | ||||
<view wx:if="{{getUser}}" class="userPhone">{{userPhone}}</view> | <view wx:if="{{getUser}}" class="userPhone">{{userPhone}}</view> | ||||
</view> | </view> | ||||
<image class="ticketArrows" src="../images/ticketArrows.png" style="transform:rotate({{historydeg}}deg)"></image> | <image class="ticketArrows" src="../images/ticketArrows.png" style="transform:rotate({{historydeg}}deg)"></image> | ||||
</view> | </view> | ||||
<scroll-view class="scrollY2" scroll-y="true" wx:if="{{historyTicketArrows}}" bindscrolltolower="lower"> | |||||
<scroll-view class="scrollY2" scroll-y="true" scroll-top='{{topNum}}' wx:if="{{historyTicketArrows}}" bindscrolltolower="lower"> | |||||
<view class="history" wx:for="{{historyArr}}"> | <view class="history" wx:for="{{historyArr}}"> | ||||
<view class="historyLeft"> | <view class="historyLeft"> | ||||
<!-- <image class="historyTicketBg" src="../images/historyTicketBg.png"></image> --> | <!-- <image class="historyTicketBg" src="../images/historyTicketBg.png"></image> --> | ||||
<view class="ticketCode">{{item.coupon_code}}</view> | <view class="ticketCode">{{item.coupon_code}}</view> | ||||
</view> | </view> | ||||
<view class="tickName">{{item.coupon_type}}</view> | |||||
<view class="tickName">{{item.coupon_name}}{{item.type_name}}</view> | |||||
<view class="tickType">已使用</view> | <view class="tickType">已使用</view> | ||||
</view> | </view> | ||||
</scroll-view> | </scroll-view> |
/* pages/personalCenter/personalCenter.wxss */ | /* pages/personalCenter/personalCenter.wxss */ | ||||
page{ | page{ | ||||
height: 100%; | height: 100%; | ||||
width: 100%; | |||||
} | } | ||||
.all{ | .all{ | ||||
height: 100%; | height: 100%; | ||||
overflow: hidden; | overflow: hidden; | ||||
border-radius: 50%; | border-radius: 50%; | ||||
} | } | ||||
.userHeaderBtn{ | |||||
width: 200rpx; | |||||
height: 200rpx; | |||||
overflow: hidden; | |||||
border-radius: 50%; | |||||
margin: 0; | |||||
padding: 0; | |||||
background-color: transparent; | |||||
} | |||||
.noUserBtn{ | |||||
margin-top: 20rpx; | |||||
width: 230rpx; | |||||
height: 64rpx; | |||||
border: none; | |||||
border-color: transparent; | |||||
border-radius: 0; | |||||
padding: 0; | |||||
background-color: transparent; | |||||
} | |||||
.noUserBtn::after{ | |||||
border: none | |||||
} | |||||
.userImg{ | .userImg{ | ||||
width: 200rpx; | width: 200rpx; | ||||
height: 200rpx; | height: 200rpx; | ||||
display: none; | display: none; | ||||
} | } | ||||
.tickName{ | .tickName{ | ||||
font-size:24rpx; | |||||
font-size:20rpx; | |||||
color:rgba(102,102,102,1); | color:rgba(102,102,102,1); | ||||
margin-left: 75rpx; | margin-left: 75rpx; | ||||
} | } | ||||
} | } | ||||
.getToRsgister{ | .getToRsgister{ | ||||
width: 318rpx; | |||||
height: 38rpx; | |||||
width: 230rpx; | |||||
height: 64rpx; | |||||
margin-top: 20rpx; | margin-top: 20rpx; | ||||
} | |||||
.getHeader{ | |||||
width: 230rpx; | |||||
height: 64rpx; | |||||
} | } |
onShareAppMessage: function () { | onShareAppMessage: function () { | ||||
return { | return { | ||||
title: "老门框爆肚会员", | title: "老门框爆肚会员", | ||||
path: "/pages/register/register", | |||||
success: res => { | success: res => { | ||||
console.log(res, "转发成功") | console.log(res, "转发成功") | ||||
}, | }, | ||||
this.data.moreClick = false; | this.data.moreClick = false; | ||||
wx.showToast({ | wx.showToast({ | ||||
title: e.message, | title: e.message, | ||||
duration: 500 | |||||
icon:"none", | |||||
duration: 1000 | |||||
}) | }) | ||||
} | } | ||||
}, this, "POST") | }, this, "POST") |
<text class="textNum">{{ticketNum}}</text> | <text class="textNum">{{ticketNum}}</text> | ||||
<text class="text">张</text> | <text class="text">张</text> | ||||
</view> | </view> | ||||
<view class="ticketType">{{ticketUser.coupon_type}}</view> | |||||
<view class="ticketType">{{ticketUser.coupon_name}}{{ticketUser.type_name}}</view> | |||||
<view class="line"></view> | <view class="line"></view> | ||||
</view> | </view> | ||||
<view class="contBot"> | <view class="contBot"> |
display: block; | display: block; | ||||
} | } | ||||
.nameText{ | .nameText{ | ||||
font-size:60rpx; | |||||
font-size:50rpx; | |||||
font-family:DINPro; | font-family:DINPro; | ||||
font-weight:bold; | font-weight:bold; | ||||
color:rgba(106,10,14,1); | color:rgba(106,10,14,1); |
onShareAppMessage: function () { | onShareAppMessage: function () { | ||||
return { | return { | ||||
title: "老门框爆肚会员", | title: "老门框爆肚会员", | ||||
path: "/pages/register/register", | |||||
success: res => { | success: res => { | ||||
console.log(res, "转发成功") | console.log(res, "转发成功") | ||||
}, | }, | ||||
console.log(this.data.minter) | console.log(this.data.minter) | ||||
}, | }, | ||||
submitUser: function () {//提交用户信息 | submitUser: function () {//提交用户信息 | ||||
if(this.data.userInfo && this.data.userInfo.province){ | |||||
if(this.data.userInfo){ | |||||
var params = { | var params = { | ||||
"province": this.data.userInfo.province, | "province": this.data.userInfo.province, | ||||
"language": this.data.userInfo.language, | "language": this.data.userInfo.language, | ||||
}, | }, | ||||
getUserFn:function(e){//点击按钮注册 | getUserFn:function(e){//点击按钮注册 | ||||
console.log(e) | console.log(e) | ||||
this.data.userInfo = e.detail.userInfo; | |||||
if(e.detail.userInfo){ | |||||
if (e.detail.userInfo) { | |||||
this.data.userInfo = e.detail.userInfo; | |||||
wx.setStorageSync('noUser', 1); | |||||
app.globalData.userInfo = e.detail.userInfo | app.globalData.userInfo = e.detail.userInfo | ||||
} else { | |||||
wx.setStorageSync('noUser', 0); | |||||
} | } | ||||
this.registerFn(); | this.registerFn(); | ||||
// if (app.globalData.openId) { | // if (app.globalData.openId) { | ||||
// } | // } | ||||
}, | }, | ||||
registerFn:function(){//注册接口 | registerFn:function(){//注册接口 | ||||
if (this.data.yesRegister){ | |||||
return; | |||||
} | |||||
if(this.data.phone){ | if(this.data.phone){ | ||||
if (!(/^1[3456789]\d{9}$/.test(this.data.phone))) { | if (!(/^1[3456789]\d{9}$/.test(this.data.phone))) { | ||||
wx.showToast({ | wx.showToast({ | ||||
}) | }) | ||||
return; | return; | ||||
} | } | ||||
if (this.data.yesRegister) { | |||||
return; | |||||
} | |||||
this.data.yesRegister = true; | |||||
app.wxRequest(app.globalData.httpUrl + 'register', { user_phone: this.data.phone, code_num: this.data.phoneCode }, e => { | app.wxRequest(app.globalData.httpUrl + 'register', { user_phone: this.data.phone, code_num: this.data.phoneCode }, e => { | ||||
console.log(e) | console.log(e) | ||||
this.data.yesRegister = true; | |||||
if (e.code == 200) { | if (e.code == 200) { | ||||
clearInterval(time); | clearInterval(time); | ||||
wx.setStorageSync('user_phone', e.data.user_phone); | wx.setStorageSync('user_phone', e.data.user_phone); |
dataArr: [],//搜索的数据列表 | dataArr: [],//搜索的数据列表 | ||||
getDataArr:[],//每次下拉获取的数据 | getDataArr:[],//每次下拉获取的数据 | ||||
topNum:0,//滚动条位置 | topNum:0,//滚动条位置 | ||||
latitude: 0, | |||||
longitude: 0, | |||||
}, | }, | ||||
bindchange:function(e){ | bindchange:function(e){ | ||||
this.data.pageNum = 1; | this.data.pageNum = 1; | ||||
provinceIndex: value, | provinceIndex: value, | ||||
cityIndex:0, | cityIndex:0, | ||||
}) | }) | ||||
console.log(this.data.changeCity) | |||||
}else{ | }else{ | ||||
this.setData({ | this.setData({ | ||||
index: value, | index: value, | ||||
*/ | */ | ||||
onLoad: function (options) { | onLoad: function (options) { | ||||
console.log(options) | console.log(options) | ||||
this.data.latitude = wx.getStorageSync('latitude'); | |||||
this.data.longitude = wx.getStorageSync('longitude'); | |||||
if (app.globalData.openId) { | if (app.globalData.openId) { | ||||
this.getShopList(); | this.getShopList(); | ||||
} else { | } else { | ||||
app.globalData.openidSuccessFuc = this.getShopList; | app.globalData.openidSuccessFuc = this.getShopList; | ||||
// app.globalData.openidSuccessFuc = this.searchShop; | // app.globalData.openidSuccessFuc = this.searchShop; | ||||
} | } | ||||
if (!wx.getStorageSync('latitude')) { | |||||
this.getNowAddress(); | |||||
} | |||||
var hig = wx.getSystemInfoSync().windowHeight; | var hig = wx.getSystemInfoSync().windowHeight; | ||||
this.setData({ | this.setData({ | ||||
scrollHig: hig-70 | scrollHig: hig-70 | ||||
}) | }) | ||||
this.searchShop(); | this.searchShop(); | ||||
// console.log(this.data.provinceArr) | |||||
// console.log(this.data.cityArr) | |||||
// console.log(this.data.provinceCityArr) | |||||
} | } | ||||
}, this) | }, this) | ||||
}, | }, | ||||
} | } | ||||
province = this.data.provinceCityArr[0][this.data.provinceIndex]; | province = this.data.provinceCityArr[0][this.data.provinceIndex]; | ||||
city = this.data.provinceCityArr[1][this.data.cityIndex]; | city = this.data.provinceCityArr[1][this.data.cityIndex]; | ||||
var locationIndex; | |||||
if (this.data.longitude){ | |||||
locationIndex = 2 | |||||
}else{ | |||||
locationIndex = 1 | |||||
} | |||||
var params = { | var params = { | ||||
"shop_province": province, | "shop_province": province, | ||||
"shop_city": city, | "shop_city": city, | ||||
"key": this.data.inputVal, | "key": this.data.inputVal, | ||||
"cur_page": this.data.pageNum, | "cur_page": this.data.pageNum, | ||||
"show_num":this.data.count, | "show_num":this.data.count, | ||||
"location": locationIndex, | |||||
"lng": this.data.longitude, | |||||
"lat": this.data.latitude, | |||||
} | } | ||||
app.wxRequest(app.globalData.httpUrl + 'shop/search', params, e => { | |||||
app.wxRequest(app.globalData.httpUrl + 'shop/shopsearch', params, e => { | |||||
console.log(e) | console.log(e) | ||||
if (e.code == 200) { | if (e.code == 200) { | ||||
for (var i = 0; i < e.data.length;i++){ | for (var i = 0; i < e.data.length;i++){ | ||||
onShareAppMessage: function () { | onShareAppMessage: function () { | ||||
return { | return { | ||||
title: "老门框爆肚会员", | title: "老门框爆肚会员", | ||||
path: "/pages/register/register", | |||||
success: res => { | success: res => { | ||||
console.log(res, "转发成功") | console.log(res, "转发成功") | ||||
}, | }, | ||||
this.setData({ | this.setData({ | ||||
inputVal:"" | inputVal:"" | ||||
}) | }) | ||||
// this.data.provinceCityArr[0][this.data.provinceIndex] = ""; | |||||
// this.data.provinceCityArr[1][this.data.cityIndex] = ""; | |||||
this.data.pageNum = 1; | this.data.pageNum = 1; | ||||
this.data.dataArr = []; | this.data.dataArr = []; | ||||
this.searchShop(); | this.searchShop(); | ||||
scale: 18, | scale: 18, | ||||
name: addressName | name: addressName | ||||
}) | }) | ||||
} | |||||
}, | |||||
getNowAddress: function () {//获取当前城市经纬度 | |||||
wx.getLocation({ | |||||
type: 'wgs84', | |||||
success: res => { | |||||
console.log(res) | |||||
wx.setStorageSync('latitude', res.latitude); | |||||
wx.setStorageSync('longitude', res.longitude); | |||||
this.data.latitude = wx.getStorageSync('latitude'); | |||||
this.data.longitude = wx.getStorageSync('longitude'); | |||||
this.data.dataArr=[]; | |||||
if (this.data.provinceCityArr[0] && this.data.provinceCityArr[1]){ | |||||
this.searchShop(); | |||||
} | |||||
} | |||||
}) | |||||
}, | |||||
}) | }) |