home.vue 31 KB

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