123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416 |
- <template>
- <view>
- <u-navbar title="无车辆扫码停车" :is-back="false"></u-navbar>
- <view class="main">
- <view class="park-name" v-if="detail.parkName">
- <img src="@/assets/static/img/if-location-pin@2x.png" alt="">
- <text>{{detail.parkName}}</text>
- </view>
- <view class="infos" v-if="!detail.id">
- {{message}}
- </view>
- <view class="infos" v-if="detail.id">
- <view class="item">
- <view class="title">
- 车牌号
- </view>
- <view class="content">
- {{detail.carNum}}
- </view>
- </view>
- <view class="item">
- <view class="title">
- 停车费
- </view>
- <view class="content">
- {{detail.price.toFixed(2)}}元
- </view>
- </view>
-
- </view>
-
- </view>
- <view class="details" v-if="detail.id">
- <view class="detail-item">
- <view class="title">
- 进场时间
- </view>
- <view class="content">
- {{detail.inParkingTime}}
- </view>
- </view>
- <view class="detail-item">
- <view class="title">
- 离场时间
- </view>
- <view class="content">
- {{detail.outParkingTime}}
- </view>
- </view>
- <view class="detail-item">
- <view class="title">
- 停车时长
- </view>
- <view class="content">
- {{detail.parkingTimeStr}}
- </view>
- </view>
- <view class="detail-item">
- <view class="title">
- 收费标准
- </view>
- <view class="content">
- {{detail.hourCost.toFixed(2)}}元/小时
- </view>
- </view>
- </view>
- <view class="payment" v-if="detail.id">
- <p>付款方式</p>
- <view class="methods">
- <view class="recharge-radio" >
- <u-radio-group v-model="value" :wrap="true" width="100%">
- <u-radio active-color="#0076ff" v-for="(item, index) in list" :key="index"
- :name="item.id" :disabled="item.disabled" width="100%">
- <view class="recharge-radio-item">
- <u-icon :name="item.icon" custom-prefix="custom-icon" :color="item.color" size="48">
- </u-icon>
- <view class="recharge-radio-name oldTextjp2" oldstyle="font-size:18px">
- {{item.name}}
- </view>
- </view>
- </u-radio>
- </u-radio-group>
- </view>
- </view>
-
- </view>
-
- <u-button @click='submit()' v-if="detail.id">缴纳停车费</u-button>
- <view class="box">
-
- </view>
- <!-- // -->
- <u-modal v-model="showModel"
- :show-cancel-button="false"
- @confirm="confirm"
- confirm-text="确定"
- title="扫码支付" >
- <view style="
- text-align: center;
- ">
- <img id="qrcode2" :src="qrCodeImg" >
- </view>
- <view style="
- text-align: center;
- ">请使用支付宝扫码</view>
-
- </u-modal>
- <img id="qrcode" style="display: none;" >
-
- <u-modal v-model="show" @confirm="confirmPhone" :confirm-text="confirmText" confirm-color="#606266" :show-cancel-button="true" ref="uModal"
- :asyncClose="true" :title="title" :content="content" :content-style="{fontSize: '24px',color: '#101010'}"></u-modal>
-
- <view class="service" @click="openModal">
- 联系停车场客服
- </view>
- </view>
- </template>
- <script>
- import * as Pay from '@/apis/weixin.js'
- import QRCode from 'qrcodejs2'
- import * as newsApi from '@/apis/news.js'
-
- import {
- convertCanvasToImage,
- } from '@/utils'
- import {
- wxPayJs
- } from '@/utils/wxpay'
- import {
- aliPayJs
- } from '@/utils/alipay'
- import * as API from '@/apis/parking.js'
- export default {
- data() {
- return {
- title:"客服电话",
- confirmText:"拨打电话",
- content:'',
- show:false,
- showModel:false,
- qrCodeImg:"",
- list: [{
- id:'0',
- name: '微信',
- icon: 'wechat-pay-fill',
- color: '#22ac38',
- },
- {
- id:'1',
- name: '支付宝',
- icon: 'alipay-fill',
- color: '#1677ff',
- },
- ],
- value:0,
- channelId:'',
- detail:{},
- message:"已抬杆,欢迎下次光临"
- }
- },onLoad(op) {
- this.getPhone()
- if(op.id){
- this.channelId=op.id
- this.getInfo()
- }else{
- uni.showModal({
- content:"参数错误"
- })
- }
-
-
- }, methods: {
- confirm(){
- this.getInfo();
- },
- getPhone(){
- newsApi.findConfigureByKey({
- key:'consumerPhone'
- }).then((res) => {
-
- this.content = res.data.value;
-
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- openModal() {
-
- this.show = true;
- },
- confirmPhone(){
-
-
- this.show = false;
- uni.makePhoneCall({
- phoneNumber:this.content //仅为示例
- });
- },
- confirm(){
- uni.redirectTo({
- url:"/pages/parking/paymentResult"
- })
- },
- submit(){
- if(this.value=="0"){
- this.wxpy()
- }else{
- this.alpy()
- }
-
- },
- alpy(){
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- API.parkTradePrecreatePay({
- id: this.detail.id,
- openId: this.carhelp.getOpenId()
- }).then((response) => {
-
- let qrcode = new QRCode('qrcode', {
- width: 200,
- height: 200,
- text: response.data,
- correctLevel: QRCode.CorrectLevel.M,
-
- })
- // this.outOrderNo=response.data.outOrderNo;
- var canvas = document.getElementsByTagName('canvas')[0];
- this.qrCodeImg = convertCanvasToImage(canvas);
- uni.hideLoading()
- this.showModel=true
-
- }).catch(error => {
- uni.showToast({
-
- title: error
- })
- })
- },
- wxpy(){
-
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
-
- API.parkingWxPay({
- id: this.detail.id,
- openId: this.carhelp.getOpenId()
- }).then(data => {
-
- //data.data.url = window.location.href.split("#")[0] + "/#/car/payResult";
-
- uni.hideLoading()
- wxPayJs(data.data)
- }).catch(error => {
- uni.hideLoading()
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- getInfo(){
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- API.generateTemporaryCarNum({
- openId:this.carhelp.getOpenId(),
- channelId:this.channelId
- }).then((res) => {
-
- uni.hideLoading();
-
- this.detail = res.data;
-
- }).catch(error => {
- uni.hideLoading()
- // uni.showToast({
- // title: error,
- // icon: "none"
- // })
- this.message=error
- // uni.showModal({
- // title:"提示",
- // content:error,
- // showCancel:false,
- // })
- })
- }
- }
- }
-
- </script>
-
- <style lang="scss" scoped>
-
- .main{
- height: 200px;
- padding: 20px 23px;
- background: linear-gradient(#1F55FF,#27ABFF);
-
- .park-name{
- line-height: 20px;
- color: rgba(255, 255, 255, 100);
- font-size: 20px;
- position: relative;
- text{
- margin-left: 25px;
- }
- img{
- width: 20px;
- height: 20px;
- margin-right: 8px;
- position: absolute;
-
- }
- }
- .infos{
- margin-top: 28px;
- color: #fff;
- font-size: 24px;
- .item{
- display: flex;
- justify-content: space-between;
- margin-bottom: 20px;
- }
- }
- }
- .details{
- width: 89.3%;
- padding: 20px 20px 5px;
- margin: auto;
- border-radius: 12px;
- background-color: #fff;
- position: relative;
- top: -30px;
- left: 0;
- right: 0;
- .detail-item{
- display: flex;
- justify-content: space-between;
- margin-bottom: 15px;
- .title{
- color: #86898c;
- }
- }
- }
- .payment{
- width: 89.3%;
- margin:0 auto ;
- .methods{
- border-radius: 8px;
- background-color: #fff;
- margin-top: 12px;
- padding: 0px 12px;
- .recharge-radio {
-
- .recharge-radio-item {
- display: flex;
- align-items: center;
-
- }
-
- .recharge-radio-name {
- margin-left: 8px;
- }
- }
- ::v-deep.u-radio-group {
- width: 100%;
- }
- ::v-deep.u-radio {
- position: relative;
- }
-
- ::v-deep.u-radio__icon-wrap {
- position: absolute;
- right: 0;
- }
- }
-
- }
- .u-btn{
- width: 89.3%;
- background-color: #0051db;
- border-radius: 12px;
- color: #fff;
- margin-top: 20px;
- }
- .box{
- width: 100%;
- height: 14vh;
- }
- .service{
- color: rgba(0, 90, 217, 100);
- font-size: 16px;
- text-align: center;
- position: fixed;
- bottom: 0px;
- left: 0;
- right: 0;
- height: 40px;
- background-color: #fff;
- z-index: 999;
-
- }
- </style>
|