This commit is contained in:
zmj 2023-10-18 16:26:54 +08:00
parent 96d0fb5e81
commit 3558026d1e
9 changed files with 241 additions and 200 deletions

235
App.vue
View File

@ -1,125 +1,132 @@
<script>
//#ifdef APP-PLUS
const jpushModule = uni.requireNativePlugin("JG-JPush");
// #endif
import { loginShopAccount, userInfo } from "@/api/oaUser.js"
export default {
onLaunch: async function(info) {
// let noticeArr = []
// jpushModule.addNotificationListener(res => {
// if (!noticeArr.includes(res.messageID)) {
// const audioContext = uni.createInnerAudioContext()
// //
// audioContext.src = `/static/audio/order.mp3`;
// // console.log(res.messageID)
// audioContext.play()
// noticeArr.push(res.messageID)
// console.log("app")
// }
// })
//#ifdef APP-PLUS
const jpushModule = uni.requireNativePlugin("JG-JPush");
// #endif
import {
loginShopAccount,
userInfo
} from "@/api/oaUser.js"
export default {
onLaunch: async function(info) {
// let noticeArr = []
// jpushModule.addNotificationListener(res => {
// if (!noticeArr.includes(res.messageID)) {
// const audioContext = uni.createInnerAudioContext()
// //
// audioContext.src = `/static/audio/order.mp3`;
// // console.log(res.messageID)
// audioContext.play()
// noticeArr.push(res.messageID)
// console.log("app")
// }
// })
// uni.showModal({
// content: info.referrerInfo.extraData
// })
// console.log('App Launch:',info);
if (info.referrerInfo?.extraData?.uniMP) {
//宿App
uni.onHostEventReceive((event, data) => {
if(event=='getLocation') uni.$emit('uniMP_getLocation', data);
else if(event=='im'){
uni.navigateTo({
url:'/subpkg/chatMang/index'
})
}
});
uni.setStorageSync('uniMP', info.referrerInfo?.extraData?.uniMP);
uni.setStorageSync('APP_token', info.referrerInfo?.extraData?.token);
try {
let res = await loginShopAccount({
shop_token: info.referrerInfo?.extraData?.token
});
this.$store.commit('SET_USERINFO', {
user: data,
token: res.data.token
})
this.$store.dispatch('initConfig');
let {
data
} = await userInfo();
this.$store.commit('setUserInfo', data);
this.$isResolve()
// uni.$emit('home_initUserInfo', data);
return;
} catch (e) {
this.$isResolve()
console.log(e);
}
}
console.log('App Launch')
this.$store.dispatch('initConfig');
this.$isResolve()
try {
if (!this.$store.state.app.token) uni.reLaunch({
url: '/pages/oaLogin/oaLogin'
})
} catch (e) {
uni.reLaunch({
url: '/pages/oaLogin/oaLogin'
})
}
},
onShow: function() {
// uni.onHostEventReceive((event, data) => {
// // if(event=='getLocation') uni.$emit('uniMP_getLocation', data);
// });
// const audioContext = uni.createInnerAudioContext()
// //
// audioContext.src = '/static/mp3/order.mp3'
//
uni.onHostEventReceive((event,data)=>{
if(event=='im'){
uni.navigateTo({
url:'/subpkg/chatMang/index'
})
}else if(event=='re_id'){
uni.setStorageSync("re_id",data)
}
// console.log('Receive event('+event+') from HOST: '+JSON.stringify(data));
});
//#ifdef APP-PLUS
jpushModule.initJPushService()
jpushModule.addNotificationListener(res => {
const audioContext = uni.createInnerAudioContext()
if(res.content.includes('')){
// uni.showModal({
// content: info.referrerInfo.extraData
// })
// console.log('App Launch:',info);
if (info.referrerInfo?.extraData?.uniMP) {
//宿App
//#ifdef APP-PLUS
uni.onHostEventReceive((event, data) => {
if (event == 'getLocation') uni.$emit('uniMP_getLocation', data);
else if (event == 'im') {
uni.navigateTo({
url: '/subpkg/chatMang/index'
})
}
});
// #endif
uni.setStorageSync('uniMP', info.referrerInfo?.extraData?.uniMP);
uni.setStorageSync('APP_token', info.referrerInfo?.extraData?.token);
try {
let res = await loginShopAccount({
shop_token: info.referrerInfo?.extraData?.token
});
this.$store.commit('SET_USERINFO', {
user: data,
token: res.data.token
})
this.$store.dispatch('initConfig');
let {
data
} = await userInfo();
this.$store.commit('setUserInfo', data);
this.$isResolve()
// uni.$emit('home_initUserInfo', data);
return;
} catch (e) {
this.$isResolve()
console.log(e);
}
}
console.log('App Launch')
this.$store.dispatch('initConfig');
this.$isResolve()
try {
if (!this.$store.state.app.token) uni.reLaunch({
url: '/pages/oaLogin/oaLogin'
})
} catch (e) {
uni.reLaunch({
url: '/pages/oaLogin/oaLogin'
})
}
},
onShow: function() {
// uni.onHostEventReceive((event, data) => {
// // if(event=='getLocation') uni.$emit('uniMP_getLocation', data);
// });
// const audioContext = uni.createInnerAudioContext()
// //
// audioContext.src = '/static/mp3/order.mp3'
//
//#ifdef APP-PLUS
uni.onHostEventReceive((event, data) => {
if (event == 'im') {
uni.navigateTo({
url: '/subpkg/chatMang/index'
})
} else if (event == 're_id') {
uni.setStorageSync("re_id", data)
}
// console.log('Receive event('+event+') from HOST: '+JSON.stringify(data));
});
// #endif
//#ifdef APP-PLUS
jpushModule.initJPushService()
jpushModule.addNotificationListener(res => {
const audioContext = uni.createInnerAudioContext()
if (res.content.includes('')) {
audioContext.src = '/static/mp3/im.wav'
audioContext.play()
uni.vibrateLong();
console.log("im")
return
console.log("im")
return
}
if (res.notificationEventType == 'notificationOpened') return
audioContext.src = '/static/mp3/order.mp3'
audioContext.play()
uni.vibrateLong();
console.log("app的监听")
})
// #endif
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
if (res.notificationEventType == 'notificationOpened') return
audioContext.src = '/static/mp3/order.mp3'
audioContext.play()
uni.vibrateLong();
console.log("app的监听")
})
// #endif
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
}
}
</script>
<style>
/*每个页面公共css */
@import "static/css/base.css";
@import "static/css/style.scss";
/*每个页面公共css */
@import "static/css/base.css";
@import "static/css/style.scss";
view {
box-sizing: border-box;
}
view {
box-sizing: border-box;
}
</style>

View File

@ -1,5 +1,5 @@
import oahttp from "@/utils/oahttp.js";
import oahttp2 from "@/utils/logistics.js";
// http://logistics.lihaink.cn/api/getCarHistory
/**
* 车辆列表
@ -15,9 +15,9 @@ export const applycarApi = (data) => oahttp.post('/vehicle/rentApply', data)
// 显示轨迹
export const locusApi = (data) => oahttp.post('/vehicle/vehicleTrack', data)
// 获取可购买车辆列表
export const canBuyCarListApi = (data) => oahttp.post('/vehicle/vehicleTrack', data)
export const canBuyCarListApi = (data) => oahttp.get('/vehicle/getFreeCars', data)
// 购买车辆
export const buyCarApi = (data) => oahttp.post('/vehicle/vehicleTrack', data)
export const buyCarApi = (data) => oahttp.post('/vehicle/buyCars', data)
// 当前车辆位置信息
// export const locusApi = (data) => oahttp.post('/vehicle/vehicleTrack', data)
// api / getCarLocal

View File

@ -1,7 +1,7 @@
let httpApiThree;
let httpApi; // 总域名
let httpApiTwo; // 物流系统域名
let httpApiTest
const env = 'dev'; // 开发
// const env = 'prod'; // 生产
@ -22,7 +22,7 @@ switch (env) {
httpApi = 'https://ceshi-worker-task.lihaink.cn' //测试
httpApiThree = 'https://ceshi-worker-task.lihaink.cn' //测试
httpApiTwo = 'https://ceshi-logistics.lihaink.cn' //测试环境
httpApiTest = 'http://192.168.1.11:8081' //测试环境
//测试环境
}
@ -50,7 +50,7 @@ module.exports = {
HTTP_REQUEST_URL: httpApi,
HTTP_REQUEST_URL_THREE: httpApiThree,
HTTP_REQUEST_URL_TWO: httpApiTwo,
httpApiTest: httpApiTest,
// #ifdef H5
//H5接口是浏览器地址

View File

@ -13,9 +13,15 @@
{{item.create_time.slice(0, 10)}}
</view>
<view class="">
<view class="" v-if="item.type==0">
{{item.company_b_name}}提出租赁车辆一辆
</view>
<view class="" v-if="item.type==1">
{{item.company_b_name}}上传自有车辆一辆
</view>
<view class="" v-if="item.type==2">
{{item.company_b_name}}提出解除租赁
</view>
</view>
</view>
@ -64,6 +70,10 @@
background-color: #FF7C32;
color: white;
padding: 0 10rpx;
font-size: 24rpx;
// line-height: rpx;
display: flex;
align-items: center;
width: 200rpx;
height: 50rpx;
margin-right: 10rpx;

View File

@ -13,29 +13,33 @@
<view class="car-info">
<view class="car-info-l">
<view class="">
<u--image :src="a" width="150rpx" height="150rpx" style="margin-right:20rpx"></u--image>
<u--image :src="item.pic" width="150rpx" height="150rpx" style="margin-right:20rpx"></u--image>
</view>
<view class="car-info-c">
<view class="lincense">
车牌号: {{item.lincense}}
车牌号: {{item.license}}
</view>
<view class="lincense">
<!-- <view class="lincense">
行驶里程: 1212KM
</view> -->
<view class="lincense" v-if="item.flag">
当前状态: 当前使用中
</view>
<view class="lincense">
当前状态: 平台公司闲置中
<view class="lincense" v-else>
当前状态: 闲置中
</view>
</view>
</view>
<!-- -->
<view class="car-info-r">
<view class="" style="margin: 10rpx 50rpx;">
<u-checkbox-group v-model="item.checked" placement="column" @change="checkboxChange(index)">
<u-checkbox-group v-model="item.checked" placement="column" @change="checkboxChange(item.id)">
<u-checkbox>
</u-checkbox>
</u-checkbox-group>
</view>
<view class="" v-show="index==carCheckedArr[0]">
<view class="" v-show="item.id==carCheckedArr[0]">
选择该车辆为监管车辆
</view>
</view>
@ -55,12 +59,12 @@
<u-popup :show="showPop" mode="bottom" @close="close" @open="open">
<view class="pop">
<view class="check-car-list" v-for="item,index in carList" v-show="item.checked.length" :key="index">
<u--image :src="a" width="150rpx" height="150rpx"></u--image>
<u--image :src="item.pic" width="150rpx" height="150rpx"></u--image>
<view class="" style="margin-top: 10rpx;">
{{item.lincense}}
{{item.license}}
</view>
<view class="pop-check">
<u-checkbox-group v-model="item.checked" @change="popChange(index)">
<u-checkbox-group v-model="item.checked" @change="popChange(item.id)">
<u-checkbox>
</u-checkbox>
</u-checkbox-group>
@ -86,53 +90,54 @@
queryCar: '',
a: "https://tse3-mm.cn.bing.net/th/id/OIP-C.0xzWZj1_A-nzJiUBxrk8XQHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
carList: [],
carListI: [{
checked: [],
lincense: '川Y103D1'
}, {
checked: [],
lincense: '川Y103D6'
}, {
checked: [],
lincense: '川Y103D5'
}, {
checked: [],
lincense: '川Y103D4'
}, {
checked: [],
lincense: '川Y103D3'
}, {
checked: [],
lincense: '川Y103D2'
}],
carListI: [],
showPop: false,
carCheckeList: [1, 1, 1, 1, 1, 1, 1, 1],
carCheckeList: [],
carCheckedArr: []
}
},
methods: {
buyCarFn() {
if (this.carCheckedArr.length == 0) {
Toast("请先选择车辆!")
return
}
// buyCarApi({}).then(res => {
// Toast("!")
// setTimeout(() => {
// uni.navigateTo({
// url: '/subpkg/property/index'
// })
// }, 500)
// })
uni.navigateTo({
url: '/subpkg/property/index'
let data = []
this.carList.forEach(item => {
this.carCheckedArr.forEach(items => {
if (item.id == items) {
data.push({
id: item.id,
license: item.license
})
}
})
})
let datas = JSON.stringify(data)
buyCarApi({
cars: datas
}).then(res => {
Toast("申请成功!")
setTimeout(() => {
uni.redirectTo({
url: '/subpkg/property/index'
})
}, 1000)
})
// uni.navigateTo({
// url: '/subpkg/property/index'
// })
},
queryCarFn() {
this.carList = []
this.carListI.forEach(item => {
if (item.lincense.includes(this.queryCar)) {
// console.log(item.license)
if (item.license.includes(this.queryCar)) {
this.carList.push(item)
}
})
@ -147,11 +152,11 @@
} else {
this.carCheckedArr.push(i)
}
// console.log(this.carCheckedArr)
console.log(this.carCheckedArr)
},
popChange(index) {
this.checkboxChange(index)
console.log(this.carCheckedArr)
// console.log(this.carCheckedArr)
},
close() {
this.showPop = false
@ -165,11 +170,18 @@
}
},
onLoad() {
// canBuyCarListApi({}).then(res => {
// this.carListI = res.data
// })
this.carList = Array.from(this.carListI);
onLoad(option) {
// console.log(option.license)
canBuyCarListApi().then(res => {
res.data.forEach(item => {
if (item.license == option.license) {
item.flag = true
}
})
this.carListI = res.data
this.carList = Array.from(this.carListI);
})
}
@ -185,7 +197,6 @@
padding: 20rpx;
background-color: #fff;
// padding-bottom: 200rpx;
.car-info {
display: flex;
justify-content: space-between;
@ -220,7 +231,7 @@
// margin-right: 30rpx;
width: 182.5rpx;
display: flex;
// justify-content: ;
// justify-tent: ;
flex-direction: column;
align-items: center;
position: relative;
@ -238,7 +249,7 @@
height: 100rpx;
position: fixed;
bottom: 0;
z-index: 1000000;
z-index: 1000;
width: 100vw;
box-sizing: border-box;
border-radius: 30rpx 30rpx 0 0;

View File

@ -46,12 +46,12 @@
<view class="car_type">
<text>自有车辆</text>
</view>
<view class="car_li">
<view class="car_li" v-for="(item,index) in dataList.cars_info">
<view class="" style="display: flex;justify-content: space-between;align-items: center;">
<view class="" style="display: flex;align-items: center;">
<u--image :src="dataList.cars_info.pic" width="100rpx" height="100rpx"></u--image>
<u--image :src="item.pic" width="100rpx" height="100rpx"></u--image>
<view class="" style="margin-left: 10rpx;">
车牌号{{dataList.cars_info.license}}
车牌号{{item.license}}
</view>
</view>
@ -133,7 +133,7 @@
<view class="name">{{typeFn( dataList.type) }}
</view>
<view>
<text>{{'2023-03-03'}}</text>
<text>{{dataList.update_time}}</text>
</view>
</view>
</view>
@ -202,11 +202,11 @@
this.dataList = res.data.vehicleContract
this.carList = res.data.vehicleRentCars
this.checked = [this.carList[0]?.car_id] || ''
this.dataList.cars_info = JSON.parse(this.dataList.cars_info) || ""
// if (this.dataList.status == 3) {
// uni.navigateBack()
// }
console.log(this.dataList.cars_info.pic)
if (this.carList.length > 0 || this.dataList.cars_info) {
this.flag1 = false
}
@ -244,7 +244,7 @@
return "租赁合同"
}
if (status == 1) {
return "自有车"
return "自有车"
}
if (status == 2) {
"解除合同"

View File

@ -30,7 +30,7 @@
export default {
data() {
return {
datasList: [1, 2, 3],
datasList: [],
}
},
onLoad() {

View File

@ -4,6 +4,7 @@
<u-loading-page :loading="showLoading"></u-loading-page>
</view>
<view class="" v-else>
<!-- 小组公司 -->
<view class="noCar" v-if='company_type==18'>
<!-- 申请 -->
@ -43,7 +44,7 @@
</view>
<view class="uplode" v-else>
<u-icon name="plus-circle-fill" color="#0022C7" size="28"></u-icon>
上传头像
上传车辆图片
<view class="up" style="opacity: 0;">
<u-upload :fileList="imgUrl?[{url:imgUrl}]:[]"
@afterRead="afterReadAvatar" :maxCount="1">
@ -59,8 +60,6 @@
</view>
</view>
</u-modal>
</view>
<!-- 等待 -->
@ -77,6 +76,7 @@
<span class="dots">...</span>
</view>
</view>
<!-- 申请用车 -->
<view v-if="datas.type ==0">
<view class="loading">
@ -85,11 +85,10 @@
</view>
</view>
<!-- 购买车辆 -->
<view class="loading" v-if="datas.type==999999999999999">
<view class="loading" v-if="datas.type==3">
<span>您的购车申请已经提交我们正在加快审核中请耐心等待在此期间您可以继续使用车辆完成配送任务哦~</span>
<span class="dots">...</span>
</view>
</view>
<!-- 审核结束 -->
@ -106,16 +105,16 @@
</view>
</view>
<view class="">
<mytn text='购买车辆' class="buyCar" :position="false" @click="navgo('/subpkg/property/buyCar')">
</mytn>
<view class="" style="margin: 20rpx 0;">
<mytn text='上传自有车辆' @click="show=true"></mytn>
</view>
<view class="">
<mytn text='申请用车' :position="false" class="upCar" @click="applycarFn"></mytn>
</view>
<u-modal :show="show" @close="show=false" :showCancelButton="true" @confirm="upCarFn"
:closeOnClickOverlay="true" @cancel="show=false" title="车辆上传">
<view class="slot-content">
@ -139,7 +138,7 @@
</view>
<view class="uplode" v-else>
<u-icon name="plus-circle-fill" color="#0022C7" size="28"></u-icon>
上传头像
上传车辆图片
<view class="up" style="opacity: 0;">
<u-upload :fileList="imgUrl?[{url:imgUrl}]:[]"
@afterRead="afterReadAvatar" :maxCount="1">
@ -213,7 +212,6 @@
<u-icon name="arrow-right"></u-icon>
</view>
</view>
</view>
</view>
<view class="personnel_list">
@ -309,7 +307,7 @@
leaseApi,
upVehicleApi,
getAgencyDetailApi,
getvehicleDetailApi,
// getvehicleDetailApi,
villageCompanyApi,
} from "@/api/property.js"
@ -352,7 +350,7 @@
},
onLoad() {
this.initIndex()
// this.initIndex()
setTimeout(() => {
this.flag = true
})
@ -368,21 +366,27 @@
methods: {
//
initIndex() {
let type = (JSON.parse(Cache.get("USER_INFO")).company.company_type)
let type = this.$store.state.app.userInfo.company.company_type
this.company_type = type
//
if (type == 18) {
villageCompanyApi().then(res => {
this.showLoading = false
this.datas = res.data
this.step = res.data?.status || 9999
console.log(res.data?.id)
if (res.data?.id) {
this.step = res.data?.status
} else {
this.step = 9999
}
if (this.step == 3) {
uni.redirectTo({
url: `/subpkg/property/vehicle_a?id=${res.data.cars_info.id}`
})
}
})
}
//
else {
@ -441,7 +445,6 @@
})
}, 2000)
})
this.show = false
this.noInfo = false

View File

@ -24,7 +24,9 @@
<view class="right">
<view class="li" style="display: flex;justify-content: space-between;">
<text>行驶总里程: {{datas.mileage}}</text>
<text v-if="datas.type" style="color: green;">自有车辆</text>
<text v-if="datas.type==2" style="color: green;">购买车辆</text>
<text v-if="datas.type==0" style="color: green;">租赁车辆</text>
<text v-if="datas.type==1" style="color: green;">自有车辆</text>
</view>
<view class="li">
<text>承租公司: </text>
@ -68,7 +70,9 @@
<u--image :showLoading="true" src="../../static/img/contract/pdf.png" width="80px"
height="80px"></u--image>
<view class="text">
<view class="name">租赁合同</view>
<view class="name" v-if="datas.type==0">租赁合同</view>
<view class="name" v-if="datas.type==1">自有车辆合同</view>
<view class="name" v-if="datas.type==2">购车合同</view>
<!-- <view class="name">购买合同</view> -->
<view>
<text>{{ datas.create_time}}</text>
@ -85,7 +89,8 @@
</view>
<mybtn text="购买车辆" @click="navTo('/subpkg/property/buyCar')"></mybtn>
<mybtn text="购买车辆" @click="navTo2(`/subpkg/property/buyCar?license=${datas.car_license}`)"
v-if="company_type==18"></mybtn>
</view>
@ -173,6 +178,11 @@
url
})
},
navTo2(url) {
uni.redirectTo({
url
})
},
//
overDateFn(date) {
var specifiedDate = new Date(date);
@ -218,7 +228,7 @@
end_time: `${this.queryData} 23:59:59`,
start_time: `${this.queryData} 00:00:00`,
}).then(res => {
console.log(res.data)
// console.log(res.data)
this.markers[0].latitude = res.data[0].latitude
this.markers[0].longitude = res.data[0].longitude
this.polyline = [{