home.vue 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126
  1. <template>
  2. <view class="home">
  3. <!-- #ifdef MP-WEIXIN -->
  4. <view class="search-wrap"
  5. :style="'height:'+(rect.height)+'px;line-height:'+rect.height+'px;padding-top:'+(rect.top)+'px'">
  6. <!-- #endif -->
  7. <!-- #ifndef MP-WEIXIN -->
  8. <view class="search-wrap" :style="'padding-top:'+statusBarHeight+'px;height:64rpx'">
  9. <!-- #endif -->
  10. <!-- <view class="back-icon" :style="rect?'padding:'+(rect.height-24)+'rpx 20rpx':''">
  11. <u-icon name="arrow-left" size="24" color="#ffffff" @click="pageBack"></u-icon>
  12. </view> -->
  13. <!-- <span class="text">首页</span> -->
  14. <!-- <span v-if="isDealerUser" class="current-tanent" @click="changeTanent">
  15. {{currentTanent}}
  16. <u-icon name="arrow-down"></u-icon>
  17. </span> -->
  18. <view class="custom" v-if="isDealerUser || isEnterpriseUser" @click="changeTanent">
  19. <span v-if="currentTanent">
  20. {{currentTanent}}
  21. </span>
  22. <u-badge v-else type="error" :value="$t('base.common.placeholderTenant')"></u-badge>
  23. <u-icon name="arrow-down-fill" style="margin-left:10rpx" color="#fff" size="8"></u-icon>
  24. </view>
  25. <view class="custom" v-if="isDriverUser" @click="toSelectVehicle">
  26. {{ currentVehicleInfo.vehicle|| $t('base.common.placeholderS')+$t('driver.runCar')}}
  27. <u-icon name="arrow-down-fill" style="margin-left:10rpx" color="#fff" size="8"></u-icon>
  28. </view>
  29. </view>
  30. <!-- <view v-if="isDealerUser" class="all-order" @click="toDealerOrderList()">
  31. <image src="../../static/czzn-img/home/home-order.png"
  32. style="margin-right:28rpx;height:84rpx;width:84rpx" alt="">
  33. <view class="order-text">
  34. <text class="title">{{ $t("home.allOrder") }}</text>
  35. <text class="text">{{ $t("home.orderHistory") }} / {{ $t("home.orderQuery") }}</text>
  36. </view>
  37. <uni-icons type="forward" size="20"></uni-icons>
  38. </view> -->
  39. <!-- <view v-if="isDriverUser && isDealerUser==false" class="all-order" @click="toDriverOrderList()">
  40. <image src="../../static/czzn-img/home/home-order.png"
  41. style="margin-right:28rpx;height:84rpx;width:84rpx" alt="">
  42. <view class="order-text">
  43. <text class="title">{{ $t("home.allOrder") }}</text>
  44. <text class="text">{{ $t("home.orderHistory") }} / {{ $t("home.orderQuery") }}</text>
  45. </view>
  46. <uni-icons type="forward" size="20"></uni-icons>
  47. </view> -->
  48. <!-- <u-notice-bar v-if="isDriverUser && !currentVehicleInfo" bgColor="red" color="white"
  49. :text="$t('driver.selectRunCar')"></u-notice-bar> -->
  50. <view class="oper-btn">
  51. <template v-if="isDealerUser">
  52. <view class="menu-line" v-show="dealerMenuList.headMenuList.length">
  53. <view class="menu-item" v-for="(item,index) in dealerMenuList.headMenuList" :key="index"
  54. @click="todo(item)">
  55. <image :src="item.icon" style="height:88rpx;width:88rpx" mode="scaleToFill" />
  56. <text class="text">{{item.title}}</text>
  57. </view>
  58. </view>
  59. <view class="menu-wrap" v-show="dealerMenuList.menuList.length">
  60. <view class="menu-module-title">
  61. <image src="../../static/czzn-img/home/home-xdgl.png" mode="scaleToFill"
  62. style="width:36rpx;height:36rpx;margin-right:20rpx" />
  63. {{$t('home.dealerMenu.orderManage')}}
  64. </view>
  65. <view class="menu-list">
  66. <template v-for="(item,index) in dealerMenuList.menuList">
  67. <view class="item" :key="index"
  68. v-if="item.isShow==true" @click="todo(item)">
  69. <image :src="item.icon" style="height:100rpx;width:100rpx" mode="scaleToFill" />
  70. <text class="text">{{item.title}}</text>
  71. </view>
  72. </template>
  73. </view>
  74. </view>
  75. </template>
  76. <template v-if="isDriverUser">
  77. <view class="menu-line" v-show="driverMenuList.headMenuList.length">
  78. <view class="menu-item" v-for="(item,index) in driverMenuList.headMenuList" :key="index"
  79. @click="todo(item)">
  80. <image :src="item.icon" style="height:88rpx;width:88rpx" mode="scaleToFill" />
  81. <text class="text">{{item.title}}</text>
  82. </view>
  83. </view>
  84. <view class="menu-wrap" v-show="driverMenuList.menuList.length">
  85. <view class="menu-module-title">
  86. <image src="../../static/czzn-img/home/home-xdgl.png" mode="scaleToFill"
  87. style="width:36rpx;height:36rpx;margin-right:20rpx" />
  88. {{$t('home.dealerMenu.orderManage')}}
  89. </view>
  90. <view class="menu-list">
  91. <view class="item" v-for="(item,index) in driverMenuList.menuList" :key="index"
  92. @click="todo(item)">
  93. <image :src="item.icon" style="height:100rpx;width:100rpx" mode="scaleToFill" />
  94. <text class="text">{{item.title}}</text>
  95. </view>
  96. </view>
  97. </view>
  98. </template>
  99. <!-- <template v-if="isEnterpriseUser">
  100. <view class="menu-line" v-show="operatorMenuList.headMenuList.length">
  101. <view class="menu-item" v-for="(item,index) in operatorMenuList.headMenuList" :key="index"
  102. @click="todo(item)">
  103. <image :src="item.icon" style="height:88rpx;width:88rpx" mode="scaleToFill" />
  104. <text class="text">{{item.title}}</text>
  105. </view>
  106. </view>
  107. <view class="menu-wrap"
  108. v-show="operatorMenuList.menuList.filter((item)=>{return item.isShow==true}).length">
  109. <view class="menu-module-title">
  110. <image src="../../static/czzn-img/home/home-xdgl.png" mode="scaleToFill"
  111. style="width:36rpx;height:36rpx;margin-right:20rpx" />
  112. {{$t('home.dealerMenu.orderManage')}}
  113. </view>
  114. <view class="menu-list">
  115. <view class="item"
  116. v-for="(item,index) in operatorMenuList.menuList.filter((item)=>{return item.isShow==true})"
  117. :key="index" @click="todo(item)">
  118. <image :src="item.icon" style="height:100rpx;width:100rpx" mode="scaleToFill" />
  119. <text class="text">{{item.title}}</text>
  120. </view>
  121. </view>
  122. </view>
  123. </template> -->
  124. </view>
  125. <!-- <view v-if="isDriverUser" class="vehicle-main" @click="toSelectVehicle">
  126. <view class="vehicle-item">
  127. {{ currentVehicleInfo.vehicle|| $t('base.common.placeholderS')+$t('driver.runCar')}}
  128. </view>
  129. </view> -->
  130. <!-- <view class="menu-wrap" style="padding:32rpx">
  131. <span class="label">{{$t('home.inDevelopment')}}</span>
  132. <view class="message-title">
  133. <span class="label">{{$t('home.dealerMenu.messageNotification')}}</span>
  134. <span class="message">
  135. 3条未读信息
  136. <u-icon name="arrow-right" color="#222222"></u-icon>
  137. </span>
  138. </view>
  139. <view class="message-item">
  140. <view class="title">
  141. <image src="https://icc-oss.oss-cn-hangzhou.aliyuncs.com/app/icc-app/laba.png"
  142. style="height:26rpx;width:28rpx" mode="scaleToFill" />
  143. <span>23分钟前</span>
  144. </view>
  145. </view>
  146. </view> -->
  147. <Bars></Bars>
  148. <u-toast ref="loadingToast"></u-toast>
  149. </view>
  150. </template>
  151. <script>
  152. import {
  153. getVehicleListByCondition,
  154. getQueueListByVehicle
  155. } from '../../api/driver'
  156. import {
  157. getUrlValueByParamName
  158. } from '../../utils/util.js'
  159. import {
  160. getHandleOrder,
  161. getDriverLatelyOrderInfo
  162. } from "../../api/order"
  163. import {
  164. getTenantPermission
  165. } from "../../api/tenant"
  166. import {
  167. mapGetters,
  168. mapMutations
  169. } from "vuex";
  170. import QQMapWX from '../../components/map/qqmap-wx-jssdk';
  171. import Bars from '../../components/tabBar/tabBar.vue';
  172. import img from '../../utils/imgUtil'
  173. import {
  174. getTenantCacheList
  175. } from '../../utils/util.js'
  176. import {
  177. sendHandleOrder
  178. } from "../../api/order"
  179. export default {
  180. components: {
  181. Bars,
  182. },
  183. data() {
  184. return {
  185. qqmapsdk: {},
  186. code: "",
  187. currentTanent: '',
  188. permissionList: [],
  189. //客商服务菜单
  190. dealerMenuList: {
  191. headMenuList: [{
  192. title: this.$t("home.dealerMenu.tenant"),
  193. to: '/subpages/tenant/list',
  194. icon: img.tenantList,
  195. key: null,
  196. isShow: false,
  197. },
  198. // {
  199. // title: this.$t("home.dealerMenu.payment"),
  200. // to: '/subpages/payment/collate',
  201. // icon: img.payment,
  202. // key: "app_home_add_collate",
  203. // isShow: false,
  204. // },
  205. {
  206. title: this.$t("home.dealerMenu.driver"),
  207. to: '/subpages/driver/dealerList',
  208. icon: img.driverList,
  209. key: null,
  210. isShow: false,
  211. },
  212. {
  213. title: this.$t("home.allOrder"),
  214. to: '/subpages/order/dealerList?index=0',
  215. icon: img.orderList,
  216. key: null,
  217. isShow: false,
  218. }
  219. ],
  220. menuList: [{
  221. title: this.$t("home.dealerMenu.order"),
  222. to: '/subpages/order/add',
  223. icon: img.orderAdd,
  224. key: 'app_home_add_order',
  225. isShow: true,
  226. },
  227. {
  228. title: this.$t("home.dealerMenu.vehicles"),
  229. to: '/subpages/order/batchOrderAdd',
  230. icon: img.batchAdd,
  231. key: "app_home_batch_order",
  232. isShow: false,
  233. },
  234. {
  235. title: this.$t("home.dealerMenu.vehicles"),
  236. to: '/subpages/order/batchVehicleAdd',
  237. icon: img.moerAdd,
  238. key: "app_home_vehicle_order",
  239. isShow: false,
  240. },
  241. {
  242. title: this.$t("home.dealerMenu.plan"),
  243. to: '/subpages/order/planOrderAdd',
  244. icon: img.orderAdd,
  245. key: "app_home_plan_order",
  246. isShow: false,
  247. },
  248. {
  249. title: this.$t("home.dealerMenu.mixed"),
  250. to: '/subpages/order/mixedOrderAdd',
  251. icon: img.hzAdd,
  252. key: "app_home_mixed_order",
  253. isShow: false,
  254. },
  255. {
  256. title: this.$t("home.dealerMenu.bigOrder"),
  257. to: '/subpages/order/bigOrderAdd',
  258. icon: img.hzAdd,
  259. key: "app_home_big_order",
  260. isShow: false,
  261. },
  262. ]
  263. },
  264. //司机服务菜单
  265. driverMenuList: {
  266. headMenuList: [{
  267. id: "scanCode",
  268. title: this.$t("home.driverMenu.scan"),
  269. do: "scanCode",
  270. icon: img.scan
  271. },
  272. {
  273. id: "vehicleList",
  274. title: this.$t("home.driverMenu.car"),
  275. to: '/subpages/driver/driverList',
  276. icon: img.vehicleList
  277. },
  278. {
  279. title: this.$t("home.allOrder"),
  280. to: '/subpages/order/driverList',
  281. icon: img.orderList,
  282. key: null,
  283. isShow: false,
  284. },
  285. // {
  286. // id: "vehicleList",
  287. // title: this.$t("home.driverMenu.runOrder"),
  288. // do: "getRunOrderInfo",
  289. // icon: img.yyVehicle
  290. // }
  291. ],
  292. menuList: [{
  293. id: "queueList",
  294. title: this.$t("home.driverMenu.queueList"),
  295. do: "getQueueList",
  296. icon: img.hzAdd
  297. },
  298. // {
  299. // id: "mapCheck",
  300. // title: this.$t("home.driverMenu.mapCheck"),
  301. // do: "mapCheck",
  302. // icon: img.hzAdd
  303. // }
  304. ]
  305. },
  306. //企业验收服务菜单
  307. operatorMenuList: {
  308. headMenuList: [{
  309. id: "scanCode",
  310. title: this.$t("home.driverMenu.scan"),
  311. do: "scanCode",
  312. icon: img.scan,
  313. key: "app_home_enterprise_scanCode",
  314. }, {
  315. title: this.$t("home.dealerMenu.tenant"),
  316. to: '/subpages/tenant/list',
  317. icon: img.tenantList,
  318. key: null,
  319. isShow: true,
  320. }
  321. // {
  322. // title: this.$t("home.allOrder"),
  323. // to: '/substaticpages/cargoOperator/order/orderList',
  324. // icon: img.orderList,
  325. // key: null,
  326. // isShow: true,
  327. // }
  328. ],
  329. menuList: [{
  330. id: "orderAccept",
  331. title: this.$t("home.acceptMenu.orderAccept"),
  332. to: '/substaticpages/cargoOperator/accept/orderAcceptList?isCheck=0',
  333. icon: img.orderDeliver,
  334. isShow: false,
  335. key: "app_home_enterprise_accept",
  336. }, {
  337. id: "orderAcceptList",
  338. title: this.$t("home.acceptMenu.orderAcceptList"),
  339. to: '/substaticpages/cargoOperator/accept/orderAcceptList?isCheck=1',
  340. icon: img.orderDeliver,
  341. isShow: false,
  342. key: "app_home_enterprise_accept",
  343. }, {
  344. id: "orderDeliver",
  345. title: this.$t("home.deliverMenu.orderDeliver"),
  346. to: '/substaticpages/cargoOperator/deliver/orderDeliverList?isDeliver=0',
  347. icon: img.orderDeliver,
  348. isShow: false,
  349. key: "app_home_enterprise_deliver",
  350. }, {
  351. id: "orderDeliverList",
  352. title: this.$t("home.deliverMenu.orderDeliverList"),
  353. to: '/substaticpages/cargoOperator/deliver/orderDeliverList?isDeliver=1',
  354. icon: img.orderDeliver,
  355. isShow: false,
  356. key: "app_home_enterprise_deliver",
  357. }]
  358. },
  359. isAuditUser: false,
  360. isDealerUser: false,
  361. isDriverUser: false,
  362. isEnterpriseUser: false,
  363. currentVehicleInfo: {}, //司机端当前运营车号
  364. location: {
  365. address: '',
  366. lat: '',
  367. lng: ''
  368. },
  369. vehicleList: [],
  370. rect: '',
  371. statusBarHeight: '',
  372. options:null,
  373. firstshow:false,
  374. }
  375. },
  376. watch: {
  377. currentVehicleInfo: function(newValue, oldValue) {
  378. if (newValue != oldValue) {
  379. uni.setStorageSync("currentVehicleInfo", newValue);
  380. }
  381. },
  382. },
  383. computed: {
  384. ...mapGetters({
  385. hasLogin: "user/hasLogin",
  386. }),
  387. },
  388. onShow() {
  389. if (!this.hasLogin && this.firstshow) {
  390. uni.showModal({
  391. // title: '提示',
  392. content: this.$t('tips.loginerror'),
  393. showCancel: true,
  394. success: function(res) {
  395. if (res.confirm) {
  396. uni.removeStorageSync('token')
  397. uni.removeStorageSync('tenantId')
  398. uni.removeStorageSync('userId')
  399. uni.removeStorageSync('userName')
  400. uni.removeStorageSync('userInfo')
  401. uni.removeStorageSync('userType')
  402. uni.removeStorageSync('tenantInfo')
  403. uni.removeStorageSync('serverAddress');
  404. uni.removeStorageSync('serverPrefix');
  405. uni.removeStorageSync('enterpriseInfo')
  406. uni.reLaunch({
  407. url: "/pages/login/login"
  408. })
  409. console.log('用户点击确定');
  410. } else if (res.cancel) {
  411. console.log('用户点击取消');
  412. }
  413. }
  414. });
  415. }else{
  416. this.firstshow = true
  417. }
  418. },
  419. onLoad(options) {
  420. this.options = options
  421. this.noNeedUpdate()
  422. },
  423. methods: {
  424. noNeedUpdate(){
  425. // console.log("获取到参数信息、", this.options);
  426. // uni.hideTabBar()
  427. // console.log(this.location);
  428. // console.log("获取到参数信息、", this.options);
  429. // this.countNavber()
  430. // if (this.options.q) {
  431. // const url = decodeURIComponent(this.options.q)
  432. // this.code = getUrlValueByParamName(url, 'code')
  433. // console.log("获取到编号信息", this.code)
  434. // } else {
  435. // console.log('非扫二维码进入')
  436. // }
  437. this.isDealerUser = uni.getStorageSync('isDealerUser')
  438. this.isDriverUser = uni.getStorageSync('isDriverUser')
  439. this.isAuditUser = uni.getStorageSync('isAuditUser')
  440. this.isEnterpriseUser = uni.getStorageSync('isEnterpriseUser')
  441. this.currentVehicleInfo = uni.getStorageSync("currentVehicleInfo");
  442. var userRoleCodeList = uni.getStorageSync('userRoleCode');
  443. if (this.isDealerUser == true || this.isEnterpriseUser == true) {
  444. this.dealerInit()
  445. } else if (this.isDriverUser == true) {
  446. this.driverInit()
  447. }
  448. if (!this.hasLogin) {
  449. uni.showModal({
  450. // title: '提示',
  451. content: this.$t('tips.loginerror'),
  452. showCancel: true,
  453. success: function(res) {
  454. if (res.confirm) {
  455. uni.removeStorageSync('token')
  456. uni.removeStorageSync('tenantId')
  457. uni.removeStorageSync('userId')
  458. uni.removeStorageSync('userName')
  459. uni.removeStorageSync('userInfo')
  460. uni.removeStorageSync('userType')
  461. uni.removeStorageSync('tenantInfo')
  462. uni.removeStorageSync('serverAddress');
  463. uni.removeStorageSync('serverPrefix');
  464. uni.removeStorageSync('enterpriseInfo')
  465. uni.reLaunch({
  466. url: "/pages/login/login"
  467. })
  468. console.log('用户点击确定');
  469. } else if (res.cancel) {
  470. console.log('用户点击取消');
  471. }
  472. }
  473. });
  474. }
  475. },
  476. dealerInit() {
  477. try {
  478. var tenantList = getTenantCacheList();
  479. if (!tenantList || tenantList.length == 0) {
  480. // uni.showModal({
  481. // title: this.$t('settings.tips'),
  482. // content: this.$t('base.common.registerTenant'),
  483. // cancelText: this.$t('base.button.cancel'),
  484. // confirmText: this.$t('base.button.regedit'),
  485. // success: res => {
  486. // if (res.confirm) {
  487. // uni.navigateTo({
  488. // url: '/subpages/tenant/list?q=add'
  489. // });
  490. // }
  491. // },
  492. // fail: () => {},
  493. // complete: () => {}
  494. // });
  495. } else {
  496. var curentTenatnInfo = uni.getStorageSync('currentTenantId');
  497. console.log('当前租户', curentTenatnInfo);
  498. if (curentTenatnInfo) {
  499. this.currentTanent = uni.getStorageSync('currentTenantId').text;
  500. } else {
  501. console.log('开始默认租户', tenantInfo[0]);
  502. uni.setStorageSync("currentTenantId", tenantInfo[0]);
  503. this.currentTanent = tenantInfo[0].text; //切换完 页面重新赋值
  504. }
  505. }
  506. this.bindTenantPermission();
  507. } catch (e) {
  508. console.log('初始化客商时出错:', e);
  509. }
  510. },
  511. driverInit() {
  512. try {
  513. if (!this.currentVehicleInfo) {
  514. let data = {}
  515. getVehicleListByCondition(data).then(res => {
  516. if (res.statusCode == 200 && res.data.code == 0) {
  517. var vehicleInfoList = res.data.data;
  518. if (vehicleInfoList) {
  519. if (vehicleInfoList.length == 1) {
  520. this.currentVehicleInfo = vehicleInfoList[0]
  521. uni.setStorageSync("currentVehicleInfo", this.currentVehicleInfo)
  522. } else {
  523. var vehicleInfo = vehicleInfoList.filter(p => {
  524. return p.runFlag == 1
  525. });
  526. if (vehicleInfo) {
  527. uni.setStorageSync("currentVehicleInfo", vehicleInfo[0]);
  528. }
  529. }
  530. }
  531. }
  532. })
  533. }
  534. var that = this;
  535. setInterval(function() {
  536. var storeVehicleInfo = uni.getStorageSync('currentVehicleInfo')
  537. if (storeVehicleInfo) {
  538. if (that.currentVehicleInfo) {
  539. if (storeVehicleInfo.vehicle != that.currentVehicleInfo.vehicle) {
  540. that.currentVehicleInfo = storeVehicleInfo
  541. }
  542. } else {
  543. that.currentVehicleInfo = storeVehicleInfo
  544. }
  545. } else {
  546. if (that.currentVehicleInfo) {
  547. that.currentVehicleInfo = storeVehicleInfo
  548. }
  549. }
  550. }, 5000);
  551. } catch (e) {
  552. console.log('初始化司机时出错:', e);
  553. }
  554. },
  555. toSelectVehicle() {
  556. uni.navigateTo({
  557. url: '/subpages/driver/vehicle'
  558. })
  559. },
  560. //切换租户
  561. changeTanent() {
  562. var tenantList = getTenantCacheList();
  563. console.log("当前租户信息、", tenantList);
  564. uni.showActionSheet({
  565. itemList: tenantList.map(item => {
  566. return item.text
  567. }),
  568. success: res => {
  569. console.log("获取到企业信息", res.tapIndex); //点击切换租户
  570. uni.setStorageSync("currentTenantId", tenantList[res.tapIndex]);
  571. this.currentTanent = uni.getStorageSync('currentTenantId').text; //切换完 页面重新赋值
  572. this.bindTenantPermission();
  573. },
  574. fail: () => {},
  575. complete: () => {}
  576. });
  577. },
  578. bindTenantPermission() {
  579. var tenantId = uni.getStorageSync('currentTenantId').value;
  580. if (tenantId) {
  581. getTenantPermission({
  582. appUser: uni.getStorageSync('userId'),
  583. tenantId: uni.getStorageSync('currentTenantId').value
  584. }).then(res => {
  585. if (this.isDealerUser == true) {
  586. this.dealerMenuList.menuList.forEach((item) => {
  587. if (item.key != null) {
  588. console.log("开始处理菜单、", item);
  589. this.permissionList = []
  590. if (res.statusCode == 200 && res.data.code == 0 && res.data.data
  591. .length >
  592. 0) {
  593. this.permissionList = res.data.data
  594. if (this.permissionList.filter((permissionInfo) => {
  595. return permissionInfo.path == item.key
  596. }).length > 0) {
  597. item.isShow = true
  598. console.log("显示该菜单、", item.to, item.key);
  599. } else {
  600. item.isShow = false
  601. console.log("影藏该菜单、", item.to, item.key);
  602. }
  603. }
  604. uni.setStorageSync('permissionInfo', this.permissionList)
  605. }
  606. });
  607. }
  608. if (this.isEnterpriseUser == true) {
  609. this.operatorMenuList.menuList.forEach((item) => {
  610. if (item.key != null) {
  611. console.log("开始处理菜单、", item);
  612. this.permissionList = []
  613. if (res.statusCode == 200 && res.data.code == 0 && res.data.data
  614. .length >
  615. 0) {
  616. this.permissionList = res.data.data
  617. if (this.permissionList.filter((permissionInfo) => {
  618. return permissionInfo.path == item.key
  619. }).length > 0) {
  620. item.isShow = true
  621. console.log("显示该菜单、", item.to, item.key);
  622. } else {
  623. item.isShow = false
  624. console.log("影藏该菜单、", item.to, item.key);
  625. }
  626. }
  627. uni.setStorageSync('permissionInfo', this.permissionList)
  628. }
  629. });
  630. }
  631. })
  632. }
  633. },
  634. //计算设备状态栏
  635. countNavber() {
  636. try {
  637. let sysInfo = uni.getSystemInfoSync(); //状态栏的高度
  638. console.log("系统信息、", sysInfo);
  639. this.statusBarHeight = sysInfo.statusBarHeight;
  640. // #ifdef MP-WEIXIN
  641. this.rect = wx.getMenuButtonBoundingClientRect();
  642. // #endif
  643. console.log(this.rect, this.statusBarHeight);
  644. } catch (e) {
  645. console.log("计算设备状态栏出错、", e);
  646. }
  647. },
  648. ...mapMutations({
  649. setUserInfo: 'user/login'
  650. }),
  651. toPendingList() {
  652. uni.navigateTo({
  653. url: '/subpages/approval/launch'
  654. })
  655. },
  656. todo(item) {
  657. if (item.to) {
  658. uni.navigateTo({
  659. url: item.to
  660. })
  661. }
  662. if (item.do) {
  663. console.log(this[item.do]);
  664. this[item.do]()
  665. }
  666. },
  667. toDealerOrderList() {
  668. uni.navigateTo({
  669. url: '/subpages/order/dealerList?index=0'
  670. })
  671. },
  672. toDriverOrderList() {
  673. uni.navigateTo({
  674. url: '/subpages/order/driverList?index=0'
  675. })
  676. },
  677. toOrder(xfFlag) {
  678. uni.navigateTo({
  679. url: '/subpages/order/add?xfFlag=' + xfFlag
  680. })
  681. },
  682. scanCode() {
  683. let _this = this
  684. if (this.isDriverUser == true && !uni.getStorageSync("currentVehicleInfo")) {
  685. uni.showToast({
  686. title: _this.$t("base.common.placeholderS") + _this.$t("home.driverMenu.runCar"),
  687. icon: 'none',
  688. duration: 2000
  689. })
  690. return;
  691. }
  692. // _this.getLocationInfo();
  693. console.log('打开扫码功能');
  694. uni.scanCode({
  695. scanType: ['qrCode'],
  696. onlyFromCamera: true,
  697. hideAlbum: true,
  698. success: function(res) {
  699. console.log('条码类型:' + res.scanType);
  700. console.log('条码内容:' + res.result);
  701. if (res.result) {
  702. let code = res.result.indexOf('http') === 0 ? getUrlValueByParamName(res
  703. .result,
  704. 'code') : res.result
  705. _this.submitCode(code)
  706. }
  707. }
  708. });
  709. },
  710. getRunOrderInfo() {
  711. getDriverLatelyOrderInfo().then(res => {
  712. if (res.statusCode == 200) {
  713. console.log('获取到运行订单:', res.data);
  714. if (res.data.code == "0") {
  715. uni.navigateTo({
  716. url: `/subpages/driver/runOrderInfo?orderInfo=${JSON.stringify(res.data.data)}`
  717. })
  718. }
  719. }
  720. })
  721. },
  722. getQueueList() {
  723. let _this = this
  724. if (this.isDriverUser == true && !uni.getStorageSync("currentVehicleInfo")) {
  725. uni.showToast({
  726. title: _this.$t("base.common.placeholderS") + _this.$t("home.driverMenu.runCar"),
  727. icon: 'none',
  728. duration: 2000
  729. })
  730. return;
  731. }
  732. if (uni.getStorageSync("tenantInfo").length<=0) {
  733. uni.showToast({
  734. title: _this.$t("home.driverMenu.tenantIdIsNull"),
  735. icon: 'none',
  736. duration: 2000
  737. })
  738. return;
  739. }
  740. uni.navigateTo({
  741. url: `/substaticpages/cargoOperator/queue/queueList`
  742. })
  743. },
  744. mapCheck() {
  745. uni.navigateTo({
  746. url: `/substaticpages/cargoOperator/map/mapcheck`
  747. })
  748. },
  749. //提交扫码内容
  750. submitCode(result, id) {
  751. this.$refs.loadingToast.show({
  752. type: "loading",
  753. message: this.$t('base.common.loading'),
  754. duration: "1000000"
  755. })
  756. try {
  757. if (this.isEnterpriseUser == true) {
  758. if (result.indexOf('-') == -1) {
  759. uni.showToast({
  760. title: "订单格式存在问题,没有租户信息,",
  761. icon: 'none',
  762. duration: 2000
  763. })
  764. this.$refs.loadingToast.hide()
  765. return;
  766. }
  767. var tenantId = result.split('-')[0]
  768. var orderId = result.split('-')[1]
  769. uni.navigateTo({
  770. url: `/substaticpages/cargoOperator/order/orderInfo?orderId=${orderId}&tenantId=${tenantId}&operationType=1`
  771. })
  772. this.$refs.loadingToast.hide()
  773. } else {
  774. getHandleOrder({
  775. appUser: uni.getStorageSync('userId'),
  776. qrCode: result,
  777. vehicle: this.currentVehicleInfo.vehicle,
  778. }).then(res => {
  779. console.log("调用成功返回、", res);
  780. this.$refs.loadingToast.hide()
  781. if (res.statusCode == 200 && res.data.code == 0) {
  782. console.log("扫码获取到的信息", res.data.data);
  783. if (res.data.data.placeType && res.data.data.placeType == 10407) {
  784. uni.navigateTo({
  785. url: `/subpages/order/driverAdd?data=${JSON.stringify(res.data.data)}`
  786. })
  787. } else {
  788. if(res.data.data.length === 1){
  789. this.selectOrder(res.data.data[0],result)
  790. }else{
  791. uni.navigateTo({
  792. url: `/subpages/order/selectList?data=${JSON.stringify(res.data.data)}&hardInfo=${JSON.stringify(res.data.hardInfo)}&qrCode=${result}&location=${JSON.stringify(this.location)}`
  793. })
  794. }
  795. }
  796. }
  797. }).catch(res => {
  798. this.$refs.loadingToast.hide()
  799. console.log("调用异常返回、", res);
  800. });
  801. }
  802. } catch (e) {
  803. this.$refs.loadingToast.hide()
  804. }
  805. },
  806. //扫码只要一条订单时
  807. selectOrder(item,qrCode) {
  808. this.$refs.loadingToast.show({
  809. type: "loading",
  810. message: this.$t('base.common.loading'),
  811. duration: "1000000"
  812. })
  813. console.log("选择到订单ID、", item);
  814. console.log("获取到二维码信息、", qrCode);
  815. if (qrCode) {
  816. let data = {
  817. orderId: item.id,
  818. orderType: item.orderType,
  819. vehicleSourceId: item.vehicleSourceId,
  820. vehicle:item.vehicle,
  821. qrCode: qrCode,
  822. orderNumber:null,
  823. }
  824. sendHandleOrder(data).then(res => {
  825. this.$refs.loadingToast.hide()
  826. console.log('扫码返回信息、', res.data);
  827. if (res.statusCode == 200) {
  828. uni.showModal({
  829. content: res.data.msg,
  830. showCancel: false,
  831. confirmText: this.$t("base.button.confirm"),
  832. success: function(res) {
  833. }
  834. })
  835. }
  836. }).catch(() => {
  837. this.$refs.loadingToast.hide()
  838. })
  839. } else {
  840. this.$refs.loadingToast.hide()
  841. }
  842. this.tempItem={};
  843. },
  844. //获取位置信息
  845. getLocationInfo() {
  846. let that = this;
  847. uni.getLocation({
  848. type: "gcj02",
  849. success(res) {
  850. console.log(res);
  851. // 腾讯地图Api
  852. const qqmapsdk = new QQMapWX({
  853. key: '26SBZ-5XVL3-QTE37-OIVPU-LPFS6-UDB4S' //这里填写自己申请的key
  854. });
  855. qqmapsdk.reverseGeocoder({
  856. success(response) {
  857. let info = response.result;
  858. console.log(JSON.stringify(info));
  859. that.location.address = info.address;
  860. that.location.lat = info.location.lat;
  861. that.location.lng = info.location.lng;
  862. console.log(that.location.address);
  863. },
  864. });
  865. },
  866. fail(err) {
  867. console.log(err)
  868. uni.showToast({
  869. title: err,
  870. icon: 'none',
  871. duration: 2000
  872. })
  873. },
  874. });
  875. }
  876. }
  877. }
  878. </script>
  879. <style scope>
  880. /* #ifndef APP-NVUE */
  881. page {
  882. background-color: #f5f7fa;
  883. }
  884. /* #endif */
  885. </style>
  886. <style lang="scss" scoped>
  887. .home {
  888. padding: 0 32rpx 32rpx;
  889. min-height: 100vh;
  890. background: url('http://icc-oss.oss-cn-hangzhou.aliyuncs.com/app/icc-app/home-bg.jpg') no-repeat;
  891. background-size: 100% auto;
  892. background-color: #f8f8f8;
  893. // background-color: #f8f8f8;
  894. .search-wrap {
  895. padding: 16px 0;
  896. // background-color: #f8f8f8;
  897. // box-shadow:0 0 16rpx 0px rgba(0, 0, 0, 0.1);
  898. display: flex;
  899. flex-direction: row;
  900. align-items: center;
  901. justify-content: space-between;
  902. margin-bottom: 278rpx;
  903. .custom {
  904. height: 100%;
  905. color: #fff;
  906. display: flex;
  907. align-items: center;
  908. line-height: 1;
  909. }
  910. .input-wrap {
  911. flex: 1;
  912. margin: 0 32rpx;
  913. }
  914. }
  915. .top-banner {
  916. margin-bottom: 32rpx;
  917. .swiper-image {
  918. width: 100%;
  919. }
  920. }
  921. .all-order {
  922. height: 84rpx;
  923. box-shadow: 0 0 16rpx 0px rgba(0, 0, 0, 0.1);
  924. background-color: #fff;
  925. border-radius: 16rpx;
  926. padding: 24rpx 32rpx;
  927. margin: 24rpx 32rpx 0;
  928. display: flex;
  929. line-height: 100rpx;
  930. .order-text {
  931. display: flex;
  932. flex-direction: column;
  933. flex: 1;
  934. .title {
  935. height: 42rpx;
  936. line-height: 42rpx;
  937. font-size: 30rpx;
  938. font-weight: bold;
  939. color: #333;
  940. }
  941. .text {
  942. height: 42rpx;
  943. line-height: 42rpx;
  944. font-size: 24rpx;
  945. color: #aaa;
  946. }
  947. }
  948. }
  949. .menu-line {
  950. margin-bottom: 32rpx;
  951. display: flex;
  952. flex-direction: row;
  953. justify-content: space-around;
  954. background: #fff;
  955. padding: 32rpx 40rpx;
  956. border-radius: 10rpx;
  957. .menu-item {
  958. box-sizing: border-box;
  959. border-radius: 12rpx;
  960. font-size: 26rpx;
  961. font-weight: bold;
  962. color: #222;
  963. display: flex;
  964. flex-direction: column;
  965. justify-content: space-between;
  966. align-items: center;
  967. background-size: 100% 100%;
  968. .text {
  969. margin-top: 20rpx;
  970. text-align: center;
  971. }
  972. }
  973. }
  974. .menu-wrap {
  975. box-sizing: border-box;
  976. width: 100%;
  977. // padding: 32rpx 0 0;
  978. background-color: #fff;
  979. border-radius: 10rpx;
  980. margin-bottom: 32rpx;
  981. box-shadow: 0rpx 0rpx 18rpx 2rpx #eee;
  982. .menu-module-title {
  983. display: flex;
  984. align-items: center;
  985. padding: 32rpx;
  986. font-size: 30rpx;
  987. font-weight: bold;
  988. }
  989. .menu-list {
  990. min-height: 130rpx;
  991. position: relative;
  992. width: 100%;
  993. display: flex;
  994. flex-wrap: wrap;
  995. justify-content: left;
  996. .item {
  997. font-size: 22rpx;
  998. color: #222;
  999. width: 25%;
  1000. display: flex;
  1001. flex-direction: column;
  1002. justify-content: space-between;
  1003. align-items: center;
  1004. background-size: 100% 100%;
  1005. margin-bottom: 32rpx;
  1006. .text {
  1007. margin-top: 12rpx;
  1008. text-align: center;
  1009. padding: 0 10rpx;
  1010. }
  1011. }
  1012. .absolute {
  1013. position: absolute;
  1014. right: 0;
  1015. bottom: 0;
  1016. }
  1017. }
  1018. .message-title {
  1019. display: flex;
  1020. justify-content: space-between;
  1021. line-height: 32rpx;
  1022. .label {
  1023. color: #222;
  1024. font-size: 28rpx;
  1025. font-weight: bold;
  1026. }
  1027. .message {
  1028. display: flex;
  1029. color: #999;
  1030. font-size: 24rpx;
  1031. }
  1032. }
  1033. .message-item {
  1034. margin-top: 32rpx;
  1035. .title {
  1036. display: flex;
  1037. width: 176rpx;
  1038. padding: 8rpx 16rpx;
  1039. color: #999;
  1040. font-size: 24rpx;
  1041. align-items: center;
  1042. justify-content: space-between;
  1043. background-color: #F5F8FF;
  1044. }
  1045. }
  1046. }
  1047. }
  1048. button {
  1049. // background:linear-gradient(to right,#0052d9 0%,#00e2fa 80%,#00e2fa 100%);
  1050. background: #0052d9;
  1051. line-height: 100rpx;
  1052. color: #fff;
  1053. border: none;
  1054. }
  1055. uni-button:after {
  1056. border: none;
  1057. }
  1058. /*首先,我们需要指定一个div元素作为整个车牌的容器*/
  1059. .vehicle-item {
  1060. margin-top: 10rpx;
  1061. line-height: 60rpx;
  1062. color: white; // 字体颜色
  1063. background-color: #1e68bb; // 背景色
  1064. border-radius: 2px; // 边框圆角
  1065. border: white .5px solid; // 白色外边框
  1066. text-align: center; // 字体居中
  1067. padding: 2px 9px; // 内边距
  1068. display: inline-block; // 视用在什么元素上而定
  1069. box-shadow: 0 0 1px 2px #1e68bb;
  1070. width: 90%;
  1071. // 外阴影 前两个参数分别是上下和左右偏移 后两个属性依次为模糊距离和阴影尺寸 最后是颜色
  1072. }
  1073. </style>