Commit 6e798bc0 by fengzhaoyu

访客初版

parent a121fc89
...@@ -83,6 +83,7 @@ const $http = (url, data, type, loadingType) => { ...@@ -83,6 +83,7 @@ const $http = (url, data, type, loadingType) => {
}) })
}, },
fail: function(err) { fail: function(err) {
debugger
dd.hideLoading() dd.hideLoading()
if(err.status == 426) { if(err.status == 426) {
dd.removeStorageSync({key: 'token'}) dd.removeStorageSync({key: 'token'})
...@@ -91,6 +92,7 @@ const $http = (url, data, type, loadingType) => { ...@@ -91,6 +92,7 @@ const $http = (url, data, type, loadingType) => {
}) })
} }
else { else {
debugger
dd.alert({ dd.alert({
content:'请检查网络并下拉重试', content:'请检查网络并下拉重试',
buttonText: '确定' buttonText: '确定'
...@@ -148,6 +150,7 @@ const $http = (url, data, type, loadingType) => { ...@@ -148,6 +150,7 @@ const $http = (url, data, type, loadingType) => {
}) })
}, },
fail: function(err) { fail: function(err) {
debugger
if(err.status == 426) { if(err.status == 426) {
dd.hideLoading() dd.hideLoading()
dd.removeStorageSync({ dd.removeStorageSync({
......
{ {
"pages": [ "pages": [
"pages/action/action", "pages/action/action",
"pages/reservations/reservations",
"pages/visitorsDetail/visitorsDetail", "pages/visitorsDetail/visitorsDetail",
"pages/visitors/visitors", "pages/visitors/visitors",
"pages/reservations/reservations",
"pages/index/index", "pages/index/index",
"pages/alipayRecharge/alipayRecharge", "pages/alipayRecharge/alipayRecharge",
"pages/allowanceList/allowanceList", "pages/allowanceList/allowanceList",
...@@ -15,7 +15,10 @@ ...@@ -15,7 +15,10 @@
"pages/noPermission/noPermission", "pages/noPermission/noPermission",
"pages/allowanceRecordList/allowanceRecordList", "pages/allowanceRecordList/allowanceRecordList",
"pages/reTry/reTry", "pages/reTry/reTry",
"pages/example/example" "pages/example/example",
"pages/historyVistiors/historyVistiors",
"pages/externalContact/externalContact",
"pages/phoneAddressBook/phoneAddressBook"
], ],
"window": { "window": {
"enableWK": "YES", "enableWK": "YES",
......
const app = getApp()
import create from 'dd-store'
import exampleStore from '/stores/exampleStore'
import $http from './../../API/http'
create.Page({
store: exampleStore,
useAll: true,
data: {
query: ''
},
onLoad(query) {
console.log(query.index, 'query')
this.setData({ query: query.index })
dd.setNavigationBar({
title: '外部联系人',
});
},
onReady() {
const _that = this
dd.chooseExternalUsers({
multiple: false, //是否多选 true多选,false单选,默认是单选
limitTips: "超出了",
maxUsers: 1, //默认不限制
success: function(res) {
if (_that.data.query == 0) {
_that.store.data.visitorName = res[0].name
_that.store.data.selectVisitors = false
_that.update()
}
else {
_that.store.data.visitorPeer[_that.data.query -1].name = res[0].name
_that.store.data.selectVisitors = false
_that.update()
}
dd.navigateBack({
delta: 1
})
},
fail: function(err) {
}
});
},
onShow() {
// 页面显示
},
onHide() {
// 页面隐藏
},
onUnload() {
// 页面被关闭
},
onTitleClick() {
// 标题被点击
},
onReachBottom() {
},
onShareAppMessage() {
// 返回自定义分享信息
return {
title: 'My App',
desc: 'My App description',
path: 'pages/index/index',
};
},
});
{}
\ No newline at end of file
<view>
New Page
</view>
\ No newline at end of file
Page({
data: {},
onLoad() {},
});
{}
\ No newline at end of file
...@@ -19,6 +19,6 @@ ...@@ -19,6 +19,6 @@
<view onTap="navigatorToNext" data-type="2"><image mode="scaleToFill" src="./../../assets/recharge.png"/>充值</view> <view onTap="navigatorToNext" data-type="2"><image mode="scaleToFill" src="./../../assets/recharge.png"/>充值</view>
<view onTap="navigatorToNext" data-type="3"><image mode="scaleToFill" src="./../../assets/allowance.png"/>津贴</view> <view onTap="navigatorToNext" data-type="3"><image mode="scaleToFill" src="./../../assets/allowance.png"/>津贴</view>
<view onTap="navigatorToNext" data-type="4"><image mode="scaleToFill" src="./../../assets/bill.png"/>账单</view> <view onTap="navigatorToNext" data-type="4"><image mode="scaleToFill" src="./../../assets/bill.png"/>账单</view>
<view onTap="navigatorToNext" data-type="5"><image mode="scaleToFill" src="./../../assets/bill.png"/>{{title}}</view> <view onTap="navigatorToNext" data-type="5"><image mode="scaleToFill" src="./../../assets/bill.png"/>{{visitorName}}</view>
</view> </view>
</view> </view>
const app = getApp()
import create from 'dd-store'
import exampleStore from '/stores/exampleStore'
import $http from './../../API/http'
create.Page({
store: exampleStore,
useAll: true,
data: {
},
onLoad(query) {
console.log(query.visitorId, 'query')
dd.setNavigationBar({
title: '手机通讯录',
});
},
onReady() {
const _that = this
dd.choosePhonebook({
multiple: false, //是否多选: true多选 false单选; 默认true
maxUsers: 1, //人数限制,当multiple为true才生效,可选范围1-1500
success: function(res) {
if (_that.data.query == 0) {
_that.store.data.visitorName = res[0].name
_that.store.data.selectVisitors = false
_that.update()
}
else {
_that.store.data.visitorPeer[_that.data.query - 1] = res[0].name
_that.store.data.selectVisitors = false
_that.update()
}
dd.navigateBack({
delta: 1
})
},
fail: function(err) {
}
});
// dd.chooseExternalUsers({
// multiple: false, //是否多选 true多选,false单选,默认是单选
// limitTips: "超出了",
// maxUsers: 1, //默认不限制
// success: function(res) {
// _that.store.data.visitorName = res[0].name
// _that.store.data.selectVisitors = false
// _that.update()
// dd.navigateBack({
// delta: 1
// })
// },
// fail: function(err) {
// }
// });
},
onShow() {
// 页面显示
},
onHide() {
// 页面隐藏
},
onUnload() {
// 页面被关闭
},
onTitleClick() {
// 标题被点击
},
onReachBottom() {
},
onShareAppMessage() {
// 返回自定义分享信息
return {
title: 'My App',
desc: 'My App description',
path: 'pages/index/index',
};
},
});
...@@ -2,11 +2,23 @@ ...@@ -2,11 +2,23 @@
font-family: 'PingFangSC-Regular'; font-family: 'PingFangSC-Regular';
} }
.visitorInformation { .appointment {
padding: 0 32rpx; background: white;
}
.appointmentSelect {
background: white;
height: 100vh;
} }
.visitorInformationTitle { @import '../../fonts/iconfont.acss';
/* .visitorInfo {
height: 74rpx;
line-height: 74rpx;
} */
.visitorInfoTitle {
padding: 0 30rpx;
height: 76rpx; height: 76rpx;
line-height: 76rpx; line-height: 76rpx;
background: #F7F7F7; background: #F7F7F7;
...@@ -14,6 +26,334 @@ ...@@ -14,6 +26,334 @@
font-size: 32rpx; font-size: 32rpx;
color: #7D8082; color: #7D8082;
} }
.visitorName { .visitorName {
padding: 0 32rpx;
width: 684rpx;
height: 112rpx;
line-height: 112rpx;
background: white;
display: flex;
/* font-size: 34rpx; */
color: #000;
border-bottom: 2rpx solid #F8F8F8;
}
.visitorNameText {
font-size: 34rpx;
font-weight: 400;
width: 30%;
height: 100%;
line-height: 112rpx;
}
.mandatory {
color: #F28C85;
margin-right: 6rpx;
}
.visitorInput {
width: 50%;
height: 112rpx;
line-height: 112rpx;
}
.visitorInput input {
display: inline-block;
vertical-align: middle;
outline: none;
width: 100%;
font-size: 32rpx;
line-height: 112rpx;
color: #999;
}
.icontongxunlu {
width: 20%;
text-align: right;
color: #1C92FF;
font-size: 44rpx;
float: right;
}
.visitorPhoneInput {
margin-left: 100rpx;
}
.visitorComNameText {
text-indent: 25rpx;
}
.accessTime {
height: 216rpx;
background: white;
overflow: hidden;
display: flex;
padding: 0 32rpx;
}
.startTime {
width: 40%;
height: 100%;
}
.startTimeTop {
height: 44rpx;
line-height: 44rpx;
color: #343434;
font-size: 34rpx;
margin-top: 36rpx;
display: flex
}
.startTimeBottop {
margin-top: 10rpx;
color: #343434;
font-size: 34rpx;
}
.startTimeBottop view {
height: 44rpx;
line-height: 44rpx;
}
.minute {
color: #000;
margin-top: 10rpx;
}
.fu {
font-size: 60rpx;
height: 100%;
line-height: 216rpx;
color: #D4D4D4;
margin: 0 32rpx 0 144rpx;
}
.purpose {
border-top: 2rpx solid #F8F8F8;
height: 112rpx;
line-height: 112rpx;
display: flex;
background: white;
padding: 0 32rpx;
}
.purposeTitle {
width: 30%;
height: 100%;
font-size: 34rpx;
color: #000;
text-indent: 28rpx;
}
.purposeContent {
width: 50%;
color: rgb(153, 153, 153);
font-size: 32rpx;
margin-left: 86rpx;
}
.iconzhankai {
width: 20%;
font-size: 40rpx;
text-align: right;
}
.accessInfo {
overflow: hidden;
}
.line {
height: 2rpx;
width: 100%;
margin-left: 32rpx;
background: #EEEEEE;
}
.inputPurpose {
width: 476rpx;
float: right;
height: 110rpx;
line-height: 110rpx;
font-size: 0.32rpx;
border-bottom: 2rpx solid #EEEEEE
}
.inputPurpose input {
line-height: 110rpx;
vertical-align: middle;
color: #808386
}
.address {
overflow: hidden;
width: 686rpx;
padding: 0 32rpx;
height: 144rpx;
display: flex;
overflow: hidden;
border-bottom: 2rpx solid #EEEEEE;
}
.address>view {
margin-top: 32rpx;
}
.address .addressTitle {
width: 30%;
height: 44rpx;
}
.addressDetail {
width: 482rpx;
height: 80rpx;
line-height: 40rpx;
font-size: 32rpx;
color: #717579;
margin-left: 20rpx;
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.companionsTitle {
display: flex;
justify-content: space-between;
}
.iconshanchu {
color: #D4D5D6;
font-size: 40rpx;
line-height: 76rpx;
}
.addCompanions {
padding: 0 32rpx;
height: 112rpx; height: 112rpx;
color: #1C92FF;
font-size: 34rpx;
line-height: 112rpx;
display: flex;
}
.iconjia {
margin-right: 12rpx;
font-size: 40rpx;
}
.moreJia {
color: #1C92FF;
float: right;
}
.moreName {
justify-content: space-between;
}
.isHidden {
height: 120rpx;
font-size: 34rpx;
color: #3296FA;
line-height: 120rpx;
text-align: center;
background: #F7F7F7;
}
.confirmAppointment {
padding: 32rpx 34rpx;
}
.confirmAppointmentButton {
height: 96rpx;
line-height: 96rpx;
font-size: 34rpx;
text-align: center;
color: white;
background: #3296FA;
border-radius: 6rpx;
}
.selectVisitors {
height: 100vh;
width: 686rpx;
padding: 0 32rpx;
background: #000;
background: rgba(0, 0, 0, 0.2);
position: fixed;
top: 0;
z-index: 10001
}
.selectVisitor {
position: fixed;
left: 32rpx;
;
right: 32rpx;
bottom: 140rpx;
overflow: hidden;
width: 686rpx;
height: 380rpx;
background: #F2F2F2;
border-radius: 20rpx;
}
.selectVisitorTitle {
color: #AFAEB3;
height: 80rpx;
font-size: 30rpx;
text-align: center;
line-height: 80rpx;
}
.select {
height: 100rpx;
border-top: 2rpx solid #E1E1E1;
color: #0A7FFE;
font-size: 34rpx;
line-height: 100rpx;
text-align: center;
}
.selectCancel {
width: 686rpx;
position: fixed;
bottom: 20rpx;
left: 32rpx;
;
right: 32rpx;
height: 100rpx;
text-align: center;
line-height: 100rpx;
color: #0A7FFE;
font-size: 34rpx;
margin-top: 20rpx;
border-radius: 20rpx;
background: #F2F2F2;
}
.ccPeople {
padding: 0px 0.32rem;
width: 6.84rem;
height: 1.12rem;
line-height: 1.12rem;
background: white;
display: flex;
color: rgb(0, 0, 0);
border-bottom: 0.5px solid rgb(248, 248, 248);
display: flex;
align-items: center;
}
.ccPeople view {
height: 100rpx;
width: 100rpx;
border-radius: 50%;
background: blue;
margin-right: 10rpx;
color: white;
overflow: hidden;
text-align: center;
} }
\ No newline at end of file
<view> <scroll-view class="appointment" scroll-y="{{selectVisitors?true:false}}">
<form onSubmit="formSubmit" onReset="formReset"> <view class="visitorInfo">
<view class='visitorInformation'> <view class="visitorInfoTitle">访客信息</view>
<view class=' visitorInformationTitle'> 访客信息</view> <view class="visitorName">
<view class='visitorName'> <view class="visitorNameText">
<text class='mandatory'>*</text> <text class="mandatory">*</text>
<text>访客姓名</text> 访客姓名
<input placeholder="请输入或选择" /> </view>
<text class=''>text</text> <view class="visitorInput">
</view> <input placeholder="请输入或选择" value="{{visitorName}}" onInput='changeMainVisitor' data-index='{{0}}' />
</view> </view>
</form> <text class="icontongxunlu iconfont" onTap="selectVisitors" data-index='{{0}}'></text>
</view> </view>
\ No newline at end of file <view class="visitorName">
<view class="visitorNameText">
<text class="mandatory">*</text>
访客手机
</view>
<view class=" visitorInput visitorPhoneInput ">
<input placeholder="请输入" />
</view>
</view>
<view class="visitorName">
<view class="visitorNameText visitorComNameText">
访客单位
</view>
<view class="visitorInput visitorPhoneInput">
<input placeholder="请输入" />
</view>
</view>
</view>
<view class="accessInfo">
<view class="accessInfoTitle visitorInfoTitle ">访问信息</view>
<view class="accessTime">
<view class="startTime">
<view class="startTimeTop">
开始
</view>
<view class="startTimeBottop" onTap="selectStartTime">
<view>{{startTime}}</view>
<view class="minute">{{startTimeHour}}</view>
</view>
</view>
<view class=" iconfont fu"></view>
<view class="startTime">
<view class="startTimeTop">
结束
</view>
<view class="startTimeBottop" onTap="selectEndTime">
<view>{{endTime}}</view>
<view class="minute">{{endTimeHour}}</view>
</view>
</view>
</view>
<picker value="{{0}}" range="{{Purposes}}" onChange='selectPurpose'>
<view>
<view class="purpose">
<view class="purposeTitle">来访目的</view>
<view class="purposeContent">{{currentPurpose}}</view>
<view class="iconfont iconzhankai"></view>
</view>
</view>
</picker>
<view class="line"></view>
<view class="inputPurpose" a:if='{{isInput}}'>
<input placeholder="请输入来访目的" />
</view>
<picker value="{{0}}" range="{{arriveAddress}}" onChange='selectAddress'>
<view>
<view class="address">
<view class="addressTitle">
<text class="mandatory">*</text>
到访地址
</view>
<view class="addressDetail">{{defaultAddress}}</view>
<view class="iconfont iconzhankai"></view>
</view>
</view>
</picker>
</view>
<view class="companions" a:for="{{visitorPeer}}" a:for-index="index" a:for-item="item">
<view class="companionsTitle visitorInfoTitle">
同行访客
<view class="iconshanchu iconfont" onTap="closeVisitor" data-index='{{index}}' ></view>
</view>
<view class="visitorName">
<view class="visitorNameText">
<text class="mandatory">*</text>
访客姓名
</view>
<view class="visitorInput">
<input placeholder="请输入或选择" value="{{item.name}}" />
</view>
<text class="icontongxunlu iconfont" data-index='{{index + 1}}' onTap="selectVisitors"></text>
</view>
<view class="visitorName">
<view class="visitorNameText">
<text class="mandatory">*</text>
访客手机
</view>
<view class=" visitorInput visitorPhoneInput ">
<input placeholder="请输入" />
</view>
</view>
</view>
<view class="addCompanions" onTap="addCompanions">
<view class="iconjia iconfont"></view>
添加同行人员
</view>
<view class="more">
<view class="moreTitle visitorInfoTitle">更多信息</view>
<view class="visitorName moreName">
<view class="visitorNameText visitorComNameText">
周知人数
</view>
<view class="iconfont iconjia moreJia" onTap="copyPerson">
</view>
</view>
<view class="ccPeople" >
<view a:for="{{copyPerson}}" a:for-index="index" a:for-item="item"></view>
</view>
<view class="visitorName">
<view class="visitorNameText visitorComNameText">
备注
</view>
<view class="visitorInput">
<input placeholder="请输入" />
</view>
</view>
<view class="isHidden">
收起更多消息
<!--<text class='iconzhankai iconfont'></text> -->
<text class='iconshouqi iconfont'></text>
</view>
</view>
<view class="confirmAppointment">
<view class="confirmAppointmentButton" onTap="confirmAppointment">确认预约</view>
</view>
<view class="selectVisitors" a:if='{{selectVisitors}}'>
<view class="selectVisitor">
<view class="selectVisitorTitle">选择访客</view>
<view class="select" onTap="historyVistiorsSelect">历史访客</view>
<view class="select" onTap="externalContactSelect">外部联系人</view>
<view class="select" onTap="phoneAddressBookSelect">手机通讯录</view>
</view>
<view class='selectCancel' onTap="selectCancel">取消</view>
</view>
</scroll-view>
\ No newline at end of file
const app = getApp() const app = getApp()
import $http from './../../API/http' import $http from './../../API/http'
Page({ import create from 'dd-store'
import exampleStore from '/stores/exampleStore'
create.Page({
store: exampleStore,
useAll: true,
data: { data: {
startTime: '00年00月00日',
startTimeHour: '00:00',
endTime: '00年00月00日',
endTimeHour: '00:00',
startTimes: '',
endTimes: '',
Purpose: '',
Purposes: [],
currentPurpose: '',
isInput: true,
arriveAddress: [],
defaultAddress: '',
Companions: [],
copyPerson: [],
index: '',
copyPerson: []
}, },
onLoad(query) { onLoad(query) {
dd.setNavigationBar({ dd.setNavigationBar({
title: '预约访客', title: '预约访客',
}); });
this.Purpose()
this.arriveAddress()
}, },
reTry() { changeMainVisitor(event) {
dd.redirectTo({ console.log(event.detail.value)
url: '/pages/action/action' },
// 点击通讯录选择访客 控制遮照层是否层出
selectVisitors(event) {
this.setData({ index: event.target.dataset.index })
this.store.data.selectVisitors = true
this.update()
},
// 取消遮照层
selectCancel() {
this.store.data.selectVisitors = false
this.update()
},
// 点击外部联系人
externalContactSelect(event) {
dd.navigateTo({ url: `./../externalContact/externalContact?index=${this.data.index}` });
},
// 点击手机通讯录
phoneAddressBookSelect() {
dd.navigateTo({ url: `./../phoneAddressBook/phoneAddressBook?index=${this.data.index}` });
},
// 添加同行人员
addCompanions() {
if (this.store.data.visitorPeer.length < 4) {
this.store.data.visitorPeer.push({ name: '', index: '' })
console.log(this.store.data.visitorPeer)
this.update()
} else {
dd.alert({
content: '最多可添加四名同行人员',
buttonText: '确定'
})
}
},
// 关闭同行访客
closeVisitor(event) {
this.store.data.visitorPeer.splice(event.target.dataset.index, 1)
this.update()
},
// 周知人
copyPerson() {
const _that = this
dd.complexChoose({
title: "选择周知人", //标题
multiple: true, //是否多选
limitTips: "最多可选取6人", //超过限定人数返回提示
maxUsers: 6, //最大可选人数
responseUserOnly: true, //返回人,或者返回人和部门
success: function(res) {
let copyPerson = []
res.users.forEach((item, index) => {
copyPerson.push(item)
})
_that.setData({
copyPerson: copyPerson
})
},
fail: function(err) {
}
})
},
// 提交预约单
confirmAppointment() {
debugger
let data = {
startTime: this.data.startTimes,
endTime: this.data.endTimes,
purpose:this.data.currentPurpose,
visitAddress: this.data.defaultAddress,
}
$http.$http('/admin/visitor/addRecord', data, 'post').then(res => {
console.log(res,66666666666)
})
},
selectStartTime() {
dd.datePicker({
format: 'yyyy-MM-dd HH:mm',
success: (res => {
let time = this.timeToStr(res.date)
this.setData({
startTime: `${time.year}${time.month}${time.date}日`,
startTimeHour: `${time.hour}:${time.minute}`,
startTimes: res.date
})
})
})
},
selectEndTime() {
dd.datePicker({
format: 'yyyy-MM-dd HH:mm',
success: (res => {
let time = this.timeToStr(res.date)
this.setData({
endTime: `${time.year}${time.month}${time.date}日`,
endTimeHour: `${time.hour}:${time.minute}`,
endTimes: res.date
})
})
}) })
},
selectPurpose(event) {
this.setData({
currentPurpose: this.data.Purpose[event.detail.value].visitPurpose
})
this.isInput()
},
selectAddress(event) {
this.setData({
defaultAddress: this.data.arriveAddress[event.detail.value].address
})
},
arriveAddress() {
$http.$http('/admin/address/list', {}, 'get').then(res => {
console.log(res, 'arriveAddress')
let arriveAddress = []
res.forEach((item, index) => {
arriveAddress.push(item.address)
if (item.isDefault == '0') {
this.setData({ defaultAddress: item.address })
}
})
if (this.data.defaultAddress == '') {
this.setData({ defaultAddress: arriveAddress[0] })
}
this.setData({ arriveAddress: arriveAddress })
})
},
Purpose() {
$http.$http('/admin/visit-purpose/list', {}, 'post').then(res => {
console.log(res, 'Purpose')
let Purposes = []
res.forEach((item, index) => {
Purposes.push(item.visitPurpose)
})
this.setData({
Purpose: res,
Purposes: Purposes,
currentPurpose: res[0].visitPurpose,
})
})
},
timeToStr(time) {
time = time.replace(/\-/g, "/")
let timeData = new Date(time)
console.log('timeData', timeData)
let year = timeData.getFullYear()
let month = timeData.getMonth() + 1
let date = timeData.getDate()
let hour = timeData.getHours()
let minute = timeData.getMinutes()
return {
year: year,
month: month.toString().length > 1 ? month : '0' + month,
date: date.toString().length > 1 ? date : '0' + date,
hour: hour.toString().length > 1 ? hour : '0' + hour,
minute: minute.toString().length > 1 ? minute : '0' + minute
}
},
isInput() {
if (this.data.currentPurpose != '其他') {
this.setData({
isInput: false
})
}
else {
this.setData({
isInput: true
})
}
},
test() {
}, },
onReady() { onReady() {
}, },
onShow() { onShow() {
// 页面显示 // 页面显示
......
...@@ -2,6 +2,9 @@ class Store { ...@@ -2,6 +2,9 @@ class Store {
data = { data = {
title: '测试', title: '测试',
visitorName: '',
selectVisitors: false, //控制遮照层是否层出
visitorPeer:[] // 同行访客
} }
} }
......
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 to comment