提交 25d0e644 编写于 作者: 刘英杰's avatar 刘英杰

1025小程序代码

上级 025909f3
// app.js // app.js
App({ App({
onHide(){
wx.setStorageSync('dialog', '切换到后台')
console.log('整个小程序');
},
onLaunch() { onLaunch() {
// 展示本地存储能力 // 展示本地存储能力
const logs = wx.getStorageSync('logs') || [] const logs = wx.getStorageSync('logs') || []
...@@ -21,5 +25,6 @@ App({ ...@@ -21,5 +25,6 @@ App({
statusBarHeight:wx.getSystemInfoSync().statusBarHeight, statusBarHeight:wx.getSystemInfoSync().statusBarHeight,
pageHeight:wx.getSystemInfoSync().screenHeight-wx.getSystemInfoSync().statusBarHeight -48, pageHeight:wx.getSystemInfoSync().screenHeight-wx.getSystemInfoSync().statusBarHeight -48,
menuHeigth:(wx.getMenuButtonBoundingClientRect().top - wx.getSystemInfoSync().statusBarHeight) * 2 + wx.getMenuButtonBoundingClientRect().height, menuHeigth:(wx.getMenuButtonBoundingClientRect().top - wx.getSystemInfoSync().statusBarHeight) * 2 + wx.getMenuButtonBoundingClientRect().height,
currentAppointmentId: '', // 全局变量
} }
}) })
...@@ -2,11 +2,10 @@ ...@@ -2,11 +2,10 @@
"pages": [ "pages": [
"pages/index/index", "pages/index/index",
"pages/login/login", "pages/login/login",
"pages/showQRcode/showQRcode", "pages/showQRcode/showQRcode",
"pages/subscribe/subscribe", "pages/subscribe/subscribe",
"pages/record/record" "pages/record/record",
"pages/teamAppointmentForm/teamAppointmentForm"
], ],
"window": { "window": {
"backgroundTextStyle": "light", "backgroundTextStyle": "light",
......
// index.js // index.js
var config = require('../../utils/config')
var http = require('../../utils/http.js') var http = require('../../utils/http.js')
var WxParse = require('../../plugins/wxParse/wxParse.js'); var WxParse = require('../../plugins/wxParse/wxParse.js');
import Toast from '@vant/weapp/toast/toast';
// 获取应用实例 // 获取应用实例
const app = getApp() const app = getApp()
...@@ -12,13 +12,25 @@ Page({ ...@@ -12,13 +12,25 @@ Page({
statusBarHeight:app.globalData.statusBarHeight, statusBarHeight:app.globalData.statusBarHeight,
show: false, show: false,
countdown:0, countdown:0,
initInfo:{} initInfo:{},
hight:null, //高度参数
backgroungImageArray:[],
imageProtocolHost:config.imageProtocolHost,
}, },
ewm(){
wx.scanCode({
scanType:['qrCode'],
success (res) {
console.log(res)
}
})
},
//同意入馆须知 //同意入馆须知
agreeGo(){ agreeGo(){
wx.setStorageSync('isAgreeGo', true) wx.setStorageSync('isAgreeGo', true)
this.setData({ show: false }); this.setData({ show: false });
wx.removeStorageSync('dialog')
}, },
//获取博物馆初始化配置 //获取博物馆初始化配置
...@@ -46,6 +58,27 @@ Page({ ...@@ -46,6 +58,27 @@ Page({
false false
) )
}, },
// 获取小程序主页背景图片
getInitImageList(){
var that = this
http.postData(
'/Carousel/GetUseCarouselList',
// 请求参数
{},
function (res) {
if (res.code == 1) {
let initInfo = res.response;
that.setData({
backgroungImageArray: initInfo
})
}
},
function (err) {
console.log('请求失败:' + err);
},
false
)
},
//展开入馆须知 //展开入馆须知
onClickShow() { onClickShow() {
...@@ -55,33 +88,79 @@ Page({ ...@@ -55,33 +88,79 @@ Page({
//路由跳转 //路由跳转
navigateToSubscribe(e) { navigateToSubscribe(e) {
// console.log("ttttt",e.currentTarget.dataset.url) // console.log("ttttt",e.currentTarget.dataset.url)
// if(wx.getStorage('token')){
// }
wx.navigateTo({ wx.navigateTo({
url: e.currentTarget.dataset.url url: e.currentTarget.dataset.url
}) })
}, },
onLoad() { onLoad() {
wx.login({
success: (res) => {
console.log('rs',res)
},
})
var that = this; var that = this;
var winHeight = wx.getSystemInfoSync().windowHeight //设置变量存放屏幕高度值
console.log(winHeight) //打印屏幕高度
winHeight = winHeight - winHeight*0.6
this.setData({
hight:winHeight //传递值
})
that.getInitInfo() //请求初始化数据 that.getInitInfo() //请求初始化数据
//第一步,启动时判断是否打开入馆须知 //第一步,启动时判断是否打开入馆须知
let isAgreeGo = wx.getStorageSync('isAgreeGo') //判断是否同意 let isAgreeGo = wx.getStorageSync('isAgreeGo') //判断是否同意
if(!isAgreeGo){ // if(!isAgreeGo){
//如果没同意过,打开并启动倒计时5秒 // //如果没同意过,打开并启动倒计时5秒
this.setData({ show: true,countdown:5 }); // this.setData({ show: true,countdown:5 });
let clock = setInterval(() => { // let clock = setInterval(() => {
if(that.data.countdown === 0) { // if(that.data.countdown === 0) {
clearInterval(clock);//清除周期 // clearInterval(clock);//清除周期
}else { // }else {
that.data.countdown-- // that.data.countdown--
that.setData({countdown: that.data.countdown}) // that.setData({countdown: that.data.countdown})
} // }
}, 1000); // }, 1000);
} // }
if(!wx.getStorageSync('dialog')){
this.setData({ show: true,countdown:5 });
let clock = setInterval(() => {
if(that.data.countdown === 0) {
clearInterval(clock);//清除周期
}else {
that.data.countdown--
that.setData({countdown: that.data.countdown})
}
}, 1000);
}
// WxParse.wxParse('content', 'html', that.data.content, that, 10); // WxParse.wxParse('content', 'html', that.data.content, that, 10);
// WxParse.wxParse('jianjie', 'html', that.data.jianjie, that, 10); // WxParse.wxParse('jianjie', 'html', that.data.jianjie, that, 10);
}, },
onShow(){
var that = this;
if(wx.getStorageSync('dialog')){
this.setData({ show: true,countdown:5 });
let clock = setInterval(() => {
if(that.data.countdown === 0) {
clearInterval(clock);//清除周期
}else {
that.data.countdown--
that.setData({countdown: that.data.countdown})
}
}, 1000);
}
that.getInitImageList() //请求初始化swiper 图片数组
},
onShareAppMessage(){
return{
title:'琼台博物馆预约',
path: "pages/index/index",
}
}
}) })
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
"van-overlay": "@vant/weapp/overlay/index", "van-overlay": "@vant/weapp/overlay/index",
"van-divider": "@vant/weapp/divider/index", "van-divider": "@vant/weapp/divider/index",
"van-icon": "@vant/weapp/icon/index", "van-icon": "@vant/weapp/icon/index",
"van-button": "@vant/weapp/button/index" "van-button": "@vant/weapp/button/index",
"van-toast": "@vant/weapp/toast/index"
}, },
"navigationStyle": "custom", "navigationStyle": "custom",
"navigationBarTitleText": "琼台师范学院博物馆" "navigationBarTitleText": "琼台师范学院博物馆"
......
<!--index.wxml--> <!--index.wxml-->
<import src="../../plugins/wxParse/wxParse.wxml" /> <import src="../../plugins/wxParse/wxParse.wxml" />
<view class="home-container"> <view class="home-container">
<view class="top"> <view class="top">
<image mode="widthFix" src="../../images/home.png" />
<!-- 多张 轮播 -->
<swiper autoplay="{{true}}" circular="{{true}}" style="height: {{hight}}px;width: 100%;" wx:if="{{backgroungImageArray.length>1}}">
<swiper-item wx:for="{{backgroungImageArray}}" wx:for-item="item">
<image mode="widthFix" src="{{imageProtocolHost+item.path}}" />
</swiper-item>
</swiper>
<!-- 一张 不轮播 -->
<image wx:if="{{backgroungImageArray.length===1}}" mode="widthFix" wx:for="{{backgroungImageArray}}" wx:for-item="item" src="{{imageProtocolHost+item.path}}" />
<view class="home-logo" style="top:{{statusBarHeight}}px"> <view class="home-logo" style="top:{{statusBarHeight}}px">
<!-- (menu.top - sysInfo.statusBarHeight) * 2 + menu.height --> <!-- (menu.top - sysInfo.statusBarHeight) * 2 + menu.height -->
<!-- style="height:{{menuHeigth}}px" --> <!-- style="height:{{menuHeigth}}px" -->
<image mode="widthFix" src="../../images/logo.png" /> <image mode="widthFix" src="../../images/logo.png" />
</view> </view>
</view> </view>
<view class="box"> <view class="box">
<view class='bg-img'> <view class='bg-img'>
<image src="../../images/home-bg.png" /> <image src="../../images/home-bg.png" />
</view> </view>
<view class="box-content"> <view class="box-content">
<view class="intro"> <view class="intro">
<view class="intro-title"> <view class="intro-title">
...@@ -32,11 +37,13 @@ ...@@ -32,11 +37,13 @@
</view> </view>
</view> </view>
<van-toast id="van-toast" />
<view class="inner"> <view class="inner">
<!-- 散客预约 --> <!-- 散客预约 -->
<view class="item" bindtap="navigateToSubscribe" data-url="../subscribe/subscribe?subscribeType=0&title=散客预约"> <view class="item" bindtap="navigateToSubscribe" data-url="../subscribe/subscribe?subscribeType=0&title=散客预约">
<view class='item-bg-img'> <view class='item-bg-img'>
<image mode="widthFix" src="../../images/view-bg.png" /> <image mode="widthFix" src="../../images/newsktd.png" />
</view> </view>
<view class="item-content"> <view class="item-content">
<view class="item-title">散客预约</view> <view class="item-title">散客预约</view>
...@@ -48,7 +55,7 @@ ...@@ -48,7 +55,7 @@
<!-- 团队预约 --> <!-- 团队预约 -->
<view class="item" bindtap="navigateToSubscribe" data-url="../subscribe/subscribe?subscribeType=1&title=团队预约"> <view class="item" bindtap="navigateToSubscribe" data-url="../subscribe/subscribe?subscribeType=1&title=团队预约">
<view class='item-bg-img'> <view class='item-bg-img'>
<image mode="widthFix" src="../../images/view-bg.png" /> <image mode="widthFix" src="../../images/newsktd.png" />
</view> </view>
<view class="item-content"> <view class="item-content">
<view class="item-title">团队预约</view> <view class="item-title">团队预约</view>
...@@ -60,7 +67,7 @@ ...@@ -60,7 +67,7 @@
<!-- 公务接待预约 --> <!-- 公务接待预约 -->
<view class="long-item" bindtap="navigateToSubscribe" data-url="../subscribe/subscribe?subscribeType=2&title=公务接待预约"> <view class="long-item" bindtap="navigateToSubscribe" data-url="../subscribe/subscribe?subscribeType=2&title=公务接待预约">
<view class='item-bg-img'> <view class='item-bg-img'>
<image mode="widthFix" src="../../images/long-view-bg1.png" /> <image mode="widthFix" src="../../images/newgwjd.png" />
</view> </view>
<view class="item-content"> <view class="item-content">
<view class="item-title">公务接待预约</view> <view class="item-title">公务接待预约</view>
...@@ -73,7 +80,7 @@ ...@@ -73,7 +80,7 @@
<!-- 预约记录 --> <!-- 预约记录 -->
<view class="long-item" bindtap="navigateToSubscribe" data-url="../record/record?title=预约记录"> <view class="long-item" bindtap="navigateToSubscribe" data-url="../record/record?title=预约记录">
<view class='item-bg-img'> <view class='item-bg-img'>
<image mode="widthFix" src="../../images/long-view-bg2.png" /> <image mode="widthFix" src="../../images/newyyjl.png" />
</view> </view>
<view class="item-content"> <view class="item-content">
<view class="item-title">预约记录</view> <view class="item-title">预约记录</view>
...@@ -82,7 +89,8 @@ ...@@ -82,7 +89,8 @@
</view> </view>
</view> </view>
</view> </view>
<view>{{token}}</view>
<!-- <button bindtap="ewm">测</button> -->
</view> </view>
</view> </view>
......
.swiper{
height: 350px;
width: 100%;
}
@import "../../plugins/wxParse/wxParse.wxss"; @import "../../plugins/wxParse/wxParse.wxss";
::-webkit-scrollbar{ ::-webkit-scrollbar{
......
// pages/login/login.js // pages/login/login.js
var http = require('../../utils/http.js') var http = require('../../utils/http.js')
import Toast from '@vant/weapp/toast/toast';
Page({ Page({
/** /**
...@@ -11,20 +13,20 @@ Page({ ...@@ -11,20 +13,20 @@ Page({
codePhone:"无", codePhone:"无",
codeLogin:"无" codeLogin:"无"
}, },
getRealtimePhoneNumber(e) {
getRealtimePhoneNumber(e) {
var that = this var that = this
console.log("code: ", e.detail.code) console.log("code: ", e.detail.code)
wx.login({ wx.login({
success(loginRes) { success(loginRes) {
``
if (loginRes.code) { if (loginRes.code) {
console.log("wx.loginCode", loginRes.code) console.log("wx.loginCode", loginRes.code)
that.setData({ that.setData({
codePhone: e.detail.code, codePhone: e.detail.code,
codeLogin: loginRes.code codeLogin: loginRes.code,
}) })
//发起网络请求 //发起网络请求
http.getData( http.getData(
'Login/api/Login/GetMiNiprogramToken', 'Login/api/Login/GetMiNiprogramToken',
...@@ -39,9 +41,12 @@ Page({ ...@@ -39,9 +41,12 @@ Page({
const loginInfo = res.response; const loginInfo = res.response;
wx.setStorageSync('token', loginInfo.access_token.token_content) wx.setStorageSync('token', loginInfo.access_token.token_content)
wx.setStorageSync('refreshToken', loginInfo.refresh_token.token_content); wx.setStorageSync('refreshToken', loginInfo.refresh_token.token_content);
// wx.setStorageSync('Token', loginRes.code)
wx.navigateBack({ wx.navigateBack({
delta: 1 delta: 1
}) })
} }
}, },
function (err) { function (err) {
...@@ -49,6 +54,7 @@ Page({ ...@@ -49,6 +54,7 @@ Page({
}, },
false false
) )
} else { } else {
console.log('登录失败!', loginRes) console.log('登录失败!', loginRes)
wx.showToast({ wx.showToast({
...@@ -59,6 +65,7 @@ Page({ ...@@ -59,6 +65,7 @@ Page({
} }
} }
}) })
}, },
// getRealtimePhoneNumber(){ // getRealtimePhoneNumber(){
// console.log("111111111111111111") // console.log("111111111111111111")
......
{ {
"usingComponents": { "usingComponents": {
"van-button": "@vant/weapp/button/index", "van-button": "@vant/weapp/button/index",
"van-checkbox": "@vant/weapp/checkbox/index" "van-checkbox": "@vant/weapp/checkbox/index",
"van-toast": "@vant/weapp/toast/index"
}, },
"navigationBarTitleText": "登录" "navigationBarTitleText": "登录"
} }
\ No newline at end of file
...@@ -13,10 +13,9 @@ ...@@ -13,10 +13,9 @@
<van-checkbox value="{{ checked }}" icon-size="32rpx" shape="square" bind:change="onChange" /> <van-checkbox value="{{ checked }}" icon-size="32rpx" shape="square" bind:change="onChange" />
<text style="color: #999;">已阅读并同意<text class="tip-text">《隐私权政策》</text><text class="tip-text">《用户协议》</text></text> <text style="color: #999;">已阅读并同意<text class="tip-text">《隐私权政策》</text><text class="tip-text">《用户协议》</text></text>
</view> </view>
<!-- <text style="margin-top: 50px;" selectable>{{codePhone}}</text> <!-- <text style="margin-top: 50px;" selectable>{{codePhone}}</text>
<text style="margin-top: 50px;" selectable>{{codeLogin}}</text> --> <text style="margin-top: 50px;" selectable>{{codeLogin}}</text> -->
<van-toast id="van-toast" />
</view> </view>
</view> </view>
\ No newline at end of file
// pages/record/record.js // pages/record/record.js
var http = require('../../utils/http.js') var http = require('../../utils/http.js')
const app = getApp() const app = getApp()
import Dialog from '@vant/weapp/dialog/dialog';
import Toast from '@vant/weapp/toast/toast';
Page({ Page({
/** /**
...@@ -13,10 +16,189 @@ Page({ ...@@ -13,10 +16,189 @@ Page({
pageIndex: 1,//页 pageIndex: 1,//页
recordList: [], //预约记录 recordList: [], //预约记录
employ_state: 1, employ_state: 1,
currentAppointmentId:'', // 当前分享的组队id
awaitSubmitList:false, // 待提交列表
list: [],
result: [],
teamId:'',
type:'',
arrayLengthzero:'',
timer:'',
},
// 弹窗
modal(res){
if(res.code !== 1){
Toast.fail('异常:'+res.code);
}else{
Toast.success('操作成功!');
}
},
//同意申请
consentApplication(){
const _this = this
if(_this.data.result.length !== 0){
http.postData(
'ChangeCommit/api/changeCommit/BatchInserAppointment',
_this.data.result,
function (res) {
_this.modal(res)
_this.setData({
result:[]
})
},
function (err) {
_this.modal(err)
},
true
)
_this.awaitSubmitListFunction()
}else if(_this.data.result.length=== 0){
Toast.fail('数据为空!');
}
},
//拒绝申请(删除)
daleteInfoMap(){
const _this = this
if(_this.data.result.length !== 0){
_this.data.result.forEach((curent,index)=>{
_this.daleteInfo(curent)
})
setTimeout(()=>{
_this.awaitSubmitListFunction()
},50)
}else if(_this.data.result.length === 0){
Toast.fail('数据为空!')
}
},
daleteInfo(e){
const _this = this
console.log( _this.data.result);
http.getData(
'ChangeCommit/api/changeCommit/ChangeCommitDelete',
{changeCommitId:e},
function (res) {
_this.modal(res)
_this.setData({
result:[]
})
},
function (err) {
console.log(err);
},
true
)
},
//获取同行人视图选中记录Id
onChangeCheckbox(event) {
const _this = this
_this.setData({
result: event.detail,
});
},
// 多选事件
toggle(event) {
console.log(event,'toggle');
const { index } = event.currentTarget.dataset;
const checkbox = this.selectComponent(`.checkboxes-${index}`);
checkbox.toggle();
},
//待提交列表显隐
onClickShow() {
this.setData({ awaitSubmitList: true });
},
//待提交列表显隐
onClickHide() {
this.setData({ awaitSubmitList: false });
this.getSubcsribeInfo()
},
//待提交列表按钮(初始化列表)
awaitSubmitListFunction(e=''){
const _this = this
if(e){
_this.setData({
teamId:e.currentTarget.dataset.appointmentid,
type:e.currentTarget.dataset.type
})
http.getData(
'ChangeCommit/api/changeCommit/GetChangeCommitList',
{appointmentId:_this.data.teamId,page_index:1,page_size:20},
function(res){
console.log(res.response.data);
_this.setData({
list:res.response.data
})
},
function(err){
console.log(err);
},
true
)
}else if(e === ''){
http.getData(
'ChangeCommit/api/changeCommit/GetChangeCommitList',
{appointmentId:_this.data.teamId,page_index:1,page_size:20},
function(res){
console.log(res.response.data,'res.response.data');
_this.setData({
list:res.response.data
})
},
function(err){
console.log(err);
},
true
)
}
_this.setData({
awaitSubmitList:true
})
},
//预约分享获取id
openShareFromFunction(e){
let _this = this
_this.setData({
currentAppointmentId:e.currentTarget.dataset.appointmentid
})
},
// 取消预约按钮事件
cancelAppointment(e){
let _this = this
Dialog.confirm({
title: '取消预约',
message: '是否确认取消此次预约?',
}).then((res) => {
http.getData( 'Background/api/guest/AppointmentCancel' ,
{ "appointmentid":e.currentTarget.dataset.appointmentid},
function(res){
Toast.success(res.msg)
},
function(err){
console.log(err);
}
,true)
_this.getSubcsribeInfo()
})
.catch((err)=>{
console.log(err,2);
})
}, },
onChange(event) { onChange(event) {
console.log(event.detail) console.log(event.detail,'event.detail')
//employ_state 1-待使用 2-已使用 3-预约变更 4-预约过期 //employ_state 1-待使用 2-已使用 3-预约变更 4-预约过期
let employ_state = 1 let employ_state = 1
if (event.detail.title) { if (event.detail.title) {
...@@ -43,13 +225,18 @@ Page({ ...@@ -43,13 +225,18 @@ Page({
}, },
navigateToSubscribe(e) { navigateToSubscribe(e) {
console.log('12312',e);
var that = this
// console.log("ttttt",e.currentTarget.dataset.url) // console.log("ttttt",e.currentTarget.dataset.url)
wx.navigateTo({ clearTimeout(that.timer)
url: e.currentTarget.dataset.url that.timer = setTimeout(()=>{
}) wx.navigateTo({
url: e.currentTarget.dataset.url
})
},500)
}, },
//获取预约记录 //获取预约记录 url, getData, doSuccess, doFail, needToken
getSubcsribeInfo() { getSubcsribeInfo() {
var that = this var that = this
http.getData( http.getData(
...@@ -62,8 +249,32 @@ Page({ ...@@ -62,8 +249,32 @@ Page({
}, },
function (res) { function (res) {
console.log("res", res) console.log("res", res)
if (res.code == 1) { if (res.code === 1) {
var recordList = that.data.recordList.concat(res.response.data) var recordList
if(that.data.employ_state === 1){
that.setData({
recordList: [],
})
}
if(that.data.employ_state === 2){
// recordList.forEach((cur,index)=>{
// if(! !!recordList.length){
// // that.arrayLengthzero = !!recordList.length
// }
// recordList.splice(index, 1);
// })
that.setData({
recordList: [],
})
}
recordList = that.data.recordList.concat(res.response.data)
console.log(recordList,'recordList');
var flag var flag
var pageIndex = that.data.pageIndex var pageIndex = that.data.pageIndex
if (recordList.length < res.response.data_count) { if (recordList.length < res.response.data_count) {
...@@ -105,9 +316,11 @@ Page({ ...@@ -105,9 +316,11 @@ Page({
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad() {
// this.getSubcsribeInfo()
// try { // try {
// wx.setNavigationBarTitle({ // wx.setNavigationBarTitle({
// title: options.title // title: options.title
...@@ -121,7 +334,7 @@ Page({ ...@@ -121,7 +334,7 @@ Page({
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady() { onReady() {
}, },
/** /**
...@@ -158,11 +371,16 @@ Page({ ...@@ -158,11 +371,16 @@ Page({
onReachBottom() { onReachBottom() {
}, },
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage() { onShareAppMessage(e) {
return {
title:'同行人预约填写',
path :`pages/teamAppointmentForm/teamAppointmentForm?currentAppointmentObject=${JSON.stringify(e.target.dataset.detail)}`,
}
// }, 30);
} }
}) })
\ No newline at end of file //?currentAppointmentId=${_this.data.currentAppointmentId}
\ No newline at end of file
...@@ -2,7 +2,17 @@ ...@@ -2,7 +2,17 @@
"usingComponents": { "usingComponents": {
"van-tab": "@vant/weapp/tab/index", "van-tab": "@vant/weapp/tab/index",
"van-tabs": "@vant/weapp/tabs/index", "van-tabs": "@vant/weapp/tabs/index",
"van-empty": "@vant/weapp/empty/index" "van-empty": "@vant/weapp/empty/index",
"van-button": "@vant/weapp/button/index",
"van-dialog": "@vant/weapp/dialog/index",
"van-overlay": "@vant/weapp/overlay/index",
"van-checkbox": "@vant/weapp/checkbox/index",
"van-checkbox-group": "@vant/weapp/checkbox-group/index",
"van-cell": "@vant/weapp/cell/index",
"van-cell-group": "@vant/weapp/cell-group/index",
"van-popup": "@vant/weapp/popup/index",
"van-toast": "@vant/weapp/toast/index",
"van-submit-bar": "@vant/weapp/submit-bar/index"
}, },
"navigationBarTitleText": "预约记录" "navigationBarTitleText": "预约记录"
} }
\ No newline at end of file
<wxs src="../../wxs/tools.wxs" module="tools" /> <wxs src="../../wxs/tools.wxs" module="tools" />
<view class="record-container"> <view class="record-container">
<van-tabs active="{{ active }}" color="#d59171" title-active-color="#d59171" bind:change="onChange"> <van-tabs active="{{ active }}" color="#d59171" title-active-color="#d59171" bind:change="onChange">
<van-tab title="待使用"> <van-tab title="待使用" >
<scroll-view wx:if="{{recordList.length>0}}" scroll-y="true" style="height: {{windowHeight -60}}px;" bindscrolltolower="loadMore"> <scroll-view wx:if="{{recordList.length>0}}" scroll-y="true" style="height: {{windowHeight -60}}px;" bindscrolltolower="loadMore">
<!-- 一条表单记录 --> <!-- 一条表单记录 -->
<view wx:for="{{recordList}}" wx:for-item="recordItem" class="record-item" bindtap="navigateToSubscribe" data-url="../showQRcode/showQRcode?appointmentid={{recordItem.appointmentid}}&title={{recordItem.type==1?'团队预约':recordItem.type==2?'公务接待预约':'散客预约'}}" > <view wx:for="{{recordList}}" wx:for-item="recordItem" class="record-item" >
<!-- 标题 --> <!-- 记录内容部分 -->
<view class="record-title-box"> <view bindtap="navigateToSubscribe" data-url="../showQRcode/showQRcode?appointmentid={{recordItem.appointmentid}}&title={{recordItem.type===1?'团队预约':recordItem.type===2?'公务接待预约':'散客预约'}}">
{{recordItem.type==1?'团队预约':recordItem.type==2?'公务接待预约':'散客预约'}} <!-- 标题 -->
<view class="record-title-box">
{{recordItem.type===1?'团队预约':recordItem.type===2?'公务接待预约':'散客预约'}}
</view> </view>
<!-- 预约详情 --> <!-- 预约详情 -->
<view class="record-content-box"> <view class="record-content-box">
<!-- -->
<view class="record-content-item"> <view class="record-content-item">
<view class="info-item-label">参观日期</view> <view class="info-item-label">参观日期</view>
<view class="info-item-value"> {{tools.formatTimeToDate(recordItem.museum_date, 'Y年M月D日')}} <text>{{recordItem.moment==1?'上午':'下午'}}</text></view> <view class="info-item-value"> {{tools.formatTimeToDate(recordItem.museum_date, 'Y年M月D日')}} <text>{{recordItem.moment===1?'上午':'下午'}}</text></view>
</view> </view>
<!-- -->
<view class="record-content-item"> <view class="record-content-item">
<view class="info-item-label">预约时间</view> <view class="info-item-label">预约时间</view>
<view class="info-item-value"> {{tools.formatTimeToDate(recordItem.createtime, 'Y-M-D h:m:s')}}</view> <!-- <view class="info-item-value"> {{tools.formatTimeToDate(recordItem.createtime, 'Y-M-D h:m:s')}}</view> -->
<view class="info-item-value"> {{tools.formatTimeToDate(recordItem.createtime, 'Y-M-D')}}</view>
</view> </view>
<!-- -->
<view class="record-content-item"> <view class="record-content-item">
<view class="info-item-label">人数</view> <view class="info-item-label">人数</view>
<view class="info-item-value">{{recordItem.num}}人</view> <view class="info-item-value">{{recordItem.num}}人</view>
</view> </view>
</view> </view>
</view>
</view>
<!-- 取消预约 -->
<view class="record-content-item">
<view class="info-item-label"></view>
<view class="info-item-value">
<!-- 待提交列表 -->
<van-button wx:if="{{recordItem.type === 1 || recordItem.type === 2}}" color="#D59171" size="small" bind:tap="awaitSubmitListFunction" data-type="{{recordItem.type}}" data-appointmentid="{{recordItem.appointmentid}}" style=" margin-right: 10px;" type="danger">待提交列表</van-button>
<!-- 预约分享 -->
<van-button wx:if="{{recordItem.type === 1 || recordItem.type === 2}}" color="#D59171" size="small" dataset="{{recordItem}}" open-type="share" bind:tap="openShareFromFunction" data-appointmentid="{{recordItem.appointmentid}}" style=" margin-right: 10px;" type="danger">预约分享</van-button>
<!-- 通行凭证 -->
<van-button style="margin-right: 10px;" color="#D59171" size="small" bindtap="navigateToSubscribe" data-url="../showQRcode/showQRcode?appointmentid={{recordItem.appointmentid}}&title={{recordItem.type===1?'团队预约':recordItem.type===2?'公务接待预约':'散客预约'}}">通行凭证</van-button>
<!-- 取消预约 -->
<van-button color="#D59171" size="small" bind:tap="cancelAppointment" data-appointmentid="{{recordItem.appointmentid}}" type="danger">取消预约</van-button>
</view>
</view>
<!-- <van-button type="primary" bind:click="onClickShow">嵌入内容</van-button> -->
<van-overlay z-index="1" show="{{awaitSubmitList}}" >
<view class="wrapper" >
<van-empty description="暂无数据" wx:if="{{list.length === 0}}"/>
<view class="block" wx:if="{{list.length !== 0}}" >
<scroll-view style="height: 100%;" scroll-y type="list" >
<view style="padding: 20px 20px; display: flex; justify-content: center;">待提交列表</view>
<van-checkbox-group value="{{ result }}" bind:change="onChangeCheckbox" >
<van-cell-group>
<van-cell
wx:for="{{ list }}"
wx:key="index"
value-class="value-class"
clickable
data-index="{{ index }}"
bind:click="toggle"
>
<view slot="title">
<view class="van-cell-text" style="width: 30%;">{{item.name}}</view>
<view class="van-cell-text" style="width: 70%;" wx:if="{{type === 1}}">{{item.identity_num}}</view>
<view class="van-cell-text" style="width: 70%;" wx:if="{{type === 2}}">{{item.position}}</view>
</view>
<van-checkbox
class="checkboxes-{{ index }}"
name="{{item.id}}"
/>
</van-cell>
</van-cell-group>
</van-checkbox-group>
</scroll-view>
<view class="listCustomTabbar">
<van-button color="#D59171" bind:click="onClickHide" size="small" type="warning">关闭界面</van-button>
<van-button color="#D59171" bind:click="daleteInfoMap" size="small" type="warning">删除</van-button>
<van-button color="#D59171" bind:click="consentApplication" size="small" type="warning">同意</van-button>
</view>
</view>
</view>
</van-overlay>
<van-toast id="van-toast" />
<van-dialog id="van-dialog" confirm-button-color="#D59171"/>
<van-toast id="van-toast" />
</view>
</scroll-view> </scroll-view>
<view wx:else> <view wx:else>
<van-empty description="暂无记录" /> <van-empty description="暂无记录" />
</view> </view>
</van-tab> </van-tab>
<van-tab title="已使用"> <van-tab title="已使用" >
<scroll-view wx:if="{{recordList.length>0}}" scroll-y="true" style="height: {{windowHeight -60}}px;" bindscrolltolower="loadMore"> <scroll-view wx:if="{{recordList.length>0}}" scroll-y="true" style="height: {{windowHeight -60}}px;" bindscrolltolower="loadMore">
<!-- 一条表单记录 --> <!-- 一条表单记录 -->
<view wx:for="{{recordList}}" wx:for-item="recordItem" class="record-item" data-url="../showQRcode/showQRcode?appointmentid={{recordItem.appointmentid}}&title={{recordItem.type==1?'团队预约':recordItem.type==2?'公务接待预约':'散客预约'}}" > <view bindtap="navigateToSubscribe" wx:for="{{recordList}}" wx:for-item="recordItem" class="record-item" data-url="../showQRcode/showQRcode?appointmentid={{recordItem.appointmentid}}&title={{recordItem.type==1?'团队预约':recordItem.type==2?'公务接待预约':'散客预约'}}" >
<!-- <view bindtap="navigateToSubscribe" data-url="../showQRcode/showQRcode?appointmentid={{recordItem.appointmentid}}&title={{recordItem.type===1?'团队预约':recordItem.type===2?'公务接待预约':'散客预约'}}"></view> -->
<!-- 标题 --> <!-- 标题 -->
<view class="record-title-box"> <view class="record-title-box">
{{recordItem.type==1?'团队预约':recordItem.type==2?'公务接待预约':'散客预约'}} {{recordItem.type==1?'团队预约':recordItem.type==2?'公务接待预约':'散客预约'}}
...@@ -48,13 +126,19 @@ ...@@ -48,13 +126,19 @@
</view> </view>
<view class="record-content-item"> <view class="record-content-item">
<view class="info-item-label">预约时间</view> <view class="info-item-label">预约时间</view>
<view class="info-item-value"> {{tools.formatTimeToDate(recordItem.createtime, 'Y-M-D h:m:s')}}</view> <!-- <view class="info-item-value"> {{tools.formatTimeToDate(recordItem.createtime, 'Y-M-D h:m:s')}}</view> -->
<view class="info-item-value"> {{tools.formatTimeToDate(recordItem.createtime, 'Y-M-D ')}}</view>
</view> </view>
<view class="record-content-item"> <view class="record-content-item">
<view class="info-item-label">人数</view> <view class="info-item-label">人数</view>
<view class="info-item-value">{{recordItem.num}}人</view> <view class="info-item-value">{{recordItem.num}}人</view>
</view> </view>
<view style="display: flex;justify-content: flex-end;">
<!-- 通行凭证 -->
<van-button color="#D59171" size="small" bindtap="navigateToSubscribe" data-url="../showQRcode/showQRcode?appointmentid={{recordItem.appointmentid}}&title={{recordItem.type===1?'团队预约':recordItem.type===2?'公务接待预约':'散客预约'}}">通行凭证</van-button>
</view>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
...@@ -64,7 +148,7 @@ ...@@ -64,7 +148,7 @@
</view> </view>
</van-tab> </van-tab>
<van-tab title="预约过期"> <van-tab title="预约过期" >
<scroll-view wx:if="{{recordList.length>0}}" scroll-y="true" style="height: {{windowHeight -60}}px;" bindscrolltolower="loadMore"> <scroll-view wx:if="{{recordList.length>0}}" scroll-y="true" style="height: {{windowHeight -60}}px;" bindscrolltolower="loadMore">
<!-- 一条表单记录 --> <!-- 一条表单记录 -->
<view wx:for="{{recordList}}" wx:for-item="recordItem" class="record-item" data-url="../showQRcode/showQRcode?appointmentid={{recordItem.appointmentid}}&title={{recordItem.type==1?'团队预约':recordItem.type==2?'公务接待预约':'散客预约'}}" > <view wx:for="{{recordList}}" wx:for-item="recordItem" class="record-item" data-url="../showQRcode/showQRcode?appointmentid={{recordItem.appointmentid}}&title={{recordItem.type==1?'团队预约':recordItem.type==2?'公务接待预约':'散客预约'}}" >
......
...@@ -53,4 +53,38 @@ ...@@ -53,4 +53,38 @@
padding: 15rpx 0; padding: 15rpx 0;
font-size: 28rpx; font-size: 28rpx;
}
.wrapper {
display: flex;
/* align-items: center; */
justify-content: center;
height: 100%;
/* opacity:1; */
background-color: #fff;
/* background-color:#ffc993 ; */
}
.block {
width: 100%;
height:90%;
background-color: #fff;
/* background-image: url(../../images/home.jpg); */
}
.listCustomTabbar{
height: 11%;
background-color: #f2eee9;
display: flex ;
justify-content: space-around;
align-items: center;
}
.value-class {
flex: none !important;
} }
\ No newline at end of file
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
</view> </view>
<view class="record-content-item"> <view class="record-content-item">
<view class="info-item-label">预约时间</view> <view class="info-item-label">预约时间</view>
<view class="info-item-value">{{tools.formatTimeToDate(record.createtime, 'Y-M-D h:m:s')}}</view> <!-- <view class="info-item-value">{{tools.formatTimeToDate(record.createtime, 'Y-M-D h:m:s')}}</view> -->
<view class="info-item-value">{{tools.formatTimeToDate(record.createtime, 'Y-M-D')}}</view>
</view> </view>
<view class="record-content-item"> <view class="record-content-item">
<view class="info-item-label">人数</view> <view class="info-item-label">人数</view>
......
...@@ -2,13 +2,14 @@ ...@@ -2,13 +2,14 @@
var http = require('../../utils/http.js') var http = require('../../utils/http.js')
var app = getApp() var app = getApp()
import Toast from '@vant/weapp/toast/toast';
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
teamNum:false, // 团队总计显隐
windowHeight: app.globalData.windowHeight, windowHeight: app.globalData.windowHeight,
subscribeType: 0, subscribeType: 0,
dateShow: false, dateShow: false,
...@@ -21,16 +22,20 @@ Page({ ...@@ -21,16 +22,20 @@ Page({
minDate: "", //最小日期 minDate: "", //最小日期
maxDate: "", //最大日期 maxDate: "", //最大日期
personNum: 1, //人数 personNum: 1, //人数
showVisitDateList: [], //前三个 showVisitDateList: [], //前三个
visitFromList: [{ visitFromList: [{
name: '', name: '',
idCode: "", idCode: "",
phoneCode:'', phoneCode:'',
}, ], }, ],
visitLeaderist: [{ visitFromListTeam:[], //团队同行人列表
name: '', // visitFromList:[],
work: "" // visitLeaderist: [{
}, ], // name: '',
// position: ""
// }, ],
visitLeaderist:[],
visitTeamFrom: { visitTeamFrom: {
unit: "", unit: "",
name: "", name: "",
...@@ -48,15 +53,38 @@ Page({ ...@@ -48,15 +53,38 @@ Page({
personNum: null, personNum: null,
}, },
formatter: null, formatter: null,
flag: false, flag: false,
txrFormFlag:false,
teamRequestFlag:true,
}, },
//预提交Flag
preSubmission(){
const _this = this
_this.setData({
teamRequestFlag:false
})
},
//立即预约Flag
makeAnAppointmentNow(){
const _this = this
_this.setData({
teamRequestFlag:true
})
if(wx.getStorage('token')){
}
},
// 加
plus(){
const _this = this
console.log(_this.data.visitFromList.length);
},
//减
minus(){
console.log('minus');
},
//获取博物馆访问日历初始化 //获取博物馆访问日历初始化
getInitWeek() { getInitWeek() {
...@@ -92,7 +120,6 @@ Page({ ...@@ -92,7 +120,6 @@ Page({
}); });
let formatter = function (day) { let formatter = function (day) {
// const month = day.date.getMonth() + 1; // const month = day.date.getMonth() + 1;
// const date = day.date.getDate(); // const date = day.date.getDate();
//判断visitDateList中的state,0:可订,1:停售 //判断visitDateList中的state,0:可订,1:停售
...@@ -101,7 +128,6 @@ Page({ ...@@ -101,7 +128,6 @@ Page({
// console.log("刷新选中的时间", that.data.defaultDate) // console.log("刷新选中的时间", that.data.defaultDate)
return day; return day;
} }
that.setData({ that.setData({
formatter: formatter formatter: formatter
}) })
...@@ -281,27 +307,32 @@ Page({ ...@@ -281,27 +307,32 @@ Page({
//人数变化 //人数变化
onSteChange(event) { onSteChange(event) {
console.log(event.detail); console.log(event.detail);
// if(this.data.subscribeType==2){ // if(this.data.subscribeType==2){
// this.addPerson() // this.addPerson()
// } // }
console.log(event.detail);
this.setData({ this.setData({
teamNum:true,
personNum: event.detail personNum: event.detail
}) })
}, },
//添加参观人员 //添加参观人员
addPerson(e) { addPerson(e) {
let that = this; let that = this;
that.setData({
txrFormFlag:true
})
console.log(e.detail.target.dataset.type) console.log(e.detail.target.dataset.type)
if(e.detail.target.dataset.type == 1){ if(e.detail.target.dataset.type == 1){
if (that.data.subscribeType == 0 || that.data.subscribeType == 1) { if (that.data.subscribeType == 0 || that.data.subscribeType == 1) {
let visitFromList = that.data.visitFromList if(that.data.subscribeType == 0){
let visitFromList = that.data.visitFromList
let userList = []; let userList = [];
//(因为数据不是双向绑定的)将页面上输入框的值全部保存起来 //(因为数据不是双向绑定的)将页面上输入框的值全部保存起来
for (let i = 0; i < visitFromList.length; i++) { for (let i = 0; i < visitFromList.length; i++) {
...@@ -311,17 +342,67 @@ Page({ ...@@ -311,17 +342,67 @@ Page({
phoneCode: e.detail.value["phoneCode" + (i + 1)], phoneCode: e.detail.value["phoneCode" + (i + 1)],
}) })
} }
//添加一个空的人员信息项 // //添加一个空的人员信息项
userList.push({ userList.push({
name: '', name: '',
idCode: "", idCode: "",
phoneCode:'', phoneCode:'',
}) })
that.setData({
that.setData({
visitFromList: userList, visitFromList: userList,
personNum:userList.length personNum:userList.length
}) })
}else{
let visitFromListTeam = that.data.visitFromListTeam
let userList = [];
//(因为数据不是双向绑定的)将页面上输入框的值全部保存起来
for (let i = 0; i < visitFromListTeam.length; i++) {
userList.push({
name: e.detail.value["name" + (i + 1)],
idCode: e.detail.value["idCode" + (i + 1)],
phoneCode: e.detail.value["phoneCode" + (i + 1)],
})
}
// //添加一个空的人员信息项
userList.push({
name: '',
idCode: "",
phoneCode:'',
})
that.setData({
visitFromListTeam: userList,
// personNum:userList.length+1
})
}
// 原
// let visitFromList = that.data.visitFromList
// let userList = [];
// //(因为数据不是双向绑定的)将页面上输入框的值全部保存起来
// for (let i = 0; i < visitFromList.length; i++) {
// userList.push({
// name: e.detail.value["name" + (i + 1)],
// idCode: e.detail.value["idCode" + (i + 1)],
// phoneCode: e.detail.value["phoneCode" + (i + 1)],
// })
// }
// //添加一个空的人员信息项
// userList.push({
// name: '',
// idCode: "",
// phoneCode:'',
// })
// if(that.data.subscribeType == 0 ){
// that.setData({
// visitFromList: userList,
// personNum:userList.length
// })
// }else{
// that.setData({
// visitFromList: userList,
// personNum:userList.length+1
// })
// }
// 原
} else if (that.data.subscribeType == 2) { } else if (that.data.subscribeType == 2) {
...@@ -331,18 +412,18 @@ Page({ ...@@ -331,18 +412,18 @@ Page({
for (let i = 0; i < visitLeaderist.length; i++) { for (let i = 0; i < visitLeaderist.length; i++) {
userList.push({ userList.push({
name: e.detail.value["name" + (i + 1)], name: e.detail.value["name" + (i + 1)],
work: e.detail.value["work" + (i + 1)], position: e.detail.value["position" + (i + 1)],
}) })
} }
userList.push({ userList.push({
name: '', name: '',
work: "" position: ""
}) })
that.setData({ that.setData({
visitLeaderist: userList, visitLeaderist: userList,
personNum:userList.length // personNum:userList.length+1 添加领导人 按钮 计数
}) })
} }
...@@ -358,9 +439,10 @@ Page({ ...@@ -358,9 +439,10 @@ Page({
let index = e.detail.target.dataset.index let index = e.detail.target.dataset.index
// let index = e.currentTarget.dataset.index // let index = e.currentTarget.dataset.index
if (that.data.subscribeType == 0 || that.data.subscribeType == 1) { if (that.data.subscribeType == 0 || that.data.subscribeType == 1) {
let visitFromList = that.data.visitFromList if(that.data.subscribeType == 0){
let visitFromList = that.data.visitFromList
let userList = []; let userList = [];
//(因为数据不是双向绑定的)将页面上输入框的值全部保存起来 // (因为数据不是双向绑定的)将页面上输入框的值全部保存起来
for (let i = 0; i < visitFromList.length; i++) { for (let i = 0; i < visitFromList.length; i++) {
userList.push({ userList.push({
name: e.detail.value["name" + (i + 1)], name: e.detail.value["name" + (i + 1)],
...@@ -374,6 +456,52 @@ Page({ ...@@ -374,6 +456,52 @@ Page({
visitFromList: userList, visitFromList: userList,
personNum:userList.length personNum:userList.length
}) })
}else{
let visitFromListTeam = that.data.visitFromListTeam
let userList = [];
// (因为数据不是双向绑定的)将页面上输入框的值全部保存起来
for (let i = 0; i < visitFromListTeam.length; i++) {
userList.push({
name: e.detail.value["name" + (i + 1)],
idCode: e.detail.value["idCode" + (i + 1)],
phoneCode: e.detail.value["phoneCode" + (i + 1)]
})
}
userList.splice(index, 1)
that.setData({
visitFromListTeam: userList,
// personNum:userList.length+1 团队 添加同行人 总计 +1
})
}
//原
// let visitFromList = that.data.visitFromList
// let userList = [];
//(因为数据不是双向绑定的)将页面上输入框的值全部保存起来
// for (let i = 0; i < visitFromList.length; i++) {
// userList.push({
// name: e.detail.value["name" + (i + 1)],
// idCode: e.detail.value["idCode" + (i + 1)],
// phoneCode: e.detail.value["phoneCode" + (i + 1)]
// })
// }
// // userList.splice(index, 1)
// // that.setData({
// // visitFromList: userList,
// // personNum:userList.length+1
// // })
// if(that.data.subscribeType == 0 ){
// that.setData({
// visitFromList: userList,
// personNum:userList.length
// })
// }else{
// that.setData({
// visitFromList: userList,
// personNum:userList.length+1
// })
// }
} else if (that.data.subscribeType == 2) { } else if (that.data.subscribeType == 2) {
let visitLeaderist = that.data.visitLeaderist let visitLeaderist = that.data.visitLeaderist
...@@ -382,25 +510,38 @@ Page({ ...@@ -382,25 +510,38 @@ Page({
for (let i = 0; i < visitLeaderist.length; i++) { for (let i = 0; i < visitLeaderist.length; i++) {
userList.push({ userList.push({
name: e.detail.value["name" + (i + 1)], name: e.detail.value["name" + (i + 1)],
work: e.detail.value["work" + (i + 1)] position: e.detail.value["position" + (i + 1)]
}) })
} }
userList.splice(index, 1) userList.splice(index, 1)
that.setData({ that.setData({
visitLeaderist: userList, visitLeaderist: userList,
personNum:userList.length // personNum:userList.length+1
}) })
} }
}, },
//提交预约信息 //提交预约信息
onSubscribe(e) { onSubscribe(e) {
const that = this; const that = this;
console.log(e,'================================='); // if(wx.getStorage('token')){
console.log("onSubscribe", e.detail.value) wx.requestSubscribeMessage({
tmplIds: ['i8mE4RkFO6ts_AINt3v_RHGuwUJf8N3dGUFkKvTAd6M','XnR_tKEGS8C7vKoeY5501sZxT5I7ymMGG-nt3kIOrzM'],
success:function (res) {
// Toast.success('推送授权成功')
console.log('推送授权成功');
},
fail:function (err) {
// Toast.fail('接口调用失败')
console.log('接口调用失败');
}
})
// }
if (that.data.checkDate && that.data.checkSession) { if (that.data.checkDate && that.data.checkSession) {
console.log("不为空") console.log("不为空")
let data = {}; let data = {};
...@@ -434,16 +575,102 @@ Page({ ...@@ -434,16 +575,102 @@ Page({
users: userList,//用户列表 users: userList,//用户列表
num: that.data.personNum, //人数 num: that.data.personNum, //人数
} }
} else if (that.data.subscribeType == 1) { } else if (that.data.subscribeType == 1) {
console.log('同行人',that.data.visitFromListTeam.length,'总人数',that.data.personNum);
// &&visitFromList.length >=10
if(that.data.visitFromListTeam.length+1 <= that.data.personNum && that.data.personNum>=10 &&that.data.teamRequestFlag === true){
postUrl = "Background/api/guest/TeamOrOfficialCreate";
let length = that.data.visitFromListTeam.length
let userList = [];
for (let i = 0; i < length; i++) {
if (e.detail.value["name" + (i + 1)] && e.detail.value["idCode" + (i + 1)]) {
userList.push({
name: e.detail.value["name" + (i + 1)],
identity_num: e.detail.value["idCode" + (i + 1)]
})
} else {
wx.showToast({
title: "请完善参观人员资料",
icon: 'error',
duration: 1000
})
return;
}
}
//团队预约
data = {
museum_date: that.data.checkDate,//日期
moment: that.data.checkSession,//场次
unit: e.detail.value.unit, //单位名称
name: e.detail.value.name, //姓名
identity_num: e.detail.value.idCode, //身份证号
mobile: e.detail.value.phone, //手机号
plate_number: e.detail.value.carCode, //车俩信息
num: e.detail.value.personNum, //人数
reason: e.detail.value.reason, //参观事由
users: userList,//拜访用户信息
type:1,//团队:1,公务:2
}
}else if(that.data.visitFromListTeam.length+1 <= that.data.personNum &&!that.data.teamRequestFlag === true){
postUrl = "Background/api/guest/TeamOrOfficialCreate";
let length = that.data.visitFromListTeam.length
let userList = [];
for (let i = 0; i < length; i++) {
if (e.detail.value["name" + (i + 1)] && e.detail.value["idCode" + (i + 1)]) {
userList.push({
name: e.detail.value["name" + (i + 1)],
identity_num: e.detail.value["idCode" + (i + 1)]
})
} else {
wx.showToast({
title: "请完善参观人员资料",
icon: 'error',
duration: 1000
})
return;
}
}
//团队预约
data = {
museum_date: that.data.checkDate,//日期
moment: that.data.checkSession,//场次
unit: e.detail.value.unit, //单位名称
name: e.detail.value.name, //姓名
identity_num: e.detail.value.idCode, //身份证号
mobile: e.detail.value.phone, //手机号
plate_number: e.detail.value.carCode, //车俩信息
num: e.detail.value.personNum, //人数
reason: e.detail.value.reason, //参观事由
users: userList,//拜访用户信息
type:1,//团队:1,公务:2
}
}else{
Toast.fail(`领队与同行人数量大于总计人数`)
}
} else if (that.data.subscribeType == 2) {
console.log('同行人数量',that.data.visitLeaderist.length,that.data.personNum,'总数');
if(that.data.visitLeaderist.length+1 <= that.data.personNum) {
postUrl = "Background/api/guest/TeamOrOfficialCreate"; postUrl = "Background/api/guest/TeamOrOfficialCreate";
let length = that.data.visitFromList.length let length = that.data.visitLeaderist.length
let userList = []; let userList = [];
console.log(e.detail.value)
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
if (e.detail.value["name" + (i + 1)] && e.detail.value["idCode" + (i + 1)]) { // userList.push({
userList.push({ // name: e.detail.value["name" + (i + 1)],
name: e.detail.value["name" + (i + 1)], // position: e.detail.value["position" + (i + 1)]
identity_num: e.detail.value["idCode" + (i + 1)] // })
}) if (e.detail.value["name" + (i + 1)] && e.detail.value["position" + (i + 1)]) {
userList.push({
name: e.detail.value["name" + (i + 1)],
position: e.detail.value["position" + (i + 1)]
})
} else { } else {
wx.showToast({ wx.showToast({
title: "请完善参观人员资料", title: "请完善参观人员资料",
...@@ -452,35 +679,8 @@ Page({ ...@@ -452,35 +679,8 @@ Page({
}) })
return; return;
} }
} }
//公务
//团队预约
data = {
museum_date: that.data.checkDate,//日期
moment: that.data.checkSession,//场次
unit: e.detail.value.unit, //单位名称
name: e.detail.value.name, //姓名
identity_num: e.detail.value.idCode, //身份证号
mobile: e.detail.value.phone, //手机号
plate_number: e.detail.value.carCode, //车俩信息
num: e.detail.value.personNum, //人数
reason: e.detail.value.reason, //参观事由
users: userList,//拜访用户信息
type:1,//团队:1,公务:2
}
} else if (that.data.subscribeType == 2) {
postUrl = "Background/api/guest/TeamOrOfficialCreate";
let length = that.data.visitLeaderist.length
let userList = [];
console.log(e.detail.value)
for (let i = 0; i < length; i++) {
userList.push({
name: e.detail.value["name" + (i + 1)],
work: e.detail.value["work" + (i + 1)]
})
}
data = { data = {
museum_date: that.data.checkDate,//日期 museum_date: that.data.checkDate,//日期
moment: that.data.checkSession,//场次 moment: that.data.checkSession,//场次
...@@ -494,9 +694,14 @@ Page({ ...@@ -494,9 +694,14 @@ Page({
users: userList,//拜访用户信息 users: userList,//拜访用户信息
type:2,//团队:1,公务:2 type:2,//团队:1,公务:2
} }
}else{
// Toast.fail('填写人数大于总计人数')
Toast.fail(`填写人数大于总计人数,填写人数(${that.data.visitLeaderist.length+1}),总人数(${that.data.personNum})`)
}
} }
http.postData( http.postData(
postUrl, postUrl,
// 请求参数 // 请求参数
...@@ -515,18 +720,25 @@ Page({ ...@@ -515,18 +720,25 @@ Page({
wx.navigateTo({ wx.navigateTo({
url: '../record/record', url: '../record/record',
}) })
} else if (res.code !== 1){
} else {
//请求失败 //请求失败
wx.showToast({ Toast.fail( res.msg_detail)
title: res.code + " : " + res.msg, // wx.showToast({
icon: 'error', // title: res.msg_detail,
duration: 1000 // icon: 'error',
}) // duration: 1000
// })
}else{
Toast.fail( res.msg)
// wx.showToast({
// title: res.msg,
// icon: 'error',
// duration: 1000
// })
} }
}, },
function (err) { function (err) {
console.log('请求失败:' + err);
wx.showToast({ wx.showToast({
title: err, title: err,
icon: 'error', icon: 'error',
...@@ -537,25 +749,14 @@ Page({ ...@@ -537,25 +749,14 @@ Page({
) )
} else { } else {
wx.showToast({ wx.showToast({
title: '请选择预约的场次', title: '请选择预约的场次',
icon: 'none', icon: 'none',
duration: 1000 duration: 1000
}) })
} }
// console.log("data111111111111111111", data) // console.log("data111111111111111111", data)
}, },
...@@ -576,7 +777,7 @@ Page({ ...@@ -576,7 +777,7 @@ Page({
if (that.data.subscribeType == 1) { if (that.data.subscribeType == 1) {
that.setData({ that.setData({
personNum: 10 personNum: 1
}); });
} }
...@@ -594,8 +795,20 @@ Page({ ...@@ -594,8 +795,20 @@ Page({
// console.log(that.getWeek("2023-07-18"))// // console.log(that.getWeek("2023-07-18"))//
// console.log(that.getMonthDay("2023-01-31"))// // console.log(that.getMonthDay("2023-01-31"))//
}, },
// aaa(){
// console.log(1123);
// wx.showShareImageMenu({
// path : "pages/teamAppointmentForm/teamAppointmentForm",
// })
// },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
...@@ -642,7 +855,10 @@ Page({ ...@@ -642,7 +855,10 @@ Page({
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage() { onShareAppMessage(){
return{
title:'琼台博物馆预约',
path: "pages/index/index",
}
} }
}) })
\ No newline at end of file
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
"van-button": "@vant/weapp/button/index", "van-button": "@vant/weapp/button/index",
"van-stepper": "@vant/weapp/stepper/index", "van-stepper": "@vant/weapp/stepper/index",
"van-calendar": "@vant/weapp/calendar/index", "van-calendar": "@vant/weapp/calendar/index",
"van-field": "@vant/weapp/field/index" "van-field": "@vant/weapp/field/index",
"van-toast": "@vant/weapp/toast/index"
}, },
"navigationBarTitleText": "散客预约" "navigationBarTitleText": "散客预约"
} }
\ No newline at end of file
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
</van-calendar> </van-calendar>
<!-- 参观日期及场次 --> <!-- 参观日期及场次 -->
<view class="time-box"> <view class="time-box" >
<!-- style="width: 684rpx; height: 545rpx; display: block; box-sizing: border-box" -->
<view class="time-title"> <view class="time-title">
琼台书院博物馆 琼台书院博物馆
</view> </view>
...@@ -90,7 +91,7 @@ ...@@ -90,7 +91,7 @@
上午 上午
</view> </view>
</view> </view>
<view bindtap="onSelectSession" data-session="2" data-undisabled="{{currentSession.aftestate==0}}" class="time-select-item {{currentSession.aftestate==0?'checked-item':'disabled-item'}}"> <view bindtap="onSelectSession" data-session="2" data-undisabled="{{currentSession.aftestate==0}}" class="time-select-item {{currentSession.aftestate==0?'checked-item':'disabled-item'}}">
<view class="item-checked-state {{currentSession.aftestate==0?'select-checked':''}}"> <view class="item-checked-state {{currentSession.aftestate==0?'select-checked':''}}">
<van-icon name="success" wx:if="{{checkSession==2}}"/> <van-icon name="success" wx:if="{{checkSession==2}}"/>
{{checkSession==2?"":currentSession.aftestate==0?'可订':'停售'}} {{checkSession==2?"":currentSession.aftestate==0?'可订':'停售'}}
...@@ -116,16 +117,16 @@ ...@@ -116,16 +117,16 @@
</view> </view>
<form bindsubmit='onSubscribe'> <form bindsubmit='onSubscribe'>
<!-- style="width: 684rpx; height: 459rpx; display: block; box-sizing: content-box" -->
<!-- 参观人员 散客 --> <!-- 参观人员 散客 -->
<view class="person-container" wx:if="{{subscribeType==0}}"> <view class="person-container" wx:if="{{subscribeType==0}}" >
<!-- style="width: 674rpx; height: 723rpx; display: block; box-sizing: border-box" -->
<form bindsubmit="addPerson"> <form bindsubmit="addPerson">
<view class="person-box" wx:for="{{visitFromList}}" wx:for-item="visitItem" wx:key="index"> <view class="person-box" wx:for="{{visitFromList}}" wx:for-item="visitItem" wx:key="index">
<view class="person-title">参观人员{{index+1}}</view> <view class="person-title">参观人员{{index+1}}</view>
<view class="person-info-box"> <view class="person-info-box">
<view class="person-info-del" wx:if="{{visitFromList.length>1}}"> <view class="person-info-del" wx:if="{{visitFromList.length>1}}">
<!-- <view class="person-info-del" > -->
<van-button color="#d89a7c" icon="cross" round formType="submit" data-type="2" data-index="{{index}}" /> <van-button color="#d89a7c" icon="cross" round formType="submit" data-type="2" data-index="{{index}}" />
<!-- <van-icon name="cross" /> --> <!-- <van-icon name="cross" /> -->
</view> </view>
...@@ -147,8 +148,6 @@ ...@@ -147,8 +148,6 @@
</view> </view>
</view> </view>
<view class="add-person-button"> <view class="add-person-button">
<van-button icon="plus" color="#f4ece6" formType="submit" data-type="1" block>添加同行人员</van-button> <van-button icon="plus" color="#f4ece6" formType="submit" data-type="1" block>添加同行人员</van-button>
</view> </view>
...@@ -194,10 +193,11 @@ ...@@ -194,10 +193,11 @@
<form bindsubmit="addPerson" bindreset="delPerson"> <form bindsubmit="addPerson" bindreset="delPerson">
<view class="person-box" wx:for="{{visitFromList}}" wx:for-item="visitItem" wx:key="index"> <view class="person-box" wx:for="{{visitFromListTeam}}" wx:for-item="visitItem" wx:key="index">
<view class="person-title">参观人员{{index+1}}</view> <view class="person-title">参观人员{{index+1}}</view>
<view class="person-info-box"> <view class="person-info-box">
<view class="person-info-del" data-index="{{index}}" wx:if="{{visitFromList.length>1}}"> <!-- <view class="person-info-del" data-index="{{index}}" wx:if="{{visitFromList.length>1}}"> -->
<view class="person-info-del" data-index="{{index}}" >
<van-button color="#d89a7c" icon="cross" round formType="submit" data-type="2" data-index="{{index}}" /> <van-button color="#d89a7c" icon="cross" round formType="submit" data-type="2" data-index="{{index}}" />
<!-- <van-icon name="cross" /> --> <!-- <van-icon name="cross" /> -->
</view> </view>
...@@ -215,7 +215,7 @@ ...@@ -215,7 +215,7 @@
</view> </view>
<view class="add-person-button"> <view class="add-person-button">
<van-button icon="plus" color="#f4ece6" formType="submit" data-type="1" block>添加同行人员</van-button> <van-button icon="plus" color="#f4ece6" formType="submit" data-type="1" block>添加同行人员</van-button>
</view> </view>
...@@ -235,8 +235,6 @@ ...@@ -235,8 +235,6 @@
<van-field type="text" name="name" value="{{ visitBusinessFrom.name }}" placeholder="请输入姓名" border="{{ false }}" /> <van-field type="text" name="name" value="{{ visitBusinessFrom.name }}" placeholder="请输入姓名" border="{{ false }}" />
</view> </view>
<view class="person-info-item"> <view class="person-info-item">
<view class="info-item-label">身份证号</view> <view class="info-item-label">身份证号</view>
...@@ -254,16 +252,18 @@ ...@@ -254,16 +252,18 @@
<view class="person-info-item"> <view class="person-info-item">
<view class="info-item-label">人数</view> <view class="info-item-label">人数</view>
<!-- <view class="info-item-value info-placeholder"></view> --> <!-- <view class="info-item-value info-placeholder"></view> -->
<van-stepper bind:change="onSteChange" name="personNum" input-width="50px" value="{{ personNum }}" min="1" /> <van-stepper bind:plus="plus" bind:minus="minus" bind:change="onSteChange" name="personNum" input-width="50px" value="{{ personNum }}" min="1" />
</view> </view>
</view> </view>
</view> </view>
<form bindsubmit="addPerson"> <form bindsubmit="addPerson">
<view class="person-box" wx:for="{{visitLeaderist}}" wx:for-item="visitItem"> <view class="person-box" wx:for="{{visitLeaderist}}" wx:for-item="visitItem">
<view class="person-title">领导信息{{index+1}}</view> <view class="person-title">领导信息{{index+1}}</view>
<view class="person-info-box"> <view class="person-info-box">
<view class="person-info-del" data-index="{{index}}" wx:if="{{visitLeaderist.length>1}}"> <!-- <view class="person-info-del" data-index="{{index}}" wx:if="{{visitLeaderist.length>1}}"> -->
<view class="person-info-del" data-index="{{index}}" >
<!-- X -->
<van-button color="#d89a7c" icon="cross" round formType="submit" data-type="2" data-index="{{index}}" /> <van-button color="#d89a7c" icon="cross" round formType="submit" data-type="2" data-index="{{index}}" />
<!-- <van-icon name="cross" /> --> <!-- <van-icon name="cross" /> -->
</view> </view>
...@@ -273,16 +273,15 @@ ...@@ -273,16 +273,15 @@
</view> </view>
<view class="person-info-item"> <view class="person-info-item">
<view class="info-item-label">职务</view> <view class="info-item-label">职务</view>
<van-field type="text" name="work{{index+1}}" value="{{ visitItem.work }}" placeholder="请输入职务" border="{{ false }}" /> <van-field type="text" name="position{{index+1}}" value="{{ visitItem.position }}" placeholder="请输入职务" border="{{ false }}" />
</view> </view>
</view> </view>
</view> </view>
<view class="add-person-button"> <view class="add-person-button">
<van-button icon="plus" color="#f4ece6" formType="submit" data-type="1" block>添加领导</van-button> <van-button icon="plus" color="#f4ece6" formType="submit" data-type="1" block>添加领导</van-button>
</view> </view>
</form> </form>
...@@ -303,13 +302,20 @@ ...@@ -303,13 +302,20 @@
</view> </view>
<!-- 底部导航栏 --> <!-- 底部导航栏 -->
<view class=" subscribe-footer"> <view class=" subscribe-footer">
<view class="footer-text">总计 <text class="person-num">{{personNum}}</text> 人</view> <!-- 团队 -->
<view class="footer-text" wx:if="{{subscribeType === 1 && teamNum === true}}">总计 <text class="person-num">{{personNum}}</text> 人</view>
<view class="footer-text" wx:if="{{subscribeType == 1 && teamNum == false }}">总计 <text class="person-num">10</text> 人</view>
<!-- 散客、公务 -->
<view class="footer-text" wx:else>总计 <text class="person-num">{{personNum}}</text> 人</view>
<view class="footer-button"> <view class="footer-button">
<van-button formType="submit" color="#d79a7d" size="small">立即预定</van-button> <van-button wx:if="{{subscribeType == 1}}" bind:click="preSubmission" style="margin-right: 10px;" formType="submit" color="#d79a7d" size="small">预提交<view style="font-size: 10px;">(无需满全员)</view></van-button>
<van-button bind:click="makeAnAppointmentNow" style="margin-right: 10px;" formType="submit" color="#d79a7d" size="small">立即预约<view wx:if="{{subscribeType == 1}}" style="font-size: 10px;">(需满全员)</view></van-button>
</view> </view>
</view> </view>
<van-toast id="van-toast" />
</form> </form>
</view> </view>
\ No newline at end of file
...@@ -128,6 +128,8 @@ ...@@ -128,6 +128,8 @@
border-radius: 16rpx; border-radius: 16rpx;
padding: 30rpx; padding: 30rpx;
padding-top: 20rpx; padding-top: 20rpx;
} }
.person-box { .person-box {
...@@ -224,6 +226,8 @@ ...@@ -224,6 +226,8 @@
border: 1px solid #d5c4b9; border: 1px solid #d5c4b9;
overflow: hidden; overflow: hidden;
box-sizing: border-box; box-sizing: border-box;
-webkit-backface-visibility: hidden;
-webkit-transform: translate3d(0, 0, 0);
} }
.add-person-button .van-button__text { .add-person-button .van-button__text {
......
module.exports = { module.exports = {
API_URL: "https://asc.hnasct.cn/museumAppointment/api/", API_URL: "https://asc.hnasct.cn/museumAppointment/api/",
// API_URL: "https://ehall.qtnu.edu.cn/museumAppointment/api/",
imageProtocolHost:'https://asc.hnasct.cn/'
} }
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
const config = require('./config.js') const config = require('./config.js')
const host = config.API_URL; // 服务器baseUrl const host = config.API_URL; // 服务器baseUrl
/** /**
* POST请求, * POST请求,
* URL:接口 * URL:接口
...@@ -21,14 +23,31 @@ function postData(url, postData, doSuccess, doFail, needToken) { ...@@ -21,14 +23,31 @@ function postData(url, postData, doSuccess, doFail, needToken) {
mask: true mask: true
}) })
if (needToken) { if (needToken) {
var token = wx.getStorageSync('token'); var token = wx.getStorageSync('token');
if (token == "") { if (token == "") {
console.log("token为空,跳转至登录页") // console.log("token为空,跳转至登录页")
wx.hideLoading() wx.hideLoading()
wx.navigateTo({ // wx.navigateTo({
url: '../login/login', // url: '../login/login',
}) // })
wx.showModal({
title: '提示',
content: '当前未登录,是否登录?',
complete: (res) => {
if (res.cancel) {
wx.showToast({
title: '用户取消登录',
})
}
if (res.confirm) {
wx.navigateTo({
url: '../login/login',
})
}
}
})
} else { } else {
wx.request({ wx.request({
...@@ -53,24 +72,41 @@ function postData(url, postData, doSuccess, doFail, needToken) { ...@@ -53,24 +72,41 @@ function postData(url, postData, doSuccess, doFail, needToken) {
doSuccess(res.data); doSuccess(res.data);
} }
// else if (res.statusCode == 401) { else if (res.statusCode == 401) {
// wx.showToast({
// title: '登录过期,请重新登录',
// icon: 'none',
// duration: 2000
// })
// wx.navigateTo({
// url: '../login/login',
// })
// }
else {
console.log("其他状态码",res)
wx.showToast({ wx.showToast({
title: res.statusCode + " : " + res.data.msg, title: '登录过期,请重新登录',
icon: 'none', icon: 'none',
duration: 4000 duration: 2000
}) })
wx.showModal({
title: '提示',
content: '当前未登录,是否登录?',
complete: (res) => {
if (res.cancel) {
wx.showToast({
title: '用户取消登录',
})
}
if (res.confirm) {
wx.navigateTo({
url: '../login/login',
})
}
}
})
// wx.navigateTo({
// url: '../login/login',
// })
}
else {
console.log("其他状态码",res)
// wx.showToast({
// title: res.statusCode + " : " + res.data.msg,
// icon: 'none',
// duration: 4000
// })
} }
...@@ -109,8 +145,25 @@ function postData(url, postData, doSuccess, doFail, needToken) { ...@@ -109,8 +145,25 @@ function postData(url, postData, doSuccess, doFail, needToken) {
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}) })
wx.navigateTo({ // wx.navigateTo({
url: '../login/login', // url: '../login/login',
// })
wx.showModal({
title: '提示',
content: '登录令牌过期,是否登录?',
complete: (res) => {
if (res.cancel) {
wx.showToast({
title: '用户取消登录',
})
}
if (res.confirm) {
wx.navigateTo({
url: '../login/login',
})
}
}
}) })
} }
else { else {
...@@ -151,8 +204,25 @@ function getData(url, getData, doSuccess, doFail, needToken) { ...@@ -151,8 +204,25 @@ function getData(url, getData, doSuccess, doFail, needToken) {
if (token == "") { if (token == "") {
console.log("token为空,跳转至登录页") console.log("token为空,跳转至登录页")
wx.hideLoading() wx.hideLoading()
wx.navigateTo({ // wx.navigateTo({
url: '../login/login', // url: '../login/login',
// })
wx.showModal({
title: '提示',
content: '当前未登录,是否登录?',
complete: (res) => {
if (res.cancel) {
wx.showToast({
title: '用户取消登录',
})
}
if (res.confirm) {
wx.navigateTo({
url: '../login/login',
})
}
}
}) })
} else { } else {
// console.log("token",token) // console.log("token",token)
...@@ -178,8 +248,25 @@ function getData(url, getData, doSuccess, doFail, needToken) { ...@@ -178,8 +248,25 @@ function getData(url, getData, doSuccess, doFail, needToken) {
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}) })
wx.navigateTo({ // wx.navigateTo({
url: '../login/login', // url: '../login/login',
// })
wx.showModal({
title: '提示',
content: '登录令牌过期,是否登录?',
complete: (res) => {
if (res.cancel) {
wx.showToast({
title: '用户取消登录',
})
}
if (res.confirm) {
wx.navigateTo({
url: '../login/login',
})
}
}
}) })
} }
else { else {
...@@ -216,6 +303,7 @@ function getData(url, getData, doSuccess, doFail, needToken) { ...@@ -216,6 +303,7 @@ function getData(url, getData, doSuccess, doFail, needToken) {
doSuccess(res.data); doSuccess(res.data);
}else { }else {
// console.log("其他状态码") // console.log("其他状态码")
wx.showToast({ wx.showToast({
title: res.statusCode + " : " + res.data.msg, title: res.statusCode + " : " + res.data.msg,
icon: 'none', icon: 'none',
...@@ -248,4 +336,5 @@ function getData(url, getData, doSuccess, doFail, needToken) { ...@@ -248,4 +336,5 @@ function getData(url, getData, doSuccess, doFail, needToken) {
// ) // )
// } // }
module.exports.postData = postData; module.exports.postData = postData;
module.exports.getData = getData; module.exports.getData = getData;
\ No newline at end of file // module.exports.cancelAppointmentRequest = cancelAppointmentRequest;
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 人 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册 或