| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807 |
- <template>
- <view class="container">
- <!-- 车牌号区域 -->
- <view class="box">
- <view class="left">车牌号</view>
- <view class="right2">
- <view class="item">
- <view :class="['select', form.selectValue != 0 ? 'selected' : '']" @tap="handleMultiple(form.selectIndex)">
- {{ form.selectValue != 0 ? form.selectValue : '请选择' }}
- </view>
- </view>
- <view class="right-img"><img src="../../static/bottom.png" /></view>
- </view>
- <!-- 车牌号选项弹窗区域 -->
- <transition>
- <multiple-picker
- title="请选择"
- :show="selectMultiple.show"
- :columns="selectMultiple.columns"
- :defaultIndex="selectMultiple.index"
- @confirm="confirmMultiple"
- @cancel="selectMultiple.show = false"
- @change="changeMultiple"
- ></multiple-picker>
- </transition>
- </view>
- <!-- 人数区域 -->
- <view class="box">
- <view class="left">容量</view>
- <view class="right">{{ info.contain }}</view>
- </view>
- <!-- 发车日期区域 -->
- <view class="box">
- <view class="left">发车日期</view>
- <view class="right">{{ info.yy_date }}</view>
- </view>
- <!-- 发车时间区域 -->
- <view class="box">
- <view class="left">发车时间</view>
- <picker style="width: 40%" @change="bindPickerChange($event, 1)" mode="time" :value="info.ci_time" :start="getCurrentTime()">
- <view :class="['right', info.ci_time != 0 ? '' : 'unSelect']">
- {{ info.ci_time != 0 ? info.ci_time : '请选择' }}
- <view class="right-img"><img src="../../static/bottom.png" /></view>
- </view>
- </picker>
- </view>
- <!-- 扫码开始时间区域 -->
- <view class="box">
- <view class="left">扫码开始时间</view>
- <picker style="width: 40%" @change="bindPickerChange($event, 4)" mode="time" :value="info.sm_start">
- <view :class="['right', info.sm_start != 0 ? '' : 'unSelect']">
- {{ info.sm_start != 0 ? info.sm_start : '请选择' }}
- <view class="right-img"><img src="../../static/bottom.png" /></view>
- </view>
- </picker>
- </view>
- <!-- 扫码结束时间区域 -->
- <view class="box">
- <view class="left">扫码结束时间</view>
- <picker style="width: 40%" @change="bindPickerChange($event, 5)" mode="time" :value="info.sm_end">
- <view :class="['right', info.sm_end != 0 ? '' : 'unSelect']">
- {{ info.sm_end != 0 ? info.sm_end : '请选择' }}
- <view class="right-img"><img src="../../static/bottom.png" /></view>
- </view>
- </picker>
- </view>
- <!-- 预约截止时间区域 -->
- <view class="box">
- <view class="left">预约截止时间</view>
- <picker style="width: 40%" @change="bindPickerChange($event, 7)" mode="time" :value="info.yy_end">
- <view :class="['right', info.yy_end != 0 ? '' : 'unSelect']">
- {{ info.yy_end != 0 ? info.yy_end : '请选择' }}
- <view class="right-img"><img src="../../static/bottom.png" /></view>
- </view>
- </picker>
- </view>
- <!-- 路线区域 -->
- <view class="box">
- <view class="left">路线</view>
- <picker style="width: 60%" @change="bindPickerChange($event, 2)" :range="pathList" range-key="route">
- <view :class="['right', info.route ? '' : 'unSelect']">
- {{ info.route ? info.route : '请选择' }}
- <view class="right-img"><img src="../../static/bottom.png" /></view>
- </view>
- </picker>
- </view>
- <!-- 站点区域 -->
- <view class="box">
- <view class="left">站点</view>
- <picker style="width: 80%" @change="bindPickerChange($event, 3)" :range="endList" range-key="route_end">
- <view :class="['right', info.route_end ? '' : 'unSelect']">
- {{ info.route_end ? info.route_end : '请选择' }}
- <view class="right-img"><img src="../../static/bottom.png" /></view>
- </view>
- </picker>
- </view>
- <!-- 状态区域 -->
- <view class="box">
- <view class="left">状态</view>
- <view class="right">{{ info.state_str }}</view>
- </view>
- <!-- 提前一天预约区域 -->
- <view class="box">
- <view class="left">可否提前一天预约</view>
- <view class="right">{{ info.before_state == 0 ? '不可以' : '可以' }}</view>
- </view>
- <!-- 保存按钮区域 -->
- <view class="saveBtn" @click="handleSave">保存</view>
- <!-- 人员名单区域 -->
- <view class="list">
- <!-- 标题区域 -->
- <view class="list-title" v-if="info.user_num != 0">人员名单({{ listData.length }}人)</view>
- <!-- 筛选区域 -->
- <view class="list-search" v-if="info.user_num !== '0'">
- <!-- 身份筛选区域 -->
- <picker style="width: 50%" :range="statusList" range-key="text" @change="bindPickerChange($event, 6)">
- <view class="list-search-item">
- {{ statusList[result_status].text }}
- <view class="right-img"><img src="../../static/bottom.png" /></view>
- </view>
- </picker>
- <!-- 上车状态筛选区域 -->
- <picker style="width: 50%" :range="typeList" range-key="text" @change="bindPickerChange($event, 8)">
- <view class="list-search-item2">
- {{ typeList[result_state].text }}
- <view class="right-img"><img src="../../static/bottom.png" /></view>
- </view>
- </picker>
- </view>
- <view class="list-item" v-for="(item, index) in listData" :key="index">
- <view class="item-img"><img src="../../static/man.png" /></view>
- <view class="item-info">
- <view class="info-name">
- <view>{{ item.user_name }}</view>
- </view>
- <view class="info-mes">
- {{ item.user_zz }}
- <span>{{ item.yy_time }}</span>
- </view>
- </view>
- <view v-if="item.yy_state === '1'" class="item-type"><img src="../../static/subscribe.png" /></view>
- <view v-else class="item-type"><img src="../../static/pass2.png" /></view>
- </view>
- <!-- 无数据时展示的区域 -->
- <view class="list-nodata" v-if="listData.length == 0">
- <img src="../../static/no-bus.png" />
- <view>暂无数据</view>
- </view>
- </view>
- </view>
- </template>
- <script setup>
- import { ref } from 'vue'
- import { onLoad } from '@dcloudio/uni-app'
- import { myRequest } from '@/util/api.js'
- import { isWeixin } from '@/util/isWeixin.js'
- import { filterIdentity } from '@/util/filterIdentity.js'
- import { time_to_sec, time_change } from '@/util/formatTime.js'
- const BASE_URL = '/carstop/carbook'
- // const BASE_URL = '/testingServertomcat/carbook/'
- onLoad((options) => {
- if (isWeixin()) {
- filterIdentity()
- info.value = JSON.parse(options.info)
- // console.log(info.value)
- idRef.value = info.value.id
- // 获取人员列表
- getData()
- // 获取路线数组
- getPathList()
- // 获取终点站列表
- getEndList()
- // 获取车牌号列表
- getBusList()
- // 获取发车时间提前推迟多少分钟可以扫码数据
- getTimeConfig()
- // 处理车牌号数据
- form.value.selectValue = info.value.car_number
- setTimeout(() => {
- let temList = []
- selectMultiple.value.columns.forEach((item) => {
- if (item.label == form.value.selectValue) {
- temList.push(item.value)
- }
- })
- form.value.selectIndex = temList
- }, 500)
- // let userInfo = JSON.parse(uni.getStorageSync('bus-userInfo'))
- // // console.log(userInfo)
- // if (userInfo.user_zz !== '车队长') {
- // uni.redirectTo({
- // url: '/pages/404/404?message=暂无权限'
- // })
- // } else {
- // info.value = JSON.parse(options.info)
- // // console.log(info.value)
- // idRef.value = info.value.id
- // // 获取人员列表
- // getData()
- // // 获取路线数组
- // getPathList()
- // // 获取终点站列表
- // getEndList()
- // // 获取车牌号列表
- // getBusList()
- // // 获取发车时间提前推迟多少分钟可以扫码数据
- // getTimeConfig()
- // // 处理车牌号数据
- // form.value.selectValue = info.value.car_number
- // setTimeout(() => {
- // let temList = []
- // selectMultiple.value.columns.forEach(item => {
- // if (item.label == form.value.selectValue) {
- // temList.push(item.value)
- // }
- // })
- // form.value.selectIndex = temList
- // }, 500)
- // }
- } else {
- uni.redirectTo({
- url: '/pages/404/404?message=请在微信客户端打开链接'
- })
- }
- })
- // 带过来的预约详情数据
- const info = ref({})
- // 参数id
- const idRef = ref(null)
- // 车牌号绑定数据
- const form = ref({
- selectValue: '',
- selectIndex: []
- })
- // 车牌号数组相关数据
- const selectMultiple = ref({
- show: false,
- index: [],
- columns: []
- })
- // 路线数组
- const pathList = ref([])
- // 终点站数组
- const endList = ref([])
- // 人员列表数组
- const listData = ref([])
- // 发车时间提前多少分钟可以扫码
- const time_early = ref(null)
- // 发车时间推迟多少分钟可以扫码
- const time_late = ref(null)
- // 发车前多少分钟截止预约
- const time_yy_end = ref(null)
- // 人员名单上车状态
- const result_state = ref(0)
- const typeList = ref([
- {
- text: '全部',
- value: 0
- },
- {
- text: '已预约未上车',
- value: 1
- },
- {
- text: '已上车',
- value: 2
- }
- ])
- // 人员名单身份类型
- const result_status = ref(0)
- const statusList = ref([
- {
- text: '全部',
- value: 0
- },
- {
- text: '教师',
- value: 1
- },
- {
- text: '临时人员',
- value: 2
- }
- ])
- // 获取路线数组请求
- const getPathList = async () => {
- const res = await myRequest({
- url: '/appqueryRoute.action'
- })
- // console.log(res);
- pathList.value = res.data
- }
- // 获取终点站数组请求
- const getEndList = async () => {
- const res = await myRequest({
- url: '/appqueryEndRoutes.action',
- data: {
- route: info.value.route
- }
- })
- // console.log(res);
- endList.value = res.data
- }
- // 获取车牌号数组请求
- const getBusList = async () => {
- const res = await myRequest({
- url: '/appqueryCarInfos.action'
- })
- // console.log(res);
- if (res.data.length) {
- let temList = []
- res.data.forEach((item, index) => {
- temList.push({
- label: item.car_number,
- value: index.toString()
- })
- })
- selectMultiple.value.columns = temList
- }
- }
- // 获取人员名单请求
- const getData = async () => {
- const res = await myRequest({
- url: '/appqueryAppointeds.action',
- data: {
- id: idRef.value,
- result_state: result_state.value,
- userzz_state: result_status.value
- }
- })
- // console.log(res)
- listData.value = res.data
- }
- // 保存按钮回调
- const handleSave = () => {
- if (info.value.car_number == 0) {
- uni.showToast({
- title: '请选择车牌号',
- icon: 'none'
- })
- return
- }
- if (info.value.ci_time == 0) {
- uni.showToast({
- title: '请选择发车时间',
- icon: 'none'
- })
- return
- }
- if (!info.value.sm_start) {
- uni.showToast({
- title: '请选择扫码开始时间',
- icon: 'none'
- })
- return
- }
- if (!info.value.sm_end) {
- uni.showToast({
- title: '请选择扫码结束时间',
- icon: 'none'
- })
- return
- }
- if (time_to_sec(info.value.sm_start) >= time_to_sec(info.value.ci_time)) {
- uni.showToast({
- title: '扫码开始时间不能晚于发车时间',
- icon: 'none',
- duration: 2000
- })
- return
- }
- if (time_to_sec(info.value.sm_end) < time_to_sec(info.value.ci_time)) {
- uni.showToast({
- title: '扫码结束时间不能早于发车时间',
- icon: 'none',
- duration: 2000
- })
- return
- }
- if (!info.value.yy_end) {
- uni.showToast({
- title: '请选择预约截止时间',
- icon: 'none'
- })
- return
- }
- if (!info.value.route) {
- uni.showToast({
- title: '请选择路线',
- icon: 'none'
- })
- return
- }
- if (!info.value.route_end) {
- uni.showToast({
- title: '请选择终点站',
- icon: 'none'
- })
- return
- }
- uni.showModal({
- title: '提示',
- content: '确定保存吗?',
- success: (res) => {
- if (res.confirm) {
- handleSaveRequest()
- } else if (res.cancel) {
- }
- }
- })
- }
- // 保存请求
- const handleSaveRequest = () => {
- // console.log(info.value)
- const { id, car_number, ci_time, route, route_end, contain, sm_start, sm_end, yy_end } = info.value
- const { user_name } = JSON.parse(uni.getStorageSync('bus-userInfo'))
- uni.showLoading({
- title: '保存中',
- mask: true
- })
- uni.request({
- url: `${BASE_URL}/scheupdate.action`,
- method: 'post',
- header: {
- admin_name: encodeURIComponent(user_name)
- },
- data: {
- id,
- car_number,
- ci_time,
- route,
- route_end,
- contain,
- sm_start,
- sm_end,
- yy_end
- },
- success: (res) => {
- if (res.data.code == 200) {
- uni.showToast({
- title: res.data.message
- })
- setTimeout(() => {
- uni.redirectTo({
- url: '/pages/record/record'
- })
- }, 1500)
- } else {
- uni.showToast({
- title: res.data.message,
- icon: 'error'
- })
- }
- }
- })
- }
- // 点击车牌号下拉框回调
- const handleMultiple = (val) => {
- // console.log(val);
- selectMultiple.value.index = val || []
- selectMultiple.value.show = true
- }
- // 车牌号下拉框确定按钮回调
- const confirmMultiple = (e) => {
- // console.log(e);
- // console.log(e.value);
- if (selectMultiple.value.index != e.value) {
- let temp = []
- e.selected.forEach((item) => {
- temp.push(item.label)
- })
- form.value.selectValue = temp.toString()
- info.value.car_number = temp.toString()
- }
- form.value.selectIndex = e.value
- selectMultiple.value.show = false
- // 获取汽车容量
- getBusContain()
- }
- // 获取汽车容量请求
- const getBusContain = async () => {
- const res = await myRequest({
- url: '/appqueryCarContain.action',
- data: {
- car_number: form.value.selectValue
- }
- })
- // console.log(res);
- info.value.contain = res.data
- }
- // 获取发车时间提前推迟多少分钟可以扫码数据
- const getTimeConfig = async () => {
- const res = await myRequest({
- url: '/cnqueryHb.action'
- })
- // console.log(res)
- time_early.value = res.sm_end
- time_late.value = res.sm_start
- time_yy_end.value = res.yy_end
- }
- // 下拉框选择时的回调
- const changeMultiple = (e) => {
- // console.log(e);
- }
- // 原生下拉框的选择回调事件
- const bindPickerChange = (e, type) => {
- if (type === 1) {
- info.value.ci_time = e.detail.value
- info.value.sm_start = time_change(info.value.ci_time, time_early.value * -1)
- info.value.sm_end = time_change(info.value.ci_time, time_late.value)
- info.value.yy_end = time_change(info.value.ci_time, time_yy_end.value * -1)
- } else if (type === 2) {
- info.value.route = pathList.value[e.detail.value].route
- getEndList()
- info.value.route_end = ''
- } else if (type === 3) {
- info.value.route_end = endList.value[e.detail.value].route_end
- } else if (type === 4) {
- info.value.sm_start = e.detail.value
- } else if (type === 5) {
- info.value.sm_end = e.detail.value
- } else if (type === 6) {
- result_status.value = e.detail.value
- getData()
- } else if (type === 7) {
- info.value.yy_end = e.detail.value
- } else if (type === 8) {
- result_state.value = e.detail.value
- getData()
- }
- }
- // 获取当前时间 hh:mm
- const getCurrentTime = () => {
- const date = new Date()
- let H = (date.getHours() + '').padStart(2, '0')
- let M = (date.getMinutes() + '').padStart(2, '0')
- return `${H}:${M}`
- }
- </script>
- <style lang="scss" scoped>
- .container {
- background-color: #fff;
- .box {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 0 30rpx;
- height: 98rpx;
- font-size: 28rpx;
- border-bottom: 1rpx solid #e6e6e6;
- .left {
- flex: 1;
- color: #999999;
- }
- .right {
- flex: 1;
- display: flex;
- justify-content: flex-end;
- .right-img {
- margin-left: 27rpx;
- margin-top: -5rpx;
- width: 17rpx;
- height: 12rpx;
- img {
- width: 100%;
- height: 100%;
- }
- }
- }
- .right2 {
- flex: 2;
- display: flex;
- justify-content: flex-end;
- align-items: center;
- .item {
- flex: 1;
- padding: 20rpx 0;
- .select {
- width: 100%;
- padding-top: 6px;
- padding-bottom: 6px;
- padding-left: 9px;
- border-radius: 4px;
- font-size: 15px;
- text-align: end;
- box-sizing: border-box;
- color: #cccccc;
- line-height: 26px;
- &.selected {
- color: black;
- }
- }
- }
- .right-img {
- margin-left: 27rpx;
- margin-top: -30rpx;
- width: 17rpx;
- height: 12rpx;
- img {
- width: 100%;
- height: 100%;
- }
- }
- }
- .unSelect {
- color: #ccc;
- }
- }
- .saveBtn {
- margin: 20rpx 30rpx;
- line-height: 100rpx;
- text-align: center;
- color: #fff;
- font-size: 34rpx;
- border-radius: 15rpx;
- background: linear-gradient(180deg, #8684ff 0%, #3c50e8 100%);
- }
- .list {
- padding: 13rpx 30rpx;
- .list-title {
- display: flex;
- margin-top: 20rpx;
- height: 41rpx;
- color: #999999;
- font-size: 28rpx;
- }
- .list-search {
- display: flex;
- padding: 20rpx 0;
- .list-search-item,
- .list-search-item2 {
- flex: 1;
- display: flex;
- justify-content: flex-start;
- .right-img {
- margin-left: 27rpx;
- margin-top: -5rpx;
- width: 17rpx;
- height: 12rpx;
- img {
- width: 100%;
- height: 100%;
- }
- }
- }
- .list-search-item2 {
- justify-content: flex-end;
- }
- }
- .list-item {
- display: flex;
- align-items: center;
- box-sizing: border-box;
- padding: 29rpx 0 26rpx 0;
- height: 155rpx;
- border-bottom: 1rpx solid #e6e6e6;
- .item-img {
- width: 100rpx;
- height: 100rpx;
- border-radius: 50%;
- img {
- width: 100%;
- height: 100%;
- }
- }
- .item-info {
- flex: 1;
- display: flex;
- flex-direction: column;
- justify-content: space-evenly;
- margin-left: 6rpx;
- height: 100rpx;
- .info-name {
- display: flex;
- align-items: center;
- font-size: 32rpx;
- .info-name-img {
- margin-left: 26rpx;
- width: 30rpx;
- height: 35rpx;
- img {
- width: 100%;
- height: 100%;
- }
- }
- }
- .info-mes {
- font-size: 24rpx;
- color: #999999;
- span {
- margin-left: 26rpx;
- color: #a6a6a6;
- }
- }
- }
- .item-type {
- width: 104rpx;
- height: 41rpx;
- img {
- width: 100%;
- height: 100%;
- }
- }
- }
- .list-nodata {
- padding: 50rpx 0;
- background-color: #fff;
- text-align: center;
- color: #999999;
- img {
- width: 500rpx;
- }
- }
- }
- }
- .v-enter-active,
- .v-leave-active {
- transition: opacity 0.5s ease;
- }
- .v-enter-from,
- .v-leave-to {
- opacity: 0;
- }
- </style>
|