|
@@ -26,14 +26,14 @@
|
|
<view>停车时长</view>
|
|
<view>停车时长</view>
|
|
<view>{{orderInfo.duration}}</view>
|
|
<view>{{orderInfo.duration}}</view>
|
|
</view>
|
|
</view>
|
|
- <view class="parking-lock-info-item">
|
|
|
|
|
|
+ <!-- <view class="parking-lock-info-item">
|
|
<view>合计金额</view>
|
|
<view>合计金额</view>
|
|
<view>{{orderInfo.totalAmount}} 元</view>
|
|
<view>{{orderInfo.totalAmount}} 元</view>
|
|
</view>
|
|
</view>
|
|
<view class="parking-lock-info-item">
|
|
<view class="parking-lock-info-item">
|
|
<view>优惠金额</view>
|
|
<view>优惠金额</view>
|
|
<view>{{orderInfo.preferentialAmount}} 元</view>
|
|
<view>{{orderInfo.preferentialAmount}} 元</view>
|
|
- </view>
|
|
|
|
|
|
+ </view> -->
|
|
<view class="parking-lock-info-item">
|
|
<view class="parking-lock-info-item">
|
|
<view>应缴金额</view>
|
|
<view>应缴金额</view>
|
|
<view class="really-money">{{orderInfo.payAmount}} 元</view>
|
|
<view class="really-money">{{orderInfo.payAmount}} 元</view>
|
|
@@ -74,27 +74,12 @@
|
|
<view class="parking-lock-pay" v-else-if="parkingLockStatus === 5">
|
|
<view class="parking-lock-pay" v-else-if="parkingLockStatus === 5">
|
|
<view class="parking-lock-tips">{{tipsMsg}}</view>
|
|
<view class="parking-lock-tips">{{tipsMsg}}</view>
|
|
</view>
|
|
</view>
|
|
- <!-- 缴费方式-->
|
|
|
|
- <u-modal
|
|
|
|
- v-model="payWayPop"
|
|
|
|
- :title-style="{color: '#404040'}"
|
|
|
|
- title="缴费方式"
|
|
|
|
- :show-confirm-button="false"
|
|
|
|
- :show-cancel-button="false">
|
|
|
|
- <view class="slot-content">
|
|
|
|
- <view class="pay-way">
|
|
|
|
- <view class="pay-way-item" @click="gyBankPay">
|
|
|
|
- <image src="../../static/img/gy-bank-pay-icon.png" mode=""></image>
|
|
|
|
- <view>贵州银行</view>
|
|
|
|
- </view>
|
|
|
|
- <view class="pay-way-item" @click="wechatPay">
|
|
|
|
- <image src="../../static/img/wechat-pay-icon.png" mode=""></image>
|
|
|
|
- <view>微信支付</view>
|
|
|
|
- </view>
|
|
|
|
- </view>
|
|
|
|
- <button class="pay-way-close-btn" @click="payWayPop = false">关闭</button>
|
|
|
|
- </view>
|
|
|
|
- </u-modal>
|
|
|
|
|
|
+ <!-- 支付方式 -->
|
|
|
|
+ <PaymentMethod
|
|
|
|
+ :payWayPop="payWayPop"
|
|
|
|
+ :curOrderList="orderList"
|
|
|
|
+ :deviceNo="deviceNo"
|
|
|
|
+ @closePaymentMethod="closePaymentMethod"></PaymentMethod>
|
|
<u-toast ref="uToast" />
|
|
<u-toast ref="uToast" />
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
@@ -102,7 +87,11 @@
|
|
<script>
|
|
<script>
|
|
import { config } from './../../common/config'
|
|
import { config } from './../../common/config'
|
|
import getUrlParams from "../../utils/getUrlParams.js";
|
|
import getUrlParams from "../../utils/getUrlParams.js";
|
|
|
|
+ import PaymentMethod from '@/pages/paymentMethod/paymentMethod.vue'
|
|
export default {
|
|
export default {
|
|
|
|
+ components: {
|
|
|
|
+ PaymentMethod
|
|
|
|
+ },
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
// 车位锁状态 1:支付 2:开始开锁 3:开锁中 4:开锁完成
|
|
// 车位锁状态 1:支付 2:开始开锁 3:开锁中 4:开锁完成
|
|
@@ -117,6 +106,7 @@
|
|
deviceNo: null,
|
|
deviceNo: null,
|
|
// 轮询
|
|
// 轮询
|
|
timer: null,
|
|
timer: null,
|
|
|
|
+ timer1: null,
|
|
// 订单信息
|
|
// 订单信息
|
|
orderInfo: {},
|
|
orderInfo: {},
|
|
// 订单id
|
|
// 订单id
|
|
@@ -124,7 +114,6 @@
|
|
}
|
|
}
|
|
},
|
|
},
|
|
onLoad(page) {
|
|
onLoad(page) {
|
|
- console.log(page)
|
|
|
|
if (page.orderId) {
|
|
if (page.orderId) {
|
|
this.getOrderDetails(page.orderId)
|
|
this.getOrderDetails(page.orderId)
|
|
this.orderList = []
|
|
this.orderList = []
|
|
@@ -136,27 +125,23 @@
|
|
this.parkingLockStatus = 5
|
|
this.parkingLockStatus = 5
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ onShow() {
|
|
|
|
+ this.timer1 = setInterval(() => {
|
|
|
|
+ this.getOrderDetails(this.orderId)
|
|
|
|
+ }, 5000)
|
|
|
|
+ },
|
|
|
|
+ onHide() {
|
|
|
|
+ if (this.timer) {
|
|
|
|
+ clearInterval(this.timer)
|
|
|
|
+ }
|
|
|
|
+ if (this.timer1) {
|
|
|
|
+ clearInterval(this.timer1)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
methods: {
|
|
methods: {
|
|
payMoney() {
|
|
payMoney() {
|
|
this.payWayPop = true
|
|
this.payWayPop = true
|
|
},
|
|
},
|
|
- // 查询订单状态
|
|
|
|
- // getOrderStatus(orderId) {
|
|
|
|
- // this.$u.api.getOrderInfo({orderId: orderId})
|
|
|
|
- // .then(res => {
|
|
|
|
- // if (res.code === 200) {
|
|
|
|
- // if (res.data.payStatus === 0 || res.data.payStatus === 3) {
|
|
|
|
- // this.getOrderDetails(orderId)
|
|
|
|
- // } else {
|
|
|
|
- // this.parkingLockStatus = 2
|
|
|
|
- // setTimeout(() => {
|
|
|
|
- // this.parkingLockStatus = 3
|
|
|
|
- // }, 300)
|
|
|
|
- // this.checkEqupment()
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
- // },
|
|
|
|
// 查询订单信息
|
|
// 查询订单信息
|
|
getOrderDetails(id) {
|
|
getOrderDetails(id) {
|
|
this.$u.api.getOrderDetail({id: id})
|
|
this.$u.api.getOrderDetail({id: id})
|
|
@@ -165,6 +150,7 @@
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
this.orderInfo = res.data
|
|
this.orderInfo = res.data
|
|
if (res.data.payStatus === 1) {
|
|
if (res.data.payStatus === 1) {
|
|
|
|
+ clearInterval(this.timer1)
|
|
this.checkEqupment()
|
|
this.checkEqupment()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -198,88 +184,8 @@
|
|
cancel() {
|
|
cancel() {
|
|
window.location.href = config.jumpHomeUrl
|
|
window.location.href = config.jumpHomeUrl
|
|
},
|
|
},
|
|
- // 贵阳银行支付
|
|
|
|
- gyBankPay() {
|
|
|
|
- this.$u.api.payGzbank({
|
|
|
|
- orderList: this.orderList,
|
|
|
|
- deviceNo: this.deviceNo,
|
|
|
|
- jumpUrl: window.location.href
|
|
|
|
- }).then(res=>{
|
|
|
|
- let payUrl = res.data.url;
|
|
|
|
- this.currentPayUrl=encodeURIComponent(res.data.url);
|
|
|
|
- this.$u.route({
|
|
|
|
- url: 'pages/payLists/pay',
|
|
|
|
- params: {
|
|
|
|
- currentPayUrl: this.currentPayUrl
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }).catch(err=>{
|
|
|
|
- this.$refs.uToast.show({
|
|
|
|
- title: err.msg,
|
|
|
|
- type: 'error',
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- // 微信支付
|
|
|
|
- wechatPay() {
|
|
|
|
- const openId = this.$store.state.vuex_wxinfo.openId
|
|
|
|
- if (openId) {
|
|
|
|
- this.getWXPay(this.orderList)
|
|
|
|
- } else {
|
|
|
|
- this.getCode()
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- async getWXPay(list){
|
|
|
|
- let params = {
|
|
|
|
- orderList: list,
|
|
|
|
- deviceNo: this.deviceNo,
|
|
|
|
- openid: this.$store.state.vuex_wxinfo.openId
|
|
|
|
- };
|
|
|
|
- await this.$wxApi.config();
|
|
|
|
- this.$pay.wechatPay(params).then(res =>{
|
|
|
|
- if(res.code == 0){
|
|
|
|
- // 成功
|
|
|
|
-
|
|
|
|
- }else if(res.code == 1){
|
|
|
|
- // 取消
|
|
|
|
- // uni.redirectTo({
|
|
|
|
- // url: '/pages/userCenter/myOrder/myOrder'
|
|
|
|
- // })
|
|
|
|
- }else if(res.code == 2){
|
|
|
|
- this.$refs.uToast.show({
|
|
|
|
- title: '支付失败,请检查!',
|
|
|
|
- type: 'error',
|
|
|
|
- // url: '/pages/user/index'
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- setTimeout(() => {
|
|
|
|
- window.location.reload()
|
|
|
|
- }, 1000)
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- getCode () {
|
|
|
|
- var local = window.location.href // 获取页面url
|
|
|
|
- let locationLocaturl = window.location.search;
|
|
|
|
- this.code = getUrlParams(locationLocaturl, "code"); // 截取code
|
|
|
|
- if (this.code == null || this.code === '') { // 如果没有code,则去请求
|
|
|
|
- window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.config.wxAppid}&redirect_uri=${encodeURIComponent(local)}&response_type=code&scope=snsapi_userinfo&#wechat_redirect`
|
|
|
|
- } else {
|
|
|
|
- this.handleGetWXInfo(this.code) //把code传给后台获取用户信息
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- handleGetWXInfo (code) { // 通过code获取 openId等用户信息,/api/user/wechat/login 为后台接口
|
|
|
|
- this.$u.api.getWXInfo(code).then((res) => {
|
|
|
|
- if (res.code === 200 ) {
|
|
|
|
- this.$u.vuex('vuex_wxinfo', res.data);
|
|
|
|
- // 继续支付
|
|
|
|
- this.getWXPay(this.orderList)
|
|
|
|
- }
|
|
|
|
- }).catch((err) => {
|
|
|
|
- this.$refs.uToast.show({
|
|
|
|
- title: err.msg,
|
|
|
|
- type: 'error',
|
|
|
|
- });
|
|
|
|
- })
|
|
|
|
|
|
+ closePaymentMethod() {
|
|
|
|
+ this.payWayPop = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|