new-site.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. <template>
  2. <ax-body :blank="0">
  3. <view class="site-body">
  4. <view class="top-banner" v-if="stationDetail.pictures">
  5. <swiper class="banner-swiper" circular :autoplay="true" interval="3000" duration="500"
  6. @change="swiperChange">
  7. <swiper-item class="banner-swiper-item" v-for="item in stationDetail.pictures">
  8. <image class="swiper-item-image" :src="item" mode=""></image>
  9. </swiper-item>
  10. </swiper>
  11. <view class="swiper-current">{{ bannerIndex }}/{{ stationDetail.pictures.length }}</view>
  12. </view>
  13. <view class="site-content" :style="{ top: `${stationDetail.pictures ? '320rpx' : '0'}` }">
  14. <view class="top-site-info">
  15. <view class="site-title">{{ stationDetail.stationName }}</view>
  16. <view class="site-text">
  17. <image src="@/static/img/site-icon03.png" class="icon"></image>
  18. <view class="item-text">{{ stationDetail.tips }}</view>
  19. </view>
  20. </view>
  21. <view class="site-location">
  22. <view class="location-left">
  23. <view class="left-km">距离您{{ stationDetail.distance }}km</view>
  24. <view class="left-address">{{ stationDetail.address }}</view>
  25. </view>
  26. <view class="location-rihgt" @click="openLocation()">
  27. <image src="@/static/img/locate2.svg" class="right-icon"></image>
  28. <view class="right-nav">导航</view>
  29. </view>
  30. </view>
  31. <view class="site-cost-info">
  32. <view class="cost-info-title">
  33. <view class="title-name">费用信息</view>
  34. <view class="check-info" @click="toPriceAll()">
  35. <text>查看全部</text>
  36. <text class="ax ax-iconline i-arrow-right icon"></text>
  37. </view>
  38. </view>
  39. <view class="cost-price-info" v-if="!stationDetail.firmUser">
  40. <view class="cost-title">
  41. <view class="title-left">当前价</view>
  42. <view class="title-right">惊喜价</view>
  43. </view>
  44. <view class="cost-price">
  45. <text style="color: #FF6464;font-size: 48rpx;font-weight: 800;">{{
  46. stationDetail.currentPrice
  47. }}</text>
  48. <text class="cost-price-unit">元/度</text>
  49. </view>
  50. <view class="time-cost-price">当前时段:</view>
  51. <view class="time-cost-number">{{ stationDetail.currentPeriod }}</view>
  52. </view>
  53. <view class="firm-price-info-box" v-else>
  54. <view class="current-price-info">
  55. <view class="current-price-title">当前价</view>
  56. <view class="current-price">
  57. <view class="current-price-text"><text class="operation-symbol">¥</text>
  58. <text>{{ stationDetail.currentPrice }}</text>
  59. </view>
  60. <view class="current-price-unit">元/度</view>
  61. </view>
  62. <view class="time-current-price">当前时段:</view>
  63. <view class="time-current-number">{{ stationDetail.currentPeriod }}</view>
  64. </view>
  65. <view class="firm-price-info">
  66. <view class="firm-price-title">
  67. <view class="title-text">企业专享价</view>
  68. <view class="tags-price">特惠价</view>
  69. </view>
  70. <view class="firm-price-box">
  71. <view class="firm-price-text">
  72. {{ stationDetail.enterprisePrice || '--' }}
  73. </view>
  74. <view class="firm-price-unit">元/度</view>
  75. </view>
  76. <view class="current-pay-price-box">
  77. <view class="pay-price">
  78. <view class="firm-old-price">{{ stationDetail.currentPrice }}元/度
  79. </view>
  80. <!-- <view class="discount-price">本单预计省9元</view> -->
  81. </view>
  82. <image class="pay-price-icon" src="/static/img/firm-price.png" mode=""></image>
  83. </view>
  84. </view>
  85. </view>
  86. <view class="stopcar-tips">
  87. <image class="stopcar-tips-icon" src="@/static/img/site-icon03.png"></image>
  88. <view class="stopcar-tips-text">
  89. <view class="tips-text-title">停车参考</view>
  90. <view class="tips-text-mini">充电减免2小时停车费</view>
  91. </view>
  92. </view>
  93. </view>
  94. <view class="site-list-card">
  95. <view class="cost-info-title">
  96. <view class="title-name">充电终端</view>
  97. <view class="check-info" @click="toDeiceAll()">
  98. <text>查看全部</text>
  99. <text class="ax ax-iconline i-arrow-right icon"></text>
  100. </view>
  101. </view>
  102. <view class="app-flex site-select-tab">
  103. <view class="select-item" v-for="(item, index) in siteSortList" @click="selectItem(item, index)"
  104. :class="{ selectItemActive: siteSelectIndex == index }">
  105. {{ item.text }}({{ item.total }})
  106. </view>
  107. </view>
  108. <view class="site-list-box">
  109. <view v-for="(item, index) in filteredConnectorList" :key="index" @click="goTerminal(item)"
  110. class="terminal-item">
  111. <view class="state" :class="[getSatesObj(item).color]">
  112. <view class="cake">
  113. <image src="@/static/img/site-icon01.svg" class="icon"></image>
  114. <view class="name">{{ item.statusName }}</view>
  115. </view>
  116. </view>
  117. <view class="info">
  118. <view class="name">{{ item.connectorName }}</view>
  119. <view class="subinfo">电类分类:{{ item.equipmentType }}</view>
  120. <view class="subinfo">终端编号:{{ item.connectorCode }}</view>
  121. </view>
  122. </view>
  123. <view v-if="filteredConnectorList.length === 0" class="not-data">暂无设备</view>
  124. </view>
  125. </view>
  126. <view class="site-list-card">
  127. <view class="cost-info-title">
  128. <view class="title-name">电站信息</view>
  129. <view class="check-info">
  130. <text>查看全部</text>
  131. <text class="ax ax-iconline i-arrow-right icon"></text>
  132. </view>
  133. </view>
  134. <view class="site-detail-line"></view>
  135. <view class="site-detail-info">
  136. <view class="detail-info-item">
  137. <view class="left-item">营业时间</view>
  138. <view class="right-item">{{ stationDetail.businessHours || '--' }}</view>
  139. </view>
  140. <view class="detail-info-item">
  141. <view class="left-item">服务提供</view>
  142. <view class="right-item">{{ stationDetail.serviceProvider }}</view>
  143. </view>
  144. <view class="detail-info-item">
  145. <view class="left-item">发票提供</view>
  146. <view class="right-item">{{ stationDetail.serviceProvider }}</view>
  147. </view>
  148. <view class="detail-info-item">
  149. <view class="left-item">客服热线</view>
  150. <view class="right-item">{{ stationDetail.customerServiceHotline }}</view>
  151. </view>
  152. </view>
  153. </view>
  154. <view style="height: 200rpx;"></view>
  155. </view>
  156. <!-- 扫码充电 -->
  157. <view class="footer">
  158. <view class="bg5">
  159. <view class="text">
  160. <view>中数电动</view>
  161. <view>特惠价</view>
  162. </view>
  163. <image src="@/static/img/site-bg05.svg" class="bg" mode="heightFix"></image>
  164. </view>
  165. <view class="price-wrap">
  166. <view class="price">
  167. <text class="symbol">¥</text>
  168. <!-- v-if="nowPriceTime.firmPrice===null" -->
  169. <text v-if="!stationDetail.firmUser">{{ stationDetail.currentPrice }}</text>
  170. <text v-else>{{ stationDetail.enterprisePrice || '--' }}</text>
  171. </view>
  172. <view class="unit">元/度</view>
  173. </view>
  174. <view @click="sacn()" class="scan">扫码充电</view>
  175. </view>
  176. </view>
  177. </ax-body>
  178. </template>
  179. <script>
  180. export default {
  181. onLoad: function (option) {
  182. console.log(option); //打印出上个页面传递的参数。
  183. this.stationInfo = JSON.parse(option.item);
  184. this.getStationsInfo();
  185. this.getConfigStationInfo();
  186. },
  187. mounted() {
  188. this.$app.act.selectorQuery(this, '#footer').then(res => {
  189. const win = uni.getWindowInfo();
  190. const tHight = win.windowWidth * 9 / 16;
  191. this.mainHeight = win.windowHeight - tHight - res.height + 10;
  192. });
  193. },
  194. data() {
  195. return {
  196. user_info: this.$app.storage.get('USER_INFO'),
  197. mainHeight: 0,
  198. tops: ["../../static/img/$temp-site.png"],
  199. another: false,
  200. terminals: [],
  201. entInfo: {
  202. title: '服务提供',
  203. name: '华能贵州盘州市风电有限责任公司',
  204. code: '915205555155625655',
  205. tel: '0851-8815158',
  206. businessLicenceUrl: "/static/img/$temp-site01.jpg"
  207. },
  208. stationInfo: "",//站点信息
  209. deviceList: [],//该站点桩列表
  210. timePricesList: [],//费用时段列表
  211. nowPriceTime: {},//当前费用时段信息
  212. service: {
  213. tel: '400-0000-0000',
  214. work: '09:00 至 18:00'
  215. },
  216. busineHours: "",//营业时间
  217. bannerIndex: 1,//轮播下标
  218. stationDetail: {},
  219. siteSelectIndex: 0,
  220. siteSortList: [{
  221. total: 0,
  222. text: '空闲',
  223. status: 1
  224. }, {
  225. total: 0,
  226. text: '占用',
  227. status: 2
  228. }, {
  229. total: 0,
  230. text: '离线',
  231. status: 0
  232. }],
  233. filteredConnectorList: [],
  234. }
  235. },
  236. methods: {
  237. swiperChange(e) {
  238. this.bannerIndex = e.detail.current + 1
  239. },
  240. getStationsInfo() {
  241. let location = this.$app.storage.get('USER_LOCATION')
  242. this.$api.base("get", "/applet/v1/station/detail", {
  243. stationId: parseInt(this.stationInfo.stationId),
  244. longitude: location.split(",")[0],
  245. latitude: location.split(",")[1]
  246. }, {}).then(res => {
  247. res.data.pictures = JSON.parse(res.data.pictures)
  248. const countMapping = {
  249. '空闲': res.data.idleCount,
  250. '占用': res.data.occupiedCount,
  251. '离线': res.data.offlineCount
  252. };
  253. this.siteSortList.forEach(item => {
  254. item.total = countMapping[item.text] || 0;
  255. });
  256. this.stationDetail = res.data
  257. // 初始化默认显示空闲状态的前3个设备
  258. this.siteSelectIndex = 0;
  259. this.filteredConnectorList = this.stationDetail.connectorList
  260. .filter(connector => connector.status == 1) // 空闲状态
  261. .slice(0, 3);
  262. // this.deviceList = res.devices;
  263. // this.timePricesList = res.prices;
  264. // this.nowPriceTime = res.nowPriceTime;
  265. })
  266. },
  267. selectItem(e, i) {
  268. this.siteSelectIndex = i;
  269. // 根据选择的状态过滤 connectorList
  270. if (e.status === 1) { // 空闲
  271. this.filteredConnectorList = this.stationDetail.connectorList.slice(0, 3).filter(connector => connector.status == 1);
  272. } else if (e.status === 2) { // 占用
  273. this.filteredConnectorList = this.stationDetail.connectorList.slice(0, 3).filter(connector =>
  274. connector.status == 2 || connector.status == 3 || connector.status == 4
  275. );
  276. } else if (e.status === 0) { // 离线
  277. this.filteredConnectorList = this.stationDetail.connectorList.slice(0, 3).filter(connector => connector.status == 0);
  278. }
  279. },
  280. getSatesObj(item) {
  281. //{name:'离线',color:'grey'},{name:'空闲',color:'green'},{name:'占用',color:'blue'}
  282. var obj = {};
  283. if (item.status == 2) {
  284. obj = { color: 'blue' };
  285. } else if (item.status == 0) {
  286. obj = { color: 'grey' };
  287. } else if (item.status == 1) {
  288. obj = { color: 'green' };
  289. }
  290. return obj;
  291. },
  292. //获取配置文件信息
  293. getConfigStationInfo() {
  294. this.$api.static(this.$config.url.configUrl + "stationConfi.json").then(res => {
  295. console.log("获取的配置文件信息:", res.busineHours);
  296. this.entInfo = res.entInfo;
  297. this.service = res.service;
  298. this.busineHours = res;
  299. })
  300. },
  301. // 拨打电话
  302. callPhone(phone) {
  303. this.$app.act.callPhone(phone);
  304. },
  305. // 打开客服
  306. openCustomerService() {
  307. this.$refs.service.open();
  308. },
  309. // 打开服务提供
  310. openEnt_Serve() {
  311. this.entInfo.title = '服务提供';
  312. this.$refs.entInfo.open();
  313. },
  314. // 打开发票提供
  315. openEnt_Invoicing() {
  316. this.entInfo.title = '发票提供';
  317. this.$refs.entInfo.open();
  318. },
  319. // 关闭企业弹窗
  320. closeEnt() {
  321. this.$refs.entInfo.close();
  322. },
  323. // 关闭服务弹窗
  324. closeService() {
  325. this.$refs.service.close();
  326. },
  327. // 打开地图
  328. openLocation() {
  329. uni.openLocation({
  330. latitude: Number(this.stationInfo.lat),
  331. longitude: Number(this.stationInfo.lng),
  332. });
  333. },
  334. // 跳转充电终端
  335. goTerminal(item) {
  336. //设备状态 0:离网1:空闲2:占用(未充电)3:占用(充电中)4:占用(预约锁定)255:故障
  337. if (item.deviceStatus == 0 || item.deviceStatus == 255) {
  338. return;
  339. }
  340. this.$app.url.goto('/pages/terminal/terminal?deviceId=' + item.connectorId + "&deviceStatus=" + item.status);
  341. },
  342. //去查看全部电站
  343. toDeiceAll() {
  344. this.$app.url.goto('/pages/site-more/site-more?stationId=' + this.stationDetail.stationId)
  345. },
  346. //去查看全部电价
  347. toPriceAll() {
  348. this.$app.url.goto('/pages/site-more/site-more?show=1&stationId=' + this.stationDetail.stationId)
  349. },
  350. //扫一扫
  351. sacn() {
  352. this.$app.act.scan().then(res => {
  353. console.log(res);
  354. var paramObj = this.getUrlParams(res.result);
  355. if (!paramObj || !paramObj.connectorCode) {
  356. this.$app.popup.alert("二维码不正确。", "温馨提示!");
  357. return;
  358. }
  359. this.getDeviceInfo(paramObj.connectorCode);
  360. })
  361. },
  362. getUrlParams(url) {
  363. const paramsRegex = /[?&]+([^=&]+)=([^&]*)/gi;
  364. const params = {};
  365. let match;
  366. while (match = paramsRegex.exec(url)) {
  367. params[match[1]] = match[2];
  368. }
  369. return params;
  370. },
  371. //通过充电桩编码(sn)获取设备详情
  372. getDeviceInfo(sn) {
  373. this.$api.base("post", "/chargeApi/checkDevicesBySn", { "sn": sn }, {}).then(res => {
  374. console.log("设备信息:", res)
  375. this.goTerminal(res.device);
  376. })
  377. }
  378. }
  379. }
  380. </script>
  381. <style scoped>
  382. @import url("new-site.css");
  383. </style>