new-site.vue 13 KB

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