瀏覽代碼

解绑车牌

tags/2.2.4
Stormeye.Wu 6 年之前
父節點
當前提交
2a7ebbe2e7
共有 2 個檔案被更改,包括 36 行新增24 行删除
  1. +35
    -23
      pages/passCar/passCar.js
  2. +1
    -1
      pages/passCar/passCar.wxml

+ 35
- 23
pages/passCar/passCar.js 查看文件

@@ -69,6 +69,7 @@ Page({
}) })
.then(res => { .then(res => {
console.log(res) console.log(res)
that.initUsrCarList()
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
showCancel: false, showCancel: false,
@@ -86,13 +87,15 @@ Page({
}) })
}) })
}, },
unbindCar: function(carNum) {
unbindCar: function(e) {
console.log(e)
var that = this var that = this
var carNum = e.currentTarget.dataset.car
// carLogin // carLogin
app.userCarLogin() app.userCarLogin()
var postData = var postData =
(parkVendor == 1) ? {
etcpToken: that.data.etcpToken,
(app.globalData.parkVendor == 1) ? {
etcpToken: app.globalData.etcpToken,
carNumber: carNum, carNumber: carNum,
} : { } : {
carNumber: carNum, carNumber: carNum,
@@ -103,6 +106,7 @@ Page({
}) })
.then(res => { .then(res => {
console.log(res) console.log(res)
that.initUsrCarList()
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
showCancel: false, showCancel: false,
@@ -119,30 +123,38 @@ Page({
}) })
}) })
}, },
init: function() {
initPark: function() {
var that = this var that = this
app.parkInitCallback = token => {
// 车场信息获取
Http.get({
url: config.api.getParkInfo,
data: {}
})
.then(res => {
console.log(res)
that.setData({
park: res.data,
})
})
//绑定车获取
Http.get({
url: config.api.getUserCarList,
data: {}
}).then(res => {
console.log(res);
// 车场信息获取
Http.get({
url: config.api.getParkInfo,
data: {}
})
.then(res => {
console.log(res)
that.setData({ that.setData({
carList: res.data
park: res.data,
}) })
}) })
},
initUsrCarList: function () {
var that = this
// 绑定车获取
Http.get({
url: config.api.getUserCarList,
data: {}
}).then(res => {
console.log(res);
that.setData({
carList: res.data
})
})
},
init: function() {
var that = this
app.parkInitCallback = token => {
that.initPark()
that.initUsrCarList()
} }
if (app.globalData.token && app.globalData.token != null) { if (app.globalData.token && app.globalData.token != null) {
app.parkInitCallback(app.globalData.token) app.parkInitCallback(app.globalData.token)


+ 1
- 1
pages/passCar/passCar.wxml 查看文件

@@ -19,7 +19,7 @@
<view class='passNumber' bindtap='orderPay'> <view class='passNumber' bindtap='orderPay'>
<text>{{item.carNumber}}</text> <text>{{item.carNumber}}</text>
</view> </view>
<button class='deleteButton' bindtap='unbindCar'>解绑</button>
<button class='deleteButton' bindtap='unbindCar' 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>


Loading…
取消
儲存