index.vue 21 KB

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