You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

333 lines
9.2 KiB

4 years ago
<template>
<view>
4 years ago
<view class="box-content">
<view class="box-card">
4 years ago
<view class="box-tip justify-between" @click="openselectorder">
<text class="box-tiptxt">已选{{selectInfo}}</text>
4 years ago
<view class="box-tipbtn">选择已预约的参观 > </view>
</view>
<u--form labelPosition="top" labelWidth="120px" :model="form" ref="form">
4 years ago
<u-form-item label="预约入场时间" labelPosition="top" borderBottom>
<view @click="handleSelectTime" style="color: #EF9525;font-size: 24rpx;">
{{(form.time?$u.timeFormat(new Date(form.time), 'yyyy年mm月dd日 hh:MM'):'请选择入场时间>')}}
</view>
<u-datetime-picker :show="showSelecttime" closeOnClickOverlay @close="cancelTime"
@cancel="cancelTime" @confirm="confirmTime" v-model="form.time" mode="datetime">
4 years ago
</u-datetime-picker>
</u-form-item>
<u-form-item label="车牌号码" labelPosition="top" borderBottom ref="plate">
<plate @listenPlateChange="plateChange" :defaultPlate="plateNumber" />
</u-form-item>
<u-form-item label="手机号" labelPosition="top" borderBottom ref="mobile">
<u--input placeholder="请输入手机号" v-model="form.mobile" border="surround" clearable></u--input>
</u-form-item>
</u--form>
4 years ago
4 years ago
<view class="box-tip box-tipgray flex-row align-center" @click="handleChange">
<u-icon :name="(form.checkUser?'checkmark-circle-fill':'checkmark-circle')" color="#828282">
</u-icon>
<view class="box-tiptxt" style="margin-left: 10rpx;">请认真阅读知悉并遵守实训基地预约停车须知</view>
</view>
</view>
</view>
<view class="page-bottom">
4 years ago
<u-button type="primary" @click="submitOrder"></u-button>
4 years ago
</view>
4 years ago
<u-popup :show="showSelectorder" mode="bottom" :closeOnClickOverlay="false" @close="closeorder" :round="10">
<view class="mpopup">
<view class="mpopup-title">
选择预约的活动或者预约的参观
</view>
<view class="mpopup-content" style="padding: 40rpx 20rpx;">
<view v-if="listOrder.length!=0">
<view class="mpopup-title" style="text-align: left;padding: 20rpx 0;font-size: 14px;">
预约的参观
</view>
<block v-for="(item,index) in listOrder" :key="index">
<view class="box-tip flex-row align-center" @click="handleSelectOrder(index,1)"
style="margin-bottom: 20rpx;">
<u-icon :name="(item.checked?'checkmark-circle-fill':'checkmark-circle')"
color="#EF9525">
</u-icon>
<view class="box-tiptxt" style="margin-left: 10rpx;">
{{$u.timeFormat(new Date(item.date), 'mm月dd日')}}
{{item.time}}{{item.details_count}} 位观众</text>
</view>
</view>
</block>
</view>
<view v-if="listActivtyOrder.length!=0">
<view class="mpopup-title" style="text-align: left;padding: 20rpx 0;font-size: 14px;">
预约的活动
</view>
<block v-for="(item,index) in listActivtyOrder" :key="index">
<view class="box-tip flex-row align-center" @click="handleSelectOrder(index,2)"
style="margin-bottom: 20rpx;">
<u-icon :name="(item.checked?'checkmark-circle-fill':'checkmark-circle')"
color="#EF9525">
</u-icon>
4 years ago
<view class="box-tiptxt" style="margin-left: 10rpx;">
活动时间{{item.activity.start_time}}
报名数量{{item.total}}</text>
</view>
4 years ago
</view>
</block>
</view>
<u-button type="primary" @click="handleConfirmOrder"></u-button>
</view>
</view>
</u-popup>
4 years ago
</view>
</template>
<script>
import {
plate
} from '@/components/plate/index.vue'
export default {
name: "index",
components: {
plate
},
data() {
return {
4 years ago
showSelectorder: true,
selectInfo: "--",
4 years ago
showSelecttime: false,
plateNumber: ['苏', 'E', '', '', '', '', ''],
form: {
plate: "",
mobile: "",
4 years ago
time: new Date(),
4 years ago
car_park_id: "",
checkUser: false,
car_type: 1,
4 years ago
type: "1",
4 years ago
car_park_id: 0,
activity_order_id: "",
visit_order_id: ""
4 years ago
},
listOrder: [],
listActivtyOrder: [],
orderType: 1,
orderid: 0,
4 years ago
}
},
4 years ago
onLoad(options) {
let that = this;
if (!that.util.isNull(options.id)) {
4 years ago
this.form.car_park_id = parseInt(options.id);
4 years ago
}
if (!that.util.isNull(options.currentPark)) {
this.form.type = options.currentPark;
}
this.loadOrder(function() {
that.loadactivityOrder(function() {})
});
that.util.getUserInfo(function(r) {
that.form.mobile = r.mobile;
}, true);
4 years ago
},
onShow() {
},
methods: {
4 years ago
handleConfirmOrder() {
if (this.orderid === 0) {
this.util.toast("请选择预约的活动或者预约的参观");
return false;
}
this.showSelectorder = false;
},
handleSelectOrder(index, type) {
for (var m of this.listActivtyOrder) {
m.checked = false;
}
for (var m of this.listOrder) {
m.checked = false;
}
if (type == 1) {
this.listOrder[index].checked = true;
this.selectInfo = this.$moment(this.listOrder[index].date).format("MM月DD日") + " " + this.listOrder[
index].time
4 years ago
this.form.time = this.$moment(this.listOrder[index].date + " " + this.listOrder[
index].time.split("-")[0]).format("YYYY-MM-DD hh:mm:ss");
4 years ago
this.form.visit_order_id = this.orderid = this.listOrder[index].id;
4 years ago
} else {
4 years ago
this.listActivtyOrder[index].checked = true
this.selectInfo = this.$moment(this.listActivtyOrder[index].activity.start_time).format("MM月DD日 hh:mm")
this.form.time = this.$moment(this.listActivtyOrder[index].activity.start_time).format("YYYY-MM-DD hh:mm:ss");
this.form.activity_order_id = this.orderid = this.listActivtyOrder[index].id;
4 years ago
}
this.orderType = type;
},
openselectorder() {
4 years ago
this.showSelectorder = true;
4 years ago
},
closeorder() {
this.showSelectorder = false;
},
loadOrder(cb) {
var that = this;
this.util.request({
api: '/api/mobile/user/my-visit-order',
data: {
status: 1
},
utilSuccess: function(res) {
for (var mod of res) {
mod.checked = false;
}
that.listOrder = res;
cb(res)
},
utilFail: function(res) {
this.util.toast(res)
}
})
},
loadactivityOrder(cb) {
var that = this;
this.util.request({
api: '/api/mobile/user/my-activity-order',
data: {
status: 1
},
utilSuccess: function(res) {
for (var mod of res) {
mod.checked = false;
}
that.listActivtyOrder = res;
cb(res);
},
utilFail: function(res) {
this.util.toast(res)
}
})
},
confirmTime(e) {
console.log(e)
4 years ago
this.showSelecttime = false;
},
cancelTime() {
this.showSelecttime = false;
},
4 years ago
plateChange(val) {
4 years ago
this.form.plate = val.join("")
4 years ago
},
handleChange() {
this.form.checkUser = !this.form.checkUser;
},
handleSelectTime() {
this.showSelecttime = true;
4 years ago
},
submitOrder() {
if (this.util.isNull(this.orderid)) {
this.util.toast("请选择参观预约或者活动预约");
return false;
}
if (this.form.plate.length != 7 && this.form.plate.length != 8) {
this.util.toast("请正确填写车牌号");
return false;
}
if (this.util.isNull(this.form.mobile)) {
uni.showToast({
icon: "none",
title: "请填写手机号"
})
return false;
} else if (!uni.$u.test.mobile(this.form.mobile)) {
uni.showToast({
icon: "none",
title: "请正确填写手机号"
})
return false;
}
if (!this.form.checkUser) {
this.util.toast("请阅读预约通知");
return false;
}
var that = this;
this.util.request({
api: '/api/mobile/carpark/order',
data: this.form,
4 years ago
method: "POST",
4 years ago
utilSuccess: function(res) {
uni.showToast({
icon: "none",
title: "下单成功",
complete() {
uni.reLaunch({
url: "/pages/success/success?from=park&id=" + res.id
})
}
})
},
utilFail: function(res) {
that.util.toast(res);
}
})
},
4 years ago
}
}
</script>
<style>
4 years ago
page {
background: #f7f6f4;
}
.box-tip {
background: #FCF6E3;
height: 66rpx;
line-height: 66rpx;
box-sizing: border-box;
padding: 0rpx 12rpx;
}
.box-tipgray {
background: #f7f6f4 !important;
}
.box-tiptxt {
font-size: 24rpx;
color: #828282;
}
4 years ago
4 years ago
.box-tipbtn {
font-size: 24rpx;
text-decoration: underline;
color: #EF9525;
}
.box-content {
padding: 30rpx 24rpx;
}
.box-card {
background: #FFFFFF;
border-radius: 16rpx;
padding: 31rpx 18rpx;
margin-bottom: 20rpx;
}
.page-bottom {
background: #FFFFFF;
height: 108rpx;
box-shadow: 2rpx 3rpx 10rpx 0rpx rgba(107, 94, 77, 0.3);
width: 100%;
position: fixed;
bottom: 0;
left: 0;
padding: 15rpx 25rpx;
box-sizing: border-box;
4 years ago
z-index: 10;
4 years ago
}
4 years ago
</style>