index.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  1. <template>
  2. <ax-body hide-indicator-area :style="[StyleSheet]">
  3. <!-- 标题栏 -->
  4. <template #title>
  5. <view class="titlebar">
  6. <image src="@/static/img/title.png" class="page-title"></image>
  7. <!-- <text class="page-subtitle">“特惠充电享不停”</text> -->
  8. </view>
  9. </template>
  10. <view class="base">
  11. <!-- 搜索块 -->
  12. <view id="search" class="app-flex search-view">
  13. <label class="search-bar" @click="$app.url.goto('/subPackages/other/search/search')">
  14. <view class="locate-city">
  15. <image src="@/static/img/locate.svg" class="_icon"></image>
  16. <text class="__name">{{ city.data[city.index].text }}</text>
  17. </view>
  18. <input placeholder-class="app-placeholder" placeholder="| 输入目的地/电站名" />
  19. <image src="@/static/img/search.svg" class="_icon-search"></image>
  20. </label>
  21. <view style="width: 20rpx;"></view>
  22. <view class="search-map-mode" @click="$app.url.goto('/pages/map/map', false)">
  23. <image class="search-map-icon" src="@/static/img/map-icon.svg" mode=""></image>
  24. <text>地图模式</text>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="arrears-tips" v-if="payment_msg != null">
  29. <view class="arrears-left">
  30. <image class="arrears-icon" src="@/static/img/arrears-icon.svg" mode=""></image>
  31. <view class="arrears-text">
  32. 您有一笔超充订单{{ (payment_msg.maspAmount + payment_msg.maspRealAmount).toFixed(2) }}元待补缴</view>
  33. </view>
  34. <view class="arrears-btn" @click="topage_coupon">去补缴</view>
  35. </view>
  36. <!-- 主滚动 -->
  37. <view class="main-scroll-wrap">
  38. <scroll-view class="root-scroll app-hide-scrollbar" @scrolltolower="scrollLock = true"
  39. @scrolltoupper="scrollLock = false" scroll-y>
  40. <view class="contet-root">
  41. <!-- 内容顶部 -->
  42. <view id="roller" class="base">
  43. <!-- 快捷栏 -->
  44. <view class="shortcut-bar">
  45. <view class="buy-charge-coupon"
  46. @click="$app.url.goto('/subPackages/coupon/coupon-buy/coupon-buy')">
  47. <view class="coupon-tag">特惠</view>
  48. <view class="charge-title">
  49. <view class="title-coupon-text">购充电券</view>
  50. <view class="title-right-text">
  51. <text class="ax ax-iconline i-arrow-right icon"></text>
  52. </view>
  53. </view>
  54. <!-- <view class="charge-text-dsc">特惠价限时购买</view> -->
  55. <image class="charge-coupon-img"
  56. src="https://national-motion.oss-cn-beijing.aliyuncs.com/20260107/c2a6329e87394f77a8ab0549b3ceb19e.png"
  57. mode=""></image>
  58. </view>
  59. <view class="">
  60. <view class="order-center" @click="$app.url.goto('/subPackages/order/order/order')">
  61. <view class="order-center-left">
  62. <view class="charge-title" style="margin-top:0;">
  63. <!-- <image class="title-coupon-text" src="@/static/img/order-center.png"
  64. mode="">
  65. </image> -->
  66. <view class="title-coupon-text">订单中心</view>
  67. <view class="title-right-text">
  68. <text class="ax ax-iconline i-arrow-right icon"></text>
  69. </view>
  70. </view>
  71. <view class="order-center-number">
  72. 查看充电订单
  73. </view>
  74. </view>
  75. <image class="order-center-icon"
  76. src="https://national-motion.oss-cn-beijing.aliyuncs.com/20260106/27d2ab4f8d544109a597f3cafa451a10.png"
  77. mode=""></image>
  78. </view>
  79. <view class="order-center" style="margin-top: 20rpx;"
  80. @click="$app.url.goto('/subPackages/other/feedback/feedback')">
  81. <view class="order-center-left">
  82. <view class="charge-title" style="margin-top:0;">
  83. <!-- <image class="title-coupon-text" src="@/static/img/yijian-fankui.png"
  84. mode="">
  85. </image> -->
  86. <view class="title-coupon-text">意见反馈</view>
  87. <view class="title-right-text">
  88. <text class="ax ax-iconline i-arrow-right icon"></text>
  89. </view>
  90. </view>
  91. <view class="order-center-number">
  92. 随时为您服务
  93. </view>
  94. </view>
  95. <image class="order-center-icon"
  96. src="https://national-motion.oss-cn-beijing.aliyuncs.com/20260106/f4ca76c0808642e49627463c8e6a2310.png"
  97. mode=""></image>
  98. </view>
  99. </view>
  100. </view>
  101. <!-- 版头广告 -->
  102. <swiper class="banner" v-if="banners.length > 0" autoplay="true" circular>
  103. <swiper-item v-for="(item, index) in banners" :key="index"
  104. @click="$app.url.goto(item.jumpPage)">
  105. <view class="swiper-item">
  106. <image @load="bannerLoadCompleted()" :src="item.picture" class="swiper-item-image"
  107. mode="widthFix"></image>
  108. </view>
  109. </swiper-item>
  110. </swiper>
  111. </view>
  112. <view id="fixed" class="base">
  113. <!-- 选项条 -->
  114. <view class="app-flex options-bar">
  115. <view class="options-tabs" v-for="(item, index) in sorts.data" :key="index"
  116. @click="changeSort(index)" :class="{ active: sorts.index == index }">
  117. <text>{{ item.name }}</text>
  118. </view>
  119. </view>
  120. </view>
  121. <!-- 电站列表 -->
  122. <view id="list-box" class="list-scroll-wrap">
  123. <!-- <scroll-view class="list-scroll" :scroll-y="scrollLock"> -->
  124. <view class="list">
  125. <view class="list-top">
  126. <view class="list-top-img">
  127. <image class="list-top-img-img"
  128. src="https://national-motion.oss-cn-beijing.aliyuncs.com/20260107/ae817f97a31d45b5a014b33be96cfb73.png"
  129. mode="" />
  130. </view>
  131. </view>
  132. <view v-for="(item, index) in list.data" :key="index" @click="gotoSiteDetail(item)"
  133. class="item">
  134. <view class="contet">
  135. <view class="name">
  136. <view class="txt">{{ item.stationName }}</view>
  137. <view class="firm-price" v-if="index!=0">
  138. 充电特惠
  139. </view>
  140. </view>
  141. <view class="parkade">
  142. <view class="txt">{{ item.tips || '' }}</view>
  143. </view>
  144. <view class="app-flex c-between info">
  145. <view class="app-flex middle">
  146. <view class="charge"><text class="icon"
  147. style="margin-right: 16rpx;">快</text>{{
  148. item.fastCharging }}
  149. </view>
  150. <view class="charge"><text class="icon blue" style="margin-right: 16rpx;">慢
  151. </text>{{
  152. item.slowCharging }}
  153. </view>
  154. </view>
  155. <view class="distance">
  156. <view class="icon">
  157. <image src="@/static/img/distance.svg" mode="widthFix"></image>
  158. </view>
  159. <text>{{ item.distance || '0' }}km</text>
  160. </view>
  161. </view>
  162. </view>
  163. <view class="price">
  164. <view class="normal-user-price" v-if="!item.enterprisePrice">
  165. <view class="normal-user-price-label">
  166. <text class="value" style="color: #FF6464;margin-left: 20rpx;">{{
  167. item.platformPrice }}</text>
  168. <text class="unit" style="color: #2B303A;font-weight: normal;">元/度</text>
  169. </view>
  170. <image class="normal-user-price-icon" src="@/static/img/normal-user.png"
  171. mode="" />
  172. <view class="normal-user-text">去充电</view>
  173. </view>
  174. <view class="app-flex middle" v-else>
  175. <text class="value" style="color: #FF6464;margin-left: 20rpx;">{{
  176. item.platformPrice }}</text>
  177. <text class="unit" style="color: #2B303A;font-weight: normal;">元/度</text>
  178. <view class="card-bottom-text">
  179. <text class="card-bottom-text-minitext">{{ item.enterprisePrice
  180. }}</text> <text style="color: #2B303A;font-size: 18rpx;">元/度</text>
  181. </view>
  182. </view>
  183. <view>{{ item.peakValue }}{{ item.peakTime || '--' }}</view>
  184. </view>
  185. </view>
  186. </view>
  187. <!-- </scroll-view> -->
  188. </view>
  189. <!-- <view style="height: 158px;"></view> -->
  190. </view>
  191. </scroll-view>
  192. <view class="concat-father" @click="customerService()">
  193. <image class="concat-icon"
  194. src="https://national-motion.oss-cn-beijing.aliyuncs.com/20251230/818d10965318468496abbbdef97e908d.png"
  195. mode=""></image>
  196. </view>
  197. </view>
  198. <ax-popup ref="filter" position="" maskType="black" maskEnable maskClose>
  199. <view class="ad-popup">
  200. <view class="close-get" @click="closeAd">X</view>
  201. <swiper class="ad-swiper" :autoplay="true" :interval="8000" :duration="1000" circular indicator-dots>
  202. <swiper-item class="ad-swiper-item" v-for="(item, index) in adBanner" :key="index">
  203. <image class="ad-image" :src="item.picture" @click="goImgLink(item)" mode="widthFix">
  204. </image>
  205. </swiper-item>
  206. </swiper>
  207. </view>
  208. </ax-popup>
  209. <view style="position: fixed;width: 100%;bottom:100rpx;z-index: 100;">
  210. <app-navigation id="app-navigation" active="home"></app-navigation>
  211. </view>
  212. </ax-body>
  213. </template>
  214. <script>
  215. var bmap = require('static/js/bmap-wx.js');
  216. export default {
  217. async onLoad(options) {
  218. const permit = await this.queryPermit();
  219. if (permit.privacy) {
  220. // 没有通过隐私协议
  221. this.privacy.visible = true;
  222. } else {
  223. // 已通过隐私协议
  224. if (permit.location === true) {
  225. // 可以调用定位能力
  226. this.updateLocation();
  227. } else if (permit.location === false) {
  228. // 通过了隐私协议,但是定位被拒绝
  229. this.location.visible = true;
  230. this.updateLocation();
  231. } else if (permit.location === undefined) {
  232. // 没有申请过定位能力
  233. this.updateLocation();
  234. }
  235. }
  236. if (options.hasOwnProperty('q') && options.q) {
  237. // 通过下面这步解码,可以拿到url的值
  238. const url = decodeURIComponent(options.q)
  239. // 对url中携带的参数提取处理
  240. console.log("url:" + url)
  241. var device_no = this.getQueryParams(url, "connectorCode")
  242. console.log("connectorCode:" + device_no)
  243. if (device_no) {
  244. this.getDeviceInfo(device_no)
  245. }
  246. }
  247. if (this.closeAdvertising) {
  248. this.getAdswiper()
  249. }
  250. // this.user_info=this.$app.storage.get('USER_INFO')
  251. },
  252. mounted() {
  253. if (this.adBanner.length > 0 && !this.$app.storage.get('AD_STATUS')) {
  254. this.$refs.filter.open();
  255. }
  256. // #ifdef MP-WEIXIN
  257. this.setListHeight();
  258. // #endif
  259. this.setAppNavigationHeight();
  260. this.get_frimid()
  261. // this.get_paymentMsg()
  262. this.getBanners()
  263. },
  264. data() {
  265. return {
  266. payment_msg: null,
  267. user_info: {},
  268. // 导航栏高度
  269. appNavigationHeight: 0,
  270. // 页面滚动锁
  271. scrollLock: true,
  272. sorts: {
  273. index: 0,
  274. data: [{
  275. name: '离我最近',
  276. code: "range"
  277. }, {
  278. name: '空闲最多',
  279. code: "device"
  280. }, {
  281. name: '电费最低',
  282. code: "price"
  283. }]
  284. },
  285. list: {
  286. height: 0,
  287. data: []
  288. },
  289. banners: [],
  290. adBanner: [],
  291. location: {
  292. visible: false,
  293. value: '',
  294. },
  295. privacy: {
  296. visible: false,
  297. },
  298. city: {
  299. index: 0,
  300. data: [{
  301. text: '贵阳',
  302. areaCode: "5201"
  303. },
  304. {
  305. text: '六盘水',
  306. areaCode: "5202"
  307. },
  308. {
  309. text: '遵义',
  310. areaCode: "5203"
  311. },
  312. {
  313. text: '安顺',
  314. areaCode: "5204"
  315. },
  316. {
  317. text: '毕节',
  318. areaCode: "5205"
  319. },
  320. {
  321. text: '铜仁',
  322. areaCode: "5206"
  323. },
  324. {
  325. text: '黔东南',
  326. areaCode: "5226"
  327. },
  328. {
  329. text: '黔南',
  330. areaCode: "5227"
  331. },
  332. {
  333. text: '黔西南',
  334. areaCode: "5223"
  335. },
  336. ]
  337. },
  338. discountInfo: null,
  339. closeAdvertising: false,
  340. pageNum: 1
  341. }
  342. },
  343. onShow() {
  344. this.getAdswiper()
  345. },
  346. onHide() {
  347. this.$app.storage.remove('AD_STATUS')
  348. },
  349. computed: {
  350. StyleSheet() {
  351. return {
  352. '--app-navigation-heiht': `${this.appNavigationHeight}px`,
  353. '--list-heiht': `${this.list.height}px`
  354. }
  355. }
  356. },
  357. onShareAppMessage(res) {
  358. if (res.from === 'button') {
  359. // 来自页面内分享按钮
  360. console.log(res.target);
  361. }
  362. return {
  363. title: "用券充天天都享会员价", // 标题
  364. path: "/pages/index/index", // 分享路径
  365. imageUrl: 'https://national-motion.oss-cn-beijing.aliyuncs.com/20251230/7eda17a802dd49e39f8c6bb3d0f1aa4e.jpg', // 分享图
  366. desc: '用券充天天都享会员价'
  367. };
  368. },
  369. onShareTimeline() {
  370. return {
  371. title: "用券充天天都享会员价", // 标题
  372. path: "/pages/index/index", // 分享路径
  373. imageUrl: 'https://national-motion.oss-cn-beijing.aliyuncs.com/20251230/7eda17a802dd49e39f8c6bb3d0f1aa4e.jpg' // 分享图
  374. };
  375. },
  376. methods: {
  377. closeAd() {
  378. this.closeAdvertising = true
  379. this.$refs.filter.close()
  380. this.$app.storage.set('AD_STATUS', this.closeAdvertising);
  381. },
  382. // 企业用户扫码进入
  383. get_frimid() {
  384. if (this.$app.storage.get('FRIM_ID')) {
  385. if (this.$app.storage.get('USER_INFO')) {
  386. this.$api.base("post", "/userApi/add-firm-user?firmId=" + parseInt(this.$app.storage.get(
  387. 'FRIM_ID')), {}, {
  388. error: false
  389. }).then(res => {
  390. this.get_userinfo()
  391. setTimeout(() => {
  392. this.$app.storage.remove('FRIM_ID')
  393. }, 500)
  394. this.$app.popup.alert(res.msg);
  395. }).catch(err => {
  396. setTimeout(() => {
  397. this.$app.storage.remove('FRIM_ID')
  398. }, 500)
  399. // this.$app.popup.alert(err.msg)
  400. })
  401. } else {
  402. uni.showModal({
  403. title: '未登录',
  404. content: '你还未进行登录,请去登录',
  405. showCancel: false,
  406. success: function (res) {
  407. if (res.confirm) {
  408. uni.navigateTo({
  409. url: '/pages/login/login'
  410. })
  411. }
  412. }
  413. })
  414. }
  415. }
  416. },
  417. getDeviceInfo(sn) {
  418. this.$api.base("get", "/applet/v1/station/connector/detail", {
  419. "connectorCode": sn
  420. }, {}).then(res => {
  421. //设备状态 0:离网1:空闲2:占用(未充电)3:占用(充电中)4:占用(预约锁定)255:故障
  422. if (res.data.status == 0 || res.data.status == 255) {
  423. return;
  424. }
  425. this.$app.url.goto('/subPackages/charging/terminal/terminal?deviceId=' + res.data.connectorCode + "&deviceStatus=" + res.data
  426. .status);
  427. })
  428. },
  429. getQueryParams(url, key) {
  430. const queryString = url.split('?')[1] || '';
  431. const params = {};
  432. const pairs = queryString.split('&');
  433. pairs.forEach(pair => {
  434. const [key, value] = pair.split('=');
  435. params[decodeURIComponent(key)] = decodeURIComponent(value || '');
  436. });
  437. return params[key];
  438. },
  439. goImgLink(e) {
  440. this.$app.url.goto(e.skipUrl);
  441. },
  442. // 打开客服
  443. customerService() {
  444. const cs = this.$config.customerService;
  445. this.$app.act.customerService(cs.id, cs.url).catch(err => {
  446. console.log(err);
  447. this.$app.popup.alert('客服中心失联啦,请联系管理员!');
  448. });
  449. },
  450. // 查询许可
  451. queryPermit() {
  452. return new Promise((resolve, reject) => {
  453. const data = {};
  454. const check = () => {
  455. if (Object.keys(data).length == 2) resolve(data);
  456. }
  457. // #ifndef H5
  458. if (uni.getPrivacySetting) {
  459. uni.getPrivacySetting({
  460. success: res => {
  461. data.privacy = res.needAuthorization;
  462. },
  463. complete: () => {
  464. if (typeof data.privacy != 'boolean' && typeof data.privacy !=
  465. 'undefined') data.privacy = null;
  466. check();
  467. },
  468. });
  469. } else {
  470. data.privacy = false;
  471. }
  472. // #endif
  473. // #ifdef H5
  474. data.privacy = false;
  475. // #endif
  476. // #ifdef MP-WEIXIN
  477. uni.getSetting({
  478. success: res => {
  479. data.location = uni.getLocation ? res.authSetting['scope.userLocation'] :
  480. undefined;
  481. },
  482. complete: () => {
  483. if (typeof data.location != 'boolean' && typeof data.location !=
  484. 'undefined') data.location = null;
  485. check();
  486. },
  487. })
  488. // #endif
  489. // #ifdef H5
  490. data.location = true;
  491. check();
  492. // #endif
  493. });
  494. },
  495. // 更新位置
  496. updateLocation() {
  497. this.getLocation().then(res => {
  498. this.location.value = [res.longitude, res.latitude].join(',');
  499. this.get_userinfo()
  500. this.getStations(res.longitude, res.latitude)
  501. this.$app.storage.set('USER_LOCATION', this.location.value);
  502. return this.reverseGeocoder([res.latitude, res.longitude].join(','))
  503. });
  504. },
  505. // 获取定位
  506. getLocation() {
  507. return new Promise((resolve, reject) => {
  508. // #ifdef H5
  509. // H5环境下使用浏览器定位API
  510. if (navigator.geolocation) {
  511. navigator.geolocation.getCurrentPosition(
  512. (position) => {
  513. resolve({
  514. longitude: position.coords.longitude,
  515. latitude: position.coords.latitude
  516. });
  517. },
  518. (error) => {
  519. console.log('H5定位失败', error);
  520. this.getStations("", "");
  521. this.get_userinfo()
  522. }
  523. );
  524. } else {
  525. console.log('浏览器不支持定位');
  526. resolve({ longitude: '', latitude: '' });
  527. }
  528. // #endif
  529. // #ifndef H5
  530. if (uni.getLocation) {
  531. uni.getLocation({
  532. success: res => resolve(res),
  533. fail: err => {
  534. console.log(err)
  535. console.log('定位失败');
  536. this.getStations("", "")
  537. this.get_userinfo()
  538. }
  539. })
  540. } else {
  541. console.log('微信版本太低,无定位接口可用');
  542. resolve({ longitude: '', latitude: '' });
  543. }
  544. // #endif
  545. });
  546. },
  547. reverseGeocoder(latlon) {
  548. // #ifdef H5
  549. // H5环境跳过百度地图处理
  550. console.log('H5环境跳过百度地图处理');
  551. return Promise.resolve();
  552. // #endif
  553. // #ifndef H5
  554. console.log(latlon)
  555. let lat = latlon.split(",")[0]
  556. let lng = latlon.split(",")[1]
  557. let baiduLoc = this.convertGcj02ToBd09(lng, lat)
  558. latlon = baiduLoc.lat + "," + baiduLoc.lng
  559. console.log(latlon)
  560. return new Promise((resolve, reject) => {
  561. var BMap = new bmap.BMapWX({
  562. ak: 'vtQgaPzonb3H4qeUOWGr53ePcNCsmdMj'
  563. });
  564. BMap.regeocoding({
  565. location: latlon,
  566. success: res => {
  567. let code = res.originalData.result.addressComponent.adcode.substr(0, 4)
  568. for (var i = 0; i < this.city.data.length; i++) {
  569. if (this.city.data[i].areaCode == code) {
  570. this.city.index = i
  571. break;
  572. }
  573. }
  574. console.log(res)
  575. },
  576. fail: err => {
  577. console.log(err)
  578. }
  579. })
  580. });
  581. // #endif
  582. },
  583. // get_paymentMsg() {
  584. // // maspStatus(1:待补缴,2:已补缴)realPredictServiceCost平台;maspAmount第三方
  585. // this.$api.base("post", "/chargeApi/queryOrderList-arrearage", {}, {}).then(res => {
  586. // this.payment_msg = res.data
  587. // })
  588. // },
  589. getBanners() {
  590. this.$api.base("get", "/applet/v1/homePage/getBannerList/1", {}, {}).then(res => {
  591. this.banners = res.data
  592. })
  593. },
  594. getAdswiper() {
  595. this.$api.base("get", "/applet/v1/homePage/getAdvertisingList", {}, {}).then(res => {
  596. this.adBanner = res.data
  597. // this.$refs.filter.open()
  598. })
  599. },
  600. convertBdToTx(lng, lat) {
  601. // 百度坐标系(BD09)转火星坐标系(GCJ-02,即腾讯地图使用的坐标系)
  602. // 这里的转换公式是基于经验公式,可能存在一定的误差
  603. let x_pi = 3.14159265358979324 * 3000.0 / 180.0;
  604. let x = lng - 0.0065;
  605. let y = lat - 0.006;
  606. let z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi);
  607. let theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi);
  608. let lngs = z * Math.cos(theta);
  609. let lats = z * Math.sin(theta);
  610. return {
  611. lng: lngs,
  612. lat: lats
  613. };
  614. },
  615. getStations(lng, lat) {
  616. this.$api.base("post", "/applet/v1/homePage/getStationInfoPage", {
  617. pageNum: this.pageNum, pageSize: 10, sortType: this.sorts.index + 1, longitude: lng, latitude: lat, userId: this.$app.storage.get('USER_INFO') ? parseInt(this.$app.storage.get('USER_INFO').appletUserId) : 0
  618. }, {}).then(res => {
  619. if (this.pageNum == 1) {
  620. this.list.data = res.data.list
  621. } else {
  622. this.list.data = this.list.data.concat(res.data.list)
  623. }
  624. })
  625. },
  626. get_userinfo() {
  627. this.$api.base("get", "/applet/v1/user/getUserInfo", {}, {
  628. error: false
  629. }).then(res => {
  630. this.user_info = res.data
  631. this.$app.storage.set('USER_INFO', res.data);
  632. })
  633. },
  634. // 设定导航栏高度
  635. setAppNavigationHeight() {
  636. this.$nextTick(() => {
  637. uni.createSelectorQuery().in(this).select("#app-navigation").boundingClientRect(data => {
  638. this.appNavigationHeight = data.height;
  639. }).exec();
  640. });
  641. },
  642. // 设置列表高度
  643. setListHeight() {
  644. this.$app.act.selectorQuery(this, "#list-box,#roller", true).then(res => {
  645. const win = uni.getWindowInfo();
  646. const roller = res.find(i => i.id == 'roller');
  647. const list = res.find(i => i.id == 'list-box');
  648. this.list.height = win.windowHeight - list.top - this.appNavigationHeight + roller.height;
  649. });
  650. },
  651. // 版头加载完成
  652. bannerLoadCompleted() {
  653. this.setListHeight();
  654. },
  655. changeSort(index) {
  656. this.sorts.index = index;
  657. this.pageNum = 1
  658. this.getStations(this.location.value.split(',')[0], this.location.value.split(',')[1])
  659. },
  660. scrolltolower() {
  661. console.log('到底')
  662. this.pageNum++
  663. this.getStations(this.location.value.split(',')[0], this.location.value.split(',')[1])
  664. },
  665. gotoSiteDetail(item) {
  666. this.$app.url.goto('/subPackages/charging/new-site/new-site?item=' + JSON.stringify(item));
  667. },
  668. topage_coupon() {
  669. let payment = this.payment_msg.realPredictServiceCost + this.payment_msg.maspAmount
  670. this.$app.url.goto('/subPackages/coupon/coupon-buy/coupon-buy?payment=' + payment)
  671. },
  672. // 确认隐私协议
  673. agreePrivacyAuthorization() {
  674. this.privacy.visible = false;
  675. this.updateLocation();
  676. },
  677. // 打开隐私协议
  678. openPrivacyContract() {
  679. uni.openPrivacyContract();
  680. },
  681. // 拒绝隐私协议
  682. refusePrivacy() {
  683. this.privacy.visible = false;
  684. },
  685. convertGcj02ToBd09(lng, lat) {
  686. const x_pi = 3.14159265358979324 * 3000.0 / 180.0;
  687. const z = Math.sqrt(lng * lng + lat * lat) + 0.00002 * Math.sin(lat * x_pi);
  688. const theta = Math.atan2(lat, lng) + 0.000003 * Math.cos(lng * x_pi);
  689. const bd_lng = z * Math.cos(theta) + 0.0065;
  690. const bd_lat = z * Math.sin(theta) + 0.006;
  691. return {
  692. lng: bd_lng,
  693. lat: bd_lat
  694. };
  695. }
  696. }
  697. }
  698. </script>
  699. <style>
  700. @import url('index.css');
  701. .discount {
  702. flex: 1;
  703. text-align: right;
  704. padding-right: 5px;
  705. }
  706. .discount view {
  707. display: inline-flex;
  708. align-items: center;
  709. height: 22px;
  710. border: 1px solid #ccc;
  711. border-radius: 5px;
  712. font-size: 12px;
  713. color: #F59C79;
  714. padding: 0 7px;
  715. overflow: hidden;
  716. }
  717. </style>