index.vue 20 KB

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