123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- <template>
- <view class="">
- <u-navbar
- title="车辆入场"
- title-color="#fff"
- :custom-back="customBack"
- :border-bottom="false"
- back-icon-color="#CCE8FF"
- :background="{background: '#008CFF' }"></u-navbar>
- <view class="car-info u-flex">
- <view class="car-info-img" @click="getPic">
- <u-image src="/static/img/default-car.png" width="100%" height="100%"></u-image>
- </view>
- <view class="car-info-text u-flex-1">
- <view class="text-item position-wrap">
- <view class="position">车位:{{spaceName}}</view>
- </view>
- <view class="text-item u-flex u-flex u-row-between">
- <view class="">车辆类型</view>
- <view class="" @click="carTypeShow = true">{{carType|filterCarType}}</view>
- </view>
- <view class="text-item u-flex u-flex u-row-between">
- <view class="">余额:<span class="balance">{{balance||'暂无'}}</span></view>
- <!-- <view class="recharge" @click="$refs.uToast.show({title: '建设中'})">充值</view> -->
- </view>
- <view class="text-item">{{$u.timeFormat(currentTime, 'yyyy-mm-dd hh:MM:ss')}}</view>
- </view>
- </view>
-
- <view class="other-info">
- <view class="other-info-item u-flex">
- <u-input v-model="vehicleNo" height="80" type="text" placeholder="输入车牌号" />
- <u-button type="primary" @click="handleParkInInfo">确认</u-button>
- </view>
- <view class="other-info-item">
- <u-input style="width: 100%;" v-model="deposit" height="80" type="text" placeholder="输入进场押金" />
- </view>
-
- </view>
- <view class="upload-wrap">
- <u-upload :action="upload" :file-list="fileList" upload-text="拍照取证" ></u-upload>
- </view>
-
-
- <view class="bottom-btn-wrap">
- <view class="bottom-btn-box u-flex">
- <view class="bottom-btn bg-blue" @click="submit">入场</view>
- <view class="bottom-btn bg-gray" @click="openPage('pages/getout/getout')">取消</view>
- </view>
- </view>
-
- <u-select v-model="carTypeShow" :default-value="[carType]" :list="carTypeList" @confirm="carTypeConfirm"></u-select>
- <u-toast ref="uToast" />
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- spaceId:'',
- spaceName:'',
- carTypeShow:false,
- carTypeList:[
- {label: '小车',value:0}
- ,{label: '大车',value:1}
- ,{label: '超大型车',value:2}
- ,{label: '摩托车',value:3}
- ,{label: '非机动车',value:4}
- ,{label: '其他',value:5}
- ],
- carType:0,
- vehicleType:null,
- currentTime: new Date(), // 获取当前时间
- vehicleNo:null,
- vehicleColor:null,
- vehicleImage:null,
- deposit:null,
- balance:null,
- fileList:[]
- }
- },
- onLoad(page) {
- this.spaceId = page.spaceId;
- this.orderInTime = page.orderInTime;
- this.spaceName = page.spaceName;
- this.roadNo = page.roadNo;
-
- },
- onShow() {
-
- },
- methods:{
- customBack(){
- this.$u.route({
- // type:'switchTab',
- url: 'pages/parking/parking'
- });
- },
- openPage(path) {
- console.log('path',path);
- this.$u.route({
- url: path
- })
- },
- carTypeConfirm(e){
- // console.log('carTypeConfirm',e[0].label);
- // this.carType = e[0].label;
- this.carType = e[0].value;
- this.vehicleType = e[0].value;
- },
- submit(){
- let param ={
- spaceId:this.spaceId,
- vehicleNo:this.vehicleNo,
- vehicleColor:this.vehicleColor,
- vehicleImage:this.vehicleImage,
- vehicleType:this.vehicleType,
- deposit:this.deposit
- };
- this.$u.api.parkInConfirm(param)
- .then(res=>{
- this.$refs.uToast.show({
- title: res.msg,
- type: 'success',
- url:'pages/getout/getout'
- });
- console.log('parkInConfirm',res)
- }).catch(err=>{
- this.$refs.uToast.show({
- title: err.msg,
- type: 'error',
- // url:'pages/parking/parking'
- });
- console.log('parkInConfirm ',err)
- });
- },
- handleParkInInfo(){
- let param ={
- vehicleNo:this.vehicleNo,
- roadNo:this.roadNo
- };
- this.$u.api.parkInInfo(param)
- .then(res=>{
- this.$refs.uToast.show({
- title: res.msg,
- type: 'success',
- // url:'pages/getout/getout'
- });
- this.vehicleType = res.data.vehicleType??"0";
- this.balance = res.data.balance;
- console.log('parkInInfo',res);
- console.log('this.vehicleType',this.vehicleType)
- }).catch(err=>{
- this.$refs.uToast.show({
- title: err.msg,
- type: 'error',
- // url:'pages/parking/parking'
- });
- console.log('parkInInfo ',err)
- });
- },
- getPic(){
- let that = this;
- uni.chooseImage({
- count: 1, //默认9
- sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
- sourceType: ['camera'], //
- success: function (res) {
- // console.log('img',res)
- uni.showLoading({});
- const tempFilePaths = res.tempFilePaths;
- // 若多选,需循环调用uni.uploadFile ,因微信小程序只支持单文件上传
- uni.uploadFile({
- url: `${that.config.fileUrl}/baidu/ocr`,
- filePath: tempFilePaths[0],
- name: 'file',
- formData: {
- 'test': 'test' // 上传附带参数
- },
- success: (res) => {
- // 根据接口具体返回格式 赋值具体对应url
- // alert(uploadFileRes.data);
- let resobj=eval("("+res.data+")");
- uni.hideLoading();
- if(resobj.code==200){
- console.log(resobj);
- that.vehicleNo = resobj.data.vehicleNo;
- that.vehicleClor = resobj.data.vehicleClor;
- }else{
- that.$refs.uToast.show({
- title: resobj.msg,
- type: 'error'
- });
- }
-
- console.log(res);
- },
- fail: (err) => {
- that.$refs.uToast.show({
- title:err.msg,
- type: 'error'
- });
- uni.hideLoading();
- }
- });
- }
- });
- },
- upload(){
-
- }
-
- }
-
- }
- </script>
- <style lang="scss">
- @import "./getin.scss";
- </style>
|