Przeglądaj źródła

停车费支持

tags/2.2.4
Stormeye.Wu 6 lat temu
rodzic
commit
5d09e5c777
2 zmienionych plików z 50 dodań i 12 usunięć
  1. +46
    -11
      pages/passCar/passCar.js
  2. +4
    -1
      pages/passCar/passCar.wxml

+ 46
- 11
pages/passCar/passCar.js Wyświetl plik

@@ -23,7 +23,7 @@ Page({
} else { } else {
app.userCarLogin() app.userCarLogin()
that.bindCar(that.data.addCar) that.bindCar(that.data.addCar)
}
}
} }
}, },
jumpToAdd: function() { jumpToAdd: function() {
@@ -32,9 +32,10 @@ Page({
}); });
}, },
jumpToPay: function() { jumpToPay: function() {
wx.redirectTo({
url: '/pages/pay/pay',
})
console.log("停车支付去")
//wx.redirectTo({
// url: '/pages/pay/pay',
//})
}, },
passb: function() { passb: function() {
wx.showToast({ wx.showToast({
@@ -69,6 +70,9 @@ Page({
}) })
.then(res => { .then(res => {
console.log(res) console.log(res)
that.setData({
addCar: null
})
that.initUsrCarList() that.initUsrCarList()
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
@@ -87,10 +91,8 @@ Page({
}) })
}) })
}, },
unbindCar: function(e) {
console.log(e)
unbindCar: function(carNum) {
var that = this var that = this
var carNum = e.currentTarget.dataset.car
// carLogin // carLogin
app.userCarLogin() app.userCarLogin()
var postData = var postData =
@@ -123,13 +125,44 @@ Page({
}) })
}) })
}, },
unbindCarBtn: function(e) {
console.log(e)
var that = this
var carNum = e.currentTarget.dataset.car
that.unbindCar(carNum)
},
getStopFee: function() {
var that = this
for (var i = 0; i < that.data.carList.length; i++) {
var carItem = that.data.carList[i]
var postData =
(app.globalData.parkVendor == 1) ? {
etcpToken: app.globalData.etcpToken,
carNumber: carItem.carNumber,
} : {
carNumber: carItem.carNumber,
outCarId: carItem.outCarId,
}
var stopFee = 'carList[' + i + '].stopFee'
Http.post({
url: config.api.getCarStopFee,
data: postData
})
.then(res => {
console.log(res)
that.setData({
[stopFee]: res.data
})
})
}
},
initPark: function() { initPark: function() {
var that = this var that = this
// 车场信息获取 // 车场信息获取
Http.get({ Http.get({
url: config.api.getParkInfo,
data: {}
})
url: config.api.getParkInfo,
data: {}
})
.then(res => { .then(res => {
console.log(res) console.log(res)
that.setData({ that.setData({
@@ -137,7 +170,7 @@ Page({
}) })
}) })
}, },
initUsrCarList: function () {
initUsrCarList: function() {
var that = this var that = this
// 绑定车获取 // 绑定车获取
Http.get({ Http.get({
@@ -148,6 +181,8 @@ Page({
that.setData({ that.setData({
carList: res.data carList: res.data
}) })
// 获取 停车费
that.getStopFee()
}) })
}, },
init: function() { init: function() {


+ 4
- 1
pages/passCar/passCar.wxml Wyświetl plik

@@ -18,8 +18,11 @@
<view class='passNumberBox' wx:for='{{carList}}' wx:key='{{index}}'> <view class='passNumberBox' wx:for='{{carList}}' wx:key='{{index}}'>
<view class='passNumber' bindtap='orderPay'> <view class='passNumber' bindtap='orderPay'>
<text>{{item.carNumber}}</text> <text>{{item.carNumber}}</text>
<text>总费用:{{item.stopFee.parkingFee}}</text>
<text>已缴:{{item.stopFee.paidFee}}</text>
<text>优免金额{{item.stopFee.discountAmount}}</text>
</view> </view>
<button class='deleteButton' bindtap='unbindCar' data-car='{{item.carNumber}}'>解绑</button>
<button class='deleteButton' bindtap='unbindCarBtn' data-car='{{item.carNumber}}'>解绑</button>
</view> </view>
<view class='addBox'> <view class='addBox'>
<view class='add' bindtap="jumpToAdd">点击添加我的爱车</view> <view class='add' bindtap="jumpToAdd">点击添加我的爱车</view>


Ładowanie…
Anuluj
Zapisz