index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. <template>
  2. <view>
  3. <!-- #ifdef APP -->
  4. <u-no-network zIndex='9' @retry='retry'></u-no-network>
  5. <!-- #endif -->
  6. <view v-if="isConnected">
  7. <block v-if="isLogin && car_info.car_sn">
  8. <view class="container-view">
  9. <view class="header_view">
  10. <!-- #ifdef MP-WEIXIN -->
  11. <view :style="{height: `${statusBarHeight + 30}px`}"></view>
  12. <!-- #endif -->
  13. <!-- #ifdef APP -->
  14. <view :style="{height: `${statusBarHeight}px`}"></view>
  15. <!-- #endif -->
  16. <!-- <navBar type="index" /> -->
  17. <view class="flex-row flex-between align-center padding_about_40">
  18. <view class="car-name-view" @tap="navSwitchCar">
  19. <text class="text" style="margin-right: 10rpx;">{{car_info.car_name}}</text>
  20. <img src="https://qiniu.bms16.com/FoSXDpVGvbdmwbX3CMUBvR7X4IzI"
  21. style="width: 14rpx;height: 14rpx;" alt="">
  22. </view>
  23. <view @click="routerLink('/pages/message/index?isSys=0')" class="news">
  24. <view v-if="newsList.device_count > 0" class="num">
  25. {{ newsList.device_count}}
  26. </view>
  27. <image src="https://qiniu.bms16.com/FtlfBtBE5-TeTI5EdrciX_u8u_Sx"
  28. style="width: 48rpx;height: 48rpx;" mode=""></image>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="fillClass">
  33. <!-- #ifdef MP-WEIXIN -->
  34. <view :style="{height: `${statusBarHeight + 80}px`}"></view>
  35. <!-- #endif -->
  36. <!-- #ifdef APP -->
  37. <view :style="{height: `${statusBarHeight + 50}px`}"></view>
  38. <!-- #endif -->
  39. </view>
  40. <view v-if="isOverdueShow" class="overdue-view flex-row flex-between">
  41. <view class="overdue-view-text flex-row">
  42. <text class="overdue-text-left">{{ $t('您已逾期') }}
  43. <text class="overdue-num">
  44. <block v-if="orderInfo.hire_duration_time">
  45. {{orderInfo.hire_duration_time.day > 0 ? orderInfo.hire_duration_time.day :'' }}<text
  46. v-if="orderInfo.hire_duration_time.day>0">{{ $t('日') }}</text>{{orderInfo.hire_duration_time.hour > 0 ? orderInfo.hire_duration_time.hour :'' }}<text
  47. v-if="orderInfo.hire_duration_time.hour>0">{{ $t('小时') }}</text>{{orderInfo.hire_duration_time.minute > 0 ? orderInfo.hire_duration_time.minute :'' }}<text
  48. v-if="orderInfo.hire_duration_time.minute>0">{{ $t('分') }}</text>
  49. </block>
  50. </text>
  51. </text>
  52. <text style="font-size: 24rpx;opacity: 0.5;">{{ $t('请及时续费或归还车辆') }}</text>
  53. </view>
  54. <view @click="routerLink('/pages/order/order')" class="renew-btn">{{ $t('去续费') }}</view>
  55. </view>
  56. <view class="car-img-view" >
  57. <view v-if="!car_info.sold_time" class="flex-row flex-between" style="align-items: center;">
  58. <text class="quantity flex-row">{{car_info.soc}} <text
  59. style="font-size: 28rpx;font-weight: 500;">%</text></text>
  60. <view v-if="car_info.sold_time==0" @tap.stop="tapReturnCar" class="return-car-btn flex-row">
  61. <image style="width: 46rpx;height: 46rpx;" src="https://qiniu.bms16.com/FtyG7Gq2QBaVVrZmTnmZFzXhE5nN" mode=""></image>
  62. <view style="margin-left: 12rpx;">{{ $t('我要还车') }}</view>
  63. </view>
  64. </view>
  65. <view class="quantity-view flex-row">
  66. <u-line-progress style="width: 100rpx;" active-color="#2ADA62" height="10"
  67. :show-percent="false" :percent="car_info.soc"></u-line-progress>
  68. <view class="quantity-text flex-row">
  69. <view style="font-weight:400;font-size: 22rpx;width: 44rpx;">{{$t("续航")}}</view>
  70. <view style="font-size: 36rpx;">{{car_info.remain_mail }}<text style="font-size: 30rpx;">km</text></view>
  71. </view>
  72. </view>
  73. <!-- <img :src="car_info.model_images||'https://qiniu.bms16.com/Fg8_p7083jpsy8BXG4bR6yMs7jQX'" style="width: 100%;height: 526rpx;" alt=""> -->
  74. <!-- <img :src="'https://qiniu.bms16.com/Fg8_p7083jpsy8BXG4bR6yMs7jQX'"
  75. style="width: 100%;height: 526rpx;" alt=""> -->
  76. <view class="custom-swiper-view">
  77. <u-swiper @click="toMoreInfoPage" v-if="car_image.length!=0" :list="car_image" :autoplay="false" mode="none"
  78. :height="480" bgColor="transparent" class="custom-swiper">
  79. </u-swiper>
  80. <image @click="toMoreInfoPage" v-else style="width: 100%;height: 480rpx;" src="https://qiniu.bms16.com/Fg8_p7083jpsy8BXG4bR6yMs7jQX" mode="">
  81. </image>
  82. </view>
  83. <view class="flex-row align-center update-time-view">
  84. <text style="margin-right: 10rpx;">{{car_info.online==1&&car_info.acc_state==1?$t("车辆已开机"): $t("车辆已关机")}} </text>
  85. <text v-if="car_info.heart_time != 0" style="margin-right: 10rpx;">{{$t("更新于")}} {{tools.formatTime( car_info.heart_time|| '')}}</text>
  86. <img :src="'https://qiniu.bms16.com/'+(isBluethConnect?'Fk3f9H_o-1Wq2xXx7I_xo7bxK1xJ':'FsL6XWGoIhfsVB7jRg6EGFVsuaTZ')"
  87. :style="{width: (isBluethConnect?32:24)+'rpx',height: '32rpx'}" alt="">
  88. </view>
  89. </view>
  90. <Control :contrilList="contrilList" @toBluetooth="inductiveUnlockHandle" @loadCarDetail="loadCarDetail"/>
  91. <!-- car_info.is_share==1 是别人共享的车 -->
  92. <!-- car_info.authority_list.indexOf(4) == -1 共享地图权限 -->
  93. <!-- car_info.authority_list.indexOf(5) == -1 共享套餐权限 -->
  94. <view :class="['flex-row', 'flex-between', 'map-card-view',car_info.exchange_package_info && car_info.exchange_package_info.activity_time&&(car_info.is_share!=1&&car_info.authority_list.indexOf(5) != -1)?'height_362':'height_260']">
  95. <MapCard v-if="car_info.is_share==1&&car_info.authority_list.indexOf(4) == -1" :car_info="car_info" :height="!!(car_info.exchange_package_info && car_info.exchange_package_info.activity_time)"/>
  96. <view class="card-right">
  97. <view class="card-bg" @tap="navTravelingTrack">
  98. <view class="flex-row flex-between card-top-title">
  99. <view class="flex-row align-center">
  100. <img style="width: 36rpx;height: 36rpx;"
  101. src="https://qiniu.bms16.com/FkrcMCV__HraZ0W0NBNdEZPIlwss" alt="">
  102. <text class="margin_l_8">{{isTrackOrAll?$t('最近骑行'):$t('总里程')}}</text>
  103. </view>
  104. <view @tap.stop="isTrackOrAll=!isTrackOrAll"><img
  105. style="width: 24rpx;height: 20rpx;"
  106. src="https://qiniu.bms16.com/FltPK-o7KGS3dQ2pfQHXGSxOdzaN" alt=""></view>
  107. </view>
  108. <view class="card-top-text">{{isTrackOrAll?car_info.current_mail:car_info.total_mil}}<text class="font_24">km</text>
  109. </view>
  110. </view>
  111. <view v-if="car_info.exchange_package_info && car_info.exchange_package_info.activity_time&&(car_info.is_share==1&&car_info.authority_list.indexOf(5) == -1)" class="card-bg">
  112. <view class="flex-row card-top-title">
  113. <img style="width: 36rpx;height: 36rpx;"
  114. src="https://qiniu.bms16.com/FtalApKa3STyruaBxxRB4O9hHXyE" alt="">
  115. <text class="margin_l_8">{{$t("换电套餐")}}</text>
  116. </view>
  117. <view v-if="car_info.package_type == 1" class="card-top-text">
  118. {{calculateRemainingDays(car_info.exchange_package_info.expire_time)}} <text
  119. class="font_24">{{$t("天")}}</text>
  120. </view>
  121. <view v-if="car_info.package_type == 2" class=" card-top-text">{{item.last_num}} <text
  122. class="font_24">{{$t("次")}}</text></view>
  123. <view v-if="car_info.package_type == 3" class=" card-top-text">
  124. {{item.total_day}}{{$t("天")}}/{{item.last_num}} <text
  125. class="font_24">{{$t("次")}}</text>
  126. </view>
  127. </view>
  128. </view>
  129. </view>
  130. <!-- <custom-switch :defaultPosition="'right'" :width="'400rpx'"
  131. :height="'96rpx'" v-model="switchValue" :fetchData="loadData"></custom-switch> -->
  132. <view class="config-view">
  133. <view @tap="navToPage" class="flex-row config-car-view">
  134. <view class="margin_r_20"><img class="icon_style_64"
  135. src="https://qiniu.bms16.com/Ftzyvs5whxDdMFksYChHaWKVb0Uk" alt=""></view>
  136. <view class="flex-row config-text-view" @tap="inductiveUnlockHandle">
  137. <view class="flex-row font_w_600">{{$t("感应解锁")}}</view>
  138. <view class="flex-row tip-text-config">{{isBluethConnect?$t("蓝牙配对成功"):$t("请先连接蓝牙")}}
  139. </view>
  140. </view>
  141. <img class="icon_style_28" src="https://qiniu.bms16.com/FqnbZ2iKHmzCGJA8XD30sf5g_CAm"
  142. alt="">
  143. </view>
  144. <view v-if="car_info.is_share != 1" @tap="navToPage" data-url="/pages/userManagement/userManagement"
  145. class="flex-row config-car-view">
  146. <view class="margin_r_20"><img class="icon_style_64"
  147. src="https://qiniu.bms16.com/FhKkijkN__9UzhYNgamBFSggIlYo" alt=""></view>
  148. <view class="flex-row config-text-view">
  149. <view class="flex-row font_w_600">{{$t("用车人管理")}}</view>
  150. <view class="flex-row tip-text-config">{{car_info.share_num + $t("个家庭账号")}}</view>
  151. </view>
  152. <img class="icon_style_28" src="https://qiniu.bms16.com/FqnbZ2iKHmzCGJA8XD30sf5g_CAm"
  153. alt="">
  154. </view>
  155. <view @click="srcFn(`/pages/deviceInfo/deviceInfo`)" class="flex-row config-car-view">
  156. <view class="margin_r_20"><img class="icon_style_64"
  157. src="https://qiniu.bms16.com/FsAg6mHEBJfbtpgIHBrDdNiPo1iH" alt=""></view>
  158. <view class="flex-row config-text-view">
  159. <view class="flex-row font_w_600">{{$t("设备信息")}}</view>
  160. <view class="flex-row tip-text-config">{{$t("软件版本") + (car_info.firmware||'')}}</view>
  161. </view>
  162. <img class="icon_style_28" src="https://qiniu.bms16.com/FqnbZ2iKHmzCGJA8XD30sf5g_CAm"
  163. alt="">
  164. </view>
  165. </view>
  166. <view style="height: 264rpx;"></view>
  167. </view>
  168. </block>
  169. <block v-else>
  170. <UnleasedPages :model_list="model_list" :img_list="img_list" />
  171. </block>
  172. <BluetoothUnlockAuth ref="bluetoothUnlockAuth" />
  173. <CustomTabbar @changCar='changCar' curt-tab="home" />
  174. <AndroidUnlockAuth :authStepList="authStepList" :value="isShowPermission" @closePermission="closePermission"
  175. v-if="isShowPermission && (platform === 'android')" />
  176. <IosUnlockAuth :authStepList="authStepList" :value="isShowPermission" @closePermission="closePermission"
  177. v-else-if="isShowPermission && (platform === 'ios')" />
  178. </view>
  179. <returnCar :isShowReturnCar="isShowReturnCar" typePage="index" @closeShowReturnCarBtn="()=>isShowReturnCar=false"
  180. @navStoreBtn="navStoreBtn" @immediatelyReturnBtn="immediatelyReturnBtn" />
  181. </view>
  182. </template>
  183. <script module="tools" lang="wxs" src="@/pages/common/wxs/tools.wxs"></script>
  184. <script module="tools" lang="sjs" src="@/pages/common/wxs/tools.sjs"></script>
  185. <script>
  186. var config = require('@/common/config.js');
  187. var config_gyq = require('@/common/config_gyq.js');
  188. var common = require('@/common/common.js');
  189. var http = require('@/common/http.js');
  190. var request = require('@/common/request.js');
  191. var storage = require('@/common/storage.js');
  192. import Control from './components/control/control'
  193. import MapCard from './components/mapCard/mapCard'
  194. import UnleasedPages from './components/unleasedPages/unleasedPages'
  195. import CustomTabbar from '@/component/customTabbar/index';
  196. import BluetoothUnlockAuth from '../bluetoothUnlock/bluetoothUnlockAuth.vue'
  197. import AndroidUnlockAuth from './components/AndroidUnlockAuth.vue'
  198. import IosUnlockAuth from './components/IosUnlockAuth.vue'
  199. import ReturnCar from '@/component/returnCar/returnCar';
  200. import {
  201. getFunctionTag,
  202. } from '@/common/storage.js';
  203. import permision from "@/js_sdk/wa-permission/permission.js"
  204. let bluetooth = require('@/common/bluetooth.js');
  205. export default {
  206. data() {
  207. return {
  208. time:null,
  209. isModel: false,
  210. isConnected: false,
  211. statusBarHeight: 0,
  212. newsList: {},
  213. img_list: [],
  214. isLogin: false,
  215. isOverdueShow: false,
  216. contrilList: [],
  217. isTrackOrAll: true,
  218. model_list: [],
  219. car_list: [], //用户车辆列表
  220. car_sn: '', //当前车辆编号
  221. isHideInduction: true,
  222. car_info: {
  223. exchange_package_info: {
  224. activity_time: 0
  225. }
  226. },
  227. platform: 'android', //手机型号
  228. isShowPermission: false, //是否打开权限弹窗
  229. statusBarHeight: 0,
  230. isBluethConnect: false, //当前是否蓝牙连接或者配对
  231. isOpenAllPermission: false, //所有蓝牙配对所需权限是否已开启
  232. isShowReturnCar:false,
  233. overdueData:{},
  234. car_image:[]
  235. };
  236. },
  237. computed: {},
  238. components: {
  239. Control,
  240. MapCard,
  241. CustomTabbar,
  242. UnleasedPages,
  243. BluetoothUnlockAuth,
  244. AndroidUnlockAuth,
  245. IosUnlockAuth,
  246. ReturnCar
  247. },
  248. /**
  249. * 生命周期函数--监听页面加载
  250. */
  251. onLoad: function(options) {
  252. this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight || 0
  253. let _this = this
  254. // #ifdef APP
  255. uni.getNetworkType({
  256. success: (res) => {
  257. if (res.networkType == 'none') {
  258. this.isConnected = false;
  259. } else {
  260. this.isConnected = true;
  261. }
  262. }
  263. });
  264. uni.onNetworkStatusChange((res) => {
  265. _this.isConnected = res.isConnected
  266. if (res.isConnected) {
  267. _this.init()
  268. }
  269. });
  270. // #endif
  271. // #ifndef APP
  272. this.isConnected = true
  273. _this.init()
  274. // #endif
  275. },
  276. /**
  277. * 生命周期函数--监听页面显示
  278. */
  279. onShow: function() {
  280. // #ifdef APP
  281. uni.getNetworkType({
  282. success: (res) => {
  283. if (res.networkType != 'none') {
  284. this.init()
  285. }
  286. }
  287. });
  288. // #endif
  289. // #ifndef APP
  290. this.init()
  291. // #endif
  292. },
  293. // 分享给好友
  294. onShareAppMessage: function(res) { //发送给朋友
  295. return {
  296. title: this.appConfig.app_name,
  297. path: 'pages/index/index',
  298. }
  299. },
  300. onUnload() {
  301. this.clearIntervalTimer()
  302. },
  303. methods: {
  304. clearIntervalTimer() {
  305. if (this.time == null) return
  306. clearInterval(this.time)
  307. this.time = null
  308. },
  309. init() {
  310. this.loadModelList()
  311. this.contrilList = getFunctionTag().activeTag
  312. const user_token = storage.getUserToken()
  313. this.car_info = uni.getStorageSync('car_info') || {};
  314. const app = getApp();
  315. this.isBluethConnect = app.globalData.nearLockCheck
  316. if (!user_token) return
  317. this.newsNumFn()
  318. this.isLogin = true
  319. this.loadUserCarList()
  320. // #ifdef APP
  321. //蓝牙配对所需权限 运行小程序需要隐藏
  322. // const permissionArr = permision.requestAndroidPermissions(this.platform)
  323. // console.log(permissionArr, 'permissionArr');
  324. // this.setData({
  325. // authStepList: permissionArr
  326. // })
  327. // permissionArr.map(item => {
  328. // if (!item.state) this.isOpenAllPermission = true
  329. // })
  330. // #endif
  331. // if (!this.car_info.car_sn) {
  332. // } else {
  333. // this.loadCarDetail(this.car_info.car_sn)
  334. // }
  335. },
  336. retry() {
  337. },
  338. async newsNumFn() {
  339. let {
  340. data
  341. } = await request.postApi(config_gyq.API_FLK_MESSAGE_UNREAD_COUNT, {})
  342. if (data.code == 200) {
  343. this.newsList = data.data
  344. }
  345. },
  346. changCar(e) {
  347. this.car_info = e
  348. },
  349. routerLink(url) {
  350. uni.navigateTo({
  351. url
  352. })
  353. },
  354. loadIsLogin() {
  355. uni.navigateTo({
  356. url: '/pages/loginRegister/login',
  357. })
  358. },
  359. toMoreInfoPage() {
  360. uni.navigateTo({
  361. url: '/pages/moreInfo/moreInfo',
  362. });
  363. },
  364. navTravelingTrack() {
  365. uni.navigateTo({
  366. url: '/pages/travelingTrack/travelingTrack?longitude=' + this.longitude + '&latitude=' + this
  367. .latitude,
  368. success: function(res) {},
  369. fail: function(res) {},
  370. complete: function(res) {}
  371. });
  372. },
  373. inductiveUnlockHandle() {
  374. uni.navigateTo({ url: '/pages/bluetoothUnlock/bluetoothPair' })
  375. // console.log(!this.isOpenAllPermission,this.isBluethConnect,'this.isBluethConnect');
  376. // if(this.isBluethConnect){
  377. // uni.navigateTo({ url: '/pages/bluetoothUnlock/unlockSet' })
  378. // }else{
  379. // if(!this.isOpenAllPermission){
  380. // common.simpleToast('所需权限开启成功,前往开启蓝牙配对...');
  381. // uni.navigateTo({ url: '/pages/bluetoothUnlock/bluetoothPair' })
  382. // }else{
  383. // this.setData({
  384. // isShowPermission:true,
  385. // })
  386. // }
  387. // }
  388. },
  389. closePermission() {
  390. this.setData({
  391. isShowPermission: false
  392. })
  393. },
  394. showInduction() {
  395. this.isHideInduction = true
  396. },
  397. loadModelList() {
  398. if (this.isModel) {
  399. return
  400. }
  401. this.isModel = true
  402. const me = this
  403. http.postApi(config.API_RECOMMEND_CAR_MODEL_LIST, {}, (resp) => {
  404. if (resp.data.code === 200) {
  405. const list = resp.data.data
  406. const img_list = resp.data.data.map(item => item.image)
  407. me.setData({
  408. model_list: list,
  409. img_list: img_list
  410. })
  411. } else {
  412. common.simpleToast(resp.data.msg);
  413. }
  414. })
  415. },
  416. srcFn(url) {
  417. uni.navigateTo({
  418. url: url
  419. });
  420. },
  421. navToPage(e) {
  422. const me = this
  423. const url = e.currentTarget.dataset.url;
  424. if (!url) {
  425. return;
  426. }
  427. uni.navigateTo({
  428. url: url
  429. });
  430. },
  431. loadUserCarList() {
  432. const me = this
  433. http.postApi(config.API_FLK_CAR_DEVICE_LIST, {}, (resp) => {
  434. if (resp.data.code === 200) {
  435. const list = resp.data.data.list
  436. let isCar = false
  437. let itemCar = {}
  438. for (let i = 0; i < list.length; i++) {
  439. let item = list[i];
  440. if (item.car_sn == this.car_info.car_sn) {
  441. isCar = true
  442. itemCar = item
  443. }
  444. }
  445. if (!isCar) {
  446. if (list.length > 0) {
  447. uni.removeStorageSync('car_info')
  448. me.setData({
  449. car_list: list,
  450. car_sn: list[0].car_sn || '',
  451. })
  452. me.loadCarDetail(list[0].car_sn)
  453. } else {
  454. uni.removeStorageSync('car_info')
  455. this.car_info = {}
  456. }
  457. } else {
  458. me.loadCarDetail(itemCar.car_sn)
  459. }
  460. } else {
  461. common.simpleToast(resp.data.msg);
  462. }
  463. })
  464. },
  465. loadCarDetail(car_sn) {
  466. const me = this
  467. http.postApi(config.API_FLK_CAR_DETAIL, {
  468. car_sn,
  469. time:Math.floor(Date.now() / 1000)
  470. }, (resp) => {
  471. uni.hideLoading();
  472. console.log(resp.data)
  473. if (resp.data.code === 200) {
  474. resp.data.data.car_sn = car_sn
  475. const _car_image=resp.data.data.model_images?resp.data.data.model_images.split(','):[]
  476. me.setData({
  477. car_info: resp.data.data,
  478. car_image:_car_image
  479. })
  480. uni.setStorageSync('car_info', this.car_info);
  481. //判断逾期
  482. if (!resp.data.data.sold_time) return
  483. let time = Math.ceil(resp.data.data.hire_end_time - Math.floor(new Date()) / 1000) / 60
  484. if (time > 0) {
  485. this.isOverdueShow = true
  486. this.car_info.hire_end_time = common.getTimeToDay(time)
  487. } else {
  488. this.isOverdueShow = false
  489. }
  490. if(!this.time){
  491. this.time = setInterval(()=>{
  492. this.loadCarDetail(car_sn)
  493. },5000)
  494. }
  495. } else {
  496. // common.simpleToast(resp.data.msg);
  497. }
  498. })
  499. },
  500. navSwitchCar() {
  501. const me = this
  502. //如果租/购多个车辆的话可以切换当前车辆
  503. uni.navigateTo({
  504. url: `/pages/carList/carList?list=${encodeURIComponent(JSON.stringify(me.car_list))}&car_sn=${me.car_sn}`,
  505. })
  506. },
  507. formatDistance(distanceMeters) {
  508. console.log(distanceMeters,'distanceMeters');
  509. // 判断距离是否超过1000米
  510. // let distanceMeters=Number(_distanceMeters)
  511. if (distanceMeters >= 1000) {
  512. // 如果超过1000米,则转换为千米并返回
  513. return (distanceMeters / 1000).toFixed(1);
  514. } else {
  515. // 否则直接返回米
  516. try {
  517. return distanceMeters;
  518. } catch (error) {
  519. return 0;
  520. }
  521. }
  522. },
  523. navStoreBtn() {
  524. const {
  525. latitude,
  526. longitude,
  527. address,
  528. model_name
  529. } = this.car_info
  530. uni.openLocation({
  531. latitude: latitude - 0,
  532. longitude: longitude - 0,
  533. scale: 15,
  534. name: model_name,
  535. address: address,
  536. success: function(res) {}
  537. });
  538. },
  539. tapReturnCar() {
  540. this.overdueMoneyFn(this.car_info.car_sn)
  541. this.setData({
  542. isShowReturnCar: true
  543. })
  544. },
  545. //逾期费用计算
  546. async overdueMoneyFn(car_sn) {
  547. let {
  548. data
  549. } = await request.postApi(config_gyq.API_FLK_CAR_OVERDUE_MONEY, {
  550. car_sn
  551. })
  552. if (data.code == 200) {
  553. this.overdueData = data.data
  554. } else {
  555. common.simpleToast(data.msg)
  556. }
  557. },
  558. immediatelyReturnBtn() {
  559. const {
  560. car_sn,
  561. model_id
  562. } = this.car_info
  563. //提交还车图片
  564. uni.navigateTo({
  565. url: `/pages/activation/activation?isReturnCar=${true}&model_id=${model_id}&car_sn=${car_sn}&isOverdue=${this.isOverdueShow}&overdueMoney=${this.overdueData.money}&overdueTime=${this.overdueData.time}&type=index`
  566. });
  567. },
  568. }
  569. };
  570. </script>
  571. <style lang="scss" scoped>
  572. @import './index.css';
  573. .header_view {
  574. position: fixed;
  575. top: 0;
  576. left: 0;
  577. width: 100%;
  578. background-color: #c4cad6;
  579. z-index: 999; /* 确保在最上层 */
  580. }
  581. .fillClass {}
  582. .news {
  583. position: relative;
  584. margin-right: 20rpx;
  585. .num {
  586. position: absolute;
  587. right: -6rpx;
  588. top: -6rpx;
  589. min-width: 28rpx;
  590. height: 28rpx;
  591. font-size: 18rpx;
  592. display: flex;
  593. align-items: center;
  594. justify-content: center;
  595. color: #fff;
  596. line-height: 1;
  597. background-color: #FA2918;
  598. border-radius: 50%;
  599. z-index: 99;
  600. }
  601. }
  602. </style>