Browse Source

车辆详情页面完成

master
chenxuhui 7 years ago
parent
commit
265e243aa5
6 changed files with 98 additions and 69 deletions
  1. +3
    -1
      pages/homePage/homePage.js
  2. +69
    -37
      pages/myCars/carsDetail/carsDetail.js
  3. +20
    -26
      pages/myCars/carsDetail/carsDetail.wxml
  4. +3
    -2
      pages/myCars/carsDetail/carsDetail.wxss
  5. +1
    -1
      pages/myCars/myCars.json
  6. +2
    -2
      pages/myCars/myCars.wxml

+ 3
- 1
pages/homePage/homePage.js View File

@ -19,7 +19,9 @@ Page({
break; break;
// 车辆申请 // 车辆申请
case "2": case "2":
transferURL = '/pages/myCars/myCars';
// transferURL = '/pages/myCars/myCars';
// 没有列表,直接进入车辆详情
transferURL = '/pages/myCars/carsDetail/carsDetail';
break; break;
// 销售出库 // 销售出库
case "3": case "3":


+ 69
- 37
pages/myCars/carsDetail/carsDetail.js View File

@ -3,62 +3,94 @@
const app = getApp() const app = getApp()
var network = require("../../../utils/net.js") var network = require("../../../utils/net.js")
var update = "/MainSystem/B3MiniProgramRpc/XuRpcs/Driver/CarRpc/Update"; var update = "/MainSystem/B3MiniProgramRpc/XuRpcs/Driver/CarRpc/Update";
var carsInfo = "/MainSystem/B3MiniProgramRpc/XuRpcs/Driver/CarRpc/GetInfo";
Page({ Page({
data: { data: {
carDetail:{},
},
onLoad: function (options) {
var that = this;
var item = JSON.parse(options.item);
this.setData({
carDetail:item,
});
carDetail: {},
}, },
// 保存按钮点击
saveCarsChange:function(){
onLoad: function(options) {
// var that = this;
// var item = JSON.parse(options.item);
// this.setData({
// carDetail:item,
// });
var that = this; var that = this;
var method = update;
var params = [{
"CarNumber": CarNumber,
"CarOwner": CarOwner,
"Phone": app.globalData.Phone,
"CarDetail_ID": ID
}];
network.transfer_request(method, params, function (res) {
wx.navigateBack({
delta: 1
var method = carsInfo;
var params = [app.globalData.Phone];
network.transfer_request(method, params, function(res) {
that.setData({
carDetail: res.result,
}) })
}) })
}, },
// 新增按钮点击
creatNewCar:function(){
wx.navigateTo({
url: '../creatNewCar/creatNewCar',
})
// 车辆对应的信息
getCarInfo: function(event) {
var value = event.detail.value;
var item = event.currentTarget.dataset.item;
this.data.carDetail[item] = value;
this.setData({
carDetail: this.data.carDetail
});
}, },
getPhone:function(event){
var phone =event.detail.value;
if (phone == "") {
// 保存按钮点击
saveCarsChange: function() {
var carInfo = this.data.carDetail;
if (!carInfo.CarNumber) {
wx.showToast({
title: '请输入车牌号',
})
return false;
}
if (!carInfo.CarOwner) {
wx.showToast({
title: '请输入车主姓名',
})
return false;
}
if (!carInfo.CarOwnerPhone) {
wx.showToast({ wx.showToast({
title: '请输入手机号码',
title: '请输入车主手机号码',
}) })
return false; return false;
} else if (!(/^1[34578]\d{9}$/.test(phone))) {
}
if (!(/^1[34578]\d{9}$/.test(carInfo.CarOwnerPhone))) {
wx.showToast({ wx.showToast({
title: '号码不正确',
title: '车主号码不正确',
}) })
return false; return false;
} else {
this.setData({
custometPhone: phone,
}
if ((carInfo.CarOwnerIDCard.length < 18) || (carInfo.CarOwnerIDCard.length > 18)) {
wx.showToast({
title: '车主身份证号不正确',
}) })
return false;
} }
}
var method = update;
var params = [this.data.carDetail];
network.transfer_request(method, params, function(res) {
wx.showToast({
title: '信息变更操作成功',
success:function(res){
wx.navigateBack({
delta: 1
})
}
})
})
},
// // 新增按钮点击
// creatNewCar:function(){
// wx.navigateTo({
// url: '../creatNewCar/creatNewCar',
// })
// },
}) })

+ 20
- 26
pages/myCars/carsDetail/carsDetail.wxml View File

@ -3,7 +3,7 @@
<view class='baseitem'> <view class='baseitem'>
<view class='baseitem_key'>车牌号</view> <view class='baseitem_key'>车牌号</view>
<view class='baseitem_value'> <view class='baseitem_value'>
<input class='inputItem' value="{{carDetail.CarNumber}}"></input>
<input class='inputItem' bindinput='getCarInfo' placeholder='请输入车牌号' value="{{carDetail.CarNumber}}" data-item='CarNumber'></input>
</view> </view>
</view> </view>
<view class='lineView'></view> <view class='lineView'></view>
@ -11,7 +11,7 @@
<view class='baseitem'> <view class='baseitem'>
<view class='baseitem_key'>车主</view> <view class='baseitem_key'>车主</view>
<view class='baseitem_value'> <view class='baseitem_value'>
<input class='inputItem' value="{{carDetail.CarOwner}}"></input>
<input class='inputItem' bindinput='getCarInfo' placeholder='请输入车主姓名' value="{{carDetail.CarOwner}}" data-item='CarOwner'></input>
</view> </view>
</view> </view>
<view class='lineView'></view> <view class='lineView'></view>
@ -19,69 +19,63 @@
<view class='baseitem'> <view class='baseitem'>
<view class='baseitem_key'>车主电话</view> <view class='baseitem_key'>车主电话</view>
<view class='baseitem_value'> <view class='baseitem_value'>
<input class='inputItem' type="number" maxlength="11" value="{{carDetail.Phone}}" bindblur="getPhone"></input>
<input class='inputItem' bindinput='getCarInfo' placeholder='请输入车主电话' type="number" maxlength="11" value="{{carDetail.CarOwnerPhone}}" data-item='CarOwnerPhone'></input>
</view> </view>
</view> </view>
<view class='lineView'></view> <view class='lineView'></view>
<!--
<view class='baseitem'> <view class='baseitem'>
<view class='baseitem_key'>车主身份证号</view> <view class='baseitem_key'>车主身份证号</view>
<view class='baseitem_value'> <view class='baseitem_value'>
<input class='inputItem' type='idcard' value="{{carDetail}}"></input>
<input class='inputItem' bindinput='getCarInfo' placeholder='请输入车主身份证号' type='idcard' value="{{carDetail.CarOwnerIDCard}}" data-item='CarOwnerIDCard'></input>
</view> </view>
</view> </view>
<view class='lineView'></view> -->
<view class='lineView'></view>
<!-- <view class='baseitem'>
<view class='baseitem'>
<view class='baseitem_key'>车主地址</view> <view class='baseitem_key'>车主地址</view>
<view class='baseitem_value'> <view class='baseitem_value'>
<input class='inputItem' value="{{carDetail}}"></input>
<input class='inputItem' bindinput='getCarInfo' placeholder='请输入车主地址' value="{{carDetail.CarOwnerAddress}}" data-item='CarOwnerAddress'></input>
</view> </view>
</view> </view>
<view class='lineView'></view> -->
<view class='lineView'></view>
<view class='baseitem'> <view class='baseitem'>
<view class='baseitem_key'>司机姓名</view> <view class='baseitem_key'>司机姓名</view>
<view class='baseitem_value'>
<input class='inputItem' value="{{carDetail.DriverName}}"></input>
</view>
<view class='baseitem_value'>{{carDetail.Name}}</view>
</view> </view>
<view class='lineView'></view> <view class='lineView'></view>
<view class='baseitem'> <view class='baseitem'>
<view class='baseitem_key'>司机电话</view> <view class='baseitem_key'>司机电话</view>
<view class='baseitem_value'>
<input class='inputItem' value="{{carDetail.Phone}}"></input>
</view>
<view class='baseitem_value'>{{carDetail.Phone}}</view>
</view> </view>
<view class='lineView'></view> <view class='lineView'></view>
<!-- <view class='baseitem'>
<view class='baseitem'>
<view class='baseitem_key'>司机身份证号</view> <view class='baseitem_key'>司机身份证号</view>
<view class='baseitem_value'>
<input class='inputItem' value="{{carDetail}}"></input>
</view>
<view class='baseitem_value'>{{carDetail.IdCard}}</view>
</view> </view>
<view class='lineView'></view> -->
<view class='lineView'></view>
</view> </view>
<view class='bottomGroupView'>
<!-- <view class='bottomGroupView'> -->
<view class='imageView' catchtap='saveCarsChange'> <view class='imageView' catchtap='saveCarsChange'>
<image class='currentImage' src="/imgs/whiteBtn.png">
<image class='currentImage' src="/imgs/blueBtn.png">
<view class='btnTextView'> <view class='btnTextView'>
<text class='whiteText'>保存</text>
<text class='btnText'>保存</text>
</view> </view>
</image> </image>
</view> </view>
<view class='imageView' catchtap='creatNewCar'>
<!-- <view class='imageView' catchtap='creatNewCar'>
<image class='currentImage' src="/imgs/blueBtn.png"> <image class='currentImage' src="/imgs/blueBtn.png">
<view class='btnTextView'> <view class='btnTextView'>
<text class='btnText'>新增</text> <text class='btnText'>新增</text>
</view> </view>
</image> </image>
</view>
</view> -->
</view>
<!-- </view> -->

+ 3
- 2
pages/myCars/carsDetail/carsDetail.wxss View File

@ -41,8 +41,9 @@ page {
.imageView { .imageView {
height: 100%;
width: 50%;
margin-top: 20%;
width: 100%;
height: 80px;
/* margin-left: 15px; /* margin-left: 15px;
margin-right: 15px; */ margin-right: 15px; */
position: relative; position: relative;


+ 1
- 1
pages/myCars/myCars.json View File

@ -1,3 +1,3 @@
{ {
"navigationBarTitleText": "车辆申请"
"navigationBarTitleText": "车辆列表"
} }

+ 2
- 2
pages/myCars/myCars.wxml View File

@ -11,7 +11,7 @@
<view class='listItem' bindlongpress="handleLongPress" catchtap='transToCarsDetail' data-detailitem='{{item}}' data-cardetailid='{{item.CarDetail_ID}}'> <view class='listItem' bindlongpress="handleLongPress" catchtap='transToCarsDetail' data-detailitem='{{item}}' data-cardetailid='{{item.CarDetail_ID}}'>
<view class='topView'> <view class='topView'>
<view class='goodsNum'> <view class='goodsNum'>
<text class='goodsIDText'>司机:{{item.DriverName}}</text>
<text class='goodsIDText'>车主:{{item.CarOwner}}</text>
</view> </view>
<view class='goodsMoney'> <view class='goodsMoney'>
<text class='goodsIDText'>电话:{{item.Phone}}</text> <text class='goodsIDText'>电话:{{item.Phone}}</text>
@ -19,7 +19,7 @@
</view> </view>
<view class='bottomView'> <view class='bottomView'>
<view class='goodsNum'> <view class='goodsNum'>
<text class='goodsNumText'>车主:{{item.CarOwner}}</text>
<text class='goodsNumText'>司机:{{item.CarOwner}}</text>
</view> </view>
<view class='goodsMoney'> <view class='goodsMoney'>
<text class='goodsMoneyText'>车牌号:{{item.CarNumber}}</text> <text class='goodsMoneyText'>车牌号:{{item.CarNumber}}</text>


Loading…
Cancel
Save