12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127 |
- <template>
- <view class="home">
- <!-- #ifdef MP-WEIXIN -->
- <view class="search-wrap"
- :style="'height:'+(rect.height)+'px;line-height:'+rect.height+'px;padding-top:'+(rect.top)+'px'">
- <!-- #endif -->
- <!-- #ifndef MP-WEIXIN -->
- <view class="search-wrap" :style="'padding-top:'+statusBarHeight+'px;height:64rpx'">
- <!-- #endif -->
- <!-- <view class="back-icon" :style="rect?'padding:'+(rect.height-24)+'rpx 20rpx':''">
- <u-icon name="arrow-left" size="24" color="#ffffff" @click="pageBack"></u-icon>
- </view> -->
- <!-- <span class="text">首页</span> -->
- <!-- <span v-if="isDealerUser" class="current-tanent" @click="changeTanent">
- {{currentTanent}}
- <u-icon name="arrow-down"></u-icon>
- </span> -->
- <view class="custom" v-if="isDealerUser || isEnterpriseUser || isTransUser" @click="changeTanent">
- <span v-if="currentTanent">
- {{currentTanent}}
- </span>
- <u-badge v-else type="error" :value="$t('base.common.placeholderTenant')"></u-badge>
- <u-icon name="arrow-down-fill" style="margin-left:10rpx" color="#fff" size="8"></u-icon>
- </view>
- <view class="custom" v-if="isDriverUser" @click="toSelectVehicle">
- {{ currentVehicleInfo.vehicle|| $t('base.common.placeholderS')+$t('driver.runCar')}}
- <u-icon name="arrow-down-fill" style="margin-left:10rpx" color="#fff" size="8"></u-icon>
- </view>
- </view>
- <!-- <view v-if="isDealerUser" class="all-order" @click="toDealerOrderList()">
- <image src="../../static/czzn-img/home/home-order.png"
- style="margin-right:28rpx;height:84rpx;width:84rpx" alt="">
- <view class="order-text">
- <text class="title">{{ $t("home.allOrder") }}</text>
- <text class="text">{{ $t("home.orderHistory") }} / {{ $t("home.orderQuery") }}</text>
- </view>
- <uni-icons type="forward" size="20"></uni-icons>
- </view> -->
- <!-- <view v-if="isDriverUser && isDealerUser==false" class="all-order" @click="toDriverOrderList()">
- <image src="../../static/czzn-img/home/home-order.png"
- style="margin-right:28rpx;height:84rpx;width:84rpx" alt="">
- <view class="order-text">
- <text class="title">{{ $t("home.allOrder") }}</text>
- <text class="text">{{ $t("home.orderHistory") }} / {{ $t("home.orderQuery") }}</text>
- </view>
- <uni-icons type="forward" size="20"></uni-icons>
- </view> -->
- <!-- <u-notice-bar v-if="isDriverUser && !currentVehicleInfo" bgColor="red" color="white"
- :text="$t('driver.selectRunCar')"></u-notice-bar> -->
- <view class="oper-btn">
- <view class="menu-line" v-show="currentMenu.headMenuList.length">
- <view class="menu-item" v-for="(item,index) in currentMenu.headMenuList" :key="index"
- @click="todo(item)">
- <image :src="item.icon" style="height:88rpx;width:88rpx" mode="scaleToFill" />
- <text class="text">{{item.title}}</text>
- </view>
- </view>
- <view class="menu-wrap" v-show="currentMenu.menuList.length">
- <view class="menu-module-title">
- <image src="../../static/czzn-img/home/home-xdgl.png" mode="scaleToFill"
- style="width:36rpx;height:36rpx;margin-right:20rpx" />
- {{$t('home.dealerMenu.orderManage')}}
- </view>
- <view class="menu-list">
- <template v-for="(item,index) in currentMenu.menuList">
- <view class="item" :key="index"
- v-if="item.isShow==true" @click="todo(item)">
- <image :src="item.icon" style="height:100rpx;width:100rpx" mode="scaleToFill" />
- <text class="text">{{item.title}}</text>
- </view>
- </template>
- </view>
- </view>
- </view>
- <!-- <view v-if="isDriverUser" class="vehicle-main" @click="toSelectVehicle">
- <view class="vehicle-item">
- {{ currentVehicleInfo.vehicle|| $t('base.common.placeholderS')+$t('driver.runCar')}}
- </view>
- </view> -->
- <!-- <view class="menu-wrap" style="padding:32rpx">
- <span class="label">{{$t('home.inDevelopment')}}</span>
- <view class="message-title">
- <span class="label">{{$t('home.dealerMenu.messageNotification')}}</span>
- <span class="message">
- 3条未读信息
- <u-icon name="arrow-right" color="#222222"></u-icon>
- </span>
- </view>
- <view class="message-item">
- <view class="title">
- <image src="https://icc-oss.oss-cn-hangzhou.aliyuncs.com/app/icc-app/laba.png"
- style="height:26rpx;width:28rpx" mode="scaleToFill" />
- <span>23分钟前</span>
- </view>
- </view>
- </view> -->
- <Bars></Bars>
- <u-toast ref="loadingToast"></u-toast>
- </view>
- </template>
- <script>
- import {
- getVehicleListByCondition,
- getQueueListByVehicle
- } from '../../api/driver'
- import {
- getUrlValueByParamName
- } from '../../utils/util.js'
- import {
- getHandleOrder,
- getDriverLatelyOrderInfo
- } from "../../api/order"
- import {
- getTenantPermission
- } from "../../api/tenant"
-
- import {
- mapGetters,
- mapMutations
- } from "vuex";
- import QQMapWX from '../../components/map/qqmap-wx-jssdk';
- import Bars from '../../components/tabBar/tabBar.vue';
- import img from '../../utils/imgUtil'
- import {
- getTenantCacheList
- } from '../../utils/util.js'
- import {
- sendHandleOrder
- } from "../../api/order"
-
- export default {
- components: {
- Bars,
- },
- data() {
- return {
- qqmapsdk: {},
- code: "",
- currentTanent: '',
- permissionList: [],
- currentMenu:{
- headMenuList:[],
- menuList:[],
- },
- //客商服务菜单
- dealerMenuList: {
- headMenuList: [{
- title: this.$t("home.dealerMenu.tenant"),
- to: '/subpages/tenant/list',
- icon: img.tenantList,
- key: null,
- isShow: false,
- },
- // {
- // title: this.$t("home.dealerMenu.payment"),
- // to: '/subpages/payment/collate',
- // icon: img.payment,
- // key: "app_home_add_collate",
- // isShow: false,
- // },
- {
- title: this.$t("home.dealerMenu.driver"),
- to: '/subpages/driver/dealerList',
- icon: img.driverList,
- key: null,
- isShow: false,
- },
- {
- title: this.$t("home.allOrder"),
- to: '/subpages/order/dealerList?index=0',
- icon: img.orderList,
- key: null,
- isShow: false,
- }
- ],
- menuList: [{
- title: this.$t("home.dealerMenu.order"),
- to: '/subpages/order/add',
- icon: img.orderAdd,
- key: 'app_home_add_order',
- isShow: true,
- },
- {
- title: this.$t("home.dealerMenu.vehicles"),
- to: '/subpages/order/batchOrderAdd',
- icon: img.batchAdd,
- key: "app_home_batch_order",
- isShow: false,
- },
- {
- title: this.$t("home.dealerMenu.vehicles"),
- to: '/subpages/order/batchVehicleAdd',
- icon: img.moerAdd,
- key: "app_home_vehicle_order",
- isShow: false,
- },
- {
- title: this.$t("home.dealerMenu.plan"),
- to: '/subpages/order/planOrderAdd',
- icon: img.orderAdd,
- key: "app_home_plan_order",
- isShow: false,
- },
- {
- title: this.$t("home.dealerMenu.mixed"),
- to: '/subpages/order/mixedOrderAdd',
- icon: img.hzAdd,
- key: "app_home_mixed_order",
- isShow: false,
- },
- {
- title: this.$t("home.dealerMenu.bigOrder"),
- to: '/subpages/order/bigOrderAdd',
- icon: img.hzAdd,
- key: "app_home_big_order",
- isShow: false,
- },
- {
- title: this.$t("home.transMenu.transOrder"),
- to: '/subpages/order/transOrderAdd',
- icon: img.hzAdd,
- key: "app_home_big_order",
- isShow: true,
- },
- ]
- },
- //司机服务菜单
- driverMenuList: {
- headMenuList: [{
- id: "scanCode",
- title: this.$t("home.driverMenu.scan"),
- do: "scanCode",
- icon: img.scan
- },
- {
- id: "vehicleList",
- title: this.$t("home.driverMenu.car"),
- to: '/subpages/driver/driverList',
- icon: img.vehicleList
- },
- {
- title: this.$t("home.allOrder"),
- to: '/subpages/order/driverList',
- icon: img.orderList,
- key: null,
- isShow: false,
- },
- // {
- // id: "vehicleList",
- // title: this.$t("home.driverMenu.runOrder"),
- // do: "getRunOrderInfo",
- // icon: img.yyVehicle
- // }
- ],
- menuList: [{
- id: "queueList",
- title: this.$t("home.driverMenu.queueList"),
- do: "getQueueList",
- icon: img.hzAdd
- },
- // {
- // id: "mapCheck",
- // title: this.$t("home.driverMenu.mapCheck"),
- // do: "mapCheck",
- // icon: img.hzAdd
- // }
- ]
- },
- //运输商服务菜单
- transMenuList: {
- headMenuList: [{
- title: this.$t("home.dealerMenu.tenant"),
- to: '/subpages/tenant/list',
- icon: img.tenantList,
- key: null,
- isShow: false,
- },
- {
- title: this.$t("home.dealerMenu.driver"),
- to: '/subpages/driver/dealerList',
- icon: img.driverList,
- key: null,
- isShow: false,
- },
- {
- title: this.$t("home.allOrder"),
- to: '/subpages/order/transOrderList?index=0',
- icon: img.orderList,
- key: null,
- isShow: false,
- }
- ],
- menuList: [
-
- ]
- },
- //企业验收服务菜单
- operatorMenuList: {
- headMenuList: [{
- id: "scanCode",
- title: this.$t("home.driverMenu.scan"),
- do: "scanCode",
- icon: img.scan,
- key: "app_home_enterprise_scanCode",
- }, {
- title: this.$t("home.dealerMenu.tenant"),
- to: '/subpages/tenant/list',
- icon: img.tenantList,
- key: null,
- isShow: true,
- }
- // {
- // title: this.$t("home.allOrder"),
- // to: '/substaticpages/cargoOperator/order/orderList',
- // icon: img.orderList,
- // key: null,
- // isShow: true,
- // }
- ],
- menuList: [{
- id: "orderAccept",
- title: this.$t("home.acceptMenu.orderAccept"),
- to: '/substaticpages/cargoOperator/accept/orderAcceptList?isCheck=0',
- icon: img.orderDeliver,
- isShow: false,
- key: "app_home_enterprise_accept",
- }, {
- id: "orderAcceptList",
- title: this.$t("home.acceptMenu.orderAcceptList"),
- to: '/substaticpages/cargoOperator/accept/orderAcceptList?isCheck=1',
- icon: img.orderDeliver,
- isShow: false,
- key: "app_home_enterprise_accept",
- }, {
- id: "orderDeliver",
- title: this.$t("home.deliverMenu.orderDeliver"),
- to: '/substaticpages/cargoOperator/deliver/orderDeliverList?isDeliver=0',
- icon: img.orderDeliver,
- isShow: false,
- key: "app_home_enterprise_deliver",
- }, {
- id: "orderDeliverList",
- title: this.$t("home.deliverMenu.orderDeliverList"),
- to: '/substaticpages/cargoOperator/deliver/orderDeliverList?isDeliver=1',
- icon: img.orderDeliver,
- isShow: false,
- key: "app_home_enterprise_deliver",
- }]
- },
- isAuditUser: false,
- isDealerUser: false,
- isDriverUser: false,
- isEnterpriseUser: false,
- isTransUser:false,
- currentVehicleInfo: {}, //司机端当前运营车号
- location: {
- address: '',
- lat: '',
- lng: ''
- },
- vehicleList: [],
- rect: '',
- statusBarHeight: '',
- options:null,
- firstshow:false,
- }
- },
- watch: {
- currentVehicleInfo: function(newValue, oldValue) {
- if (newValue != oldValue) {
- uni.setStorageSync("currentVehicleInfo", newValue);
- }
- },
- },
- computed: {
- ...mapGetters({
- hasLogin: "user/hasLogin",
- }),
- },
- onShow() {
- if (!this.hasLogin && this.firstshow) {
- uni.showModal({
- // title: '提示',
- content: this.$t('tips.loginerror'),
- showCancel: true,
- success: function(res) {
- if (res.confirm) {
- uni.removeStorageSync('token')
- uni.removeStorageSync('tenantId')
- uni.removeStorageSync('userId')
- uni.removeStorageSync('userName')
- uni.removeStorageSync('userInfo')
- uni.removeStorageSync('userType')
- uni.removeStorageSync('tenantInfo')
- uni.removeStorageSync('serverAddress');
- uni.removeStorageSync('serverPrefix');
- uni.removeStorageSync('enterpriseInfo')
- uni.reLaunch({
- url: "/pages/login/login"
- })
- console.log('用户点击确定');
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- });
- }else{
- this.firstshow = true
- }
- },
- onLoad(options) {
- uni.hideTabBar()
- this.options = options
- this.noNeedUpdate()
- },
- methods: {
- noNeedUpdate(){
- // console.log("获取到参数信息、", this.options);
- // uni.hideTabBar()
- // console.log(this.location);
- // console.log("获取到参数信息、", this.options);
- this.countNavber()
- // if (this.options.q) {
- // const url = decodeURIComponent(this.options.q)
- // this.code = getUrlValueByParamName(url, 'code')
- // console.log("获取到编号信息", this.code)
- // } else {
- // console.log('非扫二维码进入')
- // }
- this.isDealerUser = uni.getStorageSync('isDealerUser')
- this.isDriverUser = uni.getStorageSync('isDriverUser')
- this.isAuditUser = uni.getStorageSync('isAuditUser')
- this.isEnterpriseUser = uni.getStorageSync('isEnterpriseUser')
- this.isTransUser = uni.getStorageSync('isTransUser')
- if(this.isDealerUser){
- this.currentMenu.headMenuList = this.dealerMenuList.headMenuList
- this.currentMenu.menuList = this.dealerMenuList.menuList
- }
- if(this.isTransUser){
- this.currentMenu.headMenuList = this.transMenuList.headMenuList
- this.currentMenu.menuList = this.transMenuList.menuList
- }
- if(this.isDriverUser){
- this.currentMenu.headMenuList = this.driverMenuList.headMenuList
- this.currentMenu.menuList = this.driverMenuList.menuList
- }
- if(this.isEnterpriseUser){
- this.currentMenu.headMenuList = this.operatorMenuList.headMenuList
- this.currentMenu.menuList = this.operatorMenuList.menuList
- }
- this.currentVehicleInfo = uni.getStorageSync("currentVehicleInfo");
-
- var userRoleCodeList = uni.getStorageSync('userRoleCode');
- if (this.isDealerUser || this.isEnterpriseUser || this.isTransUser) {
- this.dealerInit()
- } else if (this.isDriverUser) {
- this.driverInit()
- }
- if (!this.hasLogin) {
- uni.showModal({
- // title: '提示',
- content: this.$t('tips.loginerror'),
- showCancel: true,
- success: function(res) {
- if (res.confirm) {
- uni.removeStorageSync('token')
- uni.removeStorageSync('tenantId')
- uni.removeStorageSync('userId')
- uni.removeStorageSync('userName')
- uni.removeStorageSync('userInfo')
- uni.removeStorageSync('userType')
- uni.removeStorageSync('tenantInfo')
- uni.removeStorageSync('serverAddress');
- uni.removeStorageSync('serverPrefix');
- uni.removeStorageSync('enterpriseInfo')
- uni.reLaunch({
- url: "/pages/login/login"
- })
- console.log('用户点击确定');
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- });
- }
- },
- dealerInit() {
- try {
- var tenantList = getTenantCacheList();
- if (!tenantList || tenantList.length == 0) {
- // uni.showModal({
- // title: this.$t('settings.tips'),
- // content: this.$t('base.common.registerTenant'),
- // cancelText: this.$t('base.button.cancel'),
- // confirmText: this.$t('base.button.regedit'),
- // success: res => {
- // if (res.confirm) {
- // uni.navigateTo({
- // url: '/subpages/tenant/list?q=add'
- // });
- // }
- // },
- // fail: () => {},
- // complete: () => {}
- // });
- } else {
- var curentTenatnInfo = uni.getStorageSync('currentTenantId');
- console.log('当前租户', curentTenatnInfo);
- if (curentTenatnInfo) {
- this.currentTanent = uni.getStorageSync('currentTenantId').text;
- } else {
- console.log('开始默认租户', tenantInfo[0]);
- uni.setStorageSync("currentTenantId", tenantInfo[0]);
- this.currentTanent = tenantInfo[0].text; //切换完 页面重新赋值
- }
- }
- this.bindTenantPermission();
- } catch (e) {
- console.log('初始化客商时出错:', e);
- }
- },
- driverInit() {
- try {
- if (!this.currentVehicleInfo) {
- let data = {}
- getVehicleListByCondition(data).then(res => {
- if (res.statusCode == 200 && res.data.code == 0) {
- var vehicleInfoList = res.data.data;
- if (vehicleInfoList) {
- if (vehicleInfoList.length == 1) {
- this.currentVehicleInfo = vehicleInfoList[0]
- uni.setStorageSync("currentVehicleInfo", this.currentVehicleInfo)
- } else {
- var vehicleInfo = vehicleInfoList.filter(p => {
- return p.runFlag == 1
- });
- if (vehicleInfo) {
- uni.setStorageSync("currentVehicleInfo", vehicleInfo[0]);
- }
- }
- }
- }
- })
- }
- var that = this;
- setInterval(function() {
- var storeVehicleInfo = uni.getStorageSync('currentVehicleInfo')
- if (storeVehicleInfo) {
- if (that.currentVehicleInfo) {
- if (storeVehicleInfo.vehicle != that.currentVehicleInfo.vehicle) {
- that.currentVehicleInfo = storeVehicleInfo
- }
- } else {
- that.currentVehicleInfo = storeVehicleInfo
- }
- } else {
- if (that.currentVehicleInfo) {
- that.currentVehicleInfo = storeVehicleInfo
- }
- }
- }, 5000);
- } catch (e) {
- console.log('初始化司机时出错:', e);
- }
- },
- toSelectVehicle() {
- uni.navigateTo({
- url: '/subpages/driver/vehicle'
- })
- },
- //切换租户
- changeTanent() {
- var tenantList = getTenantCacheList();
- console.log("当前租户信息、", tenantList);
- uni.showActionSheet({
- itemList: tenantList.map(item => {
- return item.text
- }),
- success: res => {
- console.log("获取到企业信息", res.tapIndex); //点击切换租户
- uni.setStorageSync("currentTenantId", tenantList[res.tapIndex]);
- this.currentTanent = uni.getStorageSync('currentTenantId').text; //切换完 页面重新赋值
- this.bindTenantPermission();
- },
- fail: () => {},
- complete: () => {}
- });
- },
- bindTenantPermission() {
- var tenantId = uni.getStorageSync('currentTenantId').value;
- if (tenantId) {
- getTenantPermission({
- appUser: uni.getStorageSync('userId'),
- tenantId: uni.getStorageSync('currentTenantId').value
- }).then(res => {
- if (this.isDealerUser == true) {
- this.dealerMenuList.menuList.forEach((item) => {
- if (item.key != null) {
- console.log("开始处理菜单、", item);
- this.permissionList = []
- if (res.statusCode == 200 && res.data.code == 0 && res.data.data
- .length >
- 0) {
- this.permissionList = res.data.data
- if (this.permissionList.filter((permissionInfo) => {
- return permissionInfo.path == item.key
- }).length > 0) {
- item.isShow = true
- console.log("显示该菜单、", item.to, item.key);
- } else {
- item.isShow = false
- console.log("影藏该菜单、", item.to, item.key);
- }
- }
- uni.setStorageSync('permissionInfo', this.permissionList)
- }
- });
- }
- if (this.isEnterpriseUser == true) {
- this.operatorMenuList.menuList.forEach((item) => {
- if (item.key != null) {
- console.log("开始处理菜单、", item);
- this.permissionList = []
- if (res.statusCode == 200 && res.data.code == 0 && res.data.data
- .length >
- 0) {
- this.permissionList = res.data.data
- if (this.permissionList.filter((permissionInfo) => {
- return permissionInfo.path == item.key
- }).length > 0) {
- item.isShow = true
- console.log("显示该菜单、", item.to, item.key);
- } else {
- item.isShow = false
- console.log("影藏该菜单、", item.to, item.key);
- }
- }
- uni.setStorageSync('permissionInfo', this.permissionList)
- }
- });
- }
- })
- }
- },
- //计算设备状态栏
- countNavber() {
- try {
- let sysInfo = uni.getSystemInfoSync(); //状态栏的高度
- console.log("系统信息、", sysInfo);
- this.statusBarHeight = sysInfo.statusBarHeight;
- // #ifdef MP-WEIXIN
- this.rect = wx.getMenuButtonBoundingClientRect();
- // #endif
- console.log('11111111111111111',this.rect, this.statusBarHeight);
- } catch (e) {
- console.log("计算设备状态栏出错、", e);
- }
- },
- ...mapMutations({
- setUserInfo: 'user/login'
- }),
- toPendingList() {
- uni.navigateTo({
- url: '/subpages/approval/launch'
- })
- },
- todo(item) {
- if (item.to) {
- uni.navigateTo({
- url: item.to
- })
- }
- if (item.do) {
- console.log(this[item.do]);
- this[item.do]()
- }
- },
- toDealerOrderList() {
- uni.navigateTo({
- url: '/subpages/order/dealerList?index=0'
- })
- },
- toDriverOrderList() {
- uni.navigateTo({
- url: '/subpages/order/driverList?index=0'
- })
- },
- toOrder(xfFlag) {
- uni.navigateTo({
- url: '/subpages/order/add?xfFlag=' + xfFlag
- })
- },
- scanCode() {
- let _this = this
- if (this.isDriverUser == true && !uni.getStorageSync("currentVehicleInfo")) {
- uni.showToast({
- title: _this.$t("base.common.placeholderS") + _this.$t("home.driverMenu.runCar"),
- icon: 'none',
- duration: 2000
- })
- return;
- }
- // _this.getLocationInfo();
- console.log('打开扫码功能');
- uni.scanCode({
- scanType: ['qrCode'],
- onlyFromCamera: true,
- hideAlbum: true,
- success: function(res) {
- console.log('条码类型:' + res.scanType);
- console.log('条码内容:' + res.result);
- if (res.result) {
- let code = res.result.indexOf('http') === 0 ? getUrlValueByParamName(res
- .result,
- 'code') : res.result
- _this.submitCode(code)
- }
- }
- });
- },
- getRunOrderInfo() {
- getDriverLatelyOrderInfo().then(res => {
- if (res.statusCode == 200) {
- console.log('获取到运行订单:', res.data);
- if (res.data.code == "0") {
- uni.navigateTo({
- url: `/subpages/driver/runOrderInfo?orderInfo=${JSON.stringify(res.data.data)}`
- })
- }
- }
- })
- },
- getQueueList() {
- let _this = this
- if (this.isDriverUser == true && !uni.getStorageSync("currentVehicleInfo")) {
- uni.showToast({
- title: _this.$t("base.common.placeholderS") + _this.$t("home.driverMenu.runCar"),
- icon: 'none',
- duration: 2000
- })
- return;
- }
-
- if (uni.getStorageSync("tenantInfo").length<=0) {
- uni.showToast({
- title: _this.$t("home.driverMenu.tenantIdIsNull"),
- icon: 'none',
- duration: 2000
- })
- return;
- }
- uni.navigateTo({
- url: `/substaticpages/cargoOperator/queue/queueList`
- })
- },
- mapCheck() {
- uni.navigateTo({
- url: `/substaticpages/cargoOperator/map/mapcheck`
- })
- },
- //提交扫码内容
- submitCode(result, id) {
- this.$refs.loadingToast.show({
- type: "loading",
- message: this.$t('base.common.loading'),
- duration: "1000000"
- })
- try {
- if (this.isEnterpriseUser == true) {
- if (result.indexOf('-') == -1) {
- uni.showToast({
- title: "订单格式存在问题,没有租户信息,",
- icon: 'none',
- duration: 2000
- })
- this.$refs.loadingToast.hide()
- return;
- }
- var tenantId = result.split('-')[0]
- var orderId = result.split('-')[1]
- uni.navigateTo({
- url: `/substaticpages/cargoOperator/order/orderInfo?orderId=${orderId}&tenantId=${tenantId}&operationType=1`
- })
- this.$refs.loadingToast.hide()
- } else {
- getHandleOrder({
- appUser: uni.getStorageSync('userId'),
- qrCode: result,
- vehicle: this.currentVehicleInfo.vehicle,
- }).then(res => {
- console.log("调用成功返回、", res);
- this.$refs.loadingToast.hide()
- if (res.statusCode == 200 && res.data.code == 0) {
- console.log("扫码获取到的信息", res.data.data);
- if (res.data.data.placeType && res.data.data.placeType == 10407) {
- uni.navigateTo({
- url: `/subpages/order/driverAdd?data=${JSON.stringify(res.data.data)}`
- })
- } else {
- if(res.data.data.length === 1){
- this.selectOrder(res.data.data[0],result)
- }else{
- uni.navigateTo({
- url: `/subpages/order/selectList?data=${JSON.stringify(res.data.data)}&hardInfo=${JSON.stringify(res.data.hardInfo)}&qrCode=${result}&location=${JSON.stringify(this.location)}`
- })
- }
- }
- }
- }).catch(res => {
- this.$refs.loadingToast.hide()
- console.log("调用异常返回、", res);
- });
- }
- } catch (e) {
- this.$refs.loadingToast.hide()
- }
- },
- //扫码只要一条订单时
- selectOrder(item,qrCode) {
- this.$refs.loadingToast.show({
- type: "loading",
- message: this.$t('base.common.loading'),
- duration: "1000000"
- })
- console.log("选择到订单ID、", item);
- console.log("获取到二维码信息、", qrCode);
- if (qrCode) {
- let data = {
- orderId: item.id,
- orderType: item.orderType,
- vehicleSourceId: item.vehicleSourceId,
- vehicle:item.vehicle,
- qrCode: qrCode,
- orderNumber:null,
- }
- sendHandleOrder(data).then(res => {
- this.$refs.loadingToast.hide()
- console.log('扫码返回信息、', res.data);
- if (res.statusCode == 200) {
- uni.showModal({
- content: res.data.msg,
- showCancel: false,
- confirmText: this.$t("base.button.confirm"),
- success: function(res) {
-
- }
- })
- }
- }).catch(() => {
- this.$refs.loadingToast.hide()
- })
- } else {
- this.$refs.loadingToast.hide()
- }
- this.tempItem={};
- },
- //获取位置信息
- getLocationInfo() {
- let that = this;
- uni.getLocation({
- type: "gcj02",
- success(res) {
- console.log(res);
- // 腾讯地图Api
- const qqmapsdk = new QQMapWX({
- key: '26SBZ-5XVL3-QTE37-OIVPU-LPFS6-UDB4S' //这里填写自己申请的key
- });
- qqmapsdk.reverseGeocoder({
- success(response) {
- let info = response.result;
- console.log(JSON.stringify(info));
- that.location.address = info.address;
- that.location.lat = info.location.lat;
- that.location.lng = info.location.lng;
- console.log(that.location.address);
- },
- });
- },
- fail(err) {
- console.log(err)
- uni.showToast({
- title: err,
- icon: 'none',
- duration: 2000
- })
- },
- });
- }
- }
- }
- </script>
- <style scope>
- /* #ifndef APP-NVUE */
- page {
- background-color: #f5f7fa;
- }
- /* #endif */
- </style>
- <style lang="scss" scoped>
- .home {
- padding: 0 32rpx 32rpx;
- min-height: 100vh;
- background: url('http://icc-oss.oss-cn-hangzhou.aliyuncs.com/app/icc-app/home-bg.jpg') no-repeat;
- background-size: 100% auto;
- background-color: #f8f8f8;
- // background-color: #f8f8f8;
- .search-wrap {
- padding: 16px 0;
- // background-color: #f8f8f8;
- // box-shadow:0 0 16rpx 0px rgba(0, 0, 0, 0.1);
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- margin-bottom: 278rpx;
- .custom {
- height: 100%;
- color: #fff;
- display: flex;
- align-items: center;
- line-height: 1;
- }
- .input-wrap {
- flex: 1;
- margin: 0 32rpx;
- }
- }
- .top-banner {
- margin-bottom: 32rpx;
- .swiper-image {
- width: 100%;
- }
- }
- .all-order {
- height: 84rpx;
- box-shadow: 0 0 16rpx 0px rgba(0, 0, 0, 0.1);
- background-color: #fff;
- border-radius: 16rpx;
- padding: 24rpx 32rpx;
- margin: 24rpx 32rpx 0;
- display: flex;
- line-height: 100rpx;
- .order-text {
- display: flex;
- flex-direction: column;
- flex: 1;
- .title {
- height: 42rpx;
- line-height: 42rpx;
- font-size: 30rpx;
- font-weight: bold;
- color: #333;
- }
- .text {
- height: 42rpx;
- line-height: 42rpx;
- font-size: 24rpx;
- color: #aaa;
- }
- }
- }
- .menu-line {
- margin-bottom: 32rpx;
- display: flex;
- flex-direction: row;
- justify-content: space-around;
- background: #fff;
- padding: 32rpx 40rpx;
- border-radius: 10rpx;
- .menu-item {
- box-sizing: border-box;
- border-radius: 12rpx;
- font-size: 26rpx;
- font-weight: bold;
- color: #222;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- align-items: center;
- background-size: 100% 100%;
- .text {
- margin-top: 20rpx;
- text-align: center;
- }
- }
- }
- .menu-wrap {
- box-sizing: border-box;
- width: 100%;
- // padding: 32rpx 0 0;
- background-color: #fff;
- border-radius: 10rpx;
- margin-bottom: 32rpx;
- box-shadow: 0rpx 0rpx 18rpx 2rpx #eee;
- .menu-module-title {
- display: flex;
- align-items: center;
- padding: 32rpx;
- font-size: 30rpx;
- font-weight: bold;
- }
- .menu-list {
- min-height: 130rpx;
- position: relative;
- width: 100%;
- display: flex;
- flex-wrap: wrap;
- justify-content: left;
- .item {
- font-size: 22rpx;
- color: #222;
- width: 25%;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- align-items: center;
- background-size: 100% 100%;
- margin-bottom: 32rpx;
- .text {
- margin-top: 12rpx;
- text-align: center;
- padding: 0 10rpx;
- }
- }
- .absolute {
- position: absolute;
- right: 0;
- bottom: 0;
- }
- }
- .message-title {
- display: flex;
- justify-content: space-between;
- line-height: 32rpx;
- .label {
- color: #222;
- font-size: 28rpx;
- font-weight: bold;
- }
- .message {
- display: flex;
- color: #999;
- font-size: 24rpx;
- }
- }
- .message-item {
- margin-top: 32rpx;
- .title {
- display: flex;
- width: 176rpx;
- padding: 8rpx 16rpx;
- color: #999;
- font-size: 24rpx;
- align-items: center;
- justify-content: space-between;
- background-color: #F5F8FF;
- }
- }
- }
- }
- button {
- // background:linear-gradient(to right,#0052d9 0%,#00e2fa 80%,#00e2fa 100%);
- background: #0052d9;
- line-height: 100rpx;
- color: #fff;
- border: none;
- }
- uni-button:after {
- border: none;
- }
- /*首先,我们需要指定一个div元素作为整个车牌的容器*/
- .vehicle-item {
- margin-top: 10rpx;
- line-height: 60rpx;
- color: white; // 字体颜色
- background-color: #1e68bb; // 背景色
- border-radius: 2px; // 边框圆角
- border: white .5px solid; // 白色外边框
- text-align: center; // 字体居中
- padding: 2px 9px; // 内边距
- display: inline-block; // 视用在什么元素上而定
- box-shadow: 0 0 1px 2px #1e68bb;
- width: 90%;
- // 外阴影 前两个参数分别是上下和左右偏移 后两个属性依次为模糊距离和阴影尺寸 最后是颜色
- }
- </style>
|