index.vue 21 KB

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