123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422 |
- <template>
- <!-- 车位锁 -->
- <view class="parking-lock">
- <!-- 车位锁支付 -->
- <view class="parking-lock-pay" v-if="parkingLockStatus === 1">
- <view class="parking-lock-title">支付停车费</view>
- <view class="parking-lock-tips">请您确认停车费用,确认后请支付费用,结束停车。谢谢您的使用!</view>
- <view class="parking-lock-info">
- <view class="parking-lock-info-item">
- <view>停车场名称</view>
- <view>{{orderInfo.roadName}}</view>
- </view>
- <view class="parking-lock-info-item">
- <view>停车泊位</view>
- <view>{{orderInfo.spaceName}}</view>
- </view>
- <view class="parking-lock-info-item">
- <view>免费时长</view>
- <view>15分钟</view>
- </view>
- <view class="parking-lock-info-item">
- <view>开始计费</view>
- <view>{{orderInfo.inTime}}</view>
- </view>
- <view class="parking-lock-info-item">
- <view>结束计费</view>
- <view>{{orderInfo.outTime}}</view>
- </view>
- <view class="parking-lock-info-item">
- <view>停车时长</view>
- <view>{{orderInfo.duration}}</view>
- </view>
- <!-- <view class="parking-lock-info-item">
- <view>合计金额</view>
- <view>{{orderInfo.totalAmount}} 元</view>
- </view>
- <view class="parking-lock-info-item">
- <view>优惠金额</view>
- <view>{{orderInfo.preferentialAmount}} 元</view>
- </view> -->
- <view class="parking-lock-info-item">
- <view>应缴金额</view>
- <view class="really-money">{{orderInfo.payAmount}} 元</view>
- </view>
- <view class="parking-lock-info-item" v-if="orderInfo.vehicleNo==''">
- <view>车牌信息</view>
- <view class="really-license" ><text class="really-license-txt" @click="addvehicleNo">添加车牌</text></view>
- </view>
- <view class="parking-lock-info-item" v-else>
- <view>车牌信息</view>
- <view class="really-license">{{orderInfo.vehicleNo}} <text @click="changevehicleNo" class="really-license-txt1">更换</text></view>
- </view>
- </view>
- <view class="parking-lock-pay-btn">
- <button type="default" @click="payMoney">立即支付</button>
- </view>
- <view class="parking-lock-pay-attention">
- <text>
- 温馨提示:车牌信息可填可不填,如果您已通过本机号码办理了特定车或包月车业务,则需要输入车牌号,否则将按照常规收费标准进行收费。
- </text>
- </view>
- </view>
- <!-- 车位锁开始状态 -->
- <view class="parking-lock-begin" v-else-if="parkingLockStatus === 2">
- <view class="parking-lock-begin-box">
- <view class="parking-lock-begin-bg">
- <image src="../../static/img/parking-lock-bg.png" mode=""></image>
- </view>
- </view>
- <view class="parking-lock-begin-info">车位锁正在动作,还未到位</view>
- </view>
- <!-- 车位锁正在状态 -->
- <view class="parking-lock-loading" v-else-if="parkingLockStatus === 3">
- <view class="parking-lock-loading-box">
- <view class="parking-lock-loading-bg">
- <image src="../../static/img/parking-lock-bg.png" mode=""></image>
- </view>
- </view>
- <view class="parking-lock-loading-info">开锁中,请等待!</view>
- </view>
- <!-- 开锁完成 -->
- <view class="parking-lock-success" v-else-if="parkingLockStatus === 4">
- <view class="parking-lock-success-box">
- <image src="../../static/img/parking-lock-achieve.png" mode=""></image>
- </view>
- <view class="parking-lock-success-info">开锁已完成</view>
- <view class="parking-lock-success-button">
- <button @click="cancel">返回</button>
- </view>
- </view>
- <view class="parking-lock-pay" v-else-if="parkingLockStatus === 5">
- <view class="parking-lock-tips">{{tipsMsg}}</view>
- </view>
- <!-- 支付方式 -->
- <PaymentMethod
- :payWayPop="payWayPop"
- :curOrderList="orderList"
- :deviceNo="deviceNo"
- :jumpUrl="jumpUrl"
- @closePaymentMethod="closePaymentMethod"></PaymentMethod>
- <u-toast ref="uToast" />
- <u-popup v-model="show" mode="center" border-radius="14" width="200rpx" height="200rpx">
- <view class="loadingSelect">订单查询中...</view>
- <view class="spinner">
- <view class="rect1"></view>
- <view class="rect2"></view>
- <view class="rect3"></view>
- <view class="rect4"></view>
- <view class="rect5"></view>
- </view>
- </u-popup>
- <u-popup class="popup-vehicleNo" v-model="ShowaddvehicleNo" mode="center" border-radius="20" width="710rpx" height="auto">
- <view class="popup-vehicleNo-title">添加车牌</view>
- <view class="popup-vehicleNo-center"></view>
- <view class="popup-vehicleNo-content">
- <view class="new-plate-number">
- <view class="message-input-wrap" @click="messageInputClick">
- <u-message-input :maxlength="8" width="70" font-size="50" :disabled-keyboard="true" v-model="newPlateNumber"></u-message-input>
- </view>
- </view>
- </view>
- <view class="popup-vehicleNo-select">暂无绑定车牌</view>
- <view class="vehicleNo-btn">
- <u-button type="primary" @click="handleAddCar">确认</u-button>
- <u-button type="primary" plain @click="ShowaddvehicleNo=false">取消</u-button>
- </view>
- </u-popup>
-
- <u-popup class="popup-vehicleNo" v-model="ShowchangevehicleNo" mode="center" border-radius="20" width="710rpx" height="auto">
- <view class="popup-vehicleNo-title">更换车牌</view>
- <view class="popup-vehicleNo-center"></view>
- <view class="popup-vehicleNo-content">
- <view class="new-plate-number">
- <view class="message-input-wrap" @click="messageInputClick">
- <u-message-input :maxlength="8" width="70" font-size="50" :disabled-keyboard="true" v-model="newPlateNumber"></u-message-input>
- </view>
- </view>
- </view>
- <view class="popup-vehicleNo-select">
- <u-collapse ref="refValue">
- <u-collapse-item title="点击选择车牌" align="center">
- <u-cell-group >
- <u-cell-item :title="item.vehicleNo" v-for="(item, index) in groupList" :key="index" :arrow="false" >
- <u-radio-group v-model="selectvalue" @change="radioGroupChange">
- <u-radio :name="item.vehicleNo" :key="index"></u-radio>
- </u-radio-group>
- </u-cell-item>
- </u-cell-group>
- </u-collapse-item>
- </u-collapse>
- </view>
- <view class="vehicleNo-btn">
- <u-button type="primary" @click="handleAddCar">确认</u-button>
- <u-button type="primary" plain @click="ShowchangevehicleNo=false">取消</u-button>
- </view>
- </u-popup>
- <u-action-sheet :list="colorList" @click="confirmColor" v-model="colorShow"></u-action-sheet>
- <u-keyboard ref="uKeyboard" mode="car" @change="keyboardChange" @confirm="keyboardConfirm" @backspace="backspace" v-model="keyboardshow"></u-keyboard>
- </view>
- </template>
- <script>
- import getUrlParams from "../../utils/getUrlParams.js";
- import PaymentMethod from '@/pages/paymentMethod/paymentMethod.vue'
- export default {
- components: {
- PaymentMethod
- },
- data() {
- return {
- selectvalue: null,
- groupList: [],
- radiogroupList: [],
- keyboardshow: false,
- colorShow: false,
- colorList:[
- {text:'蓝色',colorCode:0}
- ,{text:'黄色',colorCode:1}
- ,{text:'黑色',colorCode:2}
- ,{text:'白色',colorCode:3}
- ,{text:'绿色',colorCode:4}
- ,{text:'其他',colorCode:99}
- ],
- vehicleColor:0,
- newPlateNumber:'',
- //更换车牌弹窗
- ShowchangevehicleNo: false,
- //添加车牌弹窗
- ShowaddvehicleNo: false,
- // 车位锁状态 1:支付 2:开始开锁 3:开锁中 4:开锁完成
- parkingLockStatus: 1,
- // 支付方式选择弹框
- payWayPop: false,
- // 订单编号
- orderList: [],
- // 提示信息
- tipsMsg: null,
- // 设备编号
- deviceNo: null,
- // 轮询
- timer: null,
- timer1: null,
- // 订单信息
- orderInfo: {},
- // 订单id
- orderId: null,
- // 重定向地址
- jumpUrl: location.href + '&isBack=1',
- show: true
- }
- },
- onLoad(page) {
- if (page.orderId) {
- this.getOrderDetails(page.orderId)
- this.orderList = []
- this.orderId = page.orderId
- this.orderList.push(page.orderId)
- this.deviceNo = page.deviceNo
- } else {
- this.tipsMsg = page.msg
- this.parkingLockStatus = 5
- }
- },
- onShow() {
- if(this.orderId){
- this.timer1 = setInterval(() => {
- // uni.showLoading({
- // title: '订单查询中'
- // });
- this.show = true
- this.getOrderDetails(this.orderId)
- }, 2000)
- }else{
- this.show = false
- }
- },
- onHide() {
- if (this.timer) {
- clearInterval(this.timer)
- }
- if (this.timer1) {
- clearInterval(this.timer1)
- }
- },
- methods: {
- radioGroupChange(e){
- this.newPlateNumber = e
- },
- // 获取车辆列表
- handlegetMycars(){
- let that = this;
- this.$u.api.getMycars()
- .then(res=>{
- if (res.code === 200) {
- this.groupList = res.data.rows;
- this.radiogroupList = res.data.rows;
- this.$nextTick(() => {
- // dom元素更新后执行,因此这里能正确打印更改之后的值
- console.log(that.$refs.refValue.init()) // 改变了的值
- })
- } else {
- this.$refs.uToast.show({
- title: res.msg,
- type: 'error'
- })
- }
- })
- .catch(err=>{
- this.$refs.uToast.show({
- title: '操作失败!',
- type: 'error'
- })
- });
- },
- //更换车牌信息
- changevehicleNo(){
- this.ShowchangevehicleNo = true;
- this.handlegetMycars();
- },
- // 添加车辆
- handleAddCar(){
- if(!this.$u.test.carNo(this.newPlateNumber)){
- this.$refs.uToast.show({
- title: '请正确填写车牌号',
- type: 'error',
- });
- return
- }
- let param = {
- orderId: this.orderId,
- vehicleNo: this.newPlateNumber,
- vehicleColor: this.vehicleColor,
- };
- let that = this;
- this.$u.api.bindVehicleNo(param)
- .then(res=>{
- if (res.code === 200) {
- this.$refs.uToast.show({
- title: res.msg,
- type: 'success',
- });
- that.getOrderDetails(that.orderId);
- that.ShowchangevehicleNo = false;
- } else {
- this.$refs.uToast.show({
- title: res.msg,
- type: 'error',
- });
- }
- })
- .catch(err=>{
- this.$refs.uToast.show({
- title: '操作失败!',
- type: 'error',
- });
- });
- },
- //新增车牌
- addvehicleNo(){
- this.ShowaddvehicleNo = true;
- },
-
- // 点击输入框
- messageInputClick(){
- this.keyboardshow = true;
- },
- // 按键被点击(点击退格键不会触发此事件)
- keyboardChange(val) {
- // 将每次按键的值拼接到value变量中,注意+=写法
- this.newPlateNumber += val;
- },
- // 退格键被点击
- backspace() {
- // 删除value的最后一个字符
- if(this.newPlateNumber.length) this.newPlateNumber = this.newPlateNumber.substr(0, this.newPlateNumber.length - 1);
- },
- // 键盘输入完成后确认
- keyboardConfirm(){
- this.colorShow = true;
- },
- // 确认颜色
- confirmColor(e){
- this.vehicleColor = this.colorList[e].colorCode;
- },
-
- payMoney() {
- this.payWayPop = true
- },
- // 查询订单信息
- getOrderDetails(id) {
- // uni.showLoading({
- // title: '订单查询中'
- // });
- this.$u.api.getOrderDetail({id: id})
- .then(res => {
-
- console.log(res)
- if (res.code === 200) {
- // 获取页面完整url
- const local = window.location.href
- // 获取url后面的参数
- const locationLocaturl = window.location.search;
- // 截取url中的isBack
- let isBack = getUrlParams(local, "isBack");
- console.log('isBack',isBack);
- console.log('isBack',isBack == null || isBack != '1');
- // 如果没有isBack,则去请求
- if (!isBack) {
- // uni.hideLoading();
- this.show = false
- clearInterval(this.timer1)
- }
- this.orderInfo = res.data
- if (res.data.payStatus === 1) {
- // uni.hideLoading();
- this.show = false
- clearInterval(this.timer1)
- this.checkEqupment()
- }
- }
- })
- },
- // 检测设备
- checkEqupment() {
- this.timer = setInterval(() => {
- this.getEqumentStatus(this.deviceNo)
- }, 1000)
- },
- // 查询设备状态
- getEqumentStatus(orderNo) {
- console.log(orderNo)
- this.$u.api.getEquomentInfo({orderNo: orderNo})
- .then(res => {
- if (res.code === 200) {
- console.log(res.data)
- if (res.data.deviceStatus === 0) {
- this.parkingLockStatus = 4
- clearInterval(this.timer)
- } else if (res.data.deviceStatus === 1 || res.data.deviceStatus === 5) {
- this.parkingLockStatus = 2
- } else if (res.data.deviceStatus === 6) {
- this.parkingLockStatus = 3
- }
- }
- })
- },
- // 返回首页
- cancel() {
- uni.switchTab({
- url: '/pages/index/index'
- })
- },
- closePaymentMethod() {
- this.payWayPop = false
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import './parkingLock.scss';
- </style>
|