Commit 1eba81b5 by fengzhaoyu

111111

parent 9455e2f4
......@@ -14,9 +14,9 @@ App({
},
globalData: {
loadingType: 0,
globalUrl: 'http://192.168.1.101:9999' //本地豪
// globalUrl: 'http://192.168.1.101:9999' //本地豪
// globalUrl:'http://192.168.1.110:9999' // 本地成
// globalUrl:'https://gateway.mingwork.com'
// globalUrl:'https://gateway-beta.mingwork.com'
globalUrl:'https://gateway-beta.mingwork.com'
}
});
......@@ -23,6 +23,7 @@ create.Page({
success: function(res) {
if (_that.data.query == 0) {
_that.store.data.visitorName = res[0].name
debugger
_that.store.data.selectVisitors = false
_that.update()
}
......
......@@ -19,7 +19,6 @@ create.Page({
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
......
......@@ -189,25 +189,23 @@
.address {
overflow: hidden;
width: 686rpx;
padding: 0 32rpx;
height: 144rpx;
padding: 32rpx;
display: flex;
overflow: hidden;
border-bottom: 2rpx solid #EEEEEE;
}
.address>view {
/* .address>view {
margin-top: 32rpx;
}
} */
.address .addressTitle {
width: 30%;
height: 44rpx;
}
.addressDetail {
width: 482rpx;
height: 80rpx;
height: auto;
line-height: 40rpx;
font-size: 32rpx;
color: #717579;
......@@ -228,7 +226,7 @@
.iconshanchu {
color: #D4D5D6;
font-size: 40rpx;
line-height: 76rpx;
/* line-height: 76rpx; */
}
.addCompanions {
......@@ -347,12 +345,17 @@
align-items: center;
}
.ccPeople view {
position: relative;
height: 100rpx;
width: 100rpx;
border-radius: 50%;
background: blue;
margin-right: 10rpx;
color: white;
overflow: hidden;
text-align: center;
}
.ccPeopleShanChu {
position: absolute;
top: -40rpx;
right: -6rpx;
}
\ No newline at end of file
......@@ -52,7 +52,7 @@
</view>
</view>
</view>
<picker value="{{0}}" range="{{Purposes}}" onChange='selectPurpose'>
<picker value="{{1}}" range="{{purposes}}" onChange='selectPurpose'>
<view>
<view class="purpose">
<view class="purposeTitle">来访目的</view>
......@@ -107,7 +107,7 @@
<view class="iconjia iconfont"></view>
添加同行人员
</view>
<view class="more">
<view class="more" a:if='{{isPackUp}}'>
<view class="moreTitle visitorInfoTitle">更多信息</view>
<view class="visitorName moreName">
<view class="visitorNameText visitorComNameText">
......@@ -116,22 +116,28 @@
<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 class="ccPeople" a:if='{{copyPerson.length}}'>
<view a:for="{{copyPerson}}" a:for-index="index" a:for-item="item">
{{item.name.substring(item.name.length-2)}}
<text class="iconshanchu iconfont ccPeopleShanChu" data-index='{{index}}' onTap="deleateCcPeople"></text>
</view>
</view>
<view class="visitorName">
<view class="visitorNameText visitorComNameText">
备注
</view>
<view class="visitorInput">
<input placeholder="请输入" data-type='visitorNode' onInput='visitorInput'/>
<input placeholder="请输入" data-type='visitorNode' onInput='visitorInput' value="{{visitorNode}}"/>
</view>
</view>
</view>
<view class="isHidden">
<view class="isHidden" onTap="isPackUp" a:if='{{isPackUp}}'>
收起更多消息
<!--<text class='iconzhankai iconfont'></text> -->
<text class='iconshouqi iconfont'></text>
</view>
<view class="isHidden" onTap="isPackUp" a:else>
展开更多消息
<text class='iconzhankai iconfont'></text>
</view>
<view class="confirmAppointment">
<view class="confirmAppointmentButton" onTap="confirmAppointment">确认预约</view>
......
......@@ -12,38 +12,73 @@ create.Page({
endTimeHour: '', // 结束时间的时分
startTime: '', // 完整的开始时间
endTime: '', // 完整的结束时间
Purpose: '',
Purposes: [],
currentPurpose: '',
isInput: true,
arriveAddress: [],
defaultAddress: '',
purpose: '', //来访目的完整的信息
purposes: [], // 所有的来访目的
currentPurpose: '', // 当前选择的来访目的
isInput: false, // 来访目的是否需要手动输入
arriveAddress: [], // 来访的地址
defaultAddress: '', // 选中的来访地址
Companions: [],
copyPerson: [],
copyPerson: [], // 周知人
index: '',
copyPerson: [],
visitorPhone: '',// 主访客的手机号
visitorCompany: '',// 访客的单位
visitorPurpose: '', // 访客手动输入的目的
visitorNode: '' // 访客的备注
visitorNode: '',// 访客的备注
isPackUp: false // 是否收起更多消息
},
onLoad(query) {
console.log('onload事件触发')
this.reSet()
dd.setNavigationBar({
title: '预约访客'
});
this.Purpose()
this.arriveAddress()
},
// 重置事件
reSet() {
console.log('djjj')
const _that = this
_that.setData({
startTimeYear: '', // 开始时间的年月日
startTimeHour: '', // 开始时间的时分
endTimeYear: '', // 结束时间的年月日
endTimeHour: '', // 结束时间的时分
startTime: '', // 完整的开始时间
endTime: '', // 完整的结束时间
purpose: '', //来访目的完整的信息
purposes: [], // 所有的来访目的
currentPurpose: '', // 当前选择的来访目的
isInput: false, // 来访目的是否需要手动输入
arriveAddress: [], // 来访的地址
defaultAddress: '', // 选中的来访地址
Companions: [],
copyPerson: [], // 周知人
index: '',
visitorPhone: '',// 主访客的手机号
visitorCompany: '',// 访客的单位
visitorPurpose: '', // 访客手动输入的目的
visitorNode: '',// 访客的备注
isPackUp: false // 是否收起更多消息
})
_that.store.data.visitorName = '',
_that.store.data.selectVisitors = false,
_that.store.data.visitorPeer = [],
_that.update()
let startTimeYear = this.timeToStr(new Date()).yearMonthDate
let startTimeHour = this.timeToStr(new Date()).hourMinute
let endTimeYear = this.timeToStr(new Date()).yearMonthDate
let endTimeHour = this.timeToStr(new Date()).hourMinute
let startTime = this.timeToStr(new Date())
let endTime = this.timeToStr(new Date())
this.setData({
startTimeYear: startTimeYear,
startTimeHour: startTimeHour,
endTimeYear: endTimeYear,
endTimeHour: endTimeHour
endTimeHour: `24:00`,
startTime: `${startTime.year}-${startTime.month}-${startTime.date} ${startTime.hour}:${startTime.minute}`,
endTime: `${startTime.year}-${startTime.month}-${startTime.date} 24:00`
})
this.Purpose()
this.arriveAddress()
},
//本页面input输入事件
visitorInput(event) {
......@@ -112,7 +147,15 @@ create.Page({
content: '最多可添加四名同行人员',
buttonText: '确定'
})
}
},
// 收起更多消息
isPackUp() {
if (this.data.isPackUp == false) {
this.setData({ isPackUp: true })
}
else {
this.setData({ isPackUp: false })
}
},
......@@ -121,85 +164,170 @@ create.Page({
this.store.data.visitorPeer.splice(event.target.dataset.index, 1)
this.update()
},
// 删除周知人
deleateCcPeople(event) {
this.data.copyPerson.splice(event.target.dataset.index, 1)
this.setData({ copyPerson: this.data.copyPerson })
},
// 周知人
copyPerson() {
const _that = this
console.log(_that.data.copyPerson.length)
if (_that.data.copyPerson.length <= 5) {
dd.complexChoose({
title: "选择周知人", //标题
multiple: true, //是否多选
limitTips: "最多可选取6人", //超过限定人数返回提示
maxUsers: 6, //最大可选人数
multiple: false, //是否多选
responseUserOnly: true, //返回人,或者返回人和部门
success: function(res) {
let copyPerson = []
console.log(res, 'copyPerson')
res.users.forEach((item, index) => {
copyPerson.push(item)
_that.data.copyPerson.push(item)
})
_that.setData({
copyPerson: copyPerson
copyPerson: _that.duplicateRemoval(_that.data.copyPerson)
})
},
fail: function(err) {
console.log(err, 'copyPerson')
}
})
}
else {
dd.alert({
content: '最多可选取6人',
buttonText: '确定'
})
}
},
// 周知人去重
duplicateRemoval(person) {
let obj = {};
let peon = person.reduce((cur, next) => {
obj[next.userId] ? "" : obj[next.userId] = true && cur.push(next);
return cur;
}, [])
return peon
},
// 提交预约单
confirmAppointment() {
const _that = this
// _that.formValidation()
let participator = ''
_that.data.copyPerson.forEach((item, index) => {
participator = participator + item.userId + ','
})
participator = participator.substring(0, participator.length - 1)
let visitorPeer = ''
_that.store.data.visitorPeer.forEach((item, index) => {
visitorPeer = visitorPeer + item.name + ':' + item.phone + ','
})
visitorPeer = visitorPeer.substring(0, visitorPeer.length - 1)
let purpose = ''
if (this.data.currentPurpose == '其他') {
purpose = this.data.visitorPurpose
}
else {
purpose = this.data.currentPurpose
}
let data = {
startTime: this.data.startTimes,
endTime: this.data.endTimes,
visitorInfo: `${this.store.data.visitorName}:${this.data.visitorPhone}`,
visitorCompany: this.data.visitorCompany,
purpose: JSON.stringify(this.data.currentPurpose),
startTime: this.data.startTime + '' + ':00',
endTime: this.data.endTime + '' + ':00',
visitorInfo: `${this.store.data.visitorName}:${this.data.visitorPhone},${visitorPeer}`,
companyName: this.data.visitorCompany,
purpose: purpose,
visitorPurpose: this.data.visitorPurpose,
visitAddress: this.data.defaultAddress,
visitorPeer: JSON.stringify(this.store.data.visitorPeer),
visitorNode: this.data.visitorNode
visitorNode: this.data.visitorNode,
participator: participator
}
$http.$http('/admin/visitor/addRecord', data, 'post').then(res => {
console.log(res, 66666666666)
dd.alert({
content: '预约成功',
buttonText: '确定',
success: () => {
dd.redirectTo({
url: '/pages/visitors/visitors'
})
},
});
}).catch(err => {
console.log(err)
})
},
// 表单验证
formValidation() {
if (this.store.data.visitorName == '' || this.store.data.visitorName.length > 20) {
dd.alert({ content: '访客姓名不能为空且长度小于20个字符', buttonText: '确定' })
return
}
else if (this.data.visitorPhone == '' || !(/^[1][3,4,5,7,8][0-9]{9}$/).test(this.data.visitorPhone)) {
dd.alert({ content: '请输入正确的手机号码', buttonText: '确定' })
return
}
else if (this.data.visitorCompany.length > 20) {
dd.alert({ content: '访客单位的长度小于20个字符', buttonText: '确定' })
return
}
else if (new Date(this.data.startTime).getTime() < new Date(this.data.endTime)) {
dd.alert({ content: '开始时间不能晚于结束时间', buttonText: '确定' })
return
}
else if (this.data.visitorPurpose.length > 20) {
dd.alert({ content: '来访目的的长度小于20个字符', buttonText: '确定' })
return
}
},
// 选择开始时间
selectStartTime() {
dd.datePicker({
format: 'yyyy-MM-dd HH:mm',
success: (res => {
let time = this.timeToStr(res.date)
console.log(time)
this.setData({
startTime: `${time.year}${time.month}${time.date}`,
startTimeHour: `${time.hour}:${time.minute}`,
startTimes: res.date
startTimeYear: `${time.yearMonthDate}`,
startTimeHour: `${time.hourMinute}`,
startTime: `${res.date}`
})
})
})
},
// 选择结束时间
selectEndTime() {
dd.datePicker({
format: 'yyyy-MM-dd HH:mm',
success: (res => {
let time = this.timeToStr(res.date)
console.log(res.date)
this.setData({
endTime: `${time.year}${time.month}${time.date}`,
endTimeHour: `${time.hour}:${time.minute}`,
endTimes: res.date
endTimeYear: `${time.yearMonthDate}`,
endTimeHour: `${time.hourMinute}`,
endTime: `${res.date}`
})
})
})
},
// 选择来访目的
selectPurpose(event) {
console.log(this.data.purpose, 'selectPurpose')
this.setData({
currentPurpose: this.data.Purpose[event.detail.value].visitPurpose
currentPurpose: this.data.purpose[event.detail.value].visitPurpose
})
this.isInput()
},
// 选择地址
selectAddress(event) {
console.log(event)
console.log(this.data.arriveAddress[event.detail.value].address, 'this.data.arriveAddress[event.detail.value].address')
this.setData({
defaultAddress: this.data.arriveAddress[event.detail.value].address
defaultAddress: this.data.arriveAddress[event.detail.value]
})
},
// 所有的到访地址
arriveAddress() {
$http.$http('/admin/address/list', {}, 'get').then(res => {
console.log(res, 'arriveAddress')
......@@ -216,23 +344,24 @@ create.Page({
this.setData({ arriveAddress: arriveAddress })
})
},
// 来访的目的
// 所有的来访的目的
Purpose() {
$http.$http('/admin/visit-purpose/list', {}, 'post').then(res => {
console.log(res, 'Purpose')
let Purposes = []
let purposes = []
res.forEach((item, index) => {
Purposes.push(item.visitPurpose)
purposes.push(item.visitPurpose)
})
this.setData({
Purpose: res,
Purposes: Purposes,
currentPurpose: res[0].visitPurpose,
purpose: res,
purposes: purposes,
currentPurpose: res[1].visitPurpose,
})
})
},
// 处理时间
timeToStr(time) {
if(/-/.test(time)) {
if (/-/.test(time)) {
time = time.replace(/\-/g, "/")
}
let timeData = new Date(time)
......@@ -252,7 +381,7 @@ create.Page({
allTime: `${year}${month.toString().length > 1 ? month : '0' + month}${date.toString().length > 1 ? date : '0' + date}${hour.toString().length > 1 ? hour : '0' + hour}:${minute.toString().length > 1 ? minute : '0' + minute}分`
}
},
// 是否展示到访目的的输入框
isInput() {
if (this.data.currentPurpose != '其他') {
this.setData({
......
{}
\ No newline at end of file
{"pullRefresh": false}
\ No newline at end of file
......@@ -4,8 +4,8 @@
<view class="{{type !== '0' ? 'clickTabs' : ''}}" data-type="1" onTap="changeType">公司访客</view>
</view>
<view class='visitorSituation' a:if="{{dataList.length !== 0}}">今天共
<text>2</text>位访客,到访
<text>1</text>位
<text>{{todayVisit}}</text>位访客,到访
<text>{{arrivedVisit}}</text>位
</view>
<view class="nullImage" a:if="{{dataList.length === 0}}">
<image mode="scaleToFill" src="../../../assets/allowanceNull.png"/>
......
......@@ -8,11 +8,28 @@ Page({
pageSize: 10,
totalCount: '',
overdue: false,
todayVisit: 0,
arrivedVisit: 0
},
arriveStaus() {
const _that = this
let data = {
type: 0
}
$http.$http('/admin/visitor/getCurrentCount', data, 'post').then(res => {
_that.setData({
todayVisit: res[1],
arrivedVisit: res[0]
})
}).catch(err => {
})
},
changeType(event) {
this.setData({
type: event.target.dataset.type,
dataList: []
dataList: [],
currentPage: 1
})
this.visitorList(this.data.type)
},
......@@ -25,7 +42,7 @@ Page({
}
$http.$http('/admin/visitor/getRecordList', data, 'post').then(res => {
let dataList = res.records;
let dataListSource = [];
let dataListSource = _that.data.dataList;;
console.log(dataList.length)
if (dataList.length > 0) {
dataList.forEach((item, index) => {
......@@ -46,19 +63,19 @@ Page({
dataListSource.push(item)
})
dataList = dataListSource
let totalCount = Math.ceil(parseInt(res.total) / _that.data.pageNumber)
let totalCount = Math.ceil(parseInt(res.total) / _that.data.pageSize)
_that.setData({
dataList: dataList,
totalCount: totalCount
})
}
})
},
timeToStr(time) {
if (/-/.test(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()
......@@ -69,19 +86,22 @@ Page({
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
minute: minute.toString().length > 1 ? minute : '0' + minute,
yearMonthDate: `${year}${month.toString().length > 1 ? month : '0' + month}${date.toString().length > 1 ? date : '0' + date}日`,
hourMinute: `${hour.toString().length > 1 ? hour : '0' + hour}:${minute.toString().length > 1 ? minute : '0' + minute}`,
allTime: `${year}${month.toString().length > 1 ? month : '0' + month}${date.toString().length > 1 ? date : '0' + date}${hour.toString().length > 1 ? hour : '0' + hour}:${minute.toString().length > 1 ? minute : '0' + minute}分`
}
},
navigatorToNext(event) {
dd.setStorageSync({ key: 'item', data: event.target.dataset.item })
dd.navigateTo({ url: `./../visitorsDetail/visitorsDetail` })
dd.navigateTo({ url: `./../visitorsDetail/visitorsDetail?item=${JSON.stringify(event.target.dataset.item)}` })
},
appointment() {
dd.navigateTo({url:'./../reservations/reservations'});
dd.navigateTo({ url: './../reservations/reservations' });
},
onLoad(query) {
dd.setNavigationBar({ title: '智能访客' });
this.visitorList(0)
this.arriveStaus()
},
onReady() {
},
......
......@@ -2,19 +2,19 @@
<view class="visitorsDetail">
<view class="visitorTab">
<view class="visitorName">
<text class="visitorNameName">赖蜜桃</text>
<text class="visitorNameName">{{visitorName}}</text>
<text class="visitorNameIcon iconfont iconzhankai">
<!--<text class="visitorHidden"><text>1111111111</text><text>1111111111</text><text>1111111111</text><text>1111111111</text><text>1111111111</text></text> -->
</text>
</view>
<view class="visitorNumber">
<text class="iconfont icondianhua visitorNumberIcon"></text>
<text class="visitorNumberNumber">17853553699</text>
<text class="visitorNumberNumber">{{phone}}</text>
<text class="call" onTap="call">拨打</text>
</view>
<view class="visitorCompany">
<view class="visitorCompany" a:if='{{company}}'>
<text class="visitorCompanyIcon iconfont iconqiye"></text>
<text class="visitorCompanyName">杭州明我科技有限公司</text>
<text class="visitorCompanyName">{{company}}</text>
</view>
<image mode="scaleToFill" src="{{processStatus == 'invite'? '../../assets/await.png': (processStatus == 'cancel'? '../../assets/cancel.png':'../../assets/dao.png')}}"/>
</view>
......@@ -27,13 +27,13 @@
</view>
<view class="visitorTimeBottom">
<view>
<view>2019年10月11日</view>
<view>10:14</view>
<view>{{startTimeYear}}</view>
<view>{{startHour}}</view>
</view>
<view class="fu">~</view>
<view>
<view>2019年10月11日</view>
<view>10:14</view>
<view>{{endTimeYear}}</view>
<view>{{endHour}}</view>
</view>
</view>
</view>
......@@ -43,7 +43,7 @@
<text class="visitorTimeTopTitle">被访人</text>
</view>
<view class="visitorTimeBottom">
林萍萍
{{byVisitorName}}
</view>
</view>
<view class="visitorTime">
......@@ -52,7 +52,7 @@
<text class="visitorTimeTopTitle">来访目的</text>
</view>
<view class="visitorTimeBottom">
商务洽谈
{{purpose}}
</view>
</view>
<view class="visitorTime">
......@@ -61,7 +61,7 @@
<text class="visitorTimeTopTitle">到访地址</text>
</view>
<view class="visitorTimeBottom">
浙江省杭州市余杭区
{{visitAddress}}
</view>
</view>
<view class="visitorTime">
......@@ -70,17 +70,12 @@
<text class="visitorTimeTopTitle">周知人员</text>
</view>
<view class="visitorTimeBottom">
<text>廖培培</text>
<text>廖培培</text>
<text>廖培培</text>
<text>廖培培</text>
<text>廖培培</text>
<text>廖培培</text>
<text a:for='{{participatorUserList}}' a:for-index="index" a:for-item="item">{{item.username}}</text>
</view>
</view>
</view>
<view class="staus" a:if="{{processStatus == 'cancel'|| processStatus == 'arrive'?false:true}}">
<view class="noOverdue" a:if='!overdue'>
<view class="staus" a:if="{{processStatus == 'invite'}}">
<view class="noOverdue" a:if='{{!overdue}}'>
<view class="cancel" onTap="cancel">取消访客</view>
<view class="reception" onTap="reception">接待访客</view>
</view>
......
......@@ -2,44 +2,50 @@ const app = getApp()
import $http from './../../API/http'
Page({
data: {
name: '',
company: '',
startTime: '',
endTime: '',
byVisitorName: '',
purpose: '',
visitorName: '', //访客的名字
company: '', // 到访者的公司
startTimeYear: '', // 开始时间的年月日
startHour: '', // 开始时间的小时
endHour: '', //结束时间的小时
endTimeYear: '', // 结束时间的年月日
byVisitorName: '', // 被访人
purpose: '', // 来访的目的
participatorUserList: '', // 周知人员
participator: '',
endHour: '',
startHour: '',
phone: '',
processStatus: '',
overdue: ''
phone: '', // 访客的手机号
processStatus: '', // 访客的状态
overdue: '',
visitAddress: '' //到访的地址
},
onLoad() {
onLoad(event) {
console.log(JSON.parse(event.item), 'query')
//由JSON字符串转换为JSON对象)
const that = this
let query = dd.getStorageSync({ key: 'item' }).data
let query = JSON.parse(event.item)
dd.setNavigationBar({
title: "访客详情",
});
},
onReady() {
let query = dd.getStorageSync({ key: 'item' }).data
this.setData({
name: query.name,
visitorName: query.visitorName,
company: query.companyName,
startTime: `${query.startTime.year}${query.startTime.month}${query.startTime.date}日`,
endTime: `${query.endTime.year}${query.endTime.month}${query.endTime.date}日`,
startHour: `${query.startTime.date}:${query.startTime.minute}`,
endHour: `${query.endTime.date}:${query.endTime.minute}`,
byVisitorName: '',
purpose: '',
startTimeYear: `${query.startTime.yearMonthDate}`,
startHour: `${query.startTime.hourMinute}`,
endTimeYear: `${query.endTime.yearMonthDate}`,
endHour: `${query.endTime.hourMinute}`,
byVisitorName: `${query.byVisitorName}`,
purpose: query.purpose,
visitAddress:query.visitAddress,
participatorUserList:query.participatorUserList,
participator: '',
phone: query.mobile,
processStatus: query.processStatus,
overdue: query.overdue,
recordId:query.recordId
recordId: query.recordId
})
},
onReady() {
},
cancel() {
dd.confirm({
title: '确认取消访问',
......@@ -47,12 +53,13 @@ Page({
confirmButtonText: '确认',
cancelButtonText: '取消',
success: (result) => {
this.setData({ processStatus: 'cancel' })
console.log(result,11111111111)
let data = {
recordId: this.data.recordId
}
$http.$http('/admin/visitor/cancelVisit', data, 'post').then(res => {
console.log(res)
this.setData({ processStatus: 'cancel' })
})
},
});
......@@ -64,12 +71,12 @@ Page({
confirmButtonText: '确认',
cancelButtonText: '取消',
success: (result) => {
this.setData({ processStatus: 'arrive' })
let data = {
recordId: this.data.recordId
}
$http.$http('/admin/visitor/confirmVisit', data, 'post').then(res => {
console.log(res)
this.setData({ processStatus: 'arrive' })
})
},
});
......
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