Commit 0b4168a4 by 严立

LL - 配置门店印章信息

parent db659438
import iBase64 from './npm/base64.js'
import iMiment from './npm/miment.js'
import iUtils from './utils/utils.js'
import iRule from './utils/rule/rule.js'
......@@ -7,6 +8,7 @@ App({
modular: {
'rule': iRule,
'utils': iUtils,
'base64': iBase64,
'miment': iMiment,
},
......@@ -28,6 +30,8 @@ App({
onLaunch: function () {
this.setUnitProportion()
// this.login()
},
setUnitProportion: function () {
......@@ -49,7 +53,7 @@ App({
wxRequest: function (obj) {
var token = this.globalData.token
var param = obj.data ? JSON.stringify(obj.data) : ''
var header = obj.header ? obj.header : { 'token': token || '', }
var header = obj.header ? obj.header : { 'token': token || '' }
wx.request({
url: this.globalData.baseUrl + obj.url,
......@@ -129,8 +133,12 @@ App({
method: 'GET',
success: (response) => {
let funcResponse = response.data
// 缓存令牌信息
this.globalData.token = funcResponse.token
this.globalData.refreshToken = funcResponse.refreshToken
wx.setStorageSync('token', funcResponse.token)
wx.setStorageSync('tokenRefresh', funcResponse.refreshToken)
wx.setStorageSync('sessionKey', funcResponse.session_key)
......@@ -148,7 +156,6 @@ App({
}
// 以返回信息中是否包含手机号码判断用户是否注册过
console.log(funcUserInfo.phone)
if (funcUserInfo.phone) {
funcUserInfo.isSignIn = true
this.queryUserStatus()
......@@ -236,6 +243,16 @@ App({
},
/**
* 令牌有效性判断
* @function
* @param
* @returns
*/
tokenInspect: function () {
let funcToken = wx.getStorageSync()
},
/**
* 刷新令牌
* @function
* @param
......@@ -249,6 +266,11 @@ App({
refreshToken: this.globalData.refreshToken
},
success: (res) => {
// { "msg": "登录失效", "code": 402, "success": true }
let token = res.data.token
let refreshToken = res.data.refreshToken
......@@ -261,4 +283,13 @@ App({
}
})
},
setShopInfo: function (funcShopAppId) {
for (let i = 0, l = iEnvironmental.shopId.length; i < l; i++) {
if (funcShopAppId === iEnvironmental.shopId[i].appId) {
wx.setStorageSync('shopInfoBuffer', iEnvironmental.shopId[i])
return iEnvironmental.shopId[i]
}
}
},
})
\ No newline at end of file
......@@ -17,13 +17,14 @@ let Development = {
// appId 程序内部交互确定门店
// id 数据库门店 id
shopId: [
{ appId: 1, id: '581be62a80bb4f0485abd87abcf64dc0', logo: 'shop/logo-1.png', commodityLogo: 'shop/commodity-logo-1.png', cover: 'shop/cover-1.png', name: '海错图', title: ['海错图', '海错图购票', '海错图', '海错图文创店', '海错图', '海错图', '海错图'] },
{ appId: 2, id: '3cfe2e3b8b4342e8b62f8b45daf60d91', logo: 'shop/logo-2.png', commodityLogo: 'shop/commodity-logo-2.png', cover: 'shop/cover-2.png', name: '星空影院', title: ['星空影院', '星空影院', '星空影院', '星空影院', '星空影院', '星空影院', '星空影院'] },
{ appId: 3, id: '8a3e59c57f564c569b3d7bb278ea50b3', logo: 'shop/logo-3.png', commodityLogo: 'shop/commodity-logo-3.png', cover: 'shop/cover-3.png', name: '儿童营地', title: ['儿童营地', '儿童营地入园购票', '儿童营地', '儿童营地', '儿童营地', '儿童营地接待区', '儿童营地'] },
{ appId: 4, id: 'c63893bb472f43bca4ec72f890bcb4fd', logo: 'shop/logo-4.png', commodityLogo: 'shop/commodity-logo-4.png', cover: 'shop/cover-4.png', name: '原野MOJITO', title: ['原野MOJITO', '原野MOJITO', '原野MOJITO', '原野MOJITO', '原野MOJITO', '原野MOJITO', '原野MOJITO'] },
{ appId: 5, id: '26c40446fc454a02abe61758176597f6', logo: 'shop/logo-5.png', commodityLogo: 'shop/commodity-logo-5.png', cover: 'shop/cover-5.png', name: '拾光花坊', title: ['拾光花坊', '拾光花坊', '拾光花坊', '拾光花坊', '拾光花坊', '拾光花坊', '拾光花坊'] },
{ appId: 6, id: 'd9436d7018de43809824b6ec221ea01f', logo: 'shop/logo-6.png', commodityLogo: 'shop/commodity-logo-6.png', cover: 'shop/cover-6.png', name: '原味舒食', title: ['原味舒食', '原味舒食', '原味舒食', '原味舒食', '原味舒食', '原味舒食', '原味舒食'] },
{ appId: 7, id: '2614f117406548718bc091f24368c16e', logo: 'shop/logo-7.png', commodityLogo: 'shop/commodity-logo-7.png', cover: 'shop/cover-7.png', name: '元养水韵SPA', title: ['元养水韵SPA', '元养水韵SPA', '元养水韵SPA', '元养水韵SPA', '元养水韵SPA', '元养水韵SPA', '元养水韵SPA'] },
{ appId: 1, id: '581be62a80bb4f0485abd87abcf64dc0', logo: 'shop/logo-1.png', commodityLogo: 'shop/commodity-logo-1.png', cover: 'shop/cover-1.png', printUse: 'shop/print/print-1-1.png', print: 'shop/print/print-1-2.png', name: '海错图', title: ['海错图', '海错图购票', '海错图', '海错图文创店', '海错图', '海错图', '海错图'] },
{ appId: 2, id: '3cfe2e3b8b4342e8b62f8b45daf60d91', logo: 'shop/logo-2.png', commodityLogo: 'shop/commodity-logo-2.png', cover: 'shop/cover-2.png', printUse: 'shop/print/print-2-1.png', print: 'shop/print/print-2-2.png', name: '星空影院', title: ['星空影院', '星空影院', '星空影院', '星空影院', '星空影院', '星空影院', '星空影院'] },
{ appId: 3, id: '8a3e59c57f564c569b3d7bb278ea50b3', logo: 'shop/logo-3.png', commodityLogo: 'shop/commodity-logo-3.png', cover: 'shop/cover-3.png', printUse: 'shop/print/print-3-1.png', print: 'shop/print/print-3-2.png', name: '儿童营地', title: ['儿童营地', '儿童营地入园购票', '儿童营地', '儿童营地', '儿童营地', '儿童营地接待区', '儿童营地'] },
{ appId: 4, id: 'c63893bb472f43bca4ec72f890bcb4fd', logo: 'shop/logo-4.png', commodityLogo: 'shop/commodity-logo-4.png', cover: 'shop/cover-4.png', printUse: 'shop/print/print-4-1.png', print: 'shop/print/print-4-2.png', name: '原野MOJITO', title: ['原野MOJITO', '原野MOJITO', '原野MOJITO', '原野MOJITO', '原野MOJITO', '原野MOJITO', '原野MOJITO'] },
{ appId: 5, id: '26c40446fc454a02abe61758176597f6', logo: 'shop/logo-5.png', commodityLogo: 'shop/commodity-logo-5.png', cover: 'shop/cover-5.png', printUse: 'shop/print/print-5-1.png', print: 'shop/print/print-5-2.png', name: '拾光花坊', title: ['拾光花坊', '拾光花坊', '拾光花坊', '拾光花坊', '拾光花坊', '拾光花坊', '拾光花坊'] },
{ appId: 6, id: 'd9436d7018de43809824b6ec221ea01f', logo: 'shop/logo-6.png', commodityLogo: 'shop/commodity-logo-6.png', cover: 'shop/cover-6.png', printUse: 'shop/print/print-6-1.png', print: 'shop/print/print-6-2.png', name: '原味舒食', title: ['原味舒食', '原味舒食', '原味舒食', '原味舒食', '原味舒食', '原味舒食', '原味舒食'] },
{ appId: 7, id: '2614f117406548718bc091f24368c16e', logo: 'shop/logo-7.png', commodityLogo: 'shop/commodity-logo-7.png', cover: 'shop/cover-7.png', printUse: 'shop/print/print-7-1.png', print: 'shop/print/print-7-2.png', name: '元养水韵SPA', title: ['元养水韵SPA', '元养水韵SPA', '元养水韵SPA', '元养水韵SPA', '元养水韵SPA', '元养水韵SPA', '元养水韵SPA'] },
{ appId: 8, id: '2614f117406548718bc091f24368c16e', logo: 'shop/logo-7.png', commodityLogo: 'shop/commodity-logo-7.png', cover: 'shop/cover-7.png', printUse: 'shop/print/print-8-1.png', print: 'shop/print/print-8-2.png', name: '星光广场', title: ['星光广场', '星光广场', '星光广场', '星光广场', '星光广场', '星光广场', '星光广场'] },
]
}
......
......@@ -405,15 +405,37 @@ Page({
})
},
//客服热线拨打
call() {
/**
* 看房预约
* @function
* @param {object} - event
* @returns
*/
onRoomAppointment: function () {
wx.navigateTo({
url: '/pages/commodity/room-appointment/room-appointment?type=2'
})
},
/**
* 拨打客服
* @function
* @param {object} - event
* @returns
*/
customerService: function () {
wx.makePhoneCall({
phoneNumber: this.data.phone,
})
},
//取消拨打
cancel() {
/**
* 拨打客服取消
* @function
* @param {object} - event
* @returns
*/
customerServiceCancel: function () {
this.setData({
hotline: false,
})
......
......@@ -147,8 +147,8 @@
</view>
<view style="position: relative;">
<image class="home_footer" src="{{resourcesBase + 'commodity/home/other.png'}}"></image>
<view class="seeHouse">预约看房</view>
<view class="call" bindtap="call">拨打客服</view>
<view class="seeHouse" bindtap="onRoomAppointment">预约看房</view>
<view class="call" bindtap="customerService">拨打客服</view>
</view>
</view>
</view>
......@@ -156,7 +156,7 @@
<!-- 客服热线 -->
<l-arc-popup show="{{hotline}}" arc-radius="30">
<view class="phone">{{phone}}</view>
<view class="call" bindtap="call">呼叫</view>
<view class="call" bindtap="customerService">呼叫</view>
<view style="height:10rpx;background-color:rgb(246,247,249);"></view>
<view class="call" bindtap="cancel">取消</view>
<view class="call" bindtap="customerServiceCancel">取消</view>
</l-arc-popup>
\ No newline at end of file
......@@ -39,10 +39,10 @@ Page({
})
this.setSideBarStyle()
this.resetShoppingCart()
},
onShow: function () {
this.resetShoppingCart()
this.setCartAnimation()
this.setShopInfo()
......
......@@ -166,7 +166,6 @@ Page({
},
onBuy: function (event) {
let funcAmount = 0
let funcCommodityInfo = event.currentTarget.dataset.item
// 补充必要参数
......
......@@ -34,6 +34,11 @@ Page({
for (let i = 0, l = App.globalData.shopId.length; i < l; i++) {
if (funcShopAppId === App.globalData.shopId[i].appId) {
funcShopId = App.globalData.shopId[i].id
let funcShopInfo = this.data.shopAppId
funcShopInfo[funcIndex].id = App.globalData.shopId[i].id
this.setData({
shopAppId: funcShopInfo
})
break
}
}
......@@ -139,8 +144,26 @@ Page({
})
},
onBuy: function () {
console.log(JSON.stringify(this.data.shopCommodityData) )
onBuy: function (event) {
let funcIndex = event.currentTarget.dataset.index
let funcItemIndex = event.currentTarget.dataset.itemindex
// 保存商店信息
let funcCommodityInfo = this.data.shopCommodityData[funcIndex][funcItemIndex]
let funcShopInfo = App.setShopInfo(this.data.shopAppId[funcIndex].appId)
funcShopInfo.shopType = Number(funcCommodityInfo.typeId)
wx.setStorageSync('shopInfoBuffer', funcShopInfo)
// 补充必要参数
funcCommodityInfo.quantity = 1
funcCommodityInfo.quantityMin = 1
funcCommodityInfo.quantityMax = 1
funcCommodityInfo.isActive = true
wx.setStorageSync('shoppingCartBuffer', [funcCommodityInfo])
wx.navigateTo({
url: '/pages/pay/order-input/order-input?type=' + funcShopInfo.shopType
})
},
/**
......
......@@ -75,7 +75,7 @@
</block>
<view class="commodity-price-operation row con-e align-c">
<button class="row con-c align-c" bindtap="onBuy">购买门票</button>
<button class="row con-c align-c" data-index="{{0}}" data-itemindex="{{index}}" bindtap="onBuy">购买门票</button>
</view>
</view>
</view>
......@@ -141,7 +141,7 @@
</block>
<view class="commodity-price-operation row con-e align-c">
<button class="row con-c align-c" bindtap="onBuy">购买门票</button>
<button class="row con-c align-c" data-index="{{1}}" data-itemindex="{{index}}" bindtap="onBuy">购买门票</button>
</view>
</view>
</view>
......@@ -207,7 +207,7 @@
</block>
<view class="commodity-price-operation row con-e align-c">
<button class="row con-c align-c" bindtap="onBuy">购买门票</button>
<button class="row con-c align-c" data-index="{{2}}" data-itemindex="{{index}}" bindtap="onBuy">购买门票</button>
</view>
</view>
</view>
......
......@@ -88,7 +88,6 @@
left: 0;
max-width: 320rpx;
max-height: 120rpx;
border: 1px red solid;
background: #FFFFFF;
overflow: hidden;
......
const App = getApp()
Page({
data: {
imageBase: App.globalData.appImageBase,
resourcesBase: App.globalData.appResourcesBase,
navigationTitle: '123213231',
formType: 1,
appointmentDate: '',
appointmentEndDate: '',
appointmentComplete: false,
formName: '',
formPhone: '',
formQuantity: 0,
formDate: '',
errorName: '',
errorPhone: '',
errorQuantity: '',
canSubmit: false,
winQuota: false,
// 预约入园剩余名额
total: 0,
},
onLoad: function (options) {
this.setData({
formType: Number(options.type),
navigationTitle: Number(options.type) === 1 ? '夜间入园预约' : '看房预约'
})
console.log(options.type)
this.setReset()
},
setReset: function () {
let funcDate = App.modular.miment(new Date().getTime()).format('YYYY-MM-DD')
let endDate = this.getNextDay(funcDate, 3)
this.setData({
formName: '',
formPhone: '',
formQuantity: this.data.formType === 1 ? 0 : 1,
formDate: funcDate,
appointmentDate: funcDate,
appointmentEndDate: endDate,
})
if (this.data.formType === 1) { // 入园预约
this.getResidue()
}
},
onServic: function () {
wx.makePhoneCall({
phoneNumber: '13856782234'
})
},
onInputBlur: function (event) {
let funcType = event.target.dataset.type
let funcValue = event.detail.value
switch (funcType) {
case 'name':
this.setData({
formName: funcValue
})
if (this.data.formName === '') {
this.setData({
errorName: '请输入姓名'
})
} else {
this.setData({
errorName: ''
})
}
break
case 'phone':
this.setData({
formPhone: funcValue
})
if (this.data.formPhone === '') {
this.setData({
errorPhone: '请输入手机号码'
})
} else if (this.data.formPhone.length != 11) {
this.setData({
errorPhone: '请输入11位手机号码'
})
} else {
this.setData({
errorPhone: ''
})
}
break
}
this.updateSubmitButtonStatus()
},
onQuantityCut: function () {
if (0 < this.data.formQuantity) {
this.setData({
formQuantity: this.data.formQuantity - 1,
errorQuantity: '',
})
}
this.updateSubmitButtonStatus()
},
onQuantityAdd: function () {
if (this.data.total * 1 == 0) {
this.setData({
errorQuantity: '所选日期预约名额已满'
})
} else if (this.data.formQuantity >= this.data.total * 1) {
this.setData({
errorQuantity: '所选日期预约的名额仅剩' + activityTime.residue + '人'
})
} else if (this.data.formQuantity >= 5) {
this.setData({
errorQuantity: '每个账号最多预约5人'
})
} else {
this.setData({
formQuantity: this.data.formQuantity + 1,
errorQuantity: '',
})
}
this.updateSubmitButtonStatus()
},
onSelectionDate: function (event) {
this.setData({
formDate: event.detail.value,
})
if (this.data.formType === 1) { // 入园预约
this.getResidue()
}
},
inspectForm: function () {
let complete = true
if (this.data.formName === '') {
this.setData({
errorName: '请输入姓名'
})
complete = false
} else {
this.setData({
errorName: ''
})
}
if (this.data.formPhone === '') {
this.setData({
errorPhone: '请输入手机号码'
})
complete = false
} else if (this.data.formPhone.length != 11) {
this.setData({
errorPhone: '请输入11位手机号码'
})
complete = false
} else {
this.setData({
errorPhone: ''
})
}
if (this.data.formQuantity === 0) {
this.setData({
errorQuantity: '预约人数不能为 0'
})
complete = false
} else {
this.setData({
errorQuantity: ''
})
}
this.setData({
canSubmit: complete
})
return complete
},
updateSubmitButtonStatus() {
let complete = true
if (this.data.formName === '') {
complete = false
}
if (this.data.formPhone === '') {
complete = false
} else if (this.data.formPhone.length != 11) {
complete = false
}
if (this.data.formQuantity === 0) {
complete = false
}
this.setData({
canSubmit: complete
})
return complete
},
onSubmit: function () {
if (!this.inspectForm()) {
return
}
wx.lin.showToast({
icon: 'loading',
title: '提交中',
show: true,
mask: true,
duration: 1000 * 60,
})
App.wxRequest({
url: '/api/v1/subscribe/doSubscribe',
data: {
mobile: this.data.formPhone,
subscribeNum: this.data.formQuantity,
subscribeDate: this.data.formDate + ' 00:00:00',
name: this.data.formName,
type: this.data.formType === 1 ? 0 : 1,
},
success: (res) => {
this.setData({
appointmentComplete: true,
})
wx.lin.hideToast()
},
fail: (err) => {
wx.lin.showToast({
image: '/image/error.png',
title: err.msg,
})
}
})
},
onAppointmentComplete: function () {
this.setData({
appointmentComplete: false,
})
wx.navigateBack({
delta: 1
})
},
// 预约入园查询返回剩余名额
getResidue() {
App.login({
success: function () {
App.wxRequest({
url: '/api/v1/subscribe/getResidue',
data: {
subscribeDate: this.data.formDate + ' 00:00:00',
type: 0,
},
success: (res) => {
this.setData({
total: res.data.total,
winQuota: true,
formQuantity: 0,
})
this.updateSubmitButtonStatus()
}
})
}
})
},
getNextDay(d, t) {
console.log(d, t)//格式为---2019-02-13 3
d = new Date(d);
console.log(d)//格式为---Wed Feb 13 2019 08:00:00 GMT+0800 (中国标准时间)
d = +d + (1000 * 60 * 60 * 24) * t;
console.log(d)//格式为--时间戳1550275200000
d = new Date(d);
console.log(d)//格式为---Sat Feb 16 2019 08:00:00 GMT+0800 (中国标准时间)
return App.modular.miment(new Date(d)).format("YYYY-MM-DD") //格式为"2019-02-16 00:00:00"
},
})
\ No newline at end of file
<!--pages/home/home/home.wxml-->
<text>pages/home/home/home.wxml</text>
<l-toast l-image-class="toast-image"></l-toast>
<!-- 首页 - 入园预约 / 房屋预约 -->
<navigation class="navigation" titleText="{{navigationTitle}}" color="#FFFFFF" backIcon="{{'../../image/icon/arrow-l-2.png'}}"></navigation>
<view class="appointment-complete row con-c align-c" wx:if="{{appointmentComplete}}">
<view class="appointment-complete-tip">
<image wx:if="{{formType === 1}}" src="./image/tip-1.png"></image>
<image wx:if="{{formType === 2}}" src="./image/tip-2.png"></image>
<l-button l-class="button" plain="{{true}}" bind:lintap="onAppointmentComplete">我知道了</l-button>
</view>
</view>
<!-- 入园预约 -->
<view wx:if="{{formType === 1}}" class="container">
<view class="appointment-tip">
<image class="background-image" src="./image/banner-1.png"></image>
<image class="ornament-wave" src="/image/ornament-2.png" mode="widthFix"></image>
</view>
<view class="form-title row con-s align-c">
<text>填写预约信息</text>
</view>
<view class="form">
<!-- 名字输入 -->
<view class="row align-c">
<view class="input-label row con-b align-c">
<text>姓</text>
<text>名</text>
</view>
<view class="input-wrap row align-c">
<input maxlength="16" class="text" placeholder-class="input-tip" placeholder="请输入名字" data-type="name" bindblur="onInputBlur"></input>
</view>
</view>
<view class="form-error row align-c">
<text hidden="{{errorName ? false : true}}">{{errorName}}</text>
</view>
<!-- 手机输入 -->
<view class="row align-c">
<view class="input-label row con-b align-c">
<text>手</text>
<text>机</text>
<text>号</text>
</view>
<view class="input-wrap row align-c">
<input maxlength="11" type="number" class="text" placeholder-class="input-tip" placeholder="请输入手机号" data-type="phone" bindblur="onInputBlur"></input>
</view>
</view>
<view class="form-error row align-c">
<text hidden="{{errorPhone ? false : true}}">{{errorPhone}}</text>
</view>
<!-- 预约人数 -->
<view class="row align-c">
<view class="input-label row con-b align-c">
<text>预</text>
<text>约</text>
<text>人</text>
<text>数</text>
</view>
<view class="input-wrap row con-b align-c" style="padding: 0">
<l-button special="{{true}}" bind:lintap="onQuantityCut">
<image class="input-icon" src="{{imageBase + 'icon/cut-1.png'}}"></image>
</l-button>
<text class="text" style="{{formQuantity === 0 ? 'color: #C2C7CF' : 'color: #15191F'}}">{{formQuantity}}</text>
<l-button special="{{true}}" bind:lintap="onQuantityAdd">
<image class="input-icon" src="{{imageBase + 'icon/add-1.png'}}"></image>
</l-button>
</view>
</view>
<view class="form-error row align-c">
<text hidden="{{errorQuantity ? false : true}}">{{errorQuantity}}</text>
</view>
<!-- 预约日期 -->
<view class="row align-c">
<view class="input-label row con-b align-c">
<text>预</text>
<text>约</text>
<text>日</text>
<text>期</text>
</view>
<view class="input-wrap row con-b align-c" style="padding: 0 0 0 24rpx">
<picker class="input-picker" mode="date" value="{{date}}" start="{{appointmentDate}}" end="{{appointmentEndDate}}" bindchange="onSelectionDate">
<view class="picker text" style="display: inline-block;width:400rpx">{{formDate}}</view>
<image class="input-icon" style="float: right;" src="{{imageBase + 'icon/arrow-r-1.png'}}"></image>
</picker>
</view>
</view>
<view class="quota row con-e align-c" hidden="{{!winQuota}}">
<text>剩余名额:</text>
<text>{{total}}人</text>
</view>
</view>
<view class="appointment-operation">
<button class="{{canSubmit ? 'button' : 'button-disable'}} row con-c align-c" bindtap="onSubmit">确认预约</button>
<button class="button-plain row con-c align-c" bindtap="onServic">电话咨询</button>
</view>
</view>
<!-- 看房预约 -->
<view wx:if="{{formType === 2}}" class="container">
<view class="appointment-tip">
<image class="background-image" src="./image/banner-2.png"></image>
<image class="ornament-wave" src="/image/ornament-2.png" mode="widthFix"></image>
</view>
<view class="form-title row con-s align-c">
<text>填写预约信息</text>
</view>
<view class="form">
<!-- 名字输入 -->
<view class="row align-c">
<view class="input-label row con-b align-c">
<text>姓</text>
<text>名</text>
</view>
<view class="input-wrap row align-c">
<input maxlength="16" class="text" placeholder-class="input-tip" placeholder="请输入名字" data-type="name" bindblur="onInputBlur"></input>
</view>
</view>
<view class="form-error row align-c">
<text hidden="{{errorName ? false : true}}">{{errorName}}</text>
</view>
<!-- 手机输入 -->
<view class="row align-c">
<view class="input-label row con-b align-c">
<text>手</text>
<text>机</text>
<text>号</text>
</view>
<view class="input-wrap row align-c">
<input maxlength="11" type="number" class="text" placeholder-class="input-tip" placeholder="请输入手机号" data-type="phone" bindblur="onInputBlur"></input>
</view>
</view>
<view class="form-error row align-c">
<text hidden="{{errorPhone ? false : true}}">{{errorPhone}}</text>
</view>
<!-- 预约日期 -->
<view class="row align-c">
<view class="input-label row con-b align-c">
<text>看</text>
<text>房</text>
<text>日</text>
<text>期</text>
</view>
<view class="input-wrap row align-c" style="padding: 0 0 0 24rpx">
<picker class="input-picker" mode="date" value="{{date}}" start="{{appointmentDate}}" bindchange="onSelectionDate">
<view class="picker text" style="display: inline-block;width:400rpx">{{formDate}}</view>
<image class="input-icon" style="float: right;" src="{{imageBase + 'icon/arrow-r-1.png'}}"></image>
</picker>
</view>
</view>
</view>
<view class="appointment-operation">
<button class="{{canSubmit ? 'button' : 'button-disable'}} row con-c align-c" bindtap="onSubmit">确认预约</button>
</view>
</view>
\ No newline at end of file
/* pages/home/home/home.wxss */
\ No newline at end of file
.navigation {
z-index: 1900;
position: fixed;
top: 0;
left: 0;
width: 750rpx;
}
/* 预约完成 */
.appointment-complete {
z-index: 1900;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.65);
}
.appointment-complete-tip {
position: relative;
width: 606rpx;
height: 840rpx;
}
.appointment-complete-tip image {
width: 606rpx;
height: 840rpx;
}
.appointment-complete .button {
position: absolute;
bottom: 64rpx;
left: 88rpx;
width: 432rpx;
height: 80rpx;
border: 1px #15191f solid;
border-radius: 2px;
color: #15191f;
background: #fefcf9;
}
/* 预约提示 */
.appointment-tip {
position: relative;
width: 750rpx;
height: 552rpx;
}
.appointment-tip image {
width: 750rpx;
height: 552rpx;
}
.ornament-wave {
position: absolute;
bottom: 0;
left: 0;
width: 750rpx;
height: 50rpx;
}
/* 表单 */
.form-title {
width: 750rpx;
margin-top: 40rpx;
padding: 0 40rpx;
font-size: 30rpx;
color: #959DA9;
}
.input-label {
width: 120rpx;
height: 80rpx;
margin-top: 32rpx;
margin-right: 40rpx;
font-size: 30rpx;
font-weight: 400;
line-height: 42rpx;
color: #1E2025;
}
.input-wrap {
width: 510rpx;
height: 80rpx;
margin-top: 32rpx;
padding: 0 24rpx;
border: 1px #DBDFE5 solid;
border-radius: 2px;
}
.input-wrap .text {
font-size: 30rpx;
font-weight: 400;
color: #1E2025;
line-height: 80rpx;
}
.input-tip {
font-size: 30rpx;
color: #C2C7CF;
line-height: 32rpx;
}
.input-icon {
width: 80rpx;
height: 80rpx;
padding: 22rpx;
}
.input-picker {
flex-grow: 1;
display: flex;
}
.form-error {
width: 510rpx;
height: 32rpx;
margin-top: 8rpx;
margin-left: 160rpx;
font-size: 22rpx;
font-weight: 400;
color: #D92B3A;
line-height: 32rpx;
}
.quota {
position: relative;
top: 16rpx;
right: 0;
height: 42rpx;
}
.quota text:nth-child(1) {
font-size: 30rpx;
color: #1E2025;
}
.quota text:nth-child(2) {
font-size: 30rpx;
color: #86C5E1;
}
/* 操作按钮 */
.appointment-operation {
width: 750rpx;
margin-top: 30rpx;
padding: 30rpx 40rpx;
background: #ffffff;
}
.appointment-operation .button {
width: 670rpx;
height: 96rpx;
margin-bottom: 40rpx;
background: #86C5E1;
border-radius: 2px;
font-size: 30rpx;
font-weight: 500;
color: #ffffff;
line-height: 42rpx;
}
.appointment-operation .button-plain {
width: 670rpx;
height: 96rpx;
margin-bottom: 40rpx;
background: #FFFFFF;
border:1px solid #86C5E1;
border-radius: 2px;
font-size: 30rpx;
font-weight: 500;
color: #86C5E1;
line-height: 42rpx;
}
.appointment-operation .button-disable {
width: 670rpx;
height: 96rpx;
margin-bottom: 40rpx;
background: #C8E1EC;
border: 1px solid #C8E1EC;
border-radius: 2px;
font-size: 30rpx;
font-weight: 500;
color: #ffffff;
line-height: 42rpx;
}
......@@ -159,7 +159,7 @@ Page({
let funcShoppingCart = this.data.shoppingCart
if (funcShoppingCart[funcIndex].quantityMax <= funcShoppingCart[funcIndex].quantity) return
funcShoppingCart[funcIndex].quantity = funcShoppingCart[funcIndex].quantity + 100
funcShoppingCart[funcIndex].quantity = funcShoppingCart[funcIndex].quantity + 1
this.setData({
shoppingCart: funcShoppingCart
})
......
let App = getApp()
let output = {
/**
* 提取令牌有效期限
* @function
* @param {event}
* @returns
*/
term: function (funcToken) {
let funcIndex = funcToken.indexOf('.') + 1
let funcDateBase = funcToken.substring(funcIndex)
funcIndex = funcDateBase.indexOf('.')
funcDateBase = funcDateBase.substring(0, funcIndex)
let funcDateInfo = App.modular.base64.Base64.decode(funcDateBase)
let funcDateKey = '"exp":'
let funcDateString = funcDateInfo.substring(funcDateInfo.indexOf(funcDateKey) + funcDateKey.length, funcDateInfo.length)
funcDateString = funcDateString.substring(0, funcDateString.indexOf(','))
return Number(funcDateString)
},
/**
* 根据时间判断当前令牌状态
* @function
* @param {string} - funcToken
* @returns
*/
state: function (funcToken) {
let funcDate = output.term(funcToken)
let funcNowDate = Math.round(new Date() / 1000)
// 令牌有效
if (funcNowDate < funcDate) {
// 判断当前时间是否小于令牌期限
if (funcNowDate + 1200 < funcDate) {
// 令牌有效时间大于安全时间
console.log('[token] valid')
return 'valid'
} else {
console.log('[token] refresh')
return 'refresh'
}
}
// 令牌无效继续判断刷新令牌是否有效
funcDate = output.term(localStorage.getItem('refresh'))
// 令牌过期,刷新令牌有效需要重新登录
if (funcNowDate < funcDate) {
console.log('[token] relist')
return 'relist'
}
// 令牌过期,刷新令牌过期默认游客身份
if (funcNowDate > funcDate) {
console.log('[token] invalid')
return 'invalid'
}
},
}
export default output
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment