//app.js | |||||
App({ | |||||
onLaunch: function () { | |||||
// 展示本地存储能力 | |||||
var logs = wx.getStorageSync('logs') || [] | |||||
// logs.unshift(Date.now()) | |||||
wx.setStorageSync('logs', logs) | |||||
// 登录 | |||||
wx.login({ | |||||
success: res => { | |||||
// 发送 res.code 到后台换取 openId, sessionKey, unionId | |||||
console.log(res) | |||||
wx.request({ | |||||
url: '', | |||||
data: { | |||||
code: res.code | |||||
} | |||||
}) | |||||
} | |||||
}) | |||||
// 获取用户信息 | |||||
wx.getSetting({ | |||||
success: res => { | |||||
console.log(res) | |||||
if (res.authSetting['scope.userInfo']) { | |||||
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框 | |||||
wx.getUserInfo({ | |||||
success: res => { | |||||
// 可以将 res 发送给后台解码出 unionId | |||||
this.globalData.userInfo = res.userInfo | |||||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 | |||||
// 所以此处加入 callback 以防止这种情况 | |||||
if (this.userInfoReadyCallback) { | |||||
this.userInfoReadyCallback(res) | |||||
} | |||||
} | |||||
}) | |||||
}else{ | |||||
// wx.redirectTo({ | |||||
// url: '/pages/register/register' | |||||
// }) | |||||
} | |||||
} | |||||
}) | |||||
}, | |||||
globalData: { | |||||
userInfo: null | |||||
}, | |||||
request:function(url,data,type){//接口调用 | |||||
wx.request({ | |||||
url: url, | |||||
data: data, | |||||
type:type, | |||||
header: { | |||||
'content-type': 'application/json' // 默认值 | |||||
}, | |||||
success(res) { | |||||
console.log(res.data) | |||||
} | |||||
}) | |||||
} | |||||
}) |
{ | |||||
"pages":[ | |||||
"pages/index/index", | |||||
"pages/register/register", | |||||
"pages/shop/shop", | |||||
"pages/personalCenter/personalCenter", | |||||
"pages/buyTicket/buyTicket", | |||||
"pages/TicketDetails/TicketDetails", | |||||
"pages/givePage/givePage" | |||||
], | |||||
"window":{ | |||||
"backgroundTextStyle": "light", | |||||
"navigationBarBackgroundColor": "#fff", | |||||
"navigationBarTitleText": "老门框优惠券售卖系统", | |||||
"navigationBarTextStyle": "black" | |||||
}, | |||||
"style": "v2", | |||||
"sitemapLocation": "sitemap.json", | |||||
"tabBar":{ | |||||
"color": "#666666", | |||||
"selectedColor": "#eb6100", | |||||
"list":[ | |||||
{ | |||||
"iconPath": "/pages/images/tabbar1_1.png", | |||||
"selectedIconPath": "/pages/images/tabbar1_2.png", | |||||
"pagePath": "pages/index/index", | |||||
"text": "购券大厅" | |||||
}, | |||||
{ | |||||
"iconPath": "/pages/images/tabbar2_1.png", | |||||
"selectedIconPath": "/pages/images/tabbar2_2.png", | |||||
"pagePath": "pages/shop/shop", | |||||
"text": "门店查询" | |||||
}, | |||||
{ | |||||
"iconPath": "/pages/images/tabbar3_1.png", | |||||
"selectedIconPath": "/pages/images/tabbar3_2.png", | |||||
"pagePath": "pages/personalCenter/personalCenter", | |||||
"text": "个人中心" | |||||
} | |||||
] | |||||
} | |||||
} |
/**app.wxss**/ | |||||
.container { | |||||
height: 100%; | |||||
display: flex; | |||||
flex-direction: column; | |||||
align-items: center; | |||||
justify-content: space-between; | |||||
padding: 200rpx 0; | |||||
box-sizing: border-box; | |||||
} |
// pages/TicketDetails/TicketDetails.js | |||||
Page({ | |||||
/** | |||||
* 页面的初始数据 | |||||
*/ | |||||
data: { | |||||
dataArr: [ | |||||
{ | |||||
"code":"11111", | |||||
"name":"80元抵100元优惠券", | |||||
"type":"未使用" | |||||
}, | |||||
{ | |||||
"code": "11111", | |||||
"name": "80元抵100元优惠券", | |||||
"type": "未使用" | |||||
}, | |||||
{ | |||||
"code": "11111", | |||||
"name": "80元抵100元优惠券", | |||||
"type": "未使用" | |||||
}, | |||||
{ | |||||
"code": "11111", | |||||
"name": "80元抵100元优惠券", | |||||
"type": "未使用" | |||||
}, | |||||
], | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面加载 | |||||
*/ | |||||
onLoad: function (options) { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面初次渲染完成 | |||||
*/ | |||||
onReady: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面显示 | |||||
*/ | |||||
onShow: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面隐藏 | |||||
*/ | |||||
onHide: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面卸载 | |||||
*/ | |||||
onUnload: function () { | |||||
}, | |||||
/** | |||||
* 页面相关事件处理函数--监听用户下拉动作 | |||||
*/ | |||||
onPullDownRefresh: function () { | |||||
}, | |||||
/** | |||||
* 页面上拉触底事件的处理函数 | |||||
*/ | |||||
onReachBottom: function () { | |||||
}, | |||||
/** | |||||
* 用户点击右上角分享 | |||||
*/ | |||||
onShareAppMessage: function () { | |||||
} | |||||
}) |
{ | |||||
"usingComponents": {}, | |||||
"navigationBarTitleText": "优惠券详情" | |||||
} |
<!--pages/TicketDetails/TicketDetails.wxml--> | |||||
<view class="all"> | |||||
<view class="contTop"> | |||||
<view class="imgView"> | |||||
<image mode="aspectFill" class="ticketImg" src="../images/bigTicket.jpg"></image> | |||||
<image class="tooth" src="../images/tooth.png"></image> | |||||
</view> | |||||
<view class="buyNum"> | |||||
<view class="ticketName">80元抵100元优惠券</view> | |||||
<view class="line"></view> | |||||
<view class="lineRig"> | |||||
<text class="bigWord">50</text> | |||||
<text class="smaWord">张</text> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
<view> | |||||
<text class="title">使用说明</text> | |||||
<view> | |||||
<view class="timeLimit"> | |||||
<image src="../images/circle.png"></image> | |||||
<text>使用期限</text> | |||||
</view> | |||||
<view class="specify">购卖后30日内有效</view> | |||||
</view> | |||||
<view> | |||||
<view class="timeLimit"> | |||||
<image src="../images/circle.png"></image> | |||||
<text>使用条件</text> | |||||
</view> | |||||
<view class="specify">点单金额需商于优惠金额,每单限使用一张不可叠加使用,不与其他优惠同享</view> | |||||
</view> | |||||
<view> | |||||
<view class="timeLimit"> | |||||
<image src="../images/circle.png"></image> | |||||
<text>适用门店</text> | |||||
</view> | |||||
<view class="specify">老门框所有门店</view> | |||||
</view> | |||||
</view> | |||||
<scroll-view class="scrollY" scroll-y="true"> | |||||
<view class="history" wx:for="{{dataArr}}"> | |||||
<view class="historyLeft"> | |||||
<image class="historyTicketBg" src="../images/historyTicketBg.png"></image> | |||||
<view class="ticketCode">券码:{{item.code}}</view> | |||||
</view> | |||||
<view class="tickName">{{item.name}}</view> | |||||
<view class="tickType">{{item.type}}</view> | |||||
</view> | |||||
</scroll-view> | |||||
</view> |
/* pages/TicketDetails/TicketDetails.wxss */ | |||||
.ticketImg{ | |||||
width: 100%; | |||||
height: 472rpx; | |||||
} | |||||
.imgView{ | |||||
width: 100%; | |||||
height: 300rpx; | |||||
overflow: hidden; | |||||
border-radius:0px 0px 30rpx 30rpx; | |||||
position: relative | |||||
} | |||||
.tooth{ | |||||
display: block; | |||||
width: 694rpx; | |||||
height: 10rpx; | |||||
position: absolute; | |||||
left: 50%; | |||||
bottom: -4rpx; | |||||
transform: translateX(-50%); | |||||
} | |||||
.buyNum{ | |||||
width: 100%; | |||||
height: 190rpx; | |||||
display: flex; | |||||
justify-content: center; | |||||
align-items: center; | |||||
} | |||||
.line{ | |||||
margin-left: 94rpx; | |||||
margin-right: 46rpx; | |||||
width: 1rpx; | |||||
height: 126rpx; | |||||
background-color: rgba(204,204,204,1); | |||||
} | |||||
.bigWord{ | |||||
font-size:100rpx; | |||||
font-family:DINPro; | |||||
font-weight:bold; | |||||
color:rgba(235,97,0,1); | |||||
} | |||||
.smaWord{ | |||||
font-size:30rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight:bold; | |||||
color:rgba(51,51,51,1); | |||||
} | |||||
.title{ | |||||
display: inline-block; | |||||
width: 100%; | |||||
margin: 57rpx 0 7rpx 0; | |||||
text-align: center; | |||||
font-size:30rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight:bold; | |||||
color:rgba(51,51,51,1); | |||||
line-height:30rpx; | |||||
} | |||||
.timeLimit{ | |||||
height: 26rpx; | |||||
display: flex; | |||||
align-items: center; | |||||
margin-top: 23rpx; | |||||
margin-bottom: 15rpx; | |||||
} | |||||
.timeLimit image{ | |||||
width: 20rpx; | |||||
height: 20rpx; | |||||
margin-left: 32rpx; | |||||
margin-right: 16rpx; | |||||
} | |||||
.timeLimit text{ | |||||
font-size:26rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight:bold; | |||||
color:rgba(51,51,51,1); | |||||
line-height:30rpx; | |||||
} | |||||
.specify{ | |||||
font-size:22rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight:400; | |||||
color:rgba(102,102,102,1); | |||||
line-height:30rpx; | |||||
width: 613rpx; | |||||
margin-left: 69rpx; | |||||
} | |||||
.scrollY{ | |||||
height: 300rpx; | |||||
margin-top: 107rpx; | |||||
} | |||||
.historyIcon{ | |||||
width: 30rpx; | |||||
height: 30rpx; | |||||
} | |||||
.history{ | |||||
display: flex; | |||||
justify-content: space-between; | |||||
align-items: center; | |||||
margin-top: 20rpx; | |||||
padding: 0 50rpx; | |||||
} | |||||
.historyLeft{ | |||||
position: relative; | |||||
width: 179rpx; | |||||
height: 36rpx; | |||||
} | |||||
.ticketCode{ | |||||
width: 179rpx; | |||||
text-align: center; | |||||
font-size:20rpx; | |||||
font-family:DIN; | |||||
font-weight:500; | |||||
color:rgba(255,255,255,1); | |||||
position: absolute; | |||||
top: 50%; | |||||
transform: translateY(-50%); | |||||
} | |||||
.historyTicketBg{ | |||||
width: 179rpx; | |||||
height: 36rpx; | |||||
} | |||||
.tickName{ | |||||
font-size:24rpx; | |||||
color:rgba(102,102,102,1); | |||||
margin-left: 95rpx; | |||||
} | |||||
.tickType{ | |||||
font-size:24rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight:bold; | |||||
color:rgba(235,97,0,1); | |||||
} |
// pages/buyTicket/buyTicket.js | |||||
Page({ | |||||
/** | |||||
* 页面的初始数据 | |||||
*/ | |||||
data: { | |||||
buyNumber:1, | |||||
num : 1, | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面加载 | |||||
*/ | |||||
onLoad: function (options) { | |||||
console.log(options) | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面初次渲染完成 | |||||
*/ | |||||
onReady: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面显示 | |||||
*/ | |||||
onShow: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面隐藏 | |||||
*/ | |||||
onHide: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面卸载 | |||||
*/ | |||||
onUnload: function () { | |||||
}, | |||||
/** | |||||
* 页面相关事件处理函数--监听用户下拉动作 | |||||
*/ | |||||
onPullDownRefresh: function () { | |||||
}, | |||||
/** | |||||
* 页面上拉触底事件的处理函数 | |||||
*/ | |||||
onReachBottom: function () { | |||||
}, | |||||
/** | |||||
* 用户点击右上角分享 | |||||
*/ | |||||
onShareAppMessage: function () { | |||||
}, | |||||
addFn:function(){ | |||||
if (this.data.num<5){ | |||||
this.data.num++; | |||||
this.setData({ | |||||
buyNumber: this.data.num | |||||
}) | |||||
} | |||||
}, | |||||
subtractFn:function(){ | |||||
if (this.data.num > 1) { | |||||
this.data.num--; | |||||
this.setData({ | |||||
buyNumber: this.data.num | |||||
}) | |||||
} | |||||
}, | |||||
buySuccess:function(){ | |||||
wx.requestPayment({ | |||||
success:res=>{ | |||||
console.log(res) | |||||
// wx.switchTab({ | |||||
// url: '../index/index' | |||||
// }) | |||||
}, | |||||
}) | |||||
} | |||||
}) |
{ | |||||
"usingComponents": {}, | |||||
"navigationBarTitleText": "购买优惠券" | |||||
} |
<!--pages/buyTicket/buyTicket.wxml--> | |||||
<view class="all"> | |||||
<view class="contTop"> | |||||
<view class="imgView"> | |||||
<image mode="aspectFill" class="ticketImg" src="../images/bigTicket.jpg"></image> | |||||
<image class="tooth" src="../images/tooth.png"></image> | |||||
</view> | |||||
<view class="buyNum"> | |||||
<view class="ticketName">80元抵100元优惠券</view> | |||||
<view class="line"></view> | |||||
<view class="chooseNum"> | |||||
<view bindtap="subtractFn" class="subtractView"> | |||||
<image class="subtract" src="../images/subtract.png"></image> | |||||
</view> | |||||
<text class="textNum">{{buyNumber}}</text> | |||||
<image bindtap="addFn" class="textAdd" src="../images/add.png"></image> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
<view> | |||||
<text class="title">使用说明</text> | |||||
<view> | |||||
<view class="timeLimit"> | |||||
<image src="../images/circle.png"></image> | |||||
<text>使用期限</text> | |||||
</view> | |||||
<view class="specify">购卖后30日内有效</view> | |||||
</view> | |||||
<view> | |||||
<view class="timeLimit"> | |||||
<image src="../images/circle.png"></image> | |||||
<text>使用条件</text> | |||||
</view> | |||||
<view class="specify">点单金额需商于优惠金额,每单限使用一张不可叠加使用,不与其他优惠同享</view> | |||||
</view> | |||||
<view> | |||||
<view class="timeLimit"> | |||||
<image src="../images/circle.png"></image> | |||||
<text>适用门店</text> | |||||
</view> | |||||
<view class="specify">老门框所有门店</view> | |||||
</view> | |||||
</view> | |||||
<image bindtap="buySuccess" class="buyBtn" src="../images/buyBtn.png"></image> | |||||
</view> |
/* pages/buyTicket/buyTicket.wxss */ | |||||
.ticketImg{ | |||||
width: 100%; | |||||
height: 472rpx; | |||||
} | |||||
.imgView{ | |||||
width: 100%; | |||||
height: 300rpx; | |||||
overflow: hidden; | |||||
border-radius:0px 0px 30rpx 30rpx; | |||||
position: relative | |||||
} | |||||
.tooth{ | |||||
display: block; | |||||
width: 694rpx; | |||||
height: 10rpx; | |||||
position: absolute; | |||||
left: 50%; | |||||
bottom: -4rpx; | |||||
transform: translateX(-50%); | |||||
} | |||||
.buyNum{ | |||||
width: 100%; | |||||
height: 190rpx; | |||||
display: flex; | |||||
justify-content: center; | |||||
align-items: center; | |||||
} | |||||
.line{ | |||||
margin-left: 94rpx; | |||||
margin-right: 46rpx; | |||||
width: 1rpx; | |||||
height: 126rpx; | |||||
background-color: rgba(204,204,204,1); | |||||
} | |||||
.chooseNum{ | |||||
display: flex; | |||||
align-items: center; | |||||
} | |||||
.chooseNum text{ | |||||
font-size: 30rpx; | |||||
font-weight:bold; | |||||
color:rgba(51,51,51,1); | |||||
} | |||||
.textNum{ | |||||
margin: 0 25rpx; | |||||
} | |||||
.subtract{ | |||||
width: 28rpx; | |||||
height: 4rpx; | |||||
} | |||||
.textAdd{ | |||||
width: 28rpx; | |||||
height: 28rpx; | |||||
} | |||||
.subtractView{ | |||||
width: 28rpx; | |||||
height: 28rpx; | |||||
display: flex; | |||||
justify-content: center; | |||||
align-items: center; | |||||
background: #ffffff; | |||||
} | |||||
.ticketName{ | |||||
font-size:36rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight:bold; | |||||
color:rgba(51,51,51,1); | |||||
} | |||||
.title{ | |||||
display: inline-block; | |||||
width: 100%; | |||||
margin: 57rpx 0 7rpx 0; | |||||
text-align: center; | |||||
font-size:30rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight:bold; | |||||
color:rgba(51,51,51,1); | |||||
line-height:30rpx; | |||||
} | |||||
.timeLimit{ | |||||
height: 26rpx; | |||||
display: flex; | |||||
align-items: center; | |||||
margin-top: 23rpx; | |||||
margin-bottom: 15rpx; | |||||
} | |||||
.timeLimit image{ | |||||
width: 20rpx; | |||||
height: 20rpx; | |||||
margin-left: 32rpx; | |||||
margin-right: 16rpx; | |||||
} | |||||
.timeLimit text{ | |||||
font-size:26rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight:bold; | |||||
color:rgba(51,51,51,1); | |||||
line-height:30rpx; | |||||
} | |||||
.specify{ | |||||
font-size:22rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight:400; | |||||
color:rgba(102,102,102,1); | |||||
line-height:30rpx; | |||||
width: 613rpx; | |||||
margin-left: 69rpx; | |||||
} | |||||
.buyBtn{ | |||||
width: 100%; | |||||
height: 99rpx; | |||||
margin-top: 140rpx; | |||||
} | |||||
/* .all{ | |||||
width: 100%; | |||||
position: absolute; | |||||
top: 50%; | |||||
transform: translateY(-50%); | |||||
} */ |
// pages/givePage/givePage.js | |||||
Page({ | |||||
/** | |||||
* 页面的初始数据 | |||||
*/ | |||||
data: { | |||||
buyNumber: 1, | |||||
num: 1, | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面加载 | |||||
*/ | |||||
onLoad: function (options) { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面初次渲染完成 | |||||
*/ | |||||
onReady: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面显示 | |||||
*/ | |||||
onShow: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面隐藏 | |||||
*/ | |||||
onHide: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面卸载 | |||||
*/ | |||||
onUnload: function () { | |||||
}, | |||||
/** | |||||
* 页面相关事件处理函数--监听用户下拉动作 | |||||
*/ | |||||
onPullDownRefresh: function () { | |||||
}, | |||||
/** | |||||
* 页面上拉触底事件的处理函数 | |||||
*/ | |||||
onReachBottom: function () { | |||||
}, | |||||
/** | |||||
* 用户点击右上角分享 | |||||
*/ | |||||
onShareAppMessage: function () { | |||||
}, | |||||
addFn: function () { | |||||
if (this.data.num < 5) { | |||||
this.data.num++; | |||||
this.setData({ | |||||
buyNumber: this.data.num | |||||
}) | |||||
} | |||||
}, | |||||
subtractFn: function () { | |||||
if (this.data.num > 1) { | |||||
this.data.num--; | |||||
this.setData({ | |||||
buyNumber: this.data.num | |||||
}) | |||||
} | |||||
}, | |||||
}) |
{ | |||||
"usingComponents": {}, | |||||
"navigationBarTitleText": "赠送优惠券" | |||||
} |
<!--pages/givePage/givePage.wxml--> | |||||
<view class="all"> | |||||
<view class="contTop"> | |||||
<view class="imgView"> | |||||
<image mode="aspectFill" class="ticketImg" src="../images/bigTicket.jpg"></image> | |||||
<image class="tooth" src="../images/tooth.png"></image> | |||||
</view> | |||||
<view class="buyNum"> | |||||
<view class="ticketName">80元抵100元优惠券</view> | |||||
<view class="line"></view> | |||||
<view class="lineRig"> | |||||
<text class="bigWord">50</text> | |||||
<text class="smaWord">张</text> | |||||
</view> | |||||
</view> | |||||
<view class="giveFrind"> | |||||
<view class="giveView">赠送给好友</view> | |||||
<view class="chooseNum"> | |||||
<view bindtap="subtractFn" class="subtractView"> | |||||
<image class="subtract" src="../images/subtract.png"></image> | |||||
</view> | |||||
<text class="textNum">{{buyNumber}}</text> | |||||
<image bindtap="addFn" class="textAdd" src="../images/add.png"></image> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
<view> | |||||
<text class="title">使用说明</text> | |||||
<view> | |||||
<view class="timeLimit"> | |||||
<image src="../images/circle.png"></image> | |||||
<text>使用期限</text> | |||||
</view> | |||||
<view class="specify">购卖后30日内有效</view> | |||||
</view> | |||||
<view> | |||||
<view class="timeLimit"> | |||||
<image src="../images/circle.png"></image> | |||||
<text>使用条件</text> | |||||
</view> | |||||
<view class="specify">点单金额需商于优惠金额,每单限使用一张不可叠加使用,不与其他优惠同享</view> | |||||
</view> | |||||
<view> | |||||
<view class="timeLimit"> | |||||
<image src="../images/circle.png"></image> | |||||
<text>适用门店</text> | |||||
</view> | |||||
<view class="specify">老门框所有门店</view> | |||||
</view> | |||||
</view> | |||||
<image class="giveBtn" src="../images/giveBtn.jpg"></image> | |||||
</view> |
/* pages/givePage/givePage.wxss */ | |||||
.ticketImg{ | |||||
width: 100%; | |||||
height: 472rpx; | |||||
} | |||||
.imgView{ | |||||
width: 100%; | |||||
height: 300rpx; | |||||
overflow: hidden; | |||||
border-radius:0px 0px 30rpx 30rpx; | |||||
position: relative | |||||
} | |||||
.tooth{ | |||||
display: block; | |||||
width: 694rpx; | |||||
height: 10rpx; | |||||
position: absolute; | |||||
left: 50%; | |||||
bottom: -4rpx; | |||||
transform: translateX(-50%); | |||||
} | |||||
.buyNum{ | |||||
width: 100%; | |||||
height: 190rpx; | |||||
display: flex; | |||||
justify-content: center; | |||||
align-items: center; | |||||
} | |||||
.line{ | |||||
margin-left: 94rpx; | |||||
margin-right: 46rpx; | |||||
width: 1rpx; | |||||
height: 126rpx; | |||||
background-color: rgba(204,204,204,1); | |||||
} | |||||
.chooseNum{ | |||||
display: flex; | |||||
align-items: center; | |||||
} | |||||
.chooseNum text{ | |||||
font-size: 30rpx; | |||||
font-weight:bold; | |||||
color:rgba(51,51,51,1); | |||||
} | |||||
.textNum{ | |||||
margin: 0 25rpx; | |||||
} | |||||
.subtract{ | |||||
width: 28rpx; | |||||
height: 4rpx; | |||||
} | |||||
.textAdd{ | |||||
width: 28rpx; | |||||
height: 28rpx; | |||||
} | |||||
.subtractView{ | |||||
width: 28rpx; | |||||
height: 28rpx; | |||||
display: flex; | |||||
justify-content: center; | |||||
align-items: center; | |||||
background: #ffffff; | |||||
} | |||||
.ticketName{ | |||||
font-size:36rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight:bold; | |||||
color:rgba(51,51,51,1); | |||||
} | |||||
.giveFrind{ | |||||
padding: 47rpx 41rpx 47rpx 32rpx; | |||||
display: flex; | |||||
justify-content: space-between; | |||||
align-items: center; | |||||
} | |||||
.giveView{ | |||||
font-size:26rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight:bold; | |||||
color:rgba(51,51,51,1); | |||||
line-height:30px; | |||||
} | |||||
.bigWord{ | |||||
font-size:100rpx; | |||||
font-family:DINPro; | |||||
font-weight:bold; | |||||
color:rgba(235,97,0,1); | |||||
} | |||||
.smaWord{ | |||||
font-size:30rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight:bold; | |||||
color:rgba(51,51,51,1); | |||||
} | |||||
.title{ | |||||
display: inline-block; | |||||
width: 100%; | |||||
margin: 57rpx 0 7rpx 0; | |||||
text-align: center; | |||||
font-size:30rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight:bold; | |||||
color:rgba(51,51,51,1); | |||||
line-height:30rpx; | |||||
} | |||||
.timeLimit{ | |||||
height: 26rpx; | |||||
display: flex; | |||||
align-items: center; | |||||
margin-top: 23rpx; | |||||
margin-bottom: 15rpx; | |||||
} | |||||
.timeLimit image{ | |||||
width: 20rpx; | |||||
height: 20rpx; | |||||
margin-left: 32rpx; | |||||
margin-right: 16rpx; | |||||
} | |||||
.timeLimit text{ | |||||
font-size:26rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight:bold; | |||||
color:rgba(51,51,51,1); | |||||
line-height:30rpx; | |||||
} | |||||
.specify{ | |||||
font-size:22rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight:400; | |||||
color:rgba(102,102,102,1); | |||||
line-height:30rpx; | |||||
width: 613rpx; | |||||
margin-left: 69rpx; | |||||
} | |||||
.giveBtn{ | |||||
width: 100%; | |||||
height: 98rpx; | |||||
margin-top: 12rpx; | |||||
} |
//index.js | |||||
//获取应用实例 | |||||
const app = getApp() | |||||
Page({ | |||||
data: { | |||||
swiperHig:0, | |||||
content: ["../images/smallTicket.jpg", "../images/smallTicket.jpg", "../images/smallTicket.jpg"], | |||||
allData:[ | |||||
] | |||||
}, | |||||
//事件处理函数 | |||||
onLoad: function () { | |||||
var wid = wx.getSystemInfoSync().windowWidth; | |||||
var hig = wid * (843 / 750) | |||||
console.log(hig) | |||||
this.setData({ | |||||
swiperHig: (hig+40)+"px", | |||||
}); | |||||
}, | |||||
skipPage:function(){ | |||||
var arr = {"name":"小明","age":20}; | |||||
var option = JSON.stringify(arr); | |||||
wx.navigateTo({ | |||||
url: '../buyTicket/buyTicket?option=' + option | |||||
}) | |||||
} | |||||
}) |
{ | |||||
"usingComponents": {}, | |||||
"navigationBarTitleText": "购买大厅" | |||||
} |
<!--index.wxml--> | |||||
<view class="container"> | |||||
<!-- <view class="userinfo"> | |||||
<button wx:if="{{!hasUserInfo && canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button> | |||||
<block wx:else> | |||||
<image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image> | |||||
<text class="userinfo-nickname">{{userInfo.nickName}}</text> | |||||
</block> | |||||
</view> | |||||
<view class="usermotto"> | |||||
<text class="user-motto">{{motto}}</text> | |||||
</view> --> | |||||
<image class="buyBg" src="../images/buyBg.jpg" style="height:{{swiperHig}}"></image> | |||||
<swiper duration="500" next-margin="70rpx"> | |||||
<block wx:for="{{content}}" wx:key="*this"> | |||||
<swiper-item bindtap="skipPage"> | |||||
<view class="botCont"> | |||||
<view class="imgView"> | |||||
<image src="{{item}}"></image> | |||||
</view> | |||||
<view class="textView"> | |||||
<text class="nameText">80抵100</text> | |||||
<text class="timeText">优惠券每次限用一张,不可叠加</text> | |||||
<text class="timeText">(有效期:2020.2.18-2020.12.31)</text> | |||||
</view> | |||||
<view class="buyView">立即购买</view> | |||||
</view> | |||||
</swiper-item> | |||||
</block> | |||||
</swiper> | |||||
</view> |
/**index.wxss**/ | |||||
.buyBg{ | |||||
width: 100%; | |||||
/* height: 843rpx; */ | |||||
position: fixed; | |||||
top:0; | |||||
left: 0; | |||||
} | |||||
swiper{ | |||||
width: 100%; | |||||
height: 437rpx; | |||||
position: absolute; | |||||
left: 0; | |||||
bottom: 0; | |||||
} | |||||
.botCont{ | |||||
width: 607rpx; | |||||
border-radius:30rpx; | |||||
background-color:#ffffff; | |||||
display: flex; | |||||
flex-direction: row; | |||||
flex-wrap: wrap; | |||||
padding-top: 62rpx; | |||||
padding-left: 75rpx; | |||||
} | |||||
.imgView{ | |||||
width: 254rpx; | |||||
height: 248rpx; | |||||
overflow: hidden; | |||||
display: flex; | |||||
justify-content: center; | |||||
align-items: center; | |||||
border-radius:10px 0px 0px 10px; | |||||
} | |||||
.imgView image{ | |||||
width: 387rpx; | |||||
height: 342rpx; | |||||
} | |||||
.textView{ | |||||
width: 318rpx; | |||||
height: 248rpx; | |||||
padding-left: 33rpx; | |||||
} | |||||
.textView text{ | |||||
display: block; | |||||
} | |||||
.nameText{ | |||||
font-size:60rpx; | |||||
font-family:DINPro; | |||||
font-weight:bold; | |||||
color:rgba(106,10,14,1); | |||||
margin-top: 42rpx; | |||||
margin-bottom: 42rpx | |||||
} | |||||
.timeText{ | |||||
font-size:20rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight:300; | |||||
color:rgba(153,153,153,1); | |||||
} | |||||
.buyView{ | |||||
margin-top: 40rpx; | |||||
font-size:36rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight:500; | |||||
color:rgba(0,0,0,1); | |||||
} |
// pages/personalCenter/personalCenter.js | |||||
Page({ | |||||
/** | |||||
* 页面的初始数据 | |||||
*/ | |||||
data: { | |||||
myTicketArrows: false, | |||||
historyTicketArrows: false, | |||||
mydeg: -90, | |||||
historydeg: -90, | |||||
historyArr: [ | |||||
{ | |||||
"code": "11111", | |||||
"name": "80元抵100元优惠券", | |||||
"type": "未使用" | |||||
}, | |||||
{ | |||||
"code": "11111", | |||||
"name": "80元抵100元优惠券", | |||||
"type": "未使用" | |||||
}, | |||||
{ | |||||
"code": "11111", | |||||
"name": "80元抵100元优惠券", | |||||
"type": "未使用" | |||||
}, | |||||
{ | |||||
"code": "11111", | |||||
"name": "80元抵100元优惠券", | |||||
"type": "未使用" | |||||
}, | |||||
], | |||||
myTicketArr: [ | |||||
{ | |||||
"image": "../images/ticketImg.jpg", | |||||
"name": "80抵100", | |||||
"time": "2020.2.18-2020.12.31" | |||||
}, | |||||
{ | |||||
"image": "../images/ticketImg.jpg", | |||||
"name": "80抵100", | |||||
"time": "2020.2.18-2020.12.31" | |||||
}, | |||||
{ | |||||
"image": "../images/ticketImg.jpg", | |||||
"name": "80抵100", | |||||
"time": "2020.2.18-2020.12.31" | |||||
}, | |||||
{ | |||||
"image": "../images/ticketImg.jpg", | |||||
"name": "80抵100", | |||||
"time": "2020.2.18-2020.12.31" | |||||
}, | |||||
], | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面加载 | |||||
*/ | |||||
onLoad: function (options) { | |||||
// wx.getUserInfo({ | |||||
// success: function (res) { | |||||
// console.log(res) | |||||
// } | |||||
// }) | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面初次渲染完成 | |||||
*/ | |||||
onReady: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面显示 | |||||
*/ | |||||
onShow: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面隐藏 | |||||
*/ | |||||
onHide: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面卸载 | |||||
*/ | |||||
onUnload: function () { | |||||
}, | |||||
/** | |||||
* 页面相关事件处理函数--监听用户下拉动作 | |||||
*/ | |||||
onPullDownRefresh: function () { | |||||
}, | |||||
/** | |||||
* 页面上拉触底事件的处理函数 | |||||
*/ | |||||
onReachBottom: function () { | |||||
}, | |||||
/** | |||||
* 用户点击右上角分享 | |||||
*/ | |||||
onShareAppMessage: function () { | |||||
}, | |||||
lookMyTicket:function(){ | |||||
this.setData({ | |||||
myTicketArrows: !this.data.myTicketArrows, | |||||
}) | |||||
if (this.data.myTicketArrows){ | |||||
this.setData({ | |||||
mydeg: 0, | |||||
}) | |||||
}else{ | |||||
this.setData({ | |||||
mydeg: -90, | |||||
}) | |||||
} | |||||
}, | |||||
lookHistory:function(){ | |||||
this.setData({ | |||||
historyTicketArrows: !this.data.historyTicketArrows, | |||||
}) | |||||
if (this.data.historyTicketArrows) { | |||||
this.setData({ | |||||
historydeg: 0, | |||||
}) | |||||
} else { | |||||
this.setData({ | |||||
historydeg: -90, | |||||
}) | |||||
} | |||||
}, | |||||
lookTicket:function(e){ | |||||
console.log(e) | |||||
var index = e.target.dataset.index; | |||||
wx.navigateTo({ | |||||
url: '../TicketDetails/TicketDetails', | |||||
}) | |||||
}, | |||||
giveTicket:function(e){ | |||||
var index = e.target.dataset.index; | |||||
wx.navigateTo({ | |||||
url: '../givePage/givePage', | |||||
}) | |||||
} | |||||
}) |
{ | |||||
"usingComponents": {}, | |||||
"navigationBarTitleText": "个人中心" | |||||
} |
<!--pages/personalCenter/personalCenter.wxml--> | |||||
<view class="all"> | |||||
<image class="centerBg" src="../images/centerBg.png"></image> | |||||
<view class="userMess"> | |||||
<image class="userCircle" src="../images/userCircle.png"></image> | |||||
<view class="userAll"> | |||||
<view class="userHeader"> | |||||
<image src="../images/centerBg.png"></image> | |||||
</view> | |||||
<view class="userName">老门框用户</view> | |||||
<view class="userPhone">12345678910</view> | |||||
</view> | |||||
<view class="myTicketAll"> | |||||
<view class="myTicketTop" bindtap="lookMyTicket"> | |||||
<image class="ticketIcon" src="../images/ticketIcon.png"></image> | |||||
<view class="myTicket">我的优惠券</view> | |||||
<image style="transform:rotate({{mydeg}}deg)" class="ticketArrows" src="../images/ticketArrows.png"></image> | |||||
</view> | |||||
<scroll-view class="scrollY1" scroll-y="true" wx:if="{{myTicketArrows}}"> | |||||
<view class="contAll" wx:for="{{myTicketArr}}"> | |||||
<view class="ticketCont"> | |||||
<view class="ticketImg"> | |||||
<image class="ticketImg" src="{{item.image}}"></image> | |||||
</view> | |||||
<view class="rigWord"> | |||||
<view class="name">{{item.name}}</view> | |||||
<view class="time">优惠券每次限用一张,不可叠加</view> | |||||
<view class="time">(有效期:{{item.time}})</view> | |||||
</view> | |||||
</view> | |||||
<view class="look"> | |||||
<view bindtap="lookTicket" data-index = "{{index}}" class="clickLook">点击查看券码</view> | |||||
<image bindtap="giveTicket" class="giveFrinedBtn" data-index = "{{index}}" src="../images/giveFrinedBtn.png"></image> | |||||
</view> | |||||
</view> | |||||
</scroll-view> | |||||
<view class="myTicketTop" style="margin-top:81rpx;" bindtap="lookHistory"> | |||||
<image class="historyIcon" src="../images/historyIcon.png"></image> | |||||
<view class="myTicket" style="margin-left:-310rpx;">优惠券使用记录</view> | |||||
<image class="ticketArrows" src="../images/ticketArrows.png" style="transform:rotate({{historydeg}}deg)"></image> | |||||
</view> | |||||
<scroll-view class="scrollY2" scroll-y="true" wx:if="{{historyTicketArrows}}"> | |||||
<view class="history" wx:for="{{historyArr}}"> | |||||
<view class="historyLeft"> | |||||
<image class="historyTicketBg" src="../images/historyTicketBg.png"></image> | |||||
<view class="ticketCode">券码:{{item.code}}</view> | |||||
</view> | |||||
<view class="tickName">{{item.name}}</view> | |||||
<view class="tickType">{{item.type}}</view> | |||||
</view> | |||||
</scroll-view> | |||||
</view> | |||||
</view> | |||||
</view> |
/* pages/personalCenter/personalCenter.wxss */ | |||||
.all{ | |||||
position: relative; | |||||
} | |||||
.centerBg{ | |||||
width: 100%; | |||||
height: 535rpx; | |||||
} | |||||
.userCircle{ | |||||
width: 100%; | |||||
height: 448rpx; | |||||
} | |||||
.userMess{ | |||||
width: 100%; | |||||
position: absolute; | |||||
top: 117rpx; | |||||
left: 0; | |||||
} | |||||
.userHeader{ | |||||
width: 200rpx; | |||||
height: 200rpx; | |||||
overflow: hidden; | |||||
border-radius: 50%; | |||||
} | |||||
.userAll{ | |||||
text-align: center; | |||||
position:absolute; | |||||
top:42rpx; | |||||
left: 50%; | |||||
transform: translateX(-50%); | |||||
display: flex; | |||||
justify-content: center; | |||||
align-items: center; | |||||
flex-wrap: wrap; | |||||
flex-direction: column; | |||||
} | |||||
.userName{ | |||||
font-size:40rpx; | |||||
color:rgba(51,51,51,1); | |||||
font-weight:bold; | |||||
margin-top: 31rpx; | |||||
margin-bottom: 16rpx; | |||||
} | |||||
.userPhone{ | |||||
font-size:30rpx; | |||||
color:rgba(102,102,102,1); | |||||
} | |||||
.myTicketAll{ | |||||
padding: 0 64rpx; | |||||
} | |||||
.myTicketTop{ | |||||
display: flex; | |||||
justify-content: space-between; | |||||
align-items: center; | |||||
} | |||||
.ticketIcon{ | |||||
width: 49rpx; | |||||
height: 30rpx; | |||||
} | |||||
.ticketArrows{ | |||||
width: 34rpx; | |||||
height: 19rpx; | |||||
} | |||||
.myTicket{ | |||||
margin-left: -350rpx; | |||||
font-size:30rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight:bold; | |||||
color:rgba(51,51,51,1); | |||||
} | |||||
.ticketCont{ | |||||
display: flex; | |||||
justify-content: center; | |||||
align-items: center; | |||||
} | |||||
.ticketImg{ | |||||
width: 254rpx; | |||||
height: 248rpx; | |||||
border-radius:10px 0px 0px 10px; | |||||
overflow: hidden; | |||||
margin-right: 32rpx; | |||||
} | |||||
.name{ | |||||
font-size:50rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight:bold; | |||||
color:rgba(106,10,14,1); | |||||
margin-bottom: 40rpx; | |||||
} | |||||
.time{ | |||||
font-size:20rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight:300; | |||||
color:rgba(153,153,153,1); | |||||
} | |||||
.look{ | |||||
display: flex; | |||||
justify-content: space-between; | |||||
align-items: center; | |||||
margin-top: 41rpx; | |||||
margin-bottom: 33rpx; | |||||
} | |||||
.giveFrinedBtn{ | |||||
width: 240rpx; | |||||
height: 64rpx; | |||||
} | |||||
.clickLook{ | |||||
font-size:30rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight:500; | |||||
color:rgba(0,0,0,1); | |||||
margin-left: 15rpx; | |||||
} | |||||
.scrollY1{ | |||||
height: 360rpx; | |||||
margin-top: 33rpx; | |||||
} | |||||
.scrollY2{ | |||||
height: 200rpx; | |||||
margin-top: 20rpx; | |||||
} | |||||
.historyIcon{ | |||||
width: 30rpx; | |||||
height: 30rpx; | |||||
} | |||||
.history{ | |||||
display: flex; | |||||
justify-content: space-between; | |||||
align-items: center; | |||||
margin-bottom: 20rpx; | |||||
} | |||||
.historyLeft{ | |||||
position: relative; | |||||
width: 179rpx; | |||||
height: 36rpx; | |||||
} | |||||
.ticketCode{ | |||||
width: 179rpx; | |||||
text-align: center; | |||||
font-size:20rpx; | |||||
font-family:DIN; | |||||
font-weight:500; | |||||
color:rgba(255,255,255,1); | |||||
position: absolute; | |||||
top: 50%; | |||||
transform: translateY(-50%); | |||||
} | |||||
.historyTicketBg{ | |||||
width: 179rpx; | |||||
height: 36rpx; | |||||
} | |||||
.tickName{ | |||||
font-size:24rpx; | |||||
color:rgba(102,102,102,1); | |||||
margin-left: 95rpx; | |||||
} | |||||
.tickType{ | |||||
font-size:24rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight:bold; | |||||
color:rgba(235,97,0,1); | |||||
} |
// pages/register/register.js | |||||
const app = getApp() | |||||
let time; | |||||
Page({ | |||||
/** | |||||
* 页面的初始数据 | |||||
*/ | |||||
data: { | |||||
yesSend:false,//是否发送验证码 | |||||
minter: 60,//发送验证码60秒后才可再次发送 | |||||
num:60, | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面加载 | |||||
*/ | |||||
onLoad: function (options) { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面初次渲染完成 | |||||
*/ | |||||
onReady: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面显示 | |||||
*/ | |||||
onShow: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面隐藏 | |||||
*/ | |||||
onHide: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面卸载 | |||||
*/ | |||||
onUnload: function () { | |||||
}, | |||||
/** | |||||
* 页面相关事件处理函数--监听用户下拉动作 | |||||
*/ | |||||
onPullDownRefresh: function () { | |||||
}, | |||||
/** | |||||
* 页面上拉触底事件的处理函数 | |||||
*/ | |||||
onReachBottom: function () { | |||||
}, | |||||
/** | |||||
* 用户点击右上角分享 | |||||
*/ | |||||
onShareAppMessage: function () { | |||||
}, | |||||
sendTouch:function(){//发送验证码 | |||||
this.setData({ | |||||
yesSend: true, | |||||
}) | |||||
if (this.data.yesSend) { | |||||
time = setInterval(this.setIntervalFn,1000) | |||||
} | |||||
}, | |||||
setIntervalFn:function(){//定时器 | |||||
if (this.data.num > 0) { | |||||
this.data.num--; | |||||
if (this.data.num == 0) { | |||||
this.setData({ | |||||
yesSend: false, | |||||
}) | |||||
if (!this.data.yesSend){ | |||||
this.setData({ | |||||
num: 60, | |||||
minter: 60, | |||||
}) | |||||
} | |||||
clearInterval(time); | |||||
} | |||||
} | |||||
this.setData({ | |||||
minter: this.data.num | |||||
}) | |||||
console.log(this.data.minter) | |||||
}, | |||||
registerFn:function(){ | |||||
wx.showToast({ | |||||
title: '成功', | |||||
icon: 'success', | |||||
duration: 1000 | |||||
}) | |||||
setTimeout(function(){ | |||||
wx.switchTab({ | |||||
url: '../index/index' | |||||
}) | |||||
},1000) | |||||
} | |||||
}) |
{ | |||||
"usingComponents": {} | |||||
} |
<!--pages/register/register.wxml--> | |||||
<view> | |||||
<image class="registerBg" src="../images/registerBg.jpg"></image> | |||||
<view class="import"> | |||||
<view class="phoneView"> | |||||
<input class="phoneInt" placeholder="电话" placeholder-class="placeholderClass"></input> | |||||
</view> | |||||
<view class="codeView"> | |||||
<view bindtap="sendTouch" class="sendBtn" wx:if="{{!yesSend}}">发送</view> | |||||
<view class="sendBtn" wx:if="{{yesSend}}">{{minter}}</view> | |||||
<input class="codeInt" placeholder="验证码" placeholder-class="placeholderClass"></input> | |||||
</view> | |||||
<image bindtap="registerFn" class="registerBtn" src="../images/registerBtn.png"></image> | |||||
</view> | |||||
</view> |
/* pages/register/register.wxss */ | |||||
.registerBg{ | |||||
width: 100%; | |||||
height: 1379rpx; | |||||
position: fixed; | |||||
top: 0; | |||||
left: 0; | |||||
right: 0; | |||||
bottom: 0; | |||||
} | |||||
.import{ | |||||
position: absolute; | |||||
z-index: 9; | |||||
top: 0; | |||||
left: 0; | |||||
width: 100%; | |||||
margin-top: 654rpx; | |||||
} | |||||
.phoneView,.codeView{ | |||||
width: 583rpx; | |||||
margin: 0 auto; | |||||
border-bottom: 2px solid #FFFFFF; | |||||
padding: 32rpx 0; | |||||
position: relative; | |||||
} | |||||
.placeholderClass{ | |||||
font-size:30rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight:400; | |||||
color:rgba(255,254,254,1); | |||||
position: absolute; | |||||
left: 0; | |||||
} | |||||
.sendBtn{ | |||||
width:177rpx; | |||||
height:56rpx; | |||||
font-size:30rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight:400; | |||||
color:rgba(255,254,254,1); | |||||
position: absolute; | |||||
right: 0; | |||||
border: 2px solid #ffffff; | |||||
border-radius: 28rpx; | |||||
text-align: center; | |||||
line-height: 56rpx; | |||||
} | |||||
.phoneInt{ | |||||
font-size:30rpx; | |||||
color: #ffffff; | |||||
} | |||||
.codeInt{ | |||||
width: 415rpx; | |||||
font-size:30rpx; | |||||
color: #ffffff; | |||||
} | |||||
.registerBtn{ | |||||
width: 600rpx; | |||||
height: 98rpx; | |||||
/* bottom: 246rpx; */ | |||||
margin-left: 75rpx; | |||||
margin-top: 130rpx; | |||||
} |
// pages/shop/shop.js | |||||
Page({ | |||||
/** | |||||
* 页面的初始数据 | |||||
*/ | |||||
data: { | |||||
provinceArr: [ | |||||
["全部", "a", "b", "c", "d"], ["1", "2", "3", "4", "5"], | |||||
], | |||||
cityArr: [["1", "2", "3", "4", "5"], ["1", "2", "3", "4"], ["1", "2", "3"], ["1", "2"], ["1"]], | |||||
index:0, | |||||
inputVal:"", | |||||
scrollHig:0, | |||||
getDataArr:[ | |||||
{ | |||||
"bigImg": "../images/shop.png", | |||||
"name":"北京东城区金宝店", | |||||
"address":"北京市东城区金宝大雅宝59号(鄂尔多斯酒店对面)", | |||||
"phone":"010-8388-6698", | |||||
}, | |||||
{ | |||||
"bigImg": "../images/shop.png", | |||||
"name": "北京东城区金宝店", | |||||
"address": "北京市东城区金宝大雅宝59号(鄂尔多斯酒店对面)", | |||||
"phone": "010-8388-6698", | |||||
}, | |||||
{ | |||||
"bigImg": "../images/shop.png", | |||||
"name": "北京东城区金宝店", | |||||
"address": "北京市东城区金宝大雅宝59号(鄂尔多斯酒店对面)", | |||||
"phone": "010-8388-6698", | |||||
} | |||||
] | |||||
}, | |||||
bindchange:function(e){ | |||||
console.log("确定") | |||||
wx.pageScrollTo({ | |||||
scrollTop: 0, | |||||
duration: 300 | |||||
}) | |||||
}, | |||||
bindcolumnchange: function (e) { | |||||
console.log(e) | |||||
var clo = e.detail.column;//指移动的哪一列 | |||||
var value = e.detail.value;//指列中的哪一个 | |||||
var activeArr = [this.data.provinceArr[0], this.data.cityArr[value]] | |||||
if (clo==0){ | |||||
console.log(0) | |||||
this.setData({ | |||||
provinceArr: activeArr, | |||||
index:0, | |||||
}) | |||||
}else{ | |||||
this.setData({ | |||||
index: value | |||||
}) | |||||
} | |||||
console.log(activeArr) | |||||
console.log(clo, value) | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面加载 | |||||
*/ | |||||
onLoad: function (options) { | |||||
// var Hig = wx.getSystemInfoSync().windowHeight; | |||||
// this.setData({ | |||||
// scrollHig: Hig-110+40, | |||||
// }) | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面初次渲染完成 | |||||
*/ | |||||
onReady: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面显示 | |||||
*/ | |||||
onShow: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面隐藏 | |||||
*/ | |||||
onHide: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面卸载 | |||||
*/ | |||||
onUnload: function () { | |||||
}, | |||||
/** | |||||
* 页面相关事件处理函数--监听用户下拉动作 | |||||
*/ | |||||
onPullDownRefresh: function () { | |||||
console.log("到顶了") | |||||
}, | |||||
/** | |||||
* 页面上拉触底事件的处理函数 | |||||
*/ | |||||
onReachBottom: function () { | |||||
console.log("到底了") | |||||
}, | |||||
/** | |||||
* 用户点击右上角分享 | |||||
*/ | |||||
onShareAppMessage: function () { | |||||
}, | |||||
callPhone:function(e){//拨打电话 | |||||
var index = e.target.dataset.index; | |||||
wx.makePhoneCall({ | |||||
phoneNumber: this.data.getDataArr[index].phone | |||||
}) | |||||
}, | |||||
getInputVal:function(e){//获取input框中value | |||||
console.log(e.detail.value); | |||||
this.setData({ | |||||
inputVal:e.detail.value | |||||
}) | |||||
}, | |||||
searchFn:function(){//点击搜索按钮 | |||||
}, | |||||
}) |
{ | |||||
"usingComponents": {}, | |||||
"navigationBarTitleText": "门店查询" | |||||
} |
<!--pages/shop/shop.wxml--> | |||||
<view class="all"> | |||||
<view class="searchAll"> | |||||
<view class="chooseCity"> | |||||
<picker mode="multiSelector" range="{{provinceArr}}" bindchange="bindchange" bindcolumnchange="bindcolumnchange" value="{{index}}"> | |||||
<view class="clickChoose"> | |||||
<view class="picker">{{provinceArr[1][index]}}</view> | |||||
<image class="arrows" src="../images/arrows.png"></image> | |||||
</view> | |||||
</picker> | |||||
</view> | |||||
<view class="searchView"> | |||||
<image class="searchIcon" src="../images/searchIcon.png"></image> | |||||
<input class="int" bindinput="getInputVal" placeholder="输入搜索内容" placeholder-class="placeholderInt"></input> | |||||
</view> | |||||
<view class="searchBtn" bindtap="searchFn">搜索</view> | |||||
</view> | |||||
<view class="content"> | |||||
<!-- <scroll-view scroll-y="true" style="height:{{scrollHig}}px" bindtouchend=""> --> | |||||
<view> | |||||
<view class="getData" wx:for="{{getDataArr}}"> | |||||
<view class="imgView"> | |||||
<image class="shop" src="{{item.bigImg}}"></image> | |||||
<image bindtap="callPhone" data-index="{{index}}" class="ringUp" src="../images/ringUp.png" ></image> | |||||
</view> | |||||
<view class="shopName">{{item.name}}</view> | |||||
<view class="address"> | |||||
<image class="addressIcon" src="../images/addressIcon.png"></image> | |||||
<view class="iconRig">{{item.address}}</view> | |||||
</view> | |||||
<view class="phone"> | |||||
<image class="phoneIcon" src="../images/phoneIcon.png"></image> | |||||
<view class="iconRig">{{item.phone}}</view> | |||||
</view> | |||||
<view class="line"></view> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
/* pages/shop/shop.wxss */ | |||||
.all{ | |||||
width: 686rpx; | |||||
padding: 0 32rpx; | |||||
} | |||||
.searchAll{ | |||||
width: 686rpx; | |||||
padding-bottom: 50rpx; | |||||
position: fixed; | |||||
top: 0; | |||||
background: #ffffff; | |||||
z-index: 9; | |||||
display: flex; | |||||
justify-content: space-between; | |||||
align-items: center; | |||||
} | |||||
.clickChoose{ | |||||
display: flex; | |||||
justify-content: center; | |||||
align-items: center; | |||||
width: 138rpx; | |||||
height: 60rpx; | |||||
border: 2rpx solid rgba(204, 204, 204, 1); | |||||
border-radius:6rpx; | |||||
} | |||||
.arrows{ | |||||
width: 19rpx; | |||||
height: 10rpx; | |||||
} | |||||
.picker{ | |||||
font-size:24rpx; | |||||
color:rgba(51,51,51,1); | |||||
margin-right: 13rpx; | |||||
} | |||||
.searchView{ | |||||
position: relative; | |||||
width: 390rpx; | |||||
height: 60rpx; | |||||
} | |||||
.searchIcon{ | |||||
width: 30rpx; | |||||
height: 32rpx; | |||||
position: absolute; | |||||
left: 20rpx; | |||||
top: 50%; | |||||
transform: translateY(-50%); | |||||
} | |||||
.int{ | |||||
width: 315rpx; | |||||
height: 60rpx; | |||||
font-size:24rpx; | |||||
padding-left: 75rpx; | |||||
} | |||||
.searchBtn{ | |||||
background-color: rgba(235,97,0,1); | |||||
border-radius: 6rpx; | |||||
font-size:30rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight:bold; | |||||
color:rgba(255,255,255,1); | |||||
padding: 16rpx 26rpx; | |||||
letter-spacing:5rpx; | |||||
} | |||||
.placeholderInt{ | |||||
font-size:24rpx; | |||||
font-family:SourceHanSansCN; | |||||
color:rgba(178,178,178,1); | |||||
} | |||||
.content{ | |||||
padding-top: 128rpx; | |||||
} | |||||
.imgView{ | |||||
width: 686rpx; | |||||
height: 300rpx; | |||||
position: relative; | |||||
overflow: hidden; | |||||
} | |||||
.shop{ | |||||
width: 738rpx; | |||||
height: 352rpx; | |||||
position: absolute; | |||||
left: 50%; | |||||
top: 50%; | |||||
transform: translate(-50%,-50%); | |||||
} | |||||
.ringUp{ | |||||
width: 88rpx; | |||||
height: 88rpx; | |||||
position: absolute; | |||||
right: 0; | |||||
bottom: 0; | |||||
} | |||||
.address,.phone{ | |||||
display: flex; | |||||
justify-content: flex-start; | |||||
align-items: center; | |||||
} | |||||
.address{ | |||||
margin-bottom: 16rpx; | |||||
} | |||||
.shopName{ | |||||
font-size:30rpx; | |||||
font-family:SourceHanSansCN; | |||||
font-weight: bold; | |||||
color:rgba(51,51,51,1); | |||||
margin: 31rpx 0; | |||||
} | |||||
.iconRig{ | |||||
font-size:26rpx; | |||||
font-family:SourceHanSansCN; | |||||
color:rgba(102,102,102,1); | |||||
} | |||||
.addressIcon{ | |||||
width: 21rpx; | |||||
height: 24rpx; | |||||
margin-right: 10rpx; | |||||
} | |||||
.phoneIcon{ | |||||
width: 24rpx; | |||||
height: 24rpx; | |||||
margin-right: 10rpx | |||||
} | |||||
.line{ | |||||
margin-top: 40rpx; | |||||
width: 100%; | |||||
height: 2rpx; | |||||
background: #CCCCCC; | |||||
} | |||||
.getData{ | |||||
margin-bottom: 40rpx; | |||||
} | |||||
{ | |||||
"description": "项目配置文件", | |||||
"packOptions": { | |||||
"ignore": [] | |||||
}, | |||||
"setting": { | |||||
"urlCheck": true, | |||||
"es6": true, | |||||
"postcss": true, | |||||
"minified": true, | |||||
"newFeature": true, | |||||
"autoAudits": false, | |||||
"coverView": true | |||||
}, | |||||
"compileType": "miniprogram", | |||||
"libVersion": "2.10.2", | |||||
"appid": "wx19782b9c06798224", | |||||
"projectname": "%E8%80%81%E9%97%A8%E6%A1%86", | |||||
"debugOptions": { | |||||
"hidedInDevtools": [] | |||||
}, | |||||
"isGameTourist": false, | |||||
"simulatorType": "wechat", | |||||
"simulatorPluginLibVersion": {}, | |||||
"condition": { | |||||
"search": { | |||||
"current": -1, | |||||
"list": [] | |||||
}, | |||||
"conversation": { | |||||
"current": -1, | |||||
"list": [] | |||||
}, | |||||
"plugin": { | |||||
"current": -1, | |||||
"list": [] | |||||
}, | |||||
"game": { | |||||
"currentL": -1, | |||||
"list": [] | |||||
}, | |||||
"miniprogram": { | |||||
"current": 0, | |||||
"list": [ | |||||
{ | |||||
"id": 0, | |||||
"name": "购券大厅", | |||||
"pathName": "pages/index/index", | |||||
"query": "", | |||||
"scene": null | |||||
}, | |||||
{ | |||||
"id": 0, | |||||
"name": "购买优惠券", | |||||
"pathName": "pages/buyTicket/buyTicket", | |||||
"query": "", | |||||
"scene": null | |||||
}, | |||||
{ | |||||
"id": 0, | |||||
"name": "优惠券详情", | |||||
"pathName": "pages/TicketDetails/TicketDetails", | |||||
"query": "", | |||||
"scene": null | |||||
}, | |||||
{ | |||||
"id": 0, | |||||
"name": "赠送优惠券", | |||||
"pathName": "pages/givePage/givePage", | |||||
"query": "", | |||||
"scene": null | |||||
}, | |||||
{ | |||||
"id": 0, | |||||
"name": "门店查询", | |||||
"pathName": "pages/shop/shop", | |||||
"query": "", | |||||
"scene": null | |||||
}, | |||||
{ | |||||
"id": 0, | |||||
"name": "个人中心", | |||||
"pathName": "pages/personalCenter/personalCenter", | |||||
"query": "", | |||||
"scene": null | |||||
} | |||||
] | |||||
} | |||||
} | |||||
} |
{ | |||||
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", | |||||
"rules": [{ | |||||
"action": "allow", | |||||
"page": "*" | |||||
}] | |||||
} |
const formatTime = date => { | |||||
const year = date.getFullYear() | |||||
const month = date.getMonth() + 1 | |||||
const day = date.getDate() | |||||
const hour = date.getHours() | |||||
const minute = date.getMinutes() | |||||
const second = date.getSeconds() | |||||
return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':') | |||||
} | |||||
const formatNumber = n => { | |||||
n = n.toString() | |||||
return n[1] ? n : '0' + n | |||||
} | |||||
module.exports = { | |||||
formatTime: formatTime | |||||
} |