terminal.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. <template>
  2. <ax-body blank="0">
  3. <image src="@/static/img/page-bg01.png" class="page-background"></image>
  4. <view class="body" :class="{ visit }">
  5. <!-- 主图 -->
  6. <view class="app-flex c-center host-graph">
  7. <image
  8. src="https://national-motion.oss-cn-beijing.aliyuncs.com/20251230/9ca38a2aa5784e06b9cac31587b188b3.png"
  9. mode="widthFix" class="image"></image>
  10. </view>
  11. <!-- 主参数 -->
  12. <view class="parameter">
  13. <view class="param">
  14. <view class="value">{{ deviceInfo.current }}</view>
  15. <view class="name">电流A</view>
  16. </view>
  17. <view class="param">
  18. <view class="value">{{ deviceInfo.currentVoltage || '0' }}</view>
  19. <view class="name">电压V</view>
  20. </view>
  21. <view class="param">
  22. <view class="value">{{ deviceInfo.power }}</view>
  23. <view class="name">功率KW</view>
  24. </view>
  25. </view>
  26. <view v-if="!visit" class="block">
  27. <view class="card">
  28. <view class="title">
  29. <text>我的抵扣券</text>
  30. <view class="more" v-if="isEc">
  31. <view class="switch" :class="{ 'personal': personal == 1 }"><text
  32. @click="changeAccount(1)">个人</text><text @click="changeAccount(2)">集团</text></view>
  33. </view>
  34. </view>
  35. <view class="coupon-image-card"
  36. :style="{ backgroundImage: `url(${personal == 1 ? selectedImg : defaultImg})` }">
  37. <view class="coupon-title">充电抵扣券</view>
  38. <view class="price-info">
  39. <view class="price-numer">{{ userInfo.accountBalance }}</view>
  40. <view class="price-text">剩余可抵扣充电余量</view>
  41. </view>
  42. <view class="shop-coupon-btn"
  43. :style="{ backgroundColor: personal == 1 ? '#FF6457' : '#3EB6F8' }" @click="gotoCouponBuy">
  44. 立即购券</view>
  45. </view>
  46. <!-- <view class="coupon" :class="{'personal':personal==1}">
  47. <view class="name">{{personal == 1?'充电抵扣券':'集团抵扣券'}}</view>
  48. <view class="feature"><view class="line"></view></view>
  49. <view class="info">
  50. <view class="value">{{accountInfo.balance}}</view>
  51. <view class="describe">剩余可抵扣充电费用 (元)</view>
  52. </view>
  53. </view> -->
  54. </view>
  55. </view>
  56. <view class="block">
  57. <view class="card">
  58. <view class="title">
  59. <text>费用信息</text>
  60. <view @click="$app.url.goto('/pages/site-more/site-more?show=1&stationId=' + stationInfo.id)"
  61. class="more"><text>价格详情</text>
  62. <icon class="ax-iconline i-arrow-right icon"></icon>
  63. </view>
  64. </view>
  65. <view class="cell">
  66. <view class="lable">{{ personal == 1 ? '当前电价' : '集团折扣价' }}</view>
  67. <view class="contet app-flex middle">
  68. <view v-if="personal == 1"><text class="money">{{ deviceInfo.currentPrice }}</text><text>
  69. 元/度</text></view>
  70. <view v-else>
  71. <text class="obsolete">
  72. {{ deviceInfo.enterprisePrice }} 元/度
  73. </text>
  74. <text class="money">{{ getCurrEcPrice() }}</text><text> 元/度</text>
  75. </view>
  76. </view>
  77. </view>
  78. <view class="cell" v-if="discountInfo && personal == 1">
  79. <view class="lable">优惠</view>
  80. <view class="contet app-flex middle">
  81. <view>{{ discountInfo.temp3 }}<text class="money">{{ discountInfo.discount ?
  82. parseFloat(discountInfo.discount).toFixed(4) : "0.0000" }}</text><text>
  83. 元/度</text></view>
  84. </view>
  85. </view>
  86. <view class="cell" v-if="deviceInfo.isFirmUser">
  87. <view class="lable">企业专享价</view>
  88. <view class="contet app-flex middle">
  89. <view><text class="money">{{ deviceInfo.enterprisePrice }}</text><text>
  90. 元/度</text></view>
  91. </view>
  92. </view>
  93. <view class="cell">
  94. <view class="lable">当前时段</view>
  95. <view class="contet">{{ deviceInfo.currentPeriodDesc }}</view>
  96. </view>
  97. <view class="cell">
  98. <view class="lable">停车参考</view>
  99. <view class="contet">{{ deviceInfo.parkingTips || '--' }}</view>
  100. </view>
  101. </view>
  102. </view>
  103. <view class="block">
  104. <view class="card">
  105. <view class="title">终端信息</view>
  106. <view class="cell">
  107. <view class="lable">终端状态</view>
  108. <view class="contet">{{ deviceInfo.statusName }}</view>
  109. </view>
  110. <view class="cell">
  111. <view class="lable">终端编号</view>
  112. <view class="contet">{{ deviceInfo.connectorCode }}</view>
  113. </view>
  114. <view class="cell">
  115. <view class="lable">充电电站</view>
  116. <view class="contet">{{ deviceInfo.stationName }}</view>
  117. </view>
  118. <view class="cell">
  119. <view class="lable">充电终端</view>
  120. <view class="contet">{{ deviceInfo.connectorName }}</view>
  121. </view>
  122. <view class="cell">
  123. <view class="lable">车位编号</view>
  124. <view class="contet">{{ deviceInfo.parkNo ? deviceInfo.parkNo : "无" }}</view>
  125. </view>
  126. </view>
  127. </view>
  128. <!-- 信息 -->
  129. <view class="footer">
  130. <view class="tips">账单信息可能会有所延迟,具体以实际结算为准</view>
  131. <view>
  132. <button @click="startup()" class="startup">启动终端充电</button>
  133. <ax-ios-indicator min="10"></ax-ios-indicator>
  134. </view>
  135. </view>
  136. </view>
  137. <ax-popup ref="filter" position="" maskType="black" maskEnable>
  138. <view class="Modal-tips">
  139. <view class="tips-icon">!</view>
  140. <view class="icon-title">温馨提示</view>
  141. <view class="tips-text" v-if="payment_msg != null">
  142. 您有一笔超充订单{{ (payment_msg.maspAmount + payment_msg.maspRealAmount).toFixed(2) }}元待补缴</view>
  143. <view class="tips-btn">
  144. <view class="cancel-btn" @click="$refs.filter.close()">取消</view>
  145. <view class="confirm-btn" @click="$app.url.goto('/pages/coupon-buy/coupon-buy')">购券并补缴</view>
  146. </view>
  147. </view>
  148. </ax-popup>
  149. </ax-body>
  150. </template>
  151. <script>
  152. export default {
  153. onLoad(opts) {
  154. console.log("参数信息:", opts)
  155. /**
  156. * 判断终端是否占用状态
  157. * 判断占用终端设备的是不是用户自己
  158. */
  159. this.deviceId = opts.deviceId
  160. this.deviceStatus = opts.deviceStatus
  161. },
  162. onShow() {
  163. this.queryInChange(this.deviceId, this.deviceStatus);
  164. /**
  165. * 刷新用户信息
  166. */
  167. this.userInfo = this.$app.storage.get(this.$config.keyname.userInfo);
  168. console.log(this.userInfo, '获取到的用户信息');
  169. if (!this.userInfo.phone) {
  170. this.$app.url.goto('/pages/login/login')
  171. return;
  172. }
  173. // this.$api.login({
  174. // "checkStatus": 1
  175. // }).then(() => {
  176. // this.userInfo = this.$app.storage.get(this.$config.keyname.userInfo);
  177. // if (this.userInfo.ecId) {
  178. // //查询该集团账户是否正常使用。
  179. // this.$api.base("post", "/chargeApi/queryEcInfo", {
  180. // "ecId": this.userInfo.ecId
  181. // }, {}).then(res => {
  182. // if (res.ecInfo && res.ecInfo.ecStatus == 1) {
  183. // this.isEc = true;
  184. // }
  185. // })
  186. // }
  187. // })
  188. },
  189. mounted() {
  190. // this.get_paymentMsg()
  191. setTimeout(() => {
  192. if (this.payment_msg != null) {
  193. this.$refs.filter.open()
  194. }
  195. }, 500)
  196. },
  197. data() {
  198. return {
  199. payment_msg: null,
  200. deviceId: 0,
  201. deviceStatus: 0,
  202. visit: '',
  203. personal: 1, // 1 个人订单 2 集团订单
  204. isEc: false, //是否集团的用户
  205. nowPriceTime: {}, //当前价格时间段信息
  206. deviceInfo: {}, //充电桩的信息
  207. accountInfo: { //账户信息
  208. balance: 0, //可用抵用券余额
  209. },
  210. userInfo: {},
  211. stationInfo: {}, //站点信息
  212. orderInfo: {}, //临时订单信息
  213. checkNum: 0, //检测订单状态次数
  214. ecInfo: {}, //集团信息
  215. discountInfo: null, //优惠信息
  216. selectedImg: 'https://hyxhsh.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/AwQTRxpEMqOG50293e26d86888b3e0f7324c429d2019.png/1.png',
  217. defaultImg: 'https://hyxhsh.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/SPh1u3KAqte830a107b2e3c5033b1d1027516d84d780.png/1.png'
  218. }
  219. },
  220. methods: {
  221. //通过用户id查询是否还有在充电中的订单
  222. queryInChange(deviceId, deviceStatus) {
  223. if (deviceStatus == 3 || deviceStatus == 4) {
  224. //占用充电状态;终端占用且不是自己,进入访问模式
  225. this.visit = true;
  226. }
  227. this.getDeviceInfo(deviceId); //获取设备、站的详情信息
  228. // this.getAccountInfo(); //获取账户信息
  229. this.checkedStartStatus(); //查询订单状态
  230. },
  231. //获取设备的详情信息
  232. getDeviceInfo(deviceId) {
  233. this.$api.base("get", "/applet/v1/station/connector/detail", {
  234. "connectorCode": deviceId
  235. }, {}).then(res => {
  236. this.deviceInfo = res.data;
  237. this.nowPriceTime = res.nowPriceTime;
  238. this.stationInfo = res.stationInfo;
  239. if (res.discountInfo) {
  240. this.discountInfo = res.discountInfo
  241. }
  242. if (this.deviceInfo.tipsStatus == 1) {
  243. this.$app.popup.alert(this.deviceInfo.tipsContent, "温馨提示");
  244. }
  245. })
  246. },
  247. // get_paymentMsg() {
  248. // // maspStatus(1:待补缴,2:已补缴)realPredictServiceCost平台;maspAmount第三方
  249. // this.$api.base("post", "/chargeApi/queryOrderList-arrearage", {}, {}).then(res => {
  250. // this.payment_msg = res.data
  251. // })
  252. // },
  253. //获取账户信息
  254. // getAccountInfo() {
  255. // if (this.personal == 1) {
  256. // //获取个人账户信息
  257. // this.$api.base("post", "/chargeApi/getUserAccount", {}, {}).then(res => {
  258. // this.accountInfo.balance = res.userAccount.balance;
  259. // })
  260. // } else {
  261. // //获取集团账户信息
  262. // this.$api.base("post", "/chargeApi/getEcUserAccount", {}, {
  263. // error: false
  264. // }).then(res => {
  265. // this.ecInfo = res.ecInfo;
  266. // this.accountInfo.balance = res.ecUserAccount.balance;
  267. // }).catch(err => {
  268. // this.accountInfo.balance = 0;
  269. // this.$app.popup.alert(err.msg, "温馨提示");
  270. // })
  271. // }
  272. // },
  273. //切换账户
  274. changeAccount(type) {
  275. if (this.personal == type) {
  276. return;
  277. }
  278. this.personal = type;
  279. this.getAccountInfo();
  280. },
  281. //当前集团折扣价
  282. getCurrEcPrice() {
  283. if (!this.nowPriceTime) {
  284. return 0;
  285. }
  286. var currEcP = this.nowPriceTime.price;
  287. if (this.ecInfo && this.ecInfo.ecDiscount) {
  288. var realServicePrice = this.nowPriceTime.servicePrice
  289. if (this.stationInfo.contractServicePrice) {
  290. realServicePrice = this.stationInfo.contractServicePrice
  291. }
  292. currEcP = (this.nowPriceTime.electrovalence + realServicePrice + this.nowPriceTime.addServicePrice *
  293. this.ecInfo.ecDiscount / 100);
  294. }
  295. console.log("dddd", currEcP)
  296. if (currEcP) {
  297. currEcP = currEcP.toFixed(2);
  298. }
  299. return Number(currEcP).toFixed(4);
  300. },
  301. //转换出电压值
  302. getVolt() {
  303. if (!this.deviceInfo.power) {
  304. return 0;
  305. }
  306. var v = this.deviceInfo.power / this.deviceInfo.current * 1000;
  307. return v;
  308. },
  309. startup() {
  310. if (this.visit) {
  311. this.$app.popup.alert("该充电枪被占用或存在异常,请重新尝试或更换其他充电枪。", "温馨提示");
  312. return;
  313. }
  314. //判断账户余额是否大于两元
  315. if (this.deviceInfo.availableBalance <= 3) {
  316. return this.$app.popup.confirm("无法启动充电,抵扣余量需大于3元,请先购买充电券!", "温馨提示!", {
  317. confirmText: "立即购券"
  318. }).then(confirm => {
  319. if (confirm) {
  320. this.$app.url.goto('/pages/coupon-buy/coupon-buy', true);
  321. }
  322. });
  323. }
  324. //统一下单并启动接口
  325. this.get_subMessage();
  326. },
  327. get_subMessage() {
  328. let _this = this
  329. uni.requestSubscribeMessage({
  330. tmplIds: ['03bv7QSrzH4DSjmNsI9P0lq0Vj3sBwpN5mgfZln7Rc4'],
  331. success(res) {
  332. _this.startChangeAndOrder();
  333. }
  334. })
  335. },
  336. // 主动发起购券操作
  337. gotoCouponBuy() {
  338. this.$app.url.goto('/pages/coupon-buy/coupon-buy', true);
  339. },
  340. //统一下单并启动接口
  341. startChangeAndOrder() {
  342. var obj = {
  343. orderType: this.deviceInfo.isEcUser ? 1 : 0, //订单类型 0-平台 1-企业
  344. equipmentId: this.deviceInfo.equipmentId,
  345. stationId: this.deviceInfo.stationId,
  346. couponId: null,
  347. // equipAuthSeq: '',
  348. connectorId: this.deviceInfo.connectorCode,
  349. }
  350. this.$api.base("post", "/applet/v1/charge/invokeCharge", obj, {}).then(res => {
  351. console.log(res, '返回数据');
  352. //下单成功,并进行了订单预充值
  353. this.orderInfo = res.data;
  354. if (res.code == "00000") {
  355. this.$app.url.goto('/pages/charging/charging?chargeOrderNo=' + res.data.chargeOrderNo + "&deviceId=" +
  356. this.deviceInfo.id, false);
  357. } else {
  358. this.$app.popup.alert(res.msg, "温馨提示");
  359. }
  360. // if (res.flg && res.flg == 1) {
  361. // //用户有充电中的订单
  362. // this.$app.popup.confirm("您有一个进行中充电订单,不可再次启动。", null, {
  363. // showCancel: false,
  364. // confirmText: "查看订单"
  365. // }).then(cres => {
  366. // this.$app.url.goto('/pages/charging/charging?orderId=' + this.orderInfo.id +
  367. // "&deviceId=" + this.deviceInfo.id, false);
  368. // });
  369. // } else {
  370. // //正常启动充电订单
  371. // this.$app.url.goto('/pages/charging/charging?orderId=' + this.orderInfo.id + "&deviceId=" +
  372. // this.deviceInfo.id, false);
  373. // }
  374. })
  375. },
  376. // 查询订单
  377. checkedStartStatus() {
  378. this.$api.base("get", "/applet/v1/station/charging-cost", {}, {}).then(res => {
  379. if (res.data.orderStatus == 2) {
  380. this.$app.popup.confirm("您有一个进行中充电订单,不可再次启动。", null, {
  381. showCancel: false,
  382. confirmText: "查看订单"
  383. }).then(cres => {
  384. this.$app.url.goto('/pages/charging/charging?chargeOrderNo=' + res.data.chargeOrderNo +
  385. "&deviceId=" + this.deviceInfo.id, false);
  386. });
  387. }
  388. })
  389. },
  390. }
  391. }
  392. </script>
  393. <style scoped>
  394. @import url("terminal.css");
  395. </style>