Commit 4ef77bc0 by iambtr

蜘蛛侠完整a版

parent 8fe787dd
{
"pages": [
"pages/welcome2/welcome2",
"pages/my/my",
"pages/user_message/user_message",
"pages/return_car_pedding/return_car_pedding",
"pages/pay/pay",
......@@ -9,7 +10,7 @@
"pages/server_point/server_point",
"pages/server_detail/server_detail",
"pages/server/server",
"pages/my/my",
"pages/evaluate/evaluate",
"pages/device_bind/device_bind",
"pages/settting/setting",
"pages/path_detail/path_detail",
......@@ -19,6 +20,7 @@
"pages/qr_code/qr_code",
"pages/register2/register2",
"pages/point_detail/point_detail",
"pages/upload/upload",
"pages/choose_rent_type/choose_rent_type",
"pages/search/search"
],
......
// pages/star/star.js
const { imgName } = require('../../lib/util.js')
Component({
/**
* 组件的属性列表
*/
properties: {
titleList:{
type: Array, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
observer: function (newVal, oldVal) {
} // 属性被改变时执行的函数(可选),也可以写成在methods段中定义的方法名字符串, 如:'_propertyChange'
},
},
/**
* 组件的初始数据
*/
data: {
activeNum: 0,
},
/**
* 组件的方法列表
*/
methods: {
//点击改变分数的函数
changeScore(e) {
// var myEventDetail = {} // detail对象,提供给事件监听函数
// var myEventOption = {} // 触发事件的选项
if (!this.data.edit) return
this.setData(
{
selfScore: Number(e.target.id) + 1
}
)
this._setStar()
},
_changeTab(e) {
let oldIndex = this.data.activeNum
let newIndex=Number(e.currentTarget.id)
let res=null//tabIn 返回false的情况可以取消tab
this.data.titleList.forEach((item,ix)=>{
if(ix == oldIndex){
if (item.tabOut){
item.tabOut()
}
}
if (ix == newIndex) {
if (item.tabIn) {
res = item.tabIn() == false ? false : true
} else {
res=true
}
}
return item
})
if(res){
this.setData({
activeNum: newIndex
})
this.triggerEvent('tabChange', { activeIndex: newIndex })
}
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--components/navbar/navbar.wxml-->
<view class='wr-tab-header'>
<view class='wr-tab-item {{activeNum==index?"active":""}}' wx:for='{{titleList}}' wx:key='{{index}}' id='{{index}}' catchtap='_changeTab'>
<text>{{item.name}}</text>
</view>
</view>
\ No newline at end of file
/* components/navbar/navbar.wxss */
.wr-tab-header{
flex: 0 0 auto;
display: flex;
justify-content: space-around;
}
.wr-tab-item{
flex: 1 0 10rpx;
text-align: center;
padding: 10rpx;
border-bottom: 2px solid transparent;
}
.active{
color: #d7193c;
border-bottom: 2px solid #d7193c;
}
\ No newline at end of file
......@@ -50,7 +50,7 @@ Component({
}
)
this._setStar()
this.triggerEvent('scoreChange', { socre: this.data.selfScore})
this.triggerEvent('scoreChange', { score: this.data.selfScore})
},
_setStar(){
let newVal=this.data.selfScore
......
......@@ -9,4 +9,5 @@ image{
width: 40rpx;
height: 40rpx;
margin-right: 10rpx;
flex: 0 0 auto;
}
\ No newline at end of file
......@@ -5,7 +5,7 @@ var config = {
appid: 'wx2adf345dae23b51b',
appSecret: '73abd12083691a26638f15f412b5030b',
api: 'https://zhizuxia.zhizukj.com/ydb/app/',
rapi: 'http://114.116.54.143:8081/repair/app/',//repair
rapi: 'https://weiyang.zhizukj.com/repair/app/',//repair
version: 'v1.0.00',
imgPath: '/static/image/',
key: '3URBZ-FX6KD-H654D-H25M2-YVGJO-UAFXD'
......@@ -14,7 +14,7 @@ var config = {
appid: 'wx2adf345dae23b51b',
appSecret: '73abd12083691a26638f15f412b5030b',
api: 'https://zhizuxia.zhizukj.com/ydb/app/',
rapi: 'http://114.116.54.143:8081/repair/app/',//repair
rapi: 'https://weiyang.zhizukj.com/repair/app/',//repair
version: 'v1.0.00',
imgPath: '/static/image/',
key: 'G5DBZ-NH5KD-D3A4F-HK246-D7SJZ-H3BDB'
......
......@@ -115,7 +115,7 @@ Page({
applyFor() {
let { companyName, companyId,pointName, pointId } = this.data
if (!companyName) {
alertTip('未选择租赁商')
alertTip('未选择公司')
return
}
if (!pointName) {
......@@ -258,10 +258,11 @@ Page({
}
})
.catch(err => {
alertTip(err)
console.error(err)
})
},
//获取一级网点
//获取公司
getCompany() {
wx.navigateTo({
url: '/pages/search/search?type=companyByName',
......
......@@ -11,8 +11,8 @@
</view>
<view wx:if='{{userType===0}}'>
<view class='phone-sure list'>
<text>租赁商:</text>
<input value='{{companyName}}' placeholder='请输入租赁商' disabled catchtap='getCompany'></input>
<text>公司:</text>
<input value='{{companyName}}' placeholder='请输入公司' disabled catchtap='getCompany'></input>
</view>
<view class='phone-sure list' wx:if='{{companyName}}'>
<text>站点:</text>
......
// pages/device_bind/device_bind.js
const { api, wxscan, rapi, userLocation, imgName, getUserInfo, wxLogin, alertTip, authAgainByUser, getProtocol } = require('../../lib/util.js')
let timer=null
let pointTimer = null//网点解绑
Page({
data: {
//img
......@@ -38,15 +39,35 @@ Page({
},
onHide(){
clearInterval(timer)
clearInterval(pointTimer)
},
onUnload(){
clearInterval(timer)
clearInterval(pointTimer)
},
onShow() {
//团个租
// this.getStatus(this.data.rentType)
if (this.data.rentType==1){
this.getPointLists()
}else{
//团租
pointTimer=setInterval(()=>{
api.get('user/getByUserId',{
userId:this.data.userId
},true).then(res=>{
if(res.data.companyId==0||res.data.userType==1){
alertTip('站点已同意你的解绑申请', () => {
wx.redirectTo({
url: '/pages/choose_rent_type/choose_rent_type?status=normal',
})
})
}
}).catch(err=>{
console.error(err)
})
},5000)
}
},
......@@ -139,6 +160,38 @@ Page({
}
},
//解绑站点
relizePoint(){
api.get('message/getMessageInfo', {
userId: this.data.userId,
messageType: 7//用户申请加入站点
}, {}, true)
.then(res => {
let { state } = res.data
if (state == 3) {
alertTip('站点已同意你的解绑申请', () => {
wx.redirectTo({
url: '/pages/choose_rent_type/choose_rent_type?status=normal',
})
})
return
}
api.post('message/applyReturnSiteTB', {
userId: this.data.userId
})
.then(res => {
alertTip('申请解绑站点成功,请耐心等待站点同意!')
})
.catch(err => {
alertTip(err)
console.error(err)
})
})
.catch(err => {
console.error(err)
})
},
getStatus(userType){
let This=this
let msgType=[2,3]
......
{
"navigationBarTitleText": "车辆租赁"
"navigationBarTitleText": "车辆绑定"
}
\ No newline at end of file
......@@ -23,8 +23,10 @@
<button bindtap='apiUseCar' class='btn-bind'>开始用车</button>
<text class='scan' bindtap='backScan'>返回扫描添加</text>
</view>
<view class='my' catchtap='toMy'>我的</view>
<view class='my'>
<view catchtap='toMy'>我的</view>
<view catchtap='relizePoint' wx:if='{{rentType==0}}'>站点解绑</view>
</view>
</view>
<view class='con' wx:else>
<view class='wait-auto'>等待站点同意授权中...</view>
......
......@@ -25,10 +25,18 @@ page {
position: absolute;
bottom: 40rpx;
left: 0;
padding: 30rpx 50rpx 30rpx 30rpx;
color: #fff;
background-color: #d7193c;
border-radius: 0 50rpx 50rpx 0;
border-radius: 0 100rpx 100rpx 0;
}
.my view{
text-align: center;
height: 60rpx;
padding: 0rpx 50rpx 0rpx 30rpx;
line-height: 60rpx;
}
.my view:nth-of-type(2){
border-top: 1px solid #fff;
}
.img-tip {
......
const {
api,
rapi,
formatTime,
mapApi,
mockApi,
imgName,
getUserInfo,
wxLogin,
alertTip,
wxscan,
authAgainByUser,
userLocation
} = require('../../lib/util.js')
Page({
/**
* 页面的初始数据
*/
data: {
orderId:'',
userId:'',
serviceScore:0,
skillScore:0,
comment:''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let orderId = options.orderId
let userId=wx.getStorageSync('user').userMapp.id
this.setData({
orderId,
userId
})
},
//评价
submitEvaluate(){
let { orderId, userId, serviceScore, skillScore, comment}=this.data
console.log({ orderId, userId, serviceScore, skillScore, comment })
if (serviceScore == 0){
alertTip('请给服务打分')
return
}
if (skillScore == 0) {
alertTip('请给专业技能打分')
return
}
if (comment == '') {
alertTip('请输入评价内容')
return
}
rapi.get('userOrder/orderEvaluate',{
orderId, userId, serviceScore, skillScore, comment
})
.then(res=>{
alertTip('评价成功',()=>{
wx.navigateBack()
})
})
.catch(err=>{
alertTip(err)
})
},
skillScoreChange(e){
this.setData({
skillScore: e.detail.score
})
},
serviceScoreChange(e) {
this.setData({
serviceScore: e.detail.score
})
},
bindTextAreaBlur(e){
this.setData({
comment: e.detail.value
})
}
})
\ No newline at end of file
{
"navigationBarTitleText": "服务评价",
"usingComponents": {
"navbar": "/components/navbar/navbar",
"star-score": "/components/star/star"
}
}
\ No newline at end of file
<!--pages/user_index/user_index.wxml-->
<view class='con'>
<view>
<view class='phone list'>
<text>服务:</text>
<view><star-score score='0' edit onscoreChange='serviceScoreChange'></star-score></view>
</view>
<view class='phone list'>
<text>专业技能:</text>
<view><star-score edit score='0' onscoreChange='skillScoreChange'></star-score></view>
</view>
<view class='problem list'>
<text>问题描述:</text>
<textarea bindinput="bindTextAreaBlur" placeholder="请输入评价内容" />
</view>
</view>
<view class='option'>
<button catchtap='submitEvaluate'>提交评价</button>
</view>
</view>
\ No newline at end of file
@import '../server/server.wxss';
const { api,payApi,alertTip ,imgName } = require('../../lib/util.js')
let depositTime=null
Page({
/**
......@@ -9,14 +10,14 @@ Page({
imgHeadshot: imgName('logo.png'),
imgMore: imgName('more.png'),
imgTip: imgName('tip.png'),
point1:'',
point2: '',
imgRecar: imgName('recar.png'),
point1:'',//公司
point2: '',//站点
realName:null,
networkingStopTime: '0000-00-00',
networkingHasDay:null,
amount:0,//押金金额
person:1,//个租
vehicleName:null,
useCar:false,
userId:null,
userItemList: [{
msg: 0,
name: '我的行程',
......@@ -28,15 +29,15 @@ Page({
icon: imgName('message.png'),
page: '/pages/user_message/user_message'
}
// ,{
// msg: 0,
// name: '安防设置',
// icon: imgName('setting.png'),
// page: '/pages/user_setting/user_setting'
// }
,{
msg: 0,
name: '半身照修改',
icon: imgName('setting.png'),
page: '/pages/upload/upload'
}
, {
msg: 0,
name: '售后服务',
name: '维养服务',
icon: imgName('server.png'),
page: '/pages/server_point/server_point'
}, {
......@@ -48,20 +49,22 @@ Page({
},
onShow: function () {
let user = wx.getStorageSync('user').userMapp
let device = wx.getStorageSync('device')//可能不存在啊
if (!user) {
wx.redirectTo({
url: '/pages/welcome2/welcome2',
})
return
}
//获取站点
//获取站点 有无车辆
if(!this.data.point1){
api.get('user/getByUserId', { userId: user.id })
.then(({ data }) => {
this.setData({
point1: data.companyName,
point2: data.siteName,
useCar: (data.isUseVehicle==0)?false:true,
amount: data.depositAmount,//押金金额
person: data.userType,//个租
})
})
.catch(err => {
......@@ -77,11 +80,18 @@ Page({
realName:user.realName,
amount: user.depositAmount,//押金金额
person: user.userType,//个租
device,
userId:user.id
})
//消息数量
// this.getFirstPage()
},
onHide(){
clearTimeout(depositTime)
},
onUnload() {
clearTimeout(depositTime)
},
wxDepositRefund() {
let that=this
......@@ -149,9 +159,99 @@ Page({
})
},
//个租还车
returnCar() {
let that = this
let userId = that.data.userId
//个租
api.get('user/getByUserId', { userId })
.then(({ data }) => {
if (data.isUseVehicle){
let { frameNo } = wx.getStorageSync('device')
if (data.userType == 1) {
that.getRentRecord(() => {
api.post('message/applyReturnCar', {
frameNo,
userId,
rentType: 1
})
.then(res => {
wx.redirectTo({
url: `/pages/return_car_pedding/return_car_pedding`,
})
})
.catch(err => {
alertTip(err)
console.error(err)
})
})
} else {
api.post('message/applyReturnCarTB', {
frameNo,
userId
})
.then(res => {
alertTip('申请还车成功,请耐心等待站点同意!')
})
.catch(err => {
alertTip(err)
console.error(err)
})
}
return
}
that.setData({
useCar: data.isUseVehicle == 0 ? false : true,
})
alertTip('你当前没有使用中的车辆')
})
.catch(err => {
alertTip(err)
})
},
//判断是否未支付定单或者押金
getRentRecord(cb) {
let that=this
api.get('order/getRentRecord', {
userId: that.data.userId
})
.then(res => {
let state = res.data.state
switch (state) {
case 1:
cb && cb()
break;
case 2:
wx.redirectTo({
url: `/pages/pay/pay?type=rent`,
})
break;
case 3:
wx.redirectTo({
url: `/pages/welcome2/welcome2`,
})
break;
case 4:
wx.redirectTo({
url: `/pages/pay/pay?type=deposit`,
})
break;
case 5:
wx.redirectTo({
url: `/pages/return_car_pedding/return_car_pedding`,
})
break;
}
})
.catch(err => {
alertTip(err)
})
},
toDetailPage(e) {
let url = e.currentTarget.id
if(url==='') return
console.log(url)
if(url==='') {return}
wx.navigateTo({
url: e.currentTarget.id
})
......@@ -175,8 +275,8 @@ Page({
// this.setData({
// amount: 0
// })
setTimeout(()=>{
api.get('user/getByUserId', { userId: user.userMapp.id })
depositTime=setTimeout(()=>{
api.get('user/getByUserId', { userId: user.userMapp.id },true)
.then(res => {
user.userMapp.depositAmount = res.data.depositAmount
wx.setStorageSync('user', user)
......
......@@ -6,7 +6,7 @@
<text>{{realName}}</text>
</view>
<view class='top-des' wx:if='{{!person}}'>
<text>租赁商:{{point1}}</text>
<text>公司:{{point1}}</text>
<text>站点:{{point2}}</text>
</view>
</view>
......@@ -33,6 +33,17 @@
<image src='{{imgMore}}'></image>
</view>
</view>
<view class='layout item' catchtap='returnCar' wx:if='{{useCar}}'>
<view class='left'>
<image src='{{imgRecar}}'></image>
<view>
<view>还车</view>
</view>
</view>
<view class='right'>
<image src='{{imgMore}}'></image>
</view>
</view>
</view>
<!-- <view class='tab' catchtap='loginOut'>
切换账号
......
// pages/pay/pay.js
const { api, imgName, wxLogin, payApi, alertTip, useTime, changeTime} = require('../../lib/util.js')
const { api, formatTime, imgName, wxLogin, payApi, alertTip, useTime, changeTime} = require('../../lib/util.js')
Page({
data: {
price:'--',
......@@ -41,8 +41,8 @@ Page({
this.setData({
price: rentAmount,
orderNumber,
startRentTime: new Date(startRentTime).toLocaleString(),
endRentTime: new Date(endRentTime).toLocaleString(),
startRentTime: formatTime(new Date(startRentTime)),
endRentTime: formatTime(new Date(endRentTime)),
useTime
})
})
......@@ -161,7 +161,7 @@ Page({
'success': function (res) {
alertTip('租金支付成功!', function () {
wx.redirectTo({
url: '/pages/my/my',
url: '/pages/choose_rent_type/choose_rent_type?status=normal',
})
})
console.log(res)
......
......@@ -73,13 +73,13 @@ Page({
},
//需要服务
needServer(){
let hasCar=wx.getStorageSync('user').userMapp.isUseVehicle
if(hasCar){
// let hasCar=wx.getStorageSync('user').userMapp.isUseVehicle
// if(hasCar){
wx.navigateTo({
url: `/pages/server/server?pointId=${this.data.pointId}`,
})
}else{
alertTip('你当前并没有使用车辆')
}
// }else{
// alertTip('你当前并没有使用车辆')
// }
}
})
\ No newline at end of file
{
"usingComponents": {
"star-score": "/components/star/star"
}
}
\ No newline at end of file
......@@ -65,6 +65,7 @@ map{
.point-left{
flex:0 0 500rpx;
}
.time{
image{
width: 40rpx;
height: 40rpx;
}
\ No newline at end of file
......@@ -11,6 +11,7 @@ Page({
inputId: null,
msgLoading: false,
idPhoto:'',
idTemImg:'',
// mode:false,//true 'group'
agree: true,
setTimeSec: 60,
......@@ -214,6 +215,7 @@ Page({
name: 'file',
success(res){
that.setData({
idTemImg:tempFilePath,
idPhoto: JSON.parse(res.data).picUrl
})
},
......
......@@ -32,7 +32,7 @@
<view class='phone-sure list' catchtap='uploadIdPhoto'>
<text class='form-tip'>半身照</text>
<input wx:if='{{!idPhoto}}' id='idPhoto' disabled placeholder='请上传手持身份证半身照'></input>
<view wx:else>已上传(点击修改)</view>
<view wx:else><image class='idphoto' src='{{idTemImg}}'></image> 已上传(点击修改)</view>
</view>
<view class='phone-sure list'>
<text class='form-tip'>密码</text>
......
......@@ -75,3 +75,8 @@ button {
.point{
flex: 1;
}
.idphoto{
width: 80rpx;
height: 80rpx;
vertical-align: middle;
}
\ No newline at end of file
const config = require('../../config/index.js')
const { api, rapi, mapApi, mockApi, imgName, getUserInfo, wxLogin, alertTip, wxscan, authAgainByUser, userLocation } = require('../../lib/util.js')
const {
api,
rapi,
formatTime,
mapApi,
mockApi,
imgName,
getUserInfo,
wxLogin,
alertTip,
wxscan,
authAgainByUser,
userLocation
} = require('../../lib/util.js')
// user point device
let carTimer = null
Page({
......@@ -7,54 +20,36 @@ Page({
* 页面的初始数据
*/
data: {
tab: '',//tab是列表
//详情页数据
username:'',//用户名
userId:'',//用户id
userPhone: '',//手机号
comment:'',
username: '', //用户名
userId: '', //用户id
userPhone: '', //手机号
comment: '',
user: null,
time: '',//时间
date: '',//日期
time: '', //时间
date: '', //日期
img_arr: [], //上传图片数组
pics:'',//图片线上路径数组
pics: '', //图片线上路径数组
imgScan: imgName('imgscan.png'),
imgClose: imgName('close.png'),
imgLogo: imgName('logo.png'),
showList:[],//我的服务列表
page: 1,//当前页面
hasMorePage: false,//更多页面
},
onShow: function () {
onShow: function() {
},
//tab切换
tabCarMenu(e) {
let id = e.target.id
if (e.target.id === this.data.tab) return
let tab = this.data.tab === '' ? 'tab' : ''
//服务列表
if (tab == 'tab' && this.data.page == 1){
//当前页是第一页 获取第一页
this.getMyOrderList(1)
}
this.setData({
tab
})
},
onLoad: function () {
let {userMapp}=wx.getStorageSync('user')
let { model } = wx.getStorageSync('device')
onLoad: function() {
let {
userMapp
} = wx.getStorageSync('user')
let {
model
} = wx.getStorageSync('device')
this.setData({
username: userMapp.realName,//用户名
userPhone: userMapp.mobile,//手机号
cartype: model,//手机号
username: userMapp.realName, //用户名
userPhone: userMapp.mobile, //手机号
cartype: model, //手机号
userId: userMapp.id
})
},
onUnload() {
wx.setStorageSync('carLists', this.data.carLists)
},
carTypeChange(e) {
},
......@@ -63,39 +58,58 @@ Page({
[e.target.id]: e.detail.value
})
},
bindDateChange: function (e) {
bindDateChange: function(e) {
this.setData({
date: e.detail.value
})
},
bindTimeChange: function (e) {
bindTimeChange: function(e) {
this.setData({
time: e.detail.value
})
},
//提交工单
submitServer(){
let { username, userPhone, comment, date, time, userId}=this.data
let { id: nodeId } = wx.getStorageSync('point')
submitServer() {
let {
username,
userPhone,
comment,
date,
time,
userId
} = this.data
//判断有米有绑定车辆
api.get('user/getVcuByUserId', {
user_id: userId
})
.then(res => {
let {
id: nodeId
} = wx.getStorageSync('point')
// let { vcuNo, frameNo, model:vehicleModel } = wx.getStorageSync('device')
let {
vcuNo,
frameNo,
model: vehicleModel
} = wx.getStorageSync('device')
// 图片
if (!comment){
if (!comment) {
alertTip('请简单描述下问题')
return false
}
if (!time||!date) {
if (!time || !date) {
alertTip('选择预约时间')
return false
}
Promise.all(this.uploadIdPhoto())
.then(res=>{
let pics=res.join(',')||''
let orderTime = date.replace('-', '/') + " " + time + ":00"
rapi.get('userOrder/commitOrder',{
.then(res => {
let pics = res.join(',') || ''
let orderTime = date.replace(/-/gi, '/') + " " + time + ":00"
console.log(orderTime)
rapi.get('userOrder/commitOrder', {
userId,
nodeId,
username,
userName: username,
userPhone,
comment,
vcuNo,
......@@ -103,25 +117,45 @@ Page({
vehicleModel,
pics,
orderTime
}).then(res => {
alertTip('提交成功', () => {
this.tabCarMenu({
target: {
id: 'tab'
}
})
})
}).catch(err => {
alertTip(err)
})
})
.catch(err=>{
.catch(err => {
alertTip(err)
console.log(err)
})
})
.catch(err => {
if (/数据为空/.test(err)) {
alertTip('你当前无使用中车辆,无法报修')
return
}
alertTip(err)
})
},
//选择图片
upimg: function () {
upimg: function() {
var that = this;
let hasImgLength = this.data.img_arr.length
if (hasImgLength < 3) {
wx.chooseImage({
count: 3 - hasImgLength, // 默认9
sizeType: ['original', 'compressed'],
success: function (res) {
let img_arr= that.data.img_arr.concat(res.tempFilePaths)
success: function(res) {
let img_arr = that.data.img_arr.concat(res.tempFilePaths)
that.setData({
img_arr
})
......@@ -134,31 +168,31 @@ Page({
}
},
//删除图片
deleteImg(e){
let index=Number(e.currentTarget.id)
this.data.img_arr.splice(index,1)
deleteImg(e) {
let index = Number(e.currentTarget.id)
this.data.img_arr.splice(index, 1)
this.setData({
img_arr: this.data.img_arr
})
},
bindTextAreaBlur(e){
let comment=e.detail.value
bindTextAreaBlur(e) {
let comment = e.detail.value
this.setData({
comment
})
},
//上传图片
uploadIdPhoto() {
let that=this
if (that.data.img_arr.length==0){
let that = this
if (that.data.img_arr.length == 0) {
return [Promise.resolve()]
}else{
} else {
wx.showLoading({
title: '上传图片中',
mask: true,
})
return that.data.img_arr.map(item=>{
return new Promise((resolve,reject)=>{
return that.data.img_arr.map(item => {
return new Promise((resolve, reject) => {
wx.uploadFile({
url: 'https://zhizuxia.zhizukj.com/ydb/app/manage/file/upload.json',
filePath: item,
......@@ -176,71 +210,5 @@ Page({
})
})
}
},
//获取服务工单
getMyOrderList(page){
let curPage = page || this.data.page
let that = this
// rapi.get('userOrder/myOrderList',{
// userId: this.data.userId,
// curPage,
// }).then(res=>{
// console.log(res)
// let listArrays = res.items.map(item => { item.pics = item.pics.split(',')[0]; return item })
// //首页
// if (curPage == 1) {
// this.setData({
// showList: listArrays,
// page: curPage + 1,
// hasMorePage: res.model.haveMore
// })
// } else {
// let newArrays = that.data.pointLists.concat(listArrays)
// this.setData({
// showList: newPoints,
// page: curPage + 1,
// hasMorePage: res.model.haveMore
// })
// }
// }).catch(err=>{
// console.log(err)
// })
mockApi.get('http://result.eolinker.com/t2TvftRd7db394452f6fdee0541724f3fdde187fc6c117d?uri=repair/app/userOrder/myOrderList',{
userId: this.data.userId,
curPage,
}).then(res=>{
console.log(res)
let listArrays = res.items.map(item => {
item.pics = item.pics.split(',')[0]
let stateArray = ['已下单', '已接单', '已完成', '已完成','已取消']
item.state =stateArray[item.state]
item.orderTime = new Date(item.orderTime).toLocaleString()
return item
})
//首页
if (curPage == 1) {
this.setData({
showList: listArrays,
page: curPage + 1,
hasMorePage: res.model.haveMore
})
} else {
let newArrays = that.data.showList.concat(listArrays)
this.setData({
showList: newArrays,
page: curPage + 1,
hasMorePage: res.model.haveMore
})
}
}).catch(err=>{
console.log(err)
})
},
//获取服务详情
toServerDetail(e){
let serverId=e.currentTarget.id
wx.navigateTo({
url: `/pages/server_detail/server_detail?id=${serverId}`,
})
}
})
\ No newline at end of file
<!--pages/user_index/user_index.wxml-->
<view class='con'>
<view class='tab-header'>
<view class='main' catchtap='tabCarMenu'>
<view class='item {{tab===""? "active":""}}'>提交工单</view>
<view class='item {{tab==="tab"? "active":""}}' id='tab'>我的服务</view>
</view>
</view>
<view class='body-box {{tab}}'>
<view class='tab-map'>
<view>
<view class='phone list'>
<text>报修人:</text>
......@@ -48,29 +40,4 @@
<view class='option'>
<button catchtap='submitServer'>预约</button>
</view>
</view>
<view class='tab-detail'>
<scroll-view scroll-y class='device-list'>
<view wx:if='{{showList.length!=0}}'>
<view class='list-item' wx:for='{{showList}}' wx:key='{{item.id}}' id='{{item.id}}' catchtap='toServerDetail'>
<image src='{{item.pics||imgLogo}}'></image>
<view class='item-des item-text'>
<text>{{item.frameNo}}</text>
<text class='low-text'>{{item.vehicleModel}}</text>
</view>
<view class='item-state item-text'>
<text class='tip2'>{{item.state}}</text>
<text class='low-text'>{{item.orderTime}}</text>
</view>
</view>
<view class='btn' wx:if='{{hasMorePage}}'>
<button catchtap='getMyOrderList'>加载更多</button>
</view>
</view>
<view wx:else class='no-list'>
<text class='tip2'>不存在任何工单</text>
</view>
</scroll-view>
</view>
</view>
</view>
\ No newline at end of file
// pages/server_detail/server_detail.js.
const { api, rapi, mapApi, mockApi, imgName, alertTip } = require('../../lib/util.js')
const { api, formatTime, rapi, mapApi, mockApi, imgName, alertTip } = require('../../lib/util.js')
Page({
......@@ -16,23 +16,30 @@ Page({
*/
onLoad: function (options) {
let id = options.id
console.log(id)
this.getMyOrderDetail(id)
this.setData({
id
})
},
onShow: function () {
this.getMyOrderDetail(this.data.id)
},
getMyOrderDetail(id){
rapi.get('userOrder/myOrderDetail', {
id
}).then(res => {
let order = res.data
let stateArray = ['已下单', '已接单', '已完成', '已完成', '已取消']
let stateArray = ['已下单', '已接单', '待评价', '已评价', '已取消']
order.state = stateArray[order.state]
order.pics = order.pics.split(',')
order.orderTime = new Date(order.orderTime).toLocaleString() || ''
order.receiveTime = new Date(order.receiveTime).toLocaleString() || ''
order.completeTime = new Date(order.completeTime).toLocaleString() || ''
order.orderTime = formatTime(new Date(order.orderTime))|| ''
order.receiveTime = formatTime(new Date(order.receiveTime)) || ''
order.completeTime = formatTime(new Date(order.completeTime)) || ''
order.itemList=order.itemList.map(item=>{
item.itemFee = item.manHours * order.manHoursFee
return item
})
this.setData({
order: res.data
})
......@@ -56,10 +63,18 @@ Page({
userId: wx.getStorageSync('user').userMapp.id,
id:this.data.order.id
}).then(res => {
alertTip(res)
alertTip('取消成功',()=>{
this.getMyOrderDetail(this.data.order.id)
})
}).catch(err => {
alertTip(err)
})
},
//评价订单
evaluateOrder() {
let orderId = this.data.order.id
wx.navigateTo({
url: "/pages/evaluate/evaluate?orderId=" + orderId,
})
}
})
\ No newline at end of file
......@@ -35,11 +35,11 @@
<view class='item-title'>预约时间:</view>
<view class='item-body'>{{order.orderTime}}</view>
</view>
<view class='item' wx:if='{{order.state=="已完成"||order.state=="已接单"}}'>
<view class='item' wx:if='{{order.state!="已下单"&&order.state!="已取消"}}'>
<view class='item-title'>接单时间:</view>
<view class='item-body'>{{order.receiveTime}}</view>
</view>
<view class='item' wx:if='{{order.state=="已完成"}}'>
<view class='item' wx:if='{{order.state=="待评价"||order.state=="已评价"}}'>
<view class='item-title'>完成时间:</view>
<view class='item-body'>{{order.completeTime}}</view>
</view>
......@@ -57,26 +57,31 @@
<image wx:for='{{order.pics}}' data-src="{{item}}" data-list="{{order.pics}}" srcwx:key='{{item}}' src='{{item}}' catchtap='lookPic'></image>
</view>
</view>
<view class='item' wx:if='{{order.state=="已完成"}}'>
<view class='item' wx:if='{{order.state=="待评价"||order.state=="已评价"}}'>
<view class='item-title'>收费:</view>
<view class='item-body'>
<view>总工时:{{order.manHoursFee}}小时</view>
<view>总费用:<text class='tip'>¥{{order.price}}</text>元</view>
<view>总费用:
<text class='tip'>¥{{order.price}}</text>元</view>
</view>
</view>
<view class='item' wx:if='{{order.state=="已完成"}}'>
<view class='item' wx:if='{{order.state=="待评价"||order.state=="已评价"}}'>
<view class='item-title'>计价细目:</view>
<view class='item-body'>
<view class='item' wx:for='{{order.itemList}}' wx:key='{{item.id}}'>
<view class='min-title'>{{item.itemName}}</view>
<view class='item-body'>
<view>工时:¥{{item.manHours}}小时</view>
<view>小计:<text class='tip'>¥{{item.materialFee}}</text>元</view>
<view>工时费:
<text class='tip'>¥{{item.manHours*order.manHoursFee}}</text>元</view>
<view>材料费:
<text class='tip'>¥{{item.materialFee}}</text>元</view>
</view>
</view>
</view>
</view>
<view class='btn' wx:if='{{order.state!="已完成"||order.state!="已取消"}}'>
<view class='btn' wx:if='{{order.state=="已下单"}}'>
<button catchtap='cancleOrder'>取消工单</button>
</view>
<view class='btn' wx:if='{{order.needEvaluate}}'>
<button catchtap='evaluateOrder'>评价订单</button>
</view>
</view>
\ No newline at end of file
// pages/server_point/server_point.js
const { api, rapi,imgName, getUserInfo, wxLogin, alertTip, authAgainByUser, userLocation } = require('../../lib/util.js')
const { api, rapi,formatTime,imgName, getUserInfo, wxLogin, alertTip, authAgainByUser, userLocation } = require('../../lib/util.js')
Page({
/**
......@@ -9,15 +9,31 @@ Page({
first:true,
imgLoc: imgName('pointloc.png'),
imgPhone: imgName('security_settings_telephone_active.png'),
imgLogo: imgName('logo.png'),
activeIndex:0,
page: 1,//当前页面
hasMorePage: false,//更多页面
pointLists:[]//站点列表
pointLists:[],//站点列表
showList: [], //我的服务列表
serverPage: 1, //当前页面
serverHasMorePage: false, //更多页面
titleList: [
{
name: '我的维养'
},
{
name: '维养站点'
}
]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getPointLists(1)
},
onShow(){
this.getMyOrderList(1)
},
//获取站点列表
getPointLists(page){
......@@ -32,9 +48,8 @@ Page({
curPage
})
.then(res => {
let listArrays = res.items.map(item => { item.distance=item.distance.toFixed(1); return item})
//首页
//首页)
if (curPage==1){
this.setData({
pointLists:listArrays,
......@@ -51,13 +66,16 @@ Page({
}
})
.catch(err => {
console.log(err)
alertTip(err,()=>{
wx.navigateBack()
})
})
})
.catch(err=>{
alertTip('你拒绝了地理定位,请打开后重试')
alertTip('你拒绝了地理定位,请打开后重试', () => {
wx.navigateBack()
})
})
},
/**
......@@ -73,13 +91,6 @@ Page({
onUnload: function () {
},
onReachBottom: function () {
console.log('到底了')
},
//分数改变
scoreChange(e){
console.log(e.detail)
},
//拨打电话
callPointPhone(e){
wx.makePhoneCall({
......@@ -95,5 +106,57 @@ Page({
wx.navigateTo({
url: `/pages/point_detail/point_detail`,
})
},
tabChange(e){
let activeIndex=e.detail.activeIndex
//站点
if (this.data.pointLists.length == 0 && activeIndex==1){
this.getPointLists(1)
}
this.setData({
activeIndex
})
},
//获取服务工单
getMyOrderList(page) {
let curPage = page || this.data.serverPage
let that = this
let userId=wx.getStorageSync('user').userMapp.id
rapi.get('userOrder/myOrderList', {
userId,
curPage,
}).then(res => {
let listArrays = res.items.map(item => {
item.pics = item.pics.split(',')[0]
let stateArray = ['已下单', '已接单', '待评价', '已评价', '已取消']
item.state = stateArray[item.state]
item.orderTime = formatTime(new Date(item.orderTime))
return item
})
//首页
if (curPage == 1) {
this.setData({
showList: listArrays,
serverPage: res.model.haveMore ? (curPage + 1) : 1,
serverHasMorePage: res.model.haveMore
})
} else {
let newArrays = that.data.showList.concat(listArrays)
this.setData({
showList: newArrays,
serverPage: res.model.haveMore ? (curPage + 1) : page,
serverHasMorePage: res.model.haveMore
})
}
}).catch(err => {
console.log(err)
})
},
//获取服务详情
toServerDetail(e) {
let serverId = e.currentTarget.id
wx.navigateTo({
url: `/pages/server_detail/server_detail?id=${serverId}`,
})
}
})
\ No newline at end of file
{
"navigationBarTitleText": "售后站点",
"navigationBarTitleText": "维养服务",
"usingComponents": {
"navbar": "/components/navbar/navbar",
"star-score": "/components/star/star"
}
}
\ No newline at end of file
<view class='con'>
<scroll-view class='item-body' scroll-y>
<navbar titleList='{{titleList}}' ontabChange='tabChange'></navbar>
<view class='con' hidden='{{activeIndex==1}}'>
<scroll-view class='item-body' scroll-y>
<view wx:if='{{showList.length!=0}}'>
<view class='list-item' wx:for='{{showList}}' wx:key='{{item.id}}' id='{{item.id}}' catchtap='toServerDetail'>
<image src='{{item.pics||imgLogo}}'></image>
<view class='item-des item-text'>
<text>{{item.frameNo}}</text>
<text class='low-text'>{{item.vehicleModel}}</text>
</view>
<view class='item-state item-text'>
<text class='tip2'>{{item.state}}</text>
<text class='low-text'>{{item.orderTime}}</text>
</view>
</view>
<view class='btn' wx:if='{{hasMorePage}}'>
<button catchtap='getMyOrderList'>加载更多</button>
</view>
</view>
<view wx:else class='no-list'>
<text class='tip2'>不存在任何工单</text>
</view>
</scroll-view>
</view>
<view class='con' hidden='{{activeIndex==0}}'>
<scroll-view class='item-body' scroll-y>
<view class='point-item' wx:for='{{pointLists}}' wx:key="{{item.id}}">
<view class='tip' wx:if='{{index==0}}'>距你最近的服务商:</view>
<view class='point-box'>
......@@ -23,5 +47,5 @@
<view class='btn' wx:if='{{hasMorePage}}'>
<button catchtap='getPointLists'>加载更多</button>
</view>
</scroll-view>
</scroll-view>
</view>
\ No newline at end of file
/* pages/server_point/server_point.wxss */
@import '../server/server.wxss';
page{
font-size: 28rpx;
color: #000;
height: 100%;
}
.con{
height: 100%;
height: 90%;
}
.item-body{
height: 100%;
......@@ -44,6 +45,10 @@ page{
.point-left{
flex:0 0 500rpx;
}
image{
width: 40rpx;
height: 40rpx;
}
.btn{
padding: 30rpx;
}
......
......@@ -83,7 +83,7 @@ Page({
})
},
//详情页面
toDetail(){
toDetail(e){
let id = e.currentTarget.id
}
})
\ No newline at end of file
......@@ -15,7 +15,7 @@
</view>
</view>
</view>
<view class='i nav-item'>
<!-- <view class='i nav-item'>
<view class='layout'>
<view class='left sub-title'>
关于
......@@ -29,7 +29,7 @@
<image src='{{imgMore}}'></image>
</view>
</view>
</view>
</view> -->
</scroll-view>
<view class='bom' catchtap='loginOut'>
退出登录
......
// pages/upload/upload.js
const { api, rapi, formatTime, mapApi, mockApi, imgName, getUserInfo, wxLogin, alertTip, wxscan, authAgainByUser, userLocation } = require('../../lib/util.js')
Page({
/**
* 页面的初始数据
*/
data: {
imgScan: imgName('imgadd.png'),
imgClose: imgName('close.png'),
imgUrl:''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
upimg(){
let that = this
wx.chooseImage({
count: 1, // 默认9
sizeType: ['original'], // 可以指定是原图还是压缩图,默认二者都有
success: function (res) {
// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
let tempFilePath = res.tempFilePaths[0]
that.setData({
imgUrl: tempFilePath,
})
}
})
},
deleteImg(){
this.setData({
imgUrl: ''
})
},
sureChange(){
let imgUrl = this.data.imgUrl
if (imgUrl){
wx.showLoading({
title: '上传中。。',
})
wx.uploadFile({
url: 'https://zhizuxia.zhizukj.com/ydb/app/manage/file/upload.json',
filePath: imgUrl,
name: 'file',
success(res) {
let upUrl=JSON.parse(res.data).picUrl
api.post('user/editInfo',{
id:wx.getStorageSync('user').userMapp.id,
idImg:upUrl
}).then(res=>{
alertTip('修改成功',()=>{
wx.navigateBack()
})
})
.catch(err=>{
alertTip(err)
})
},
fail(err) {
alertTip('上传失败')
},
complete(res) {
wx.hideLoading()
}
})
return
}
alertTip('请选择半身照')
}
})
\ No newline at end of file
<view class="big-logos">
<image catchtap="upimg" src='{{imgScan}}' wx:if='{{!imgUrl}}'></image>
<view class='logoinfo' wx:else>
<image class='close' id='{{index}}' src='{{imgClose}}' catchtap='deleteImg'></image>
<image catchtap="upimg" src='{{imgUrl}}'></image>
</view>
</view>
<button catchtap='sureChange'>确认修改</button>
/* pages/upload/upload.wxss */
page{
padding: 0 30rpx;
}
.big-logos{
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 50rpx;
}
.big-logos image{
width: 300rpx;
height: 300rpx;
margin-right:20rpx;
}
.logoinfo{
position: relative;
}
.big-logos image.close{
position: absolute;
top: 0;
right: 0;
width:80rpx;
height: 80rpx;
}
button{
background-color: #d7193c;
}
\ No newline at end of file
const config = require('../../config/index.js')
const { api, mapApi, imgName, getUserInfo, wxLogin, alertTip, authAgainByUser, userLocation } = require('../../lib/util.js')
const { api, formatTime, mapApi, imgName, getUserInfo, wxLogin, alertTip, authAgainByUser, userLocation } = require('../../lib/util.js')
let carTimer = null//数据轮询 车实时状态
let medicalTimer = null //体检 延时器
......@@ -17,11 +17,13 @@ Page({
imgLoc: imgName('loc.png'),
imgLock: imgName('lock.png'),
imgToloc: imgName('toloc.png'),
imgcarloc: imgName('timeline_location.png'),
imgMore: imgName('more.png'),
imgSpeed: imgName('speed.png'),
imgMedical: imgName('medical.png'),
user: null,//用户
person:1,//个租
V3: true,//v3版本的过渡版,不可控制
person: 1,//个租
device: null,//设备
timerDevice: null,
baseMsg: true,//基础数据获取是否正常
......@@ -32,7 +34,7 @@ Page({
licensePlate: '--',//号牌
vehicleTypeName: '--',//车型名称
rentStartTime: '--',//起租时间
fee:'1.5',
fee: '1.5',
deviceAdress: '--',//位置
last_communication_time: '--',//更新时间
lockState: 0,//锁
......@@ -45,9 +47,9 @@ Page({
latitude: 30.334546,
longitude: 120.121121,
markers: [{
id:0,
latitude:0,
longitude:0,
id: 0,
latitude: 0,
longitude: 0,
iconPath: imgName('location_sucess.png'),
}]
},
......@@ -138,7 +140,20 @@ Page({
//获取硬件信息
getCarDetail() {
let { device, ui, details } = this.data
let that=this
let that = this
api.get('user/getByUserId', {
userId: that.data.user.id
}, true).then(res => {
if (res.data.isUseVehicle == 0) {
alertTip('您当前无使用中车辆', () => {
wx.redirectTo({
url: '/pages/device_bind/device_bind',
})
})
}
}).catch(err => {
console.error(err)
})
if (device && device.vcuNo) {
api.get('device/getDevInfo', {
vcuNo: device.vcuNo,
......@@ -148,8 +163,8 @@ Page({
let { data } = res
console.log('实时数据', data)
//实时数据
if (data.isUseVehicle==1){
alertTip('你的车辆已被站点解绑',()=>{
if (data.isUseVehicle == 1) {
alertTip('你的车辆已被站点解绑', () => {
wx.redirectTo({
url: '/pages/device_bind/device_bind',
})
......@@ -166,19 +181,19 @@ Page({
ui.lockState = data.lock_state == 'closed' ? 0 : 1//锁 1开锁状态
ui.dumpEnergy = data.power//剩余电量
ui.speed = data.speed//行驶速度
//地图内容
//地图内容
ui.locMap.latitude = Number(data.latitude)
ui.locMap.longitude = Number(data.longitude)
ui.locMap.markers[0].latitude = Number(data.latitude)
ui.locMap.markers[0].longitude = Number(data.longitude)
//详情内容
//详情内容
this.setCarDetail(data)
this.setData({
ui,
})
})
.catch(err => {
console.error(1,err)
console.error(1, err)
})
}
......@@ -235,6 +250,7 @@ Page({
let carData2 = res.data
device = Object.assign(carData2, device)
this.setData({
V3: /^v3/gi.test(device.vcuNo),
device,
baseMsg: true
})
......@@ -261,7 +277,7 @@ Page({
// baseMsg: false
// })
if(/数据为空/.test(err)){
if (/数据为空/.test(err)) {
that.getRentRecord()
}
console.error(err)
......@@ -269,39 +285,45 @@ Page({
},
//关锁
netCloseCar() {
let This = this
api.get('device/lockSwitch.json', { lockState: 0, userId:this.data.user.id })
let that = this
if (!that.data.V3) {
api.get('device/lockSwitch.json', { lockState: 0, userId: this.data.user.id })
.then(res => {
let ui=this.data.ui
ui.lockState=0
let ui = this.data.ui
ui.lockState = 0
alertTip('锁车成功')
This.setData({
that.setData({
ui,
})
})
.catch(err => {
alertTip(err)
})
}
},
//开锁
netOpenCar() {
let This = this
let that = this
//不是v3可以控制
if (!that.data.V3) {
api.get('device/lockSwitch.json', { lockState: 1, userId: this.data.user.id })
.then(res => {
let ui = this.data.ui
ui.lockState = 1
alertTip('开锁成功')
This.setData({
that.setData({
ui,
})
})
.catch(err => {
alertTip(err)
})
}
},
//寻车
netFindCar() {
api.get('device/findCar.json', { userId:this.data.user.id})
api.get('device/findCar.json', { userId: this.data.user.id })
.then(res => {
alertTip('寻车成功')
})
......@@ -309,6 +331,15 @@ Page({
alertTip(err)
})
},
//导航
toLocCar() {
let ui = this.data.ui.locMap
wx.openLocation({
latitude: Number(ui.latitude),
longitude: Number(ui.longitude),
scale: 28
})
},
//开关锁
apiActionDevice() {
if (this.data.ui.lockState) {//开
......@@ -335,7 +366,7 @@ Page({
details[0].des1 = `信号强度:${d.csq}`
details[0].des2 = `最后通信时间:${d.last_update_time}`
details[1].des1 = `经度:${d.longitude} 纬度:${d.latitude}`
details[1].des2 = `gps:${d.gps_effective==5?'有效':'无效'}`
details[1].des2 = `gps:${d.gps_effective == 5 ? '有效' : '无效'}`
details[1].des3 = `位置:${d.address}`
details[1].tip = `${d.gps_effective == 5 ? '' : '当前定位异常(以上数据为最后一次上报数据), 将车辆移至信号良好处, 可增强通讯和定位。'}`
details[2].des1 = `可用卫星:${d.number_satellite}`
......@@ -378,11 +409,11 @@ Page({
let { user, device, ui } = this.data
//基础信息
if (user && device) {
ui.froNo = device.frameNo//车架号
ui.vcuNo = device.vcuNo//中控号
ui.vehicleTypeName = device.model//车型名称
ui.licensePlate = device.licensePlate//号牌
ui.rentStartTime = new Date(device.createDate).toLocaleString()//租车起始时间
ui.froNo = device.frameNo || '未录入'//车架号
ui.vcuNo = device.vcuNo || '未录入'//中控号
ui.vehicleTypeName = device.model || '未录入'//车型名称
ui.licensePlate = device.licensePlate || '未录入'//号牌
ui.rentStartTime = formatTime(new Date(device.createDate))//租车起始时间
}
//车辆信息
this.setData({
......@@ -411,7 +442,7 @@ Page({
let state = res.data.state
switch (state) {
case 1:
cb&&cb()
cb && cb()
break;
case 2:
wx.redirectTo({
......@@ -439,28 +470,9 @@ Page({
alertTip(err)
})
},
//个租还车
returnCar(){
let that=this
this.getRentRecord(()=>{
api.post('message/applyReturnCar',{
frameNo: that.data.ui.froNo,
userId:that.data.user.id,
rentType:1
})
.then(res=>{
wx.redirectTo({
url: `/pages/return_car_pedding/return_car_pedding`,
})
})
.catch(err=>{
alertTip(err)
console.error(err)
})
})
},
//维修服务
toServer(){
toServer() {
wx.navigateTo({
url: '/pages/server_point/server_point',
})
......
......@@ -23,32 +23,30 @@
<cover-view class='map-controltap'>
<cover-image src='{{imgFind}}' catchtap='netFindCar'></cover-image>
<cover-image src='{{imgToloc}}' catchtap='showMyLoc'></cover-image>
<cover-image src='{{imgcarloc}}' catchtap='toLocCar'></cover-image>
</cover-view>
</map>
<view class='map-des'>
<view class='loc'>{{ui.deviceAdress}}</view>
<view class='loc-des'>定位时间:{{ui.last_communication_time}}</view>
<view class='status'>
<view class='status' wx:if='{{!V3}}'>
<view class='status-item'>
<image class='km' src='{{imgKm}}'></image>
<view>里程:{{ui.estimatedMileage}}</view>
</view>
<!-- <view class='status-item'>
<view class='status-item'>
<image class='battery' src='{{imgSpeed}}'></image>
<view>速度:{{ui.speed}}</view>
</view> -->
</view>
<view class='status-item'>
<image class='battery' src='{{imgBattery}}'></image>
<view>电量:{{ui.dumpEnergy}}</view>
</view>
</view>
<view class='btn-action'>
<view class='lock' catchtap='returnCar' wx:if='{{person==1}}'>
<text>还车</text>
</view>
<view class='lock' bindtap='apiActionDevice'>
<view class='{{ui.lockState?"lock-active":""}} lock' bindtap='apiActionDevice'>
<image src='{{imgLock}}'></image>
<text>{{ui.lockState?'我要锁车':'开锁用车'}}</text>
<text>{{ui.lockState?'已开锁':'已锁车'}}</text>
</view>
</view>
</view>
......@@ -77,7 +75,7 @@
<text class='vname'>{{ui.rentStartTime}}</text>
</view>
</view>
<view class='item'>
<!-- <view class='item'>
<image class='icon' src='{{imgMedical}}'></image>
<view class='des'>
<view class='title'>
......@@ -101,7 +99,7 @@
<text catchtap='toServer'> 我要保修。</text>
</view>
</view>
</view>
</view> -->
<view class='item' wx:for="{{details}}" wx:key='{{item.title}}'>
<image class='icon' src='{{item.icon}}'></image>
<view class='des'>
......
......@@ -6,8 +6,11 @@ page .con {
height: 100%;
overflow: hidden;
position: relative;
display: flex;
flex-direction: column;
}
page .con .tab-header {
flex: 0 0 103rpx;
box-sizing: border-box;
display: flex;
justify-content: space-between;
......@@ -45,7 +48,9 @@ page .con .tab-header .item.active {
border-bottom-color: #d7193c;
}
page .con .body-box {
height: 1111rpx;
/* height: 100%; */
flex: 1 0 100rpx;
overflow: hidden;
width: 200%;
box-sizing: border-box;
transform: translateX(0);
......@@ -60,7 +65,8 @@ page .con .body-box .tab-map {
}
page .con .body-box .tab-map map {
width: 100%;
height: 690rpx;
flex: 1 0 200rpx;
/* height: 690rpx; */
position: relative;
}
page .con .body-box .tab-map map .map-alarm {
......@@ -114,15 +120,17 @@ page .con .body-box .tab-map map .map-controltap {
page .con .body-box .tab-map map .map-controltap cover-image {
width: 80rpx;
height: 80rpx;
margin-bottom: 30rpx;
}
page .con .body-box .tab-map map .map-controltap cover-image:last-child {
position: absolute;
top: 0;
bottom: 0;
right: 26rpx;
}
page .con .body-box .tab-map .map-des {
height: 400rpx;
padding: 0 20rpx;
/* height: 100%; */
flex: 0 0 auto;
padding: 0 20rpx 40rpx;
display: flex;
align-items: center;
flex-direction: column;
......@@ -180,6 +188,7 @@ page .con .body-box .tab-map .map-des .lock image {
page .con .body-box .tab-detail {
width: 50%;
height: 100%;
/* overflow: hidden; */
box-sizing: border-box;
padding: 0 40rpx 50rpx;
}
......@@ -272,8 +281,10 @@ page .con .tab {
}
.btn-action{
display: flex;
flex: 1 0 auto;
width: 100%;
justify-content: space-between;
align-items: flex-end;
}
.btn-action view:nth-of-type(1){
flex: 1 0 50rpx;
......@@ -282,3 +293,6 @@ page .con .tab {
.btn-action view:nth-of-type(2){
flex: 2 0 50rpx;
}
page .con .body-box .tab-map .map-des .lock-active{
background-color: #30c100;
}
\ No newline at end of file
const {
api,
formatTime,
mapApi,
imgName,
getUserInfo,
......@@ -53,7 +54,7 @@ Page({
.then(res => {
console.log('getList', res)
let alarmMsg = res.items.map(item => {
item.showTime = new Date(item.timestamp).toLocaleString()
item.showTime = formatTime(new Date(item.timestamp))
item.alarmMsg = msgType[item.messageType]
return item
})
......
const { api, mockApi, imgName, getUserInfo, wxLogin, alertTip, authAgainByUser, userLocation } = require('../../lib/util.js')
const { api, mockApi, formatTime, imgName, getUserInfo, wxLogin, alertTip, authAgainByUser, userLocation } = require('../../lib/util.js')
let months={
'01': '一月',
'02': '二月',
......@@ -53,8 +53,8 @@ Page({
item.startPosition = String(item.startPosition).slice(0, 5)
item.endPosition = String(item.endPosition).slice(0, 5)
item.useTime = new Date(item.endDate - item.startDate).getSeconds() + 1
item.startDate = new Date(item.startDate).toLocaleString()
item.endDate = new Date(item.endDate).toLocaleString()
item.startDate = formatTime(new Date(item.startDate))
item.endDate = formatTime(new Date(item.endDate))
item.useMileage = ((item.endMileage - item.startMileage) / 1000).toFixed(2)
return item
})
......
const { api, imgName, getUserInfo, wxLogin, alertTip, authAgainByUser } = require('../../lib/util.js')
Page({
data: {
title:'智租科技',
titleDes:'这是一段描述',
//图片
img_logo: imgName('logo.png'),
icon: imgName('icon.png')
},
onLoad: function () {
this.readyLogin()
console.log('welcome')
},
onShow: function () {
console.log('welcome show')
},
readyLogin(){
var _this=this
//登录
wxLogin()
.then(code => {
wx.request({
url: api('user/loginCode'),
data: { code },
success: function (res) {
if (res.statusCode != 200) {
alertTip('loginCode请求失败')
return
}
if(res.data.ok){
console.log('openid', res.data.data.openid)
}else{
alertTip(res.data.msg)
}
// _this.readyUserInfo()
},
fail: function (res) {
alertTip('loginCode请求失败:服务器异常')
}
})
})
.catch(err => {
alertTip(err)
})
},
//param:authAgain 手动授权
readyUserInfo(authAgain){
//获取用户信息
getUserInfo()
.then(userinfo => {
// console.log('用户信息', userinfo)
wx.setStorageSync('userinfo', userinfo)
//校验用户是否存在,上传用户信息,获取用户在逗哈状态
wx.request({
url: api('user/login'),
data: { userinfo },
method: 'POST',
success: function (res) {
if (res.statusCode != 200) {
alertTip('login请求失败')
return
}
console.log('欢迎',res)
if(!res.data.ok){
alertTip(res.data.msg)
return
}
//判断有没有注册 绑定手机号
let userData=res.data.data
//存储userid
wx.setStorageSync('userId', userData.userId)
if(userData.register==false){
wx.showModal({
title: '',
content: '检测到您的账号还未绑定手机号,请绑定手机号',
confirmText:'绑定手机',
success(res) {
if(res.confirm){
wx.redirectTo({
url: '/pages/register/register?userId=' + userData.userId,
})
}
}
})
return
}
// 判断绑定产品没有
if (userData.hasBindDevice){
wx.redirectTo({
url: '/pages/user_index/user_index',
})
return
}else{
wx.redirectTo({
url: '/pages/device_bind/device_bind',
})
return
}
},
fail: function (res) {
alertTip('login请求失败:请检查网络')
}
})
})
.catch(err => {
console.log('用户信息错误', err)
authAgain && authAgain('需要授权用户信息才能正常使用,点击确定去授权')
})
},
auth(){
this.readyUserInfo(authAgainByUser)
},
test(e){
console.log(e.detail)
}
})
\ No newline at end of file
<view class='container'>
<scroll-view class='read' scroll-y>
<image class='logo' src='{{img_logo}}'></image>
<view class='tle'>
<view>{{title}}</view>
<view>{{titleDes}}</view>
</view>
<view class='des'>
</view>
</scroll-view>
<view class='login' bindtap='auth'>登录</view>
</view>
\ No newline at end of file
page{
height: 100%;
}
.container{
height: 100%;
background-color: #ffffff;
padding: 0 30rpx;
}
.read{
height: 400rpx;
text-align: center;
}
.logo{
width: 168rpx;
height: 153rpx;
margin-top: 80rpx;
}
.tle{
margin-top: 8rpx;
}
.tle view{
margin-top: 28rpx;
}
.des{
}
.login{
margin-top: 60rpx;
background-color: #1aad19;
width: 100%;
padding: 30rpx 0;
border-radius: 12rpx;
font-size: 18px;
color: #ffffff;
text-align: center
}
\ No newline at end of file
{
"description": "项目配置文件。",
"setting": {
"urlCheck": false,
"urlCheck": true,
"es6": true,
"postcss": true,
"minified": true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment